From 729fa04136e2ea738e491b753ddc0e535cfc4369 Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 10 May 2024 11:13:45 +0100 Subject: [PATCH] Don't release ASs on replay * These resources are destroyed on capture shutdown and possibly out of order between ASs and ASBs. The ownership tracking is not needed on replay so only do this during capture. --- renderdoc/driver/d3d12/d3d12_resources.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/renderdoc/driver/d3d12/d3d12_resources.cpp b/renderdoc/driver/d3d12/d3d12_resources.cpp index edc6f4245..2f15e3774 100644 --- a/renderdoc/driver/d3d12/d3d12_resources.cpp +++ b/renderdoc/driver/d3d12/d3d12_resources.cpp @@ -152,8 +152,6 @@ D3D12AccelerationStructure::D3D12AccelerationStructure(WrappedID3D12Device *wrap D3D12AccelerationStructure::~D3D12AccelerationStructure() { - RDCLOG("AS %s destroyed", ToStr(GetResourceID()).c_str()); - Shutdown(); } @@ -209,9 +207,12 @@ WrappedID3D12Resource::~WrappedID3D12Resource() } } - // release all ASs - for(auto it = m_accelerationStructMap.begin(); it != m_accelerationStructMap.end(); ++it) - SAFE_RELEASE(it->second); + // release all ASs during capture. During replay these will be destroyed themselves + if(IsCaptureMode(m_pDevice->GetState())) + { + for(auto it = m_accelerationStructMap.begin(); it != m_accelerationStructMap.end(); ++it) + SAFE_RELEASE(it->second); + } if(IsReplayMode(m_pDevice->GetState())) m_pDevice->RemoveReplayResource(GetResourceID());