From a5332bc76402419119c369c7f10f84e71a740104 Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 22 May 2024 16:09:43 +0100 Subject: [PATCH] Don't try to patch empty TLAS builds --- renderdoc/driver/d3d12/d3d12_command_list4_wrap.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/renderdoc/driver/d3d12/d3d12_command_list4_wrap.cpp b/renderdoc/driver/d3d12/d3d12_command_list4_wrap.cpp index fb99a517d..d6ea68752 100644 --- a/renderdoc/driver/d3d12/d3d12_command_list4_wrap.cpp +++ b/renderdoc/driver/d3d12/d3d12_command_list4_wrap.cpp @@ -797,7 +797,8 @@ bool WrappedID3D12GraphicsCommandList::PatchAccStructBlasAddress( const D3D12_BUILD_RAYTRACING_ACCELERATION_STRUCTURE_DESC *accStructInput, ID3D12GraphicsCommandList4 *dxrCmd, BakedCmdListInfo::PatchRaytracing *patchRaytracing) { - if(accStructInput->Inputs.Type == D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL) + if(accStructInput->Inputs.Type == D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL && + accStructInput->Inputs.NumDescs > 0) { // Here, we are uploading the old BLAS addresses, and comparing the BLAS // addresses in the TLAS and patching it with the corresponding new address. @@ -981,7 +982,8 @@ bool WrappedID3D12GraphicsCommandList::Serialise_BuildRaytracingAccelerationStru { if(m_Cmd->InRerecordRange(m_Cmd->m_LastCmdListID)) { - if(AccStructDesc.Inputs.Type == D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL) + if(AccStructDesc.Inputs.Type == D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL && + AccStructDesc.Inputs.NumDescs > 0) { patchInfo.m_patched = false; PatchAccStructBlasAddress(&AccStructDesc, dxrCmd, &patchInfo); @@ -1005,7 +1007,8 @@ bool WrappedID3D12GraphicsCommandList::Serialise_BuildRaytracingAccelerationStru } else { - if(AccStructDesc.Inputs.Type == D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL) + if(AccStructDesc.Inputs.Type == D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL && + AccStructDesc.Inputs.NumDescs > 0) { uint64_t totalInstancesSize = (uint64_t)(AccStructDesc.Inputs.NumDescs * sizeof(D3D12_RAYTRACING_INSTANCE_DESC));