Don't try to patch empty TLAS builds

This commit is contained in:
baldurk
2024-05-27 10:13:58 +01:00
parent c59f46e8dc
commit a5332bc764
@@ -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));