From 97e16e83335df871361bd7e281aa8ed6db63507f Mon Sep 17 00:00:00 2001 From: baldurk Date: Thu, 27 Jul 2017 16:13:53 +0100 Subject: [PATCH] Make sure to sync *all* GPU queues before processing ExecuteIndirect --- renderdoc/driver/d3d12/d3d12_command_queue_wrap.cpp | 3 ++- renderdoc/driver/d3d12/d3d12_device.cpp | 6 ++++++ renderdoc/driver/d3d12/d3d12_device.h | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/renderdoc/driver/d3d12/d3d12_command_queue_wrap.cpp b/renderdoc/driver/d3d12/d3d12_command_queue_wrap.cpp index 74dcf560f..2e2dc2c1a 100644 --- a/renderdoc/driver/d3d12/d3d12_command_queue_wrap.cpp +++ b/renderdoc/driver/d3d12/d3d12_command_queue_wrap.cpp @@ -180,7 +180,8 @@ bool WrappedID3D12CommandQueue::Serialise_ExecuteCommandLists(UINT NumCommandLis for(size_t c = 1; c < info.crackedLists.size(); c++) { - m_pDevice->GPUSync(); + // ensure all work on all queues has finished + m_pDevice->GPUSyncAllQueues(); // readback the patch buffer and perform patching m_ReplayList->PatchExecuteIndirect(info, uint32_t(c - 1)); diff --git a/renderdoc/driver/d3d12/d3d12_device.cpp b/renderdoc/driver/d3d12/d3d12_device.cpp index 6d03ad498..09ff62bc4 100644 --- a/renderdoc/driver/d3d12/d3d12_device.cpp +++ b/renderdoc/driver/d3d12/d3d12_device.cpp @@ -2142,6 +2142,12 @@ void WrappedID3D12Device::GPUSync(ID3D12CommandQueue *queue, ID3D12Fence *fence) RDCASSERTEQUAL(hr, S_OK); } +void WrappedID3D12Device::GPUSyncAllQueues() +{ + for(size_t i = 0; i < m_QueueFences.size(); i++) + GPUSync(m_Queues[i], m_QueueFences[i]); +} + ID3D12GraphicsCommandList *WrappedID3D12Device::GetNewList() { ID3D12GraphicsCommandList *ret = NULL; diff --git a/renderdoc/driver/d3d12/d3d12_device.h b/renderdoc/driver/d3d12/d3d12_device.h index 5d5736355..e3f717600 100644 --- a/renderdoc/driver/d3d12/d3d12_device.h +++ b/renderdoc/driver/d3d12/d3d12_device.h @@ -443,6 +443,7 @@ public: void FlushLists(bool forceSync = false, ID3D12CommandQueue *queue = NULL); void GPUSync(ID3D12CommandQueue *queue = NULL, ID3D12Fence *fence = NULL); + void GPUSyncAllQueues(); void StartFrameCapture(void *dev, void *wnd); bool EndFrameCapture(void *dev, void *wnd);