From de5a3451cd376d94c5366c68cc89a00d59f85475 Mon Sep 17 00:00:00 2001 From: Vincent Lejeune Date: Sun, 20 Sep 2015 18:13:16 +0200 Subject: [PATCH] d3d12: Force command queue completion --- rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp b/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp index 119a648395..51499e56a9 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp @@ -307,7 +307,15 @@ D3D12GSRender::D3D12GSRender() D3D12GSRender::~D3D12GSRender() { - getNonCurrentResourceStorage().WaitAndClean(); + // wait until queue has completed + ComPtr fence; + ThrowIfFailed(m_device->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(fence.GetAddressOf()))); + HANDLE handle = CreateEventEx(nullptr, FALSE, FALSE, EVENT_ALL_ACCESS); + fence->SetEventOnCompletion(1, handle); + + m_commandQueueGraphic->Signal(fence.Get(), 1); + WaitForSingleObjectEx(handle, INFINITE, FALSE); + CloseHandle(handle); { std::lock_guard lock(mut);