Zebediah Figura : wined3d: Implement restoring context in wined3d_deferred_context_record_command_list().

Alexandre Julliard julliard at winehq.org
Thu May 27 16:02:10 CDT 2021


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Thu May 27 11:14:34 2021 -0500

wined3d: Implement restoring context in wined3d_deferred_context_record_command_list().

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/d3d11/tests/d3d11.c | 39 +++++++++++++--------------------------
 dlls/wined3d/cs.c        | 11 ++++-------
 2 files changed, 17 insertions(+), 33 deletions(-)

diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index d8c3b2df19c..63c36414f20 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -32268,15 +32268,7 @@ static void test_deferred_context_state(void)
     ID3D11Buffer_Release(ret_buffer);
 
     hr = ID3D11DeviceContext_FinishCommandList(deferred, TRUE, &list1);
-    todo_wine ok(hr == S_OK, "Failed to create command list, hr %#x.\n", hr);
-    if (hr != S_OK)
-    {
-        ID3D11DeviceContext_Release(deferred);
-        ID3D11Buffer_Release(blue_buffer);
-        ID3D11Buffer_Release(green_buffer);
-        release_test_context(&test_context);
-        return;
-    }
+    ok(hr == S_OK, "Failed to create command list, hr %#x.\n", hr);
 
     ID3D11DeviceContext_PSGetConstantBuffers(deferred, 0, 1, &ret_buffer);
     ok(ret_buffer == blue_buffer, "Got unexpected buffer %p.\n", ret_buffer);
@@ -32297,7 +32289,9 @@ static void test_deferred_context_state(void)
     ID3D11DeviceContext_PSSetConstantBuffers(immediate, 0, 1, &green_buffer);
     ID3D11DeviceContext_ExecuteCommandList(immediate, list1, FALSE);
     ID3D11DeviceContext_PSGetConstantBuffers(immediate, 0, 1, &ret_buffer);
-    ok(!ret_buffer, "Got unexpected buffer %p.\n", ret_buffer);
+    todo_wine ok(!ret_buffer, "Got unexpected buffer %p.\n", ret_buffer);
+    if (ret_buffer)
+        ID3D11Buffer_Release(ret_buffer);
 
     ID3D11CommandList_Release(list2);
     ID3D11CommandList_Release(list1);
@@ -32471,16 +32465,7 @@ static void test_deferred_context_rendering(void)
     ID3D11DeviceContext_ClearRenderTargetView(deferred, test_context.backbuffer_rtv, green);
 
     hr = ID3D11DeviceContext_FinishCommandList(deferred, TRUE, &list1);
-    todo_wine ok(hr == S_OK, "Failed to create command list, hr %#x.\n", hr);
-    if (hr != S_OK)
-    {
-        ID3D11BlendState_Release(red_blend);
-        ID3D11BlendState_Release(green_blend);
-        ID3D11BlendState_Release(blue_blend);
-        ID3D11DeviceContext_Release(deferred);
-        release_test_context(&test_context);
-        return;
-    }
+    ok(hr == S_OK, "Failed to create command list, hr %#x.\n", hr);
 
     hr = ID3D11DeviceContext_FinishCommandList(deferred, TRUE, &list2);
     ok(hr == S_OK, "Failed to create command list, hr %#x.\n", hr);
@@ -32490,12 +32475,12 @@ static void test_deferred_context_rendering(void)
 
     ID3D11DeviceContext_ExecuteCommandList(immediate, list1, TRUE);
     color = get_texture_color(test_context.backbuffer, 320, 240);
-    ok(color == 0xff00ff00, "Got unexpected color %#08x.\n", color);
+    todo_wine ok(color == 0xff00ff00, "Got unexpected color %#08x.\n", color);
 
     ID3D11DeviceContext_ClearRenderTargetView(immediate, test_context.backbuffer_rtv, &white.x);
     ID3D11DeviceContext_ExecuteCommandList(immediate, list1, TRUE);
     color = get_texture_color(test_context.backbuffer, 320, 240);
-    ok(color == 0xff00ff00, "Got unexpected color %#08x.\n", color);
+    todo_wine ok(color == 0xff00ff00, "Got unexpected color %#08x.\n", color);
 
     ID3D11DeviceContext_ClearRenderTargetView(immediate, test_context.backbuffer_rtv, &white.x);
     ID3D11DeviceContext_ExecuteCommandList(immediate, list2, TRUE);
@@ -32511,7 +32496,7 @@ static void test_deferred_context_rendering(void)
     ID3D11DeviceContext_ClearRenderTargetView(immediate, test_context.backbuffer_rtv, &white.x);
     ID3D11DeviceContext_ExecuteCommandList(immediate, list2, TRUE);
     color = get_texture_color(test_context.backbuffer, 320, 240);
-    ok(color == 0xff00ff00, "Got unexpected color %#08x.\n", color);
+    todo_wine ok(color == 0xff00ff00, "Got unexpected color %#08x.\n", color);
 
     ID3D11CommandList_Release(list2);
     ID3D11CommandList_Release(list1);
@@ -32537,7 +32522,7 @@ static void test_deferred_context_rendering(void)
     ID3D11DeviceContext_ClearRenderTargetView(immediate, rtv, blue);
     ID3D11DeviceContext_ExecuteCommandList(immediate, list1, TRUE);
     color = get_texture_color(test_context.backbuffer, 320, 240);
-    ok(color == 0xffff0000, "Got unexpected color %#08x.\n", color);
+    todo_wine ok(color == 0xffff0000, "Got unexpected color %#08x.\n", color);
 
     ID3D11CommandList_Release(list1);
     ID3D11DeviceContext_Release(deferred);
@@ -32571,10 +32556,12 @@ static void test_deferred_context_rendering(void)
     set_viewport(immediate, 0.0f, 0.0f, 640.0f, 480.0f, 0.0f, 1.0f);
     draw_color_quad(&test_context, &white);
     color = get_texture_color(test_context.backbuffer, 320, 240);
-    ok(color == 0xffffffff, "Got unexpected color %#08x.\n", color);
+    todo_wine ok(color == 0xffffffff, "Got unexpected color %#08x.\n", color);
 
     ID3D11DeviceContext_OMGetBlendState(immediate, &ret_blend, blend_factor, &sample_mask);
-    ok(!ret_blend, "Got unexpected blend state %p.\n", ret_blend);
+    todo_wine ok(!ret_blend, "Got unexpected blend state %p.\n", ret_blend);
+    if (ret_blend)
+        ID3D11BlendState_Release(ret_blend);
 
     ID3D11CommandList_Release(list1);
     ID3D11DeviceContext_Release(deferred);
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index db1c811a1f1..1e082ce724d 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -3395,12 +3395,6 @@ HRESULT CDECL wined3d_deferred_context_record_command_list(struct wined3d_device
 
     TRACE("context %p, list %p.\n", context, list);
 
-    if (restore)
-    {
-        FIXME("Restoring context state is not implemented.\n");
-        return E_NOTIMPL;
-    }
-
     if (!(object = heap_alloc_zero(sizeof(*object))))
         return E_OUTOFMEMORY;
 
@@ -3429,7 +3423,10 @@ HRESULT CDECL wined3d_deferred_context_record_command_list(struct wined3d_device
     deferred->resource_count = 0;
 
     /* This is in fact recorded into a subsequent command list. */
-    wined3d_device_context_reset_state(&deferred->c);
+    if (restore)
+        wined3d_device_context_set_state(&deferred->c, deferred->c.state);
+    else
+        wined3d_device_context_reset_state(&deferred->c);
 
     TRACE("Created command list %p.\n", object);
     *list = object;




More information about the wine-cvs mailing list