Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d11/tests/d3d11.c | 103 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 82a165c62d7..e1a6dd6159b 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -30237,6 +30237,108 @@ static void test_deferred_context_state(void) release_test_context(&test_context); }
+static void test_deferred_context_rendering(void) +{ + ID3D11DeviceContext *immediate, *deferred; + struct d3d11_test_context test_context; + D3D11_TEXTURE2D_DESC texture_desc; + ID3D11CommandList *list1, *list2; + ID3D11RenderTargetView *rtv; + ID3D11Texture2D *texture; + ID3D11Device *device; + DWORD color; + HRESULT hr; + + static const float white[] = {1.0f, 1.0f, 1.0f, 1.0f}; + static const float green[] = {0.0f, 1.0f, 0.0f, 1.0f}; + static const float blue[] = {0.0f, 0.0f, 1.0f, 1.0f}; + + if (!init_test_context(&test_context, NULL)) + return; + + device = test_context.device; + immediate = test_context.immediate_context; + + ID3D11DeviceContext_ClearRenderTargetView(immediate, test_context.backbuffer_rtv, white); + + hr = ID3D11Device_CreateDeferredContext(device, 0, &deferred); + todo_wine ok(hr == S_OK, "Failed to create deferred context, hr %#x.\n", hr); + if (hr != S_OK) + { + release_test_context(&test_context); + return; + } + + ID3D11DeviceContext_ClearRenderTargetView(deferred, test_context.backbuffer_rtv, green); + + hr = ID3D11DeviceContext_FinishCommandList(deferred, TRUE, &list1); + 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); + + color = get_texture_color(test_context.backbuffer, 320, 240); + ok(color == 0xffffffff, "Got unexpected color %#08x.\n", color); + + ID3D11DeviceContext_ExecuteCommandList(immediate, list1, TRUE); + color = get_texture_color(test_context.backbuffer, 320, 240); + ok(color == 0xff00ff00, "Got unexpected color %#08x.\n", color); + + ID3D11DeviceContext_ClearRenderTargetView(immediate, test_context.backbuffer_rtv, white); + ID3D11DeviceContext_ExecuteCommandList(immediate, list1, TRUE); + color = get_texture_color(test_context.backbuffer, 320, 240); + ok(color == 0xff00ff00, "Got unexpected color %#08x.\n", color); + + ID3D11DeviceContext_ClearRenderTargetView(immediate, test_context.backbuffer_rtv, white); + ID3D11DeviceContext_ExecuteCommandList(immediate, list2, TRUE); + color = get_texture_color(test_context.backbuffer, 320, 240); + ok(color == 0xffffffff, "Got unexpected color %#08x.\n", color); + + ID3D11CommandList_Release(list2); + + ID3D11DeviceContext_ExecuteCommandList(deferred, list1, TRUE); + hr = ID3D11DeviceContext_FinishCommandList(deferred, TRUE, &list2); + ok(hr == S_OK, "Failed to create command list, hr %#x.\n", hr); + + ID3D11DeviceContext_ClearRenderTargetView(immediate, test_context.backbuffer_rtv, white); + ID3D11DeviceContext_ExecuteCommandList(immediate, list2, TRUE); + color = get_texture_color(test_context.backbuffer, 320, 240); + ok(color == 0xff00ff00, "Got unexpected color %#08x.\n", color); + + ID3D11CommandList_Release(list2); + ID3D11CommandList_Release(list1); + ID3D11DeviceContext_Release(deferred); + + ID3D11Texture2D_GetDesc(test_context.backbuffer, &texture_desc); + hr = ID3D11Device_CreateTexture2D(device, &texture_desc, NULL, &texture); + ok(hr == S_OK, "Failed to create texture, hr %#x.\n", hr); + hr = ID3D11Device_CreateRenderTargetView(device, (ID3D11Resource *)texture, NULL, &rtv); + ok(hr == S_OK, "Failed to create view, hr %#x.\n", hr); + + ID3D11DeviceContext_ClearRenderTargetView(immediate, test_context.backbuffer_rtv, white); + ID3D11DeviceContext_ClearRenderTargetView(immediate, rtv, green); + + hr = ID3D11Device_CreateDeferredContext(device, 0, &deferred); + ok(hr == S_OK, "Failed to create deferred context, hr %#x.\n", hr); + + ID3D11DeviceContext_CopyResource(deferred, (ID3D11Resource *)test_context.backbuffer, (ID3D11Resource *)texture); + + hr = ID3D11DeviceContext_FinishCommandList(deferred, TRUE, &list1); + ok(hr == S_OK, "Failed to create command list, hr %#x.\n", hr); + + 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); + + ID3D11CommandList_Release(list1); + ID3D11DeviceContext_Release(deferred); + + ID3D11RenderTargetView_Release(rtv); + ID3D11Texture2D_Release(texture); + release_test_context(&test_context); +} + START_TEST(d3d11) { unsigned int argc, i; @@ -30401,6 +30503,7 @@ START_TEST(d3d11) queue_test(test_independent_blend); queue_test(test_dual_source_blend); queue_test(test_deferred_context_state); + queue_test(test_deferred_context_rendering);
run_queued_tests(); }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=79635
Your paranoid android.
=== w1064v1809 (32 bit report) ===
d3d11: d3d11.c:5804: Test failed: Got unexpected IAVertices count: 0. d3d11.c:5805: Test failed: Got unexpected IAPrimitives count: 0. d3d11.c:5806: Test failed: Got unexpected VSInvocations count: 0. d3d11.c:5809: Test failed: Got unexpected CInvocations count: 0. d3d11.c:5810: Test failed: Got unexpected CPrimitives count: 0.