From 53b21a10724c96377759d30c404a87a914b2c135 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 13 May 2024 14:15:33 +0100 Subject: [PATCH] Don't patch hitgroup/callable tables if not present * The runtime seems to complain about an invalid address if it's at the end of a buffer even if the size is 0 bytes --- renderdoc/driver/d3d12/d3d12_manager.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/renderdoc/driver/d3d12/d3d12_manager.cpp b/renderdoc/driver/d3d12/d3d12_manager.cpp index d6af00883..c805a7e7a 100644 --- a/renderdoc/driver/d3d12/d3d12_manager.cpp +++ b/renderdoc/driver/d3d12/d3d12_manager.cpp @@ -925,9 +925,9 @@ PatchedRayDispatch D3D12RaytracingResourceAndUtilHandler::PatchRayDispatch( unwrappedCmd->CopyBufferRegion(scratchBuffer->Resource(), scratchBuffer->Offset() + hitOffs, res, offs, desc.HitGroupTable.SizeInBytes); - } - ret.desc.HitGroupTable.StartAddress = scratchBuffer->Address() + hitOffs; + ret.desc.HitGroupTable.StartAddress = scratchBuffer->Address() + hitOffs; + } if(desc.CallableShaderTable.SizeInBytes > 0) { @@ -946,9 +946,9 @@ PatchedRayDispatch D3D12RaytracingResourceAndUtilHandler::PatchRayDispatch( unwrappedCmd->CopyBufferRegion(scratchBuffer->Resource(), scratchBuffer->Offset() + callOffs, res, offs, desc.CallableShaderTable.SizeInBytes); - } - ret.desc.CallableShaderTable.StartAddress = scratchBuffer->Address() + callOffs; + ret.desc.CallableShaderTable.StartAddress = scratchBuffer->Address() + callOffs; + } barrier.Transition.pResource = scratchBuffer->Resource(); barrier.Transition.StateBefore = D3D12_RESOURCE_STATE_COPY_DEST;