Zebediah Figura : d3d9: Forbid capturing a stateblock while recording.

Alexandre Julliard julliard at winehq.org
Wed Apr 3 15:26:21 CDT 2019


Module: wine
Branch: master
Commit: 3e87746eb7b56619298ad18e2c04c9efea24406b
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=3e87746eb7b56619298ad18e2c04c9efea24406b

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Tue Apr  2 12:42:47 2019 -0500

d3d9: Forbid capturing a stateblock while recording.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3d9/stateblock.c   | 8 ++++++++
 dlls/d3d9/tests/device.c | 2 +-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/dlls/d3d9/stateblock.c b/dlls/d3d9/stateblock.c
index 124e1ef..75f9748 100644
--- a/dlls/d3d9/stateblock.c
+++ b/dlls/d3d9/stateblock.c
@@ -96,10 +96,18 @@ static HRESULT WINAPI d3d9_stateblock_GetDevice(IDirect3DStateBlock9 *iface, IDi
 static HRESULT WINAPI d3d9_stateblock_Capture(IDirect3DStateBlock9 *iface)
 {
     struct d3d9_stateblock *stateblock = impl_from_IDirect3DStateBlock9(iface);
+    struct d3d9_device *device;
 
     TRACE("iface %p.\n", iface);
 
     wined3d_mutex_lock();
+    device = impl_from_IDirect3DDevice9Ex(stateblock->parent_device);
+    if (device->recording)
+    {
+        wined3d_mutex_unlock();
+        WARN("Trying to capture stateblock while recording, returning D3DERR_INVALIDCALL.\n");
+        return D3DERR_INVALIDCALL;
+    }
     wined3d_stateblock_capture(stateblock->wined3d_stateblock);
     wined3d_mutex_unlock();
 
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index 639c26d..40ccdc4 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -10599,7 +10599,7 @@ static void test_begin_end_state_block(void)
     ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
 
     hr = IDirect3DStateBlock9_Capture(stateblock);
-    todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
+    ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
 
     hr = IDirect3DDevice9_CreateStateBlock(device, D3DSBT_ALL, &stateblock2);
     todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);




More information about the wine-cvs mailing list