mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
dxgi/tests: Make sure that device is idle before destroying swapchains.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
670062ae33
commit
d601983971
1 changed files with 24 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue