Rémi Bernon : d3d11: Make SwapDeviceContextState truly no-op when state is NULL.

Alexandre Julliard julliard at winehq.org
Wed Feb 17 16:23:34 CST 2021


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

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Tue Feb 16 13:56:00 2021 +0100

d3d11: Make SwapDeviceContextState truly no-op when state is NULL.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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");




More information about the wine-cvs mailing list