Module: wine Branch: master Commit: 467199d59385e8bb145190e11a5a6fde906b81c8 URL: https://source.winehq.org/git/wine.git/?a=commit;h=467199d59385e8bb145190e11...
Author: Paul Gofman gofmanp@gmail.com Date: Wed Apr 3 20:26:06 2019 +0300
d3d9: Keep previous stream source stride and offset only when setting NULL buffer.
Signed-off-by: Paul Gofman gofmanp@gmail.com Signed-off-by: Henri Verbeet hverbeet@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/d3d9/device.c | 10 +++------- dlls/d3d9/tests/device.c | 22 ++++++++++++++++++++-- 2 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index bad9211..f7f9358 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -3558,13 +3558,9 @@ static HRESULT WINAPI d3d9_device_SetStreamSource(IDirect3DDevice9Ex *iface, iface, stream_idx, buffer, offset, stride);
wined3d_mutex_lock(); - if (!stride) - { - unsigned int cur_offset; - - hr = wined3d_device_get_stream_source(device->wined3d_device, stream_idx, &wined3d_buffer, - &cur_offset, &stride); - } + if (!buffer_impl) + wined3d_device_get_stream_source(device->wined3d_device, stream_idx, &wined3d_buffer, + &offset, &stride);
if (!buffer_impl) wined3d_buffer = NULL; diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index e7366b1..f5c8972 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -3240,7 +3240,8 @@ cleanup:
static void test_set_stream_source(void) { - IDirect3DVertexBuffer9 *vb; + IDirect3DVertexBuffer9 *vb, *current_vb; + unsigned int offset, stride; IDirect3DDevice9 *device; IDirect3D9 *d3d9; ULONG refcount; @@ -3273,7 +3274,24 @@ static void test_set_stream_source(void) hr = IDirect3DDevice9_SetStreamSource(device, 0, vb, 3, 32); ok(hr == D3DERR_INVALIDCALL || hr == D3D_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice9_SetStreamSource(device, 0, vb, 4, 32); - ok(SUCCEEDED(hr), "Failed to set the stream source, hr %#x.\n", hr); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + + hr = IDirect3DDevice9_SetStreamSource(device, 0, NULL, 0, 0); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice9_GetStreamSource(device, 0, ¤t_vb, &offset, &stride); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + ok(!current_vb, "Got unexpected vb %p.\n", current_vb); + ok(offset == 4, "Got unexpected offset %u.\n", offset); + ok(stride == 32, "Got unexpected stride %u.\n", stride); + + hr = IDirect3DDevice9_SetStreamSource(device, 0, vb, 0, 0); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice9_GetStreamSource(device, 0, ¤t_vb, &offset, &stride); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + ok(current_vb == vb, "Got unexpected vb %p.\n", current_vb); + IDirect3DVertexBuffer9_Release(current_vb); + ok(!offset, "Got unexpected offset %u.\n", offset); + ok(!stride, "Got unexpected stride %u.\n", stride);
/* Try to set the NULL buffer with an offset and stride 0 */ hr = IDirect3DDevice9_SetStreamSource(device, 0, NULL, 0, 0);