Add fatal error checks to avoid crashes on load in AS init state apply

This commit is contained in:
baldurk
2025-02-21 13:43:00 +00:00
parent 8f0e9a2c48
commit e59c0494a5
@@ -2087,6 +2087,9 @@ void D3D12ResourceManager::Apply_InitialState(ID3D12DeviceChild *live, D3D12Init
RDCMAX(4 * 1024 * 1024ULL, prebuild.ScratchDataSizeInBytes));
}
if(m_Device->HasFatalError() || GetRTManager()->ASSerialiseBuffer == NULL)
return;
desc.ScratchAccelerationStructureData = GetRTManager()->ASSerialiseBuffer->Address();
}
@@ -2155,6 +2158,9 @@ void D3D12ResourceManager::Apply_InitialState(ID3D12DeviceChild *live, D3D12Init
D3D12GpuBufferHeapMemoryFlag::Default,
prebuild.ResultDataMaxSizeInBytes, 256, &data.cachedBuiltAS);
if(!data.cachedBuiltAS)
return;
ResourceId origId = GetOriginalID(as->GetResourceID());
UINT numPostBuilds = 0;