[PATCH 2/4] d3d8: Forbid applying a stateblock while recording.

Zebediah Figura z.figura12 at gmail.com
Wed Apr 3 21:18:42 CDT 2019


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 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 5016ac4f17..381588f8ca 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 f0acd9ff81..fee73de1a6 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);
-- 
2.20.1




More information about the wine-devel mailing list