[PATCH 3/4] d3d8: Forbid capturing a stateblock while recording.

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


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/d3d8/device.c       | 6 ++++++
 dlls/d3d8/tests/device.c | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 381588f8ca..4bd7578a8f 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -1964,6 +1964,12 @@ static HRESULT WINAPI d3d8_device_CaptureStateBlock(IDirect3DDevice8 *iface, DWO
     TRACE("iface %p, token %#x.\n", iface, token);
 
     wined3d_mutex_lock();
+    if (device->recording)
+    {
+        wined3d_mutex_unlock();
+        WARN("Trying to capture 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 fee73de1a6..37f4c5c119 100644
--- a/dlls/d3d8/tests/device.c
+++ b/dlls/d3d8/tests/device.c
@@ -7280,7 +7280,7 @@ static void test_begin_end_state_block(void)
     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);
+    ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
 
     hr = IDirect3DDevice8_CreateStateBlock(device, D3DSBT_ALL, &stateblock2);
     todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
-- 
2.20.1




More information about the wine-devel mailing list