Signed-off-by: Paul Gofman gofmanp@gmail.com --- dlls/d3d8/device.c | 11 ++++----- dlls/d3d8/tests/device.c | 50 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 7 deletions(-)
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 5016ac4f17..40b5c86027 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -3264,16 +3264,13 @@ static HRESULT WINAPI d3d8_device_SetStreamSource(IDirect3DDevice8 *iface, iface, stream_idx, buffer, 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, + NULL, &stride); wined3d_buffer = NULL; + } else if (buffer_impl->draw_buffer) wined3d_buffer = buffer_impl->draw_buffer; else diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index c5ec9aa736..b602ebe3bb 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -2310,6 +2310,55 @@ cleanup: DestroyWindow(window); }
+static void test_set_stream_source(void) +{ + IDirect3DVertexBuffer8 *vb, *current_vb; + IDirect3DDevice8 *device; + unsigned int stride; + IDirect3D8 *d3d8; + ULONG refcount; + HWND window; + HRESULT hr; + + window = create_window(); + ok(!!window, "Failed to create a window.\n"); + d3d8 = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d8, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d8, window, NULL))) + { + skip("Failed to create a 3D device, skipping test.\n"); + goto cleanup; + } + + hr = IDirect3DDevice8_CreateVertexBuffer(device, 512, 0, 0, D3DPOOL_DEFAULT, &vb); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + + hr = IDirect3DDevice8_SetStreamSource(device, 0, vb, 32); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + + hr = IDirect3DDevice8_SetStreamSource(device, 0, NULL, 0); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice8_GetStreamSource(device, 0, ¤t_vb, &stride); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + ok(!current_vb, "Got unexpected vb %p.\n", current_vb); + ok(stride == 32, "Got unexpected stride %u.\n", stride); + + hr = IDirect3DDevice8_SetStreamSource(device, 0, vb, 0); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice8_GetStreamSource(device, 0, ¤t_vb, &stride); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + ok(current_vb == vb, "Got unexpected vb %p.\n", current_vb); + IDirect3DVertexBuffer8_Release(current_vb); + ok(!stride, "Got unexpected stride %u.\n", stride); + + IDirect3DVertexBuffer8_Release(vb); + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); +cleanup: + IDirect3D8_Release(d3d8); + DestroyWindow(window); +} + static void test_render_zero_triangles(void) { IDirect3DDevice8 *device; @@ -9747,6 +9796,7 @@ START_TEST(device) test_shader(); test_limits(); test_lights(); + test_set_stream_source(); test_ApplyStateBlock(); test_render_zero_triangles(); test_depth_stencil_reset();
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=50535
Your paranoid android.
=== debian9 (build log) ===
X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig)
=== debian9 (build log) ===
X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig)