Signed-off-by: Józef Kucia jkucia@codeweavers.com --- dlls/d3d12/tests/d3d12.c | 102 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+)
diff --git a/dlls/d3d12/tests/d3d12.c b/dlls/d3d12/tests/d3d12.c index 7b610c0c85a9..67e72405d89f 100644 --- a/dlls/d3d12/tests/d3d12.c +++ b/dlls/d3d12/tests/d3d12.c @@ -908,6 +908,107 @@ static void test_swapchain_draw(void) destroy_test_context(&context); }
+static void test_swapchain_size_mismatch(void) +{ + static const float green[] = {0.0f, 1.0f, 0.0f, 1.0f}; + ID3D12GraphicsCommandList *command_list; + ID3D12Resource *backbuffers[2]; + struct test_context_desc desc; + struct test_context context; + ID3D12Resource *backbuffer; + IDXGISwapChain3 *swapchain; + ID3D12CommandQueue *queue; + unsigned int index, i; + ID3D12Device *device; + ULONG refcount; + HWND window; + HRESULT hr; + RECT rect; + BOOL ret; + + desc.no_pipeline = TRUE; + if (!init_test_context(&context, &desc)) + return; + device = context.device; + command_list = context.list; + queue = context.queue; + + window = CreateWindowA("static", "d3d12_test", WS_VISIBLE, 0, 0, 200, 200, NULL, NULL, NULL, NULL); + swapchain = create_swapchain(queue, window, DXGI_FORMAT_B8G8R8A8_UNORM, 400, 400); + index = IDXGISwapChain3_GetCurrentBackBufferIndex(swapchain); + hr = IDXGISwapChain3_GetBuffer(swapchain, index, &IID_ID3D12Resource, (void **)&backbuffer); + ok(hr == S_OK, "Failed to get swapchain buffer %u, hr %#x.\n", index, hr); + ID3D12Device_CreateRenderTargetView(device, backbuffer, NULL, context.rtv); + + transition_sub_resource_state(command_list, backbuffer, 0, + D3D12_RESOURCE_STATE_PRESENT, D3D12_RESOURCE_STATE_RENDER_TARGET); + ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, green, 0, NULL); + transition_sub_resource_state(command_list, backbuffer, 0, + D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_COPY_SOURCE); + check_sub_resource_uint(backbuffer, 0, queue, command_list, 0xff00ff00, 0); + + reset_command_list(command_list, context.allocator); + transition_sub_resource_state(command_list, backbuffer, 0, + D3D12_RESOURCE_STATE_COPY_SOURCE, D3D12_RESOURCE_STATE_PRESENT); + hr = ID3D12GraphicsCommandList_Close(command_list); + ok(hr == S_OK, "Failed to close command list, hr %#x.\n", hr); + exec_command_list(queue, command_list); + + hr = IDXGISwapChain3_Present(swapchain, 1, 0); + ok(hr == S_OK, "Failed to present, hr %#x.\n", hr); + + wait_queue_idle(device, queue); + reset_command_list(command_list, context.allocator); + + refcount = ID3D12Resource_Release(backbuffer); + ok(!refcount, "Backbuffer has %u references left.\n", refcount); + refcount = IDXGISwapChain3_Release(swapchain); + ok(!refcount, "Swapchain has %u references left.\n", refcount); + DestroyWindow(window); + + window = create_window(WS_VISIBLE); + ret = GetClientRect(window, &rect); + ok(ret, "Failed to get client rect.\n"); + swapchain = create_swapchain(queue, window, DXGI_FORMAT_B8G8R8A8_UNORM, rect.right, rect.bottom); + + for (i = 0; i < ARRAY_SIZE(backbuffers); ++i) + { + hr = IDXGISwapChain3_GetBuffer(swapchain, i, &IID_ID3D12Resource, (void **)&backbuffers[i]); + ok(hr == S_OK, "Failed to get swapchain buffer %u, hr %#x.\n", i, hr); + } + + for (i = 0; i < 20; ++i) + { + index = IDXGISwapChain3_GetCurrentBackBufferIndex(swapchain); + ID3D12Device_CreateRenderTargetView(device, backbuffers[index], NULL, context.rtv); + + transition_sub_resource_state(command_list, backbuffers[index], 0, + D3D12_RESOURCE_STATE_PRESENT, D3D12_RESOURCE_STATE_RENDER_TARGET); + ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, green, 0, NULL); + transition_sub_resource_state(command_list, backbuffers[index], 0, + D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_PRESENT); + hr = ID3D12GraphicsCommandList_Close(command_list); + ok(hr == S_OK, "Failed to close command list, hr %#x.\n", hr); + exec_command_list(queue, command_list); + + hr = IDXGISwapChain3_Present(swapchain, 1, 0); + ok(hr == S_OK, "Failed to present, hr %#x.\n", hr); + + wait_queue_idle(device, queue); + reset_command_list(command_list, context.allocator); + + if (i == 6) + MoveWindow(window, 0, 0, 100, 100, TRUE); + } + + for (i = 0; i < ARRAY_SIZE(backbuffers); ++i) + ID3D12Resource_Release(backbuffers[i]); + refcount = IDXGISwapChain3_Release(swapchain); + ok(!refcount, "Swapchain has %u references left.\n", refcount); + DestroyWindow(window); + destroy_test_context(&context); +} + START_TEST(d3d12) { BOOL enable_debug_layer = FALSE; @@ -937,4 +1038,5 @@ START_TEST(d3d12) test_interfaces(); test_draw(); test_swapchain_draw(); + test_swapchain_size_mismatch(); }
Hi,
While running your changed tests on Windows, 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=48342
Your paranoid android.
=== debian9 (32 bit French report) ===
Report errors: The report seems to have been truncated
=== debian9 (build log) ===
X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig)
=== debian9 (build log) ===
X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig) X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 21 (RRSetCrtcConfig)
On Wed, 27 Feb 2019 at 18:36, Józef Kucia jkucia@codeweavers.com wrote:
Signed-off-by: Józef Kucia jkucia@codeweavers.com
dlls/d3d12/tests/d3d12.c | 102 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+)
This fails here (Intel SKL, slightly ancient Mesa):
0009:err:dxgi:d3d12_swapchain_acquire_next_image Failed to acquire next Vulkan image, vr -1000001004. 0009:fixme:dxgi:hresult_from_vk_result Unhandled VkResult -1000001004. d3d12.c:995: Test failed: Failed to present, hr 0x80004005.