# Results
- In my small tests this resulted in compiling 8.9x less shaders (1558 vs. 174)
- Spent 107 seconds less compiling.
# Changes
- Adds CacheGivenTypesForCooking to UMaterialInterface and implemented for UMaterial and UMaterialInstance. This is responsible for compiling just the given types of shaders which is fully qualified by VF Type, Shader Type (or Shader Pipeline Type).
- Fully qualify each shader compile request from the client by FeatureLevel and QualityLevel. This way we don't compile multiple quality levels that aren't actively rendered with.
- CacheGivenTypesForCooking for UMaterial and UMaterialInterface explicity tries to re-use and find existing resources so we can progressively build up the shadermap while running.
- FMaterial::CacheGivenTypes now can compile shader pipelines.
- Adds CompileODSCMaterialsForRemoteRecompile which compiles just the requested shaders. This was because I wanted to leave the functionality in CompileMaterialsForRemoteRecompile alone.
- FShaderRecompileData now has a serialize function so the Load/Save serialize code can be the same on host and client.
- Made CompileMaterialsForRemoteRecompile compiled only for the Editor.
- Don't assert on needing complete shader maps when using ODSC.
- Mass conversion from NULL to nullptr in ShaderCompiler.cpp
- Refactoring some common code from RecompileShadersForRemote into separate functions.
#rb Ben.Ingram
#jira UE-136438
#preflight 6261bb9afe26b98ad8479633
[CL 19863961 by Jason Nadro in ue5-main branch]
- Prevent CacheGivenTypes from being called if material compilation fails when generating platform stats.
#rb Sebastien.Hillaire
#preflight none
[CL 19528276 by Jason Nadro in ue5-main branch]
# Results
Modfiying WorldGridMaterial with two platforms open in platform stats.
- We compile a fixed number of shaders (less than 10 per platform) now instead of the 1078 shaders (per platform) w/ WorldGridMaterial.
- On average ProcessCompiledShaderMaps is 40x faster. (1727ms vs. 43ms)
- In the worst cast ProcessCompiledShaderMaps is 10.9x faster. (4865ms vs 445ms)
- The material editor in this scenario goes from unusable to useable.
# Changes
- Add `FMaterial::CacheGivenTypes` to compile just the shader types given to it.
- Call `GetRepresentativeShaderTypesAndDescriptions` to gather the shader types we care about and only submit jobs to compile those shaders when generating platform stats.
- Since we are no longer compile a complete shader map the ShaderCount is incorrect. Now we call `GetShaderTypes` of the `FMaterialResource` to gather the number of shaders in the material. This function doesn't trigger shader compilation which is important.
- Adding const to the following functions:
- FMaterial::GetShaderTypesForLayout
- FMaterial::GetShaderTypes
- FMaterial::GetShaderTypes is now ENGINE_API so we can call it from the Material Editor.
- Add `TBasePassPSFCachedVolumeIndirectLightingPolicy` shader type to FMaterialStatsUtils::GetRepresentativeShaderTypesAndDescriptions. This shader has the worst case sampler count. This ensures we compile this shader and are able to query the worst case sampler count for the platform stats. This is very ad-hoc, and could be improved in the future.
#rb Ben.Ingram
#jira UE-138623
#preflight 623b4e4cc3399da9533282cc
[CL 19481265 by Jason Nadro in ue5-main branch]
#rb none
#preflight none
#ROBOMERGE-AUTHOR: ben.ingram
#ROBOMERGE-SOURCE: CL 19458597 via CL 19460034 via CL 19463251 via CL 19475219 via CL 19475280
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v935-19464907)
[CL 19475939 by ben ingram in ue5-main branch]
We can't share DDPI infrastructure with PC D3D ES3.1 because of conflicts from sharing. We need a separate shader platform.
For now, we'll just 'intrusively' plumb the new Hololens shader platform. In the future, we want to move as much code out into
Hololens-specific platform code to reduce conflict with shared paths that don't need to know about Hololens.
#rb steve.smith, christopher.waters
#jira UE-133375
#preflight 61f9ca302251c6fb596e583e
#ROBOMERGE-AUTHOR: robert.srinivasiah
#ROBOMERGE-SOURCE: CL 18818524 in //UE5/Release-5.0/... via CL 18818546 via CL 18822881
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v910-18824042)
[CL 18824735 by robert srinivasiah in ue5-main branch]
This represents UE4/Main @18073326, Release-5.0 @18081140 and Dev-PerfTest @18045971
[CL 18081471 by aurel cordonnier in ue5-release-engine-test branch]
[FYI] Ben.Ingram
#jira UE-132661
Original CL Desc
-----------------------------------------------------------------
Generate cached data for MID created at runtime in non-editor builds
Make sure material instance resources are updated from cached data loaded in non-editor builds
#jira UE-131802
#rb none
#ROBOMERGE-OWNER: aurel.cordonnier
#ROBOMERGE-AUTHOR: kevin.ortegren
#ROBOMERGE-COMMAND: _robomerge UE5-Release-Engine-Test
#ROBOMERGE-SOURCE: CL 17921250 in //UE5/Release-5.0/... via CL 17922774
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v885-17909292)
[CL 17930569 by kevin ortegren in ue5-release-engine-test branch]
This represents UE4/Main @17911760, Release-5.0 @17915875 and Dev-PerfTest @17914035
[CL 17918595 by aurel cordonnier in ue5-release-engine-test branch]
- Count SM finalization time into the time budget to prevent super long ticks.
- Make material stats panel update no more frequently than once in 5 seconds.
#rb Ben.Ingram
[at]Ben.Ingram
#jira none
#ROBOMERGE-SOURCE: CL 16333791 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v804-16311228)
[CL 16333803 by arciel rekman in ue5-release-engine-test branch]
Handle null vertex factory in stats collection.
#rb jason.nadro
#lockdown kevin.ortegren
#ROBOMERGE-SOURCE: CL 15942493 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v787-15839533)
[CL 15944995 by jeremy moore in ue5-main branch]
- Same issue as FORT-334737: platform extension may be present, but haven't been properly initialized.
(Edigrating CL 14858266).
#rb Josh.Adams (in previous branch)
#jira UE-104965
#fyi Kevin.Ortegren
[CL 14991301 by Arciel Rekman in ue5-main branch]
#rb josh.adams
#jira none
#lockdown marcus.wassmer
#ROBOMERGE-SOURCE: CL 12653863 in //UE4/Release-4.25Plus/... via CL 12653865
#ROBOMERGE-BOT: RELEASE (Release-Engine-Staging -> Main) (v675-12543919)
[CL 12653868 by david harvey in Main branch]