Bug in NiagaraRendererMeshes

Hi,

I believe we have found a bug in the Niagara code that you should be aware of. In the function NiagaraRendererMeshes::GetDynamicRayTracingInstances sometimes mesh instances are added when their geometry is not streamed in yet or is invalid. This causes a check() to fail in FD3D12RayTracingGeometry::GetAccelerationStructureAddress D3D12RayTracing.h (because AccelerationStructureBuffers[GPUIndex] is null).

The following changes to the code, adding a check on RayTracingGeometry->IsValid(), in NiagaraRendererMeshes::GetDynamicRayTracingInstance seem to fix the issue.

//ENGINE MODIFICATION - START //if (LODModel.LODIndex == INDEX_NONE || LODModel.RayTracingGeometry == nullptr) //Need to check if the RayTracingGeometry is valid or instances of it can be sometimes added when the geometry's data has not been streamed in yet if (LODModel.LODIndex == INDEX_NONE || LODModel.RayTracingGeometry == nullptr || LODModel.RayTracingGeometry->IsValid() == false) //ENGINE MODIFICATION - END { continue; }Is this change the correct way to fix this issue ?

I have checked the perforce database and could not find any change that would fix this issue but I might have missed it if it was fixed in another way.

Thanks

Lucian

Steps to Reproduce
Use NiagaraRendererMeshes on a system with a slow HDD

Thanks for the report, I believe this is already fixed by CL 39939601 where the LOD selection inside GetRayTraceLODModelData should do all of the relevant checks for validity.

if (RayTracingGeometry.IsValid() && !RayTracingGeometry.IsEvicted() && !RayTracingGeometry.HasPendingBuildRequest())Please let me know if that’s not the case,

Thanks,

Stu

The changes in CL 39939601 appear to fix the issue we were seeing. I have replaced my hack with these changes instead.

Thanks,

Lucian