Zebediah Figura : ddraw: Forbid applying a stateblock while recording.

Alexandre Julliard julliard at winehq.org
Fri Apr 5 16:04:58 CDT 2019


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Thu Apr  4 18:37:58 2019 -0500

ddraw: Forbid applying 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/ddraw/device.c       | 6 ++++++
 dlls/ddraw/tests/ddraw7.c | 4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index 49eb664..0ddf9a8 100644
--- a/dlls/ddraw/device.c
+++ b/dlls/ddraw/device.c
@@ -5822,6 +5822,12 @@ static HRESULT d3d_device7_ApplyStateBlock(IDirect3DDevice7 *iface, DWORD stateb
     TRACE("iface %p, stateblock %#x.\n", iface, stateblock);
 
     wined3d_mutex_lock();
+    if (device->recording)
+    {
+        wined3d_mutex_unlock();
+        WARN("Trying to apply a stateblock while recording, returning D3DERR_INBEGINSTATEBLOCK.\n");
+        return D3DERR_INBEGINSTATEBLOCK;
+    }
     wined3d_sb = ddraw_get_object(&device->handle_table, stateblock - 1, DDRAW_HANDLE_STATEBLOCK);
     if (!wined3d_sb)
     {
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index e10aedb..ff73eea 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -15866,7 +15866,7 @@ static void test_begin_end_state_block(void)
     ok(hr == D3DERR_INBEGINSTATEBLOCK, "Got unexpected hr %#x.\n", hr);
 
     hr = IDirect3DDevice7_ApplyStateBlock(device, stateblock);
-    todo_wine ok(hr == D3DERR_INBEGINSTATEBLOCK, "Got unexpected hr %#x.\n", hr);
+    ok(hr == D3DERR_INBEGINSTATEBLOCK, "Got unexpected hr %#x.\n", hr);
 
     hr = IDirect3DDevice7_CaptureStateBlock(device, stateblock);
     todo_wine ok(hr == D3DERR_INBEGINSTATEBLOCK, "Got unexpected hr %#x.\n", hr);
@@ -15886,7 +15886,7 @@ static void test_begin_end_state_block(void)
 
     hr = IDirect3DDevice7_GetRenderState(device, D3DRENDERSTATE_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 = IDirect3DDevice7_Release(device);
     ok(!refcount, "Device has %u references left.\n", refcount);




More information about the wine-cvs mailing list