Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3d8/device.c | 8 ++++++++ dlls/d3d9/device.c | 8 ++++++++ dlls/d3d9/tests/device.c | 2 +- dlls/d3d9/tests/visual.c | 2 +- dlls/wined3d/device.c | 6 ++---- 5 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 616886bcafa..e4869c2618e 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -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(); diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 2f3ad2880d6..4016b0ccaa2 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -3349,6 +3349,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(); diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index b71058de486..66bf5b00c50 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -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); diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 1e213abeb18..95982e05155 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -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); diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 8ef74b6ef0f..6776c5c5e0c 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -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);