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 --- dlls/d3d11/tests/d3d11.c | 110 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 82a165c62d7..5b157af513f 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -30237,6 +30237,115 @@ 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); + + hr = ID3D11DeviceContext_Map(deferred, (ID3D11Resource *)rtv, 0, D3D11_MAP_READ, 0, &map_desc); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + + hr = ID3D11DeviceContext_Map(deferred, (ID3D11Resource *)rtv, 0, D3D11_MAP_READ_WRITE, 0, &map_desc); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + + 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 +30510,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=79493
Your paranoid android.
=== w2008s64 (32 bit report) ===
d3d11: 0390:d3d11: unhandled exception c0000005 at 7451E2E7
=== 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. 1870:d3d11: unhandled exception c0000094 at 73FF0520
=== w10pro64 (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. 1dc4:d3d11: unhandled exception c0000094 at 739A2031
=== w10pro64_2scr (32 bit report) ===
d3d11: 1ac0:d3d11: unhandled exception c0000094 at 74BE2031
=== w10pro64_ar (32 bit report) ===
d3d11: 0874:d3d11: unhandled exception c0000094 at 747D2031
=== w10pro64_he (32 bit report) ===
d3d11: 1cb4:d3d11: unhandled exception c0000094 at 75502031
=== w10pro64_ja (32 bit report) ===
d3d11: 1ee0:d3d11: unhandled exception c0000094 at 74F32031
=== w2008s64 (64 bit report) ===
d3d11: d3d11.c:30336: Test failed: Got unexpected hr 0x74892620. d3d11.c:30339: Test failed: Got unexpected hr 0x74892620.
=== w864 (64 bit report) ===
d3d11: d3d11.c:30336: Test failed: Got unexpected hr 0x79d80a0. d3d11.c:30339: Test failed: Got unexpected hr 0x79d80a0. 02e8:d3d11: unhandled exception c0000005 at 0000000000000000
=== w1064v1809 (64 bit report) ===
d3d11: 1664:d3d11: unhandled exception c0000005 at 00007FF86D7F2D94
=== w10pro64 (64 bit report) ===
d3d11: 1cc0:d3d11: unhandled exception c0000094 at 00007FFF8760D7AD
=== w10pro64_2scr (64 bit report) ===
d3d11: 1a1c:d3d11: unhandled exception c0000094 at 00007FFFB7CFD7AD
=== w10pro64_ar (64 bit report) ===
d3d11: 0e04:d3d11: unhandled exception c0000005 at 00007FF9E7816A27
=== w10pro64_he (64 bit report) ===
d3d11: 1cd0:d3d11: unhandled exception c0000005 at 00007FFF40176A27
=== w10pro64_ja (64 bit report) ===
d3d11: 1f14:d3d11: unhandled exception c0000005 at 00007FF9F2BE6A27
=== w10pro64_zh_CN (64 bit report) ===
d3d11: 1eec:d3d11: unhandled exception c0000005 at 00007FFC79BAD70E
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=79492
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.
=== w10pro64_2scr (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.
=== w10pro64_ar (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. d3d11.c:5651: Test failed: Got unexpected query result 0x0000000000000000.