[PATCH 3/6] ddraw: Return D3DERR_NOTINBEGINSTATEBLOCK when EndStateBlock() is called while not recording.

Zebediah Figura z.figura12 at gmail.com
Thu Apr 4 18:37:57 CDT 2019


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 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 4ab7621e1a..49eb664576 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 c0d2aad06d..e10aedbc16 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);
-- 
2.20.1




More information about the wine-devel mailing list