During our ‘Hitch Hunt’ for our latest game released on 5.5.4 in September, we found PSO hitches related to Landscapes.
I looked at the 5.7 code, and it seems to still be there.
Here are the things I corrected to fix the issue :
1. Add missing code to skip 'Scene Proxy Creation’ when PSO are still pending :
Our game relies on delayed proxy creation when PSOs are not ready, the various landscape components are abiding by this setting, unlike other components, so we added the code needed.
FPrimitiveSceneProxy* ULandscapeMeshProxyComponent::CreateSceneProxy()
{
if (GetStaticMesh() == nullptr
|| GetStaticMesh()->IsCompiling()
|| GetStaticMesh()->GetRenderData() == nullptr
|| GetStaticMesh()->GetRenderData()->LODResources.Num() == 0
|| GetStaticMesh()->GetRenderData()->LODResources[0].VertexBuffers.StaticMeshVertexBuffer.GetNumVertices() == 0)
{
return nullptr;
}
if ((LODGroupKey != 0) && (ComponentResolution == 0))
{
// this is an OLD HLOD not built with the new resolution/x/y/center information, which we need if LODGroups are used.
UE_LOG(LogLandscape, Warning, TEXT("HLOD for Landscape needs to be rebuilt! Landscape Mesh Proxy Component '%s' is using LODGroups but does not have the position and orientation information necessary to register it with the Landscape renderer. This HLOD will not render until it is fixed."),
*GetName());
return nullptr;
}
// -BEGIN- Fix Landscape 'Too late' PSOs
if (CheckPSOPrecachingAndBoostPriority(EPSOPrecachePriority::Highest) && GetPSOPrecacheProxyCreationStrategy() == EPSOPrecacheProxyCreationStrategy::DelayUntilPSOPrecached)
{
UE_LOG(LogLandscape, Verbose, TEXT("Skipping CreateSceneProxy for ULandscapeMeshProxyComponent %s (Its PSOs are still compiling)"), *GetFullName());
return nullptr;
}
// -END- Fix Landscape 'Too late' PSOs
return new FLandscapeMeshProxySceneProxy(this, LandscapeGuid, ProxyComponentBases, ProxyComponentCentersObjectSpace, ComponentXVectorObjectSpace, ComponentYVectorObjectSpace, GetComponentTransform(), ComponentResolution, ProxyLOD, LODGroupKey, ALandscapeProxy::ComputeLandscapeKey(GetWorld(), LODGroupKey, LandscapeGuid));
}
// Same logic in 'ULandscapeNaniteComponent::CreateSceneProxy()' and 'ULandscapeComponent::CreateSceneProxy()'
2. Moved precaching code from ‘PostLoad’ to expected ‘CollectPSOPrecacheData’
The ‘ULandscapeComponent’ is not following the expected ‘CollectPSOPrecacheData’ interface. Our fix was to move all of the PSO Precaching code present in ‘*ULandscapeComponent::*PostLoad()’ in a new ‘ULandscapeComponent::CollectPSOPrecacheData’ and added a call to ‘PrecachePSOs()’ at the end of ‘*ULandscapeComponent::*PostLoad()’.
[Attachment Removed]