Zebediah Figura : d3d9: Use wined3d_stateblock_* methods directly in BeginStateBlock() and EndStateBlock().

Alexandre Julliard julliard at winehq.org
Tue Nov 26 16:21:24 CST 2019


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Tue Nov 26 09:57:38 2019 -0600

d3d9: Use wined3d_stateblock_* methods directly in BeginStateBlock() and EndStateBlock().

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       | 17 ++++++++++++-----
 dlls/d3d9/tests/device.c |  7 -------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 76fddc59f1..0657cc2f76 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -2400,7 +2400,14 @@ static HRESULT WINAPI d3d9_device_BeginStateBlock(IDirect3DDevice9Ex *iface)
     TRACE("iface %p.\n", iface);
 
     wined3d_mutex_lock();
-    if (SUCCEEDED(hr = wined3d_device_begin_stateblock(device->wined3d_device, &stateblock)))
+    if (device->recording)
+    {
+        wined3d_mutex_unlock();
+        WARN("Trying to begin a stateblock while recording, returning D3DERR_INBEGINSTATEBLOCK.\n");
+        return D3DERR_INVALIDCALL;
+    }
+
+    if (SUCCEEDED(hr = wined3d_stateblock_create(device->wined3d_device, WINED3D_SBT_RECORDED, &stateblock)))
         device->update_state = device->recording = stateblock;
     wined3d_mutex_unlock();
 
@@ -2417,14 +2424,14 @@ static HRESULT WINAPI d3d9_device_EndStateBlock(IDirect3DDevice9Ex *iface, IDire
     TRACE("iface %p, stateblock %p.\n", iface, stateblock);
 
     wined3d_mutex_lock();
-    hr = wined3d_device_end_stateblock(device->wined3d_device);
-    if (FAILED(hr))
+    if (!device->recording)
     {
         wined3d_mutex_unlock();
-        WARN("Failed to end the stateblock, hr %#x.\n", hr);
-        return hr;
+        WARN("Trying to end a stateblock, but no stateblock is being recorded.\n");
+        return D3DERR_INVALIDCALL;
     }
     wined3d_stateblock = device->recording;
+    wined3d_stateblock_init_contained_states(wined3d_stateblock);
     device->recording = NULL;
     device->update_state = device->state;
     wined3d_mutex_unlock();
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index 75cddbb6db..03ebe242e9 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -3048,19 +3048,12 @@ static void test_draw_primitive(void)
 
     hr = IDirect3DDevice9_GetStreamSource(device, 0, &current_vb, &offset, &stride);
     ok(SUCCEEDED(hr), "GetStreamSource failed, hr %#x.\n", hr);
-todo_wine
     ok(!current_vb, "Unexpected vb %p.\n", current_vb);
     ok(!offset, "Unexpected offset %u.\n", offset);
-todo_wine
     ok(!stride, "Unexpected stride %u.\n", stride);
-    if (current_vb)
-        IDirect3DVertexBuffer9_Release(current_vb);
     hr = IDirect3DDevice9_GetIndices(device, &current_ib);
     ok(SUCCEEDED(hr), "GetIndices failed, hr %#x.\n", hr);
-todo_wine
     ok(!current_ib, "Unexpected index buffer %p.\n", current_ib);
-    if (current_ib)
-        IDirect3DIndexBuffer9_Release(current_ib);
 
     hr = IDirect3DStateBlock9_Capture(stateblock);
     ok(SUCCEEDED(hr), "Capture failed, hr %#x.\n", hr);




More information about the wine-cvs mailing list