From bde070fcf42eb7ed346dd15de943bdb9326d2aff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 16 Feb 2021 13:56:00 +0100 Subject: [PATCH] d3d11: Make SwapDeviceContextState truly no-op when state is NULL. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RĂ©mi Bernon Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- 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");