From d63e1bc9ab5aa60a952ad7b06101e37c48f4cde7 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 3 Apr 2019 21:18:42 -0500 Subject: [PATCH] d3d8: Forbid applying a stateblock while recording. Signed-off-by: Zebediah Figura Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/d3d8/device.c | 6 ++++++ dlls/d3d8/tests/device.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 5016ac4f176..381588f8ca8 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -1924,6 +1924,12 @@ static HRESULT WINAPI d3d8_device_ApplyStateBlock(IDirect3DDevice8 *iface, DWORD return D3D_OK; wined3d_mutex_lock(); + if (device->recording) + { + wined3d_mutex_unlock(); + WARN("Trying to apply stateblock while recording, returning D3DERR_INVALIDCALL.\n"); + return D3DERR_INVALIDCALL; + } stateblock = d3d8_get_object(&device->handle_table, token - 1, D3D8_HANDLE_SB); if (!stateblock) { diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index f0acd9ff815..fee73de1a66 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -7277,7 +7277,7 @@ static void test_begin_end_state_block(void) ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice8_ApplyStateBlock(device, stateblock); - todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice8_CaptureStateBlock(device, stateblock); todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); @@ -7297,7 +7297,7 @@ static void test_begin_end_state_block(void) hr = IDirect3DDevice8_GetRenderState(device, D3DRS_LIGHTING, &value); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); - todo_wine ok(value == TRUE, "Got unexpected value %#x.\n", value); + ok(value == TRUE, "Got unexpected value %#x.\n", value); refcount = IDirect3DDevice8_Release(device); ok(!refcount, "Device has %u references left.\n", refcount);