From a26e599c02807cc413d045c911233ab6ccf881e6 Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 4 Dec 2024 18:02:25 +0000 Subject: [PATCH] Rebase addresses to current form in indirect ray dispatches --- .../driver/d3d12/d3d12_command_list_wrap.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp b/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp index c4d04ca1a..d370e035e 100644 --- a/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp +++ b/renderdoc/driver/d3d12/d3d12_command_list_wrap.cpp @@ -3878,6 +3878,23 @@ void WrappedID3D12GraphicsCommandList::FinaliseExecuteIndirectEvents(BakedCmdLis D3D12_DISPATCH_RAYS_DESC *args = (D3D12_DISPATCH_RAYS_DESC *)data; data += sizeof(D3D12_DISPATCH_RAYS_DESC); + for(D3D12_GPU_VIRTUAL_ADDRESS *addr : + {&args->RayGenerationShaderRecord.StartAddress, &args->MissShaderTable.StartAddress, + &args->HitGroupTable.StartAddress, &args->CallableShaderTable.StartAddress}) + { + if(*addr == 0) + continue; + + ResourceId id; + uint64_t offs = 0; + m_pDevice->GetResIDFromOrigAddr(*addr, id, offs); + + ID3D12Resource *res = GetResourceManager()->GetLiveAs(id); + RDCASSERT(res); + if(res) + *addr = res->GetGPUVirtualAddress() + offs; + } + curAction.dispatchDimension[0] = args->Width; curAction.dispatchDimension[1] = args->Height; curAction.dispatchDimension[2] = args->Depth;