Files
UnrealEngineUWP/Engine/Source/Developer/FunctionalTesting/Private/AutomationBlueprintFunctionLibrary.cpp
Jason Nadro 135472bdb0 Adding functionality to compile remaining shaders for materials.
When running with ODSC in the editor Materials can have incomplete or partial shader maps.  In other words some shaders _might_ be missing.  If a render system requires all shaders to be present and can't use ODSC functionality to compile the necessary shaders we need a mechanism for compiling just the missing shaders.

- Added UMaterialInterface::CacheShaders() which is implemented for UMatetrial and UMaterialInstance.  The call is just forwarded along to CacheResourceShadersForRendering and InitStaticPermutation respectively.
- You can call CacheResourceShadersForRendering multiple times (even with a completed shader map) and it will not recache uniform expressions.  If the Resource's shader map is complete the function is a no-op.
- FObjectCacheContext can accept a UWorld and will only return primitives that are in that world.
- Added a function SubmitRemainingJobsForWorld(UWorld* World, EMaterialShaderPrecompileMode CompileMode) that will iterate all materials used by primitives in the world and compile the missing shaders.
- SubmitRemainingJobsForWorld() is used in various scenarios in the editor to ensure _all_ shaders are compiled for all materials before proceeding.
- Explicitly try to compile UI and PP materials.  Since we don't know which ones are used in the given world we just have to iterate all loaded ones.  This is a potential area of optimization.
- If there are already complete shader maps (if you are not running with the shader job cache), SubmitRemainingJobsForWorld is fast and results in a no-op for each material.

#rb Arciel.Rekman, Danny.Couture
#jira UE-136442, UE-136447
#preflight 61fc0e9c176256ec4f764206

[CL 18848560 by Jason Nadro in ue5-main branch]
2022-02-03 15:12:58 -05:00

46 KiB