Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d11/tests/d3d11.c | 74 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 91280f2c371..82a165c62d7 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -30164,6 +30164,79 @@ static void test_dual_source_blend(void) release_test_context(&test_context); }
+static void test_deferred_context_state(void) +{ + ID3D11Buffer *green_buffer, *blue_buffer, *ret_buffer; + ID3D11DeviceContext *immediate, *deferred; + struct d3d11_test_context test_context; + ID3D11CommandList *list1, *list2; + ID3D11Device *device; + HRESULT hr; + + 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; + + green_buffer = create_buffer(device, D3D11_BIND_CONSTANT_BUFFER, sizeof(green), &green); + blue_buffer = create_buffer(device, D3D11_BIND_CONSTANT_BUFFER, sizeof(blue), &blue); + ID3D11DeviceContext_PSSetConstantBuffers(immediate, 0, 1, &green_buffer); + + 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) + { + ID3D11Buffer_Release(blue_buffer); + ID3D11Buffer_Release(green_buffer); + release_test_context(&test_context); + return; + } + + ID3D11DeviceContext_PSGetConstantBuffers(deferred, 0, 1, &ret_buffer); + ok(!ret_buffer, "Got unexpected buffer %p.\n", ret_buffer); + + ID3D11DeviceContext_PSSetConstantBuffers(deferred, 0, 1, &blue_buffer); + + ID3D11DeviceContext_PSGetConstantBuffers(deferred, 0, 1, &ret_buffer); + ok(ret_buffer == blue_buffer, "Got unexpected buffer %p.\n", ret_buffer); + ID3D11Buffer_Release(ret_buffer); + + hr = ID3D11DeviceContext_FinishCommandList(deferred, TRUE, &list1); + 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); + ID3D11Buffer_Release(ret_buffer); + + hr = ID3D11DeviceContext_FinishCommandList(deferred, FALSE, &list2); + ok(hr == S_OK, "Failed to create command list, hr %#x.\n", hr); + + ID3D11DeviceContext_PSGetConstantBuffers(deferred, 0, 1, &ret_buffer); + ok(!ret_buffer, "Got unexpected buffer %p.\n", ret_buffer); + + ID3D11DeviceContext_PSSetConstantBuffers(immediate, 0, 1, &green_buffer); + ID3D11DeviceContext_ExecuteCommandList(immediate, list1, TRUE); + ID3D11DeviceContext_PSGetConstantBuffers(immediate, 0, 1, &ret_buffer); + ok(ret_buffer == green_buffer, "Got unexpected buffer %p.\n", ret_buffer); + ID3D11Buffer_Release(ret_buffer); + + 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); + + ID3D11CommandList_Release(list2); + ID3D11CommandList_Release(list1); + ID3D11DeviceContext_Release(deferred); + ID3D11Buffer_Release(blue_buffer); + ID3D11Buffer_Release(green_buffer); + release_test_context(&test_context); +} + START_TEST(d3d11) { unsigned int argc, i; @@ -30327,6 +30400,7 @@ START_TEST(d3d11) queue_test(test_color_mask); queue_test(test_independent_blend); queue_test(test_dual_source_blend); + queue_test(test_deferred_context_state);
run_queued_tests(); }
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- v2: Remove tests which crash on Windows.
dlls/d3d11/tests/d3d11.c | 104 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 82a165c62d7..792edad0882 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -30237,6 +30237,109 @@ 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_MAPPED_SUBRESOURCE map_desc; + 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 +30504,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=79515
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.
On Wed, 30 Sep 2020 at 03:54, Zebediah Figura z.figura12@gmail.com wrote:
+static void test_deferred_context_rendering(void) +{
- ID3D11DeviceContext *immediate, *deferred;
- struct d3d11_test_context test_context;
- D3D11_MAPPED_SUBRESOURCE map_desc;
This variable is unused.
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=79514
Your paranoid android.
=== w10pro64_ja (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.
=== debiant (64 bit WoW report) ===
d3d11: d3d11.c:16893: Test failed: d3d11.c:17991: Test failed: Got {0x00000001, 0xffffffff, 0x00000000, 0x00000000}, expected {0x00000001, 0x00000000, 0x00000000, 0x00000000} at (0, 0), sub-resource 0.