Missing PSO Precaches in the engine

Hi,

I wanted to report some more missing PSO Precaching we found in Epic code which we have fixed locally in case it helps others:

  • UCableComponent doesn’t implement CollectPSOPrecacheData or call CheckPSOPrecachingAndBoostPriority/PrecachePSOs
  • UNiagaraRibbonRendererProperties::IsBackfaceCullingDisabled() reports the wrong value if bUseMaterialBackfaceCulling=true instead of Material->IsTwoSided(), which results in caching the wrong PSO
  • FBasePassMeshProcessor::ShouldDraw should ignore the AutoBeforeDOFTranslucencyBoundary > 0 if Scene == nullptr (IE it’s the PSO precaching instance) so that those variants are cached also.
  • MD_LightFunction materials do not reliably precache and cause hitches, UMaterialInstance::PostLoad() does not check for MD_LightFunction like UMaterial::PostLoad does, which misses instances with static permutations and even with that caching, CreateSceneProxy() on the LightComponents don’t wait for precaching before creating the FLightSceneProxy which causes hitches depite EPSOPrecacheProxyCreationStrategy::DelayUntilPSOPrecached

These fixes were fairly trivial except for the ULightComponent ones since it’s not a UPrimitiveComponent so we had to implement custom logic for calling MarkRenderStateDirty when the precache completes.

Hopefully this is helpful!

Steps to Reproduce
Run with r.PSOPrecache.Validation=2

Hi Lucas,

Thanks for pointing out this missing PSO Precaching logic. I filed a ticket for the dev team to look at and patch up. Would it be possible for you to submit a Pull Request for the changes you made so that we can speed up the integration process?

Cheers,

Tim

Hi Tim,

Great! Thanks for taking a look. Sure, but it might take bit to prep one on my end though.

-Lucas

No worries. We have some folks who work on PSO precaching out of the office for a couple of days, so don’t feel rushed. We appreciate you taking this on though