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

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


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

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

d3d9: Forbid creating 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/device.c       | 9 +++++++++
 dlls/d3d9/tests/device.c | 4 ++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 4a41443..bad9211 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -2313,6 +2313,15 @@ static HRESULT WINAPI d3d9_device_CreateStateBlock(IDirect3DDevice9Ex *iface,
         return D3DERR_INVALIDCALL;
     }
 
+    wined3d_mutex_lock();
+    if (device->recording)
+    {
+        wined3d_mutex_unlock();
+        WARN("Trying to create a stateblock while recording, returning D3DERR_INVALIDCALL.\n");
+        return D3DERR_INVALIDCALL;
+    }
+    wined3d_mutex_unlock();
+
     if (!(object = heap_alloc_zero(sizeof(*object))))
         return E_OUTOFMEMORY;
 
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index 40ccdc4..e7366b1 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -10602,7 +10602,7 @@ static void test_begin_end_state_block(void)
     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);
+    ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
 
     hr = IDirect3DDevice9_GetRenderState(device, D3DRS_LIGHTING, &value);
     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
@@ -10621,7 +10621,7 @@ static void test_begin_end_state_block(void)
     IDirect3DStateBlock9_Release(stateblock);
     IDirect3DStateBlock9_Release(stateblock2);
     refcount = IDirect3DDevice9_Release(device);
-    todo_wine ok(!refcount, "Device has %u references left.\n", refcount);
+    ok(!refcount, "Device has %u references left.\n", refcount);
     IDirect3D9_Release(d3d);
     DestroyWindow(window);
 }




More information about the wine-cvs mailing list