From a8d26fb01838ab79025dcc838bb91e6bdfe707b9 Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 7 Jan 2020 13:20:15 +0000 Subject: [PATCH] Ensure that ExecuteIndirect forced buffer references are in-frame * If we add the references after transitioning back to background capturing, they will be ignored. --- renderdoc/driver/d3d12/d3d12_device.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/renderdoc/driver/d3d12/d3d12_device.cpp b/renderdoc/driver/d3d12/d3d12_device.cpp index 547ffc80f..ea3d49eea 100644 --- a/renderdoc/driver/d3d12/d3d12_device.cpp +++ b/renderdoc/driver/d3d12/d3d12_device.cpp @@ -1868,6 +1868,16 @@ bool WrappedID3D12Device::EndFrameCapture(void *dev, void *wnd) SCOPED_WRITELOCK(m_CapTransitionLock); EndCaptureFrame(); + queues = m_Queues; + + bool ContainsExecuteIndirect = false; + + for(auto it = queues.begin(); it != queues.end(); ++it) + ContainsExecuteIndirect |= (*it)->GetResourceRecord()->ContainsExecuteIndirect; + + if(ContainsExecuteIndirect) + WrappedID3D12Resource1::RefBuffers(GetResourceManager()); + m_State = CaptureState::BackgroundCapturing; GPUSync(); @@ -1877,12 +1887,6 @@ bool WrappedID3D12Device::EndFrameCapture(void *dev, void *wnd) for(auto it = m_Maps.begin(); it != m_Maps.end(); ++it) GetWrapped(it->res)->FreeShadow(); } - - queues = m_Queues; - - for(auto it = queues.begin(); it != queues.end(); ++it) - if((*it)->GetResourceRecord()->ContainsExecuteIndirect) - WrappedID3D12Resource1::RefBuffers(GetResourceManager()); } const uint32_t maxSize = 2048;