[PATCH 1/2] d3d11: Make SwapDeviceContextState truly no-op when state is NULL.

Rémi Bernon rbernon at codeweavers.com
Tue Feb 16 06:56:00 CST 2021


Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---

These two patches should be mostly independent from the rest of the
d3d11 state swap implementation, so I'm sending them now.

In the first patch, I'm not making any change to the rest of the logic,
although some ifs are now redundant with the initial checks, because
the function will have to be completely rewritten later anyway.

 dlls/d3d11/device.c      | 3 +++
 dlls/d3d11/tests/d3d11.c | 3 +--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c
index 8e5beb8893b..914b64d6019 100644
--- a/dlls/d3d11/device.c
+++ b/dlls/d3d11/device.c
@@ -2761,6 +2761,9 @@ static void STDMETHODCALLTYPE d3d11_immediate_context_SwapDeviceContextState(ID3
 
     FIXME("iface %p, state %p, prev_state %p semi-stub!\n", iface, state, prev_state);
 
+    if (prev_state) *prev_state = NULL;
+    if (!state) return;
+
     wined3d_mutex_lock();
     if (prev_state)
     {
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 044c1ce5a17..1505b3fddbc 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -7078,8 +7078,7 @@ static void test_device_context_state(void)
 
     previous_context_state = (ID3DDeviceContextState *)0xdeadbeef;
     ID3D11DeviceContext1_SwapDeviceContextState(context, NULL, &previous_context_state);
-    todo_wine ok(previous_context_state == NULL, "Got unexpected state pointer.\n");
-    if (previous_context_state) ID3DDeviceContextState_Release(previous_context_state);
+    ok(previous_context_state == NULL, "Got unexpected state pointer.\n");
     previous_context_state = NULL;
     ID3D11DeviceContext1_SwapDeviceContextState(context, context_state, &previous_context_state);
     ok(previous_context_state != NULL, "Failed to get previous context state\n");
-- 
2.30.0




More information about the wine-devel mailing list