Fix patching of BLAS addresses in TLAS build during replay

This commit is contained in:
baldurk
2024-04-17 15:32:23 +01:00
parent 1bd2b3976e
commit 70b7b770e8
3 changed files with 10 additions and 6 deletions
@@ -847,8 +847,7 @@ bool WrappedID3D12GraphicsCommandList::PatchAccStructBlasAddress(
ID3D12Resource *addressPairRes = m_pDevice->GetBLASAddressBufferResource();
D3D12_GPU_VIRTUAL_ADDRESS addressPairResAddress = addressPairRes->GetGPUVirtualAddress();
// TODO: Update to gather the right count.
uint64_t addressCount = 0;
uint64_t addressCount = m_pDevice->GetBLASAddressCount();
dxrCmd->SetPipelineState(patchInfo.m_pipeline);
dxrCmd->SetComputeRootSignature(patchInfo.m_rootSignature);
@@ -930,7 +929,6 @@ bool WrappedID3D12GraphicsCommandList::Serialise_BuildRaytracingAccelerationStru
}
}
// AMD TODO: Find out do we need pre callback before build Acc struct call
dxrCmd->BuildRaytracingAccelerationStructure(&AccStructDesc, NumPostbuildInfoDescs,
pPostbuildInfoDescs);
}
+2
View File
@@ -3122,6 +3122,8 @@ void WrappedID3D12Device::UploadBLASBufferAddresses()
}
}
m_blasAddressCount = (uint32_t)blasAddressPair.size();
uint64_t requiredSize = blasAddressPair.size() * sizeof(BlasAddressPair);
D3D12_RESOURCE_DESC addressBufferResDesc;
+7 -3
View File
@@ -992,6 +992,12 @@ public:
// pending at once then they will be split up and issued in multiple calls.
static const UINT executeListsMaxSize = 50;
// GPU side pair-struct for remapping BLAS addresses just in time before builds
uint32_t m_blasAddressCount = 0;
ID3D12Resource *m_blasAddressBufferResource = NULL;
ID3D12Resource *m_blasAddressBufferUploadResource = NULL;
bool m_addressBufferUploaded = false;
ID3D12GraphicsCommandListX *GetNewList();
ID3D12GraphicsCommandListX *GetInitialStateList();
@@ -1260,9 +1266,7 @@ public:
void UploadBLASBufferAddresses();
ID3D12Resource *GetBLASAddressBufferResource() const { return m_blasAddressBufferResource; }
ID3D12Resource *m_blasAddressBufferResource = NULL;
ID3D12Resource *m_blasAddressBufferUploadResource = NULL;
bool m_addressBufferUploaded = false;
uint32_t GetBLASAddressCount() const { return m_blasAddressCount; }
void ReleaseResource(ID3D12DeviceChild *pResource);