Zebediah Figura : ddraw: Return D3DERR_NOTINBEGINSTATEBLOCK when EndStateBlock() is called while not recording.

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


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

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

ddraw: Return D3DERR_NOTINBEGINSTATEBLOCK when EndStateBlock() is called while not 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       | 7 ++++++-
 dlls/ddraw/tests/ddraw7.c | 4 ++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index 4ab7621..49eb664 100644
--- a/dlls/ddraw/device.c
+++ b/dlls/ddraw/device.c
@@ -5703,7 +5703,12 @@ static HRESULT d3d_device7_EndStateBlock(IDirect3DDevice7 *iface, DWORD *statebl
         return DDERR_INVALIDPARAMS;
 
     wined3d_mutex_lock();
-
+    if (!device->recording)
+    {
+        wined3d_mutex_unlock();
+        WARN("Trying to end a stateblock, but no stateblock is being recorded.\n");
+        return D3DERR_NOTINBEGINSTATEBLOCK;
+    }
     hr = wined3d_device_end_stateblock(device->wined3d_device, &wined3d_sb);
     if (FAILED(hr))
     {
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index c0d2aad..e10aedb 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -15852,8 +15852,8 @@ static void test_begin_end_state_block(void)
 
     stateblock2 = 0xdeadbeef;
     hr = IDirect3DDevice7_EndStateBlock(device, &stateblock2);
-    todo_wine ok(hr == D3DERR_NOTINBEGINSTATEBLOCK, "Got unexpected hr %#x.\n", hr);
-    todo_wine ok(stateblock2 == 0xdeadbeef, "Got unexpected stateblock %#x.\n", stateblock2);
+    ok(hr == D3DERR_NOTINBEGINSTATEBLOCK, "Got unexpected hr %#x.\n", hr);
+    ok(stateblock2 == 0xdeadbeef, "Got unexpected stateblock %#x.\n", stateblock2);
 
     hr = IDirect3DDevice7_GetRenderState(device, D3DRENDERSTATE_LIGHTING, &value);
     ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);




More information about the wine-cvs mailing list