wined3d: Set stream stride and offset even when buffer is NULL.

Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Matteo Bruni 2018-06-12 18:41:15 +02:00 committed by Alexandre Julliard
parent 346e8cf8ee
commit 11f9cac435
8 changed files with 24 additions and 13 deletions

View File

@ -5493,8 +5493,8 @@ float4 main(float4 color : COLOR) : SV_TARGET
for (i = 0; i < D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT; ++i)
{
ok(!tmp_buffer[i], "Got unexpected vertex buffer %p in slot %u.\n", tmp_buffer[i], i);
todo_wine ok(!stride[i], "Got unexpected stride %u in slot %u.\n", stride[i], i);
todo_wine ok(!offset[i], "Got unexpected offset %u in slot %u.\n", offset[i], i);
ok(!stride[i], "Got unexpected stride %u in slot %u.\n", stride[i], i);
ok(!offset[i], "Got unexpected offset %u in slot %u.\n", offset[i], i);
}
ID3D10Device_IAGetIndexBuffer(device, tmp_buffer, &format, offset);
ok(!tmp_buffer[0], "Got unexpected index buffer %p.\n", tmp_buffer[0]);

View File

@ -10647,11 +10647,8 @@ static void test_clear_state(void)
for (i = 0; i < D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT; ++i)
{
ok(!tmp_buffer[i], "Got unexpected vertex buffer %p in slot %u.\n", tmp_buffer[i], i);
todo_wine_if(i < D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT)
{
ok(!stride[i], "Got unexpected stride %u in slot %u.\n", stride[i], i);
ok(!offset[i], "Got unexpected offset %u in slot %u.\n", offset[i], i);
}
}
ID3D11DeviceContext_IAGetIndexBuffer(context, tmp_buffer, &format, offset);
ok(!tmp_buffer[0], "Got unexpected index buffer %p.\n", tmp_buffer[0]);

View File

@ -3102,6 +3102,14 @@ static HRESULT WINAPI d3d8_device_SetStreamSource(IDirect3DDevice8 *iface,
iface, stream_idx, buffer, stride);
wined3d_mutex_lock();
if (!stride)
{
struct wined3d_buffer *wined3d_buffer;
unsigned int cur_offset;
hr = wined3d_device_get_stream_source(device->wined3d_device, stream_idx, &wined3d_buffer,
&cur_offset, &stride);
}
hr = wined3d_device_set_stream_source(device->wined3d_device, stream_idx,
buffer_impl ? buffer_impl->wined3d_buffer : NULL, 0, stride);
wined3d_mutex_unlock();

View File

@ -3348,6 +3348,14 @@ static HRESULT WINAPI d3d9_device_SetStreamSource(IDirect3DDevice9Ex *iface,
iface, stream_idx, buffer, offset, stride);
wined3d_mutex_lock();
if (!stride)
{
struct wined3d_buffer *wined3d_buffer;
unsigned int cur_offset;
hr = wined3d_device_get_stream_source(device->wined3d_device, stream_idx, &wined3d_buffer,
&cur_offset, &stride);
}
hr = wined3d_device_set_stream_source(device->wined3d_device, stream_idx,
buffer_impl ? buffer_impl->wined3d_buffer : NULL, offset, stride);
wined3d_mutex_unlock();

View File

@ -2973,7 +2973,7 @@ static void test_draw_primitive(void)
ok(SUCCEEDED(hr), "GetStreamSource failed, hr %#x.\n", hr);
ok(!current_vb, "Unexpected vb %p.\n", current_vb);
ok(!offset, "Unexpected offset %u.\n", offset);
todo_wine ok(!stride, "Unexpected stride %u.\n", stride);
ok(!stride, "Unexpected stride %u.\n", stride);
/* NULL index buffer, valid vertex declaration, NULL stream source. */
hr = IDirect3DDevice9_SetIndices(device, NULL);

View File

@ -23132,7 +23132,7 @@ static void test_drawindexedprimitiveup(void)
ok(SUCCEEDED(hr), "GetStreamSource failed, hr %#x.\n", hr);
ok(!vb, "Unexpected vb %p.\n", vb);
ok(!offset, "Unexpected offset %u.\n", offset);
todo_wine ok(!stride, "Unexpected stride %u.\n", stride);
ok(!stride, "Unexpected stride %u.\n", stride);
hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffffffff, 0.0f, 0);
ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);

View File

@ -480,8 +480,8 @@ float4 main(float4 color : COLOR) : SV_TARGET
for (i = 0; i < D3D10_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT; ++i)
{
ok(!tmp_buffer[i], "Got unexpected vertex buffer %p in slot %u.\n", tmp_buffer[i], i);
todo_wine ok(!stride[i], "Got unexpected stride %u in slot %u.\n", stride[i], i);
todo_wine ok(!offset[i], "Got unexpected offset %u in slot %u.\n", offset[i], i);
ok(!stride[i], "Got unexpected stride %u in slot %u.\n", stride[i], i);
ok(!offset[i], "Got unexpected offset %u in slot %u.\n", offset[i], i);
}
ID3D10Device_IAGetIndexBuffer(device, tmp_buffer, &format, offset);
ok(!tmp_buffer[0], "Got unexpected index buffer %p.\n", tmp_buffer[0]);

View File

@ -1389,12 +1389,10 @@ HRESULT CDECL wined3d_device_set_stream_source(struct wined3d_device *device, UI
}
stream->buffer = buffer;
stream->stride = stride;
stream->offset = offset;
if (buffer)
{
stream->stride = stride;
stream->offset = offset;
wined3d_buffer_incref(buffer);
}
if (!device->recording)
wined3d_cs_emit_set_stream_source(device->cs, stream_idx, buffer, offset, stride);