=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: dxgi/tests: Make sure that device is idle before destroying swapchains.

Alexandre Julliard julliard at winehq.org
Wed Mar 6 15:29:41 CST 2019


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

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Wed Mar  6 14:19:53 2019 +0100

dxgi/tests: Make sure that device is idle before destroying swapchains.

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dxgi/tests/dxgi.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/dlls/dxgi/tests/dxgi.c b/dlls/dxgi/tests/dxgi.c
index a7e60c6..fcbaf79 100644
--- a/dlls/dxgi/tests/dxgi.c
+++ b/dlls/dxgi/tests/dxgi.c
@@ -608,6 +608,26 @@ static void wait_queue_idle_(unsigned int line, ID3D12Device *device, ID3D12Comm
     ID3D12Fence_Release(fence);
 }
 
+#define wait_device_idle(a) wait_device_idle_(__LINE__, a)
+static void wait_device_idle_(unsigned int line, IUnknown *device)
+{
+    ID3D12Device *d3d12_device;
+    ID3D12CommandQueue *queue;
+    HRESULT hr;
+
+    hr = IUnknown_QueryInterface(device, &IID_ID3D12CommandQueue, (void **)&queue);
+    if (hr != S_OK)
+        return;
+
+    hr = ID3D12CommandQueue_GetDevice(queue, &IID_ID3D12Device, (void **)&d3d12_device);
+    ok_(__FILE__, line)(hr == S_OK, "Failed to get d3d12 device, hr %#x.\n", hr);
+
+    wait_queue_idle_(line, d3d12_device, queue);
+
+    ID3D12CommandQueue_Release(queue);
+    ID3D12Device_Release(d3d12_device);
+}
+
 #define get_factory(a, b, c) get_factory_(__LINE__, a, b, c)
 static void get_factory_(unsigned int line, IUnknown *device, BOOL is_d3d12, IDXGIFactory **factory)
 {
@@ -3952,6 +3972,8 @@ static void test_swapchain_present(IUnknown *device, BOOL is_d3d12)
     hr = IDXGISwapChain_Present(swapchain, 0, 0);
     ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
 
+    wait_device_idle(device);
+
     IDXGISwapChain_Release(swapchain);
     DestroyWindow(swapchain_desc.OutputWindow);
     refcount = IDXGIFactory_Release(factory);
@@ -4031,6 +4053,8 @@ static void test_swapchain_backbuffer_index(IUnknown *device, BOOL is_d3d12)
             ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
         }
 
+        wait_device_idle(device);
+
         IDXGISwapChain3_Release(swapchain3);
         refcount = IDXGISwapChain_Release(swapchain);
         ok(!refcount, "Swapchain has %u references left.\n", refcount);




More information about the wine-cvs mailing list