Hello everyone,
I’m looking for some additional information or direction regarding our PSO setup in Unreal Engine 5.6.1.
So far, we’ve:
- Completed multiple QA playthroughs to gather
.rec.upipelinecache assets.
- Merged these into an SM6
.spc asset (ensuring the latest cooked .shk assets were used during the merge).
- Set up a loading screen that tracks the number of shaders remaining. Once that step completes, we call:
FShaderPipelineCache::SavePipelineFileCache(FPipelineFileCacheManager::SaveMode::Incremental)
- On game exit,
FShaderPipelineCache::SavePipelineFileCache(FPipelineFileCacheManager::SaveMode::BoundPSOsOnly)
We’ve also enabled the recommended settings from the official docs in both DefaultGame.ini and DefaultEngine.ini.
Here are the relevant settings:
; Shared (Dev + Shipping)
r.PSOPrecaching=0
r.ShaderPipelineCache.Enabled=1
r.ShaderPipelineCache.GameFileMaskEnabled=1
r.ShaderPipelineCache.LazyLoadShadersWhenPSOCacheIsPresent=1
r.ShaderPipelineCache.AlwaysGenerateOSCache=0
r.ShaderPipelineCache.StartupMode=0
r.ShaderPipelineCache.SaveUserCache=1
r.ShaderPipelineCache.BatchSize=150
r.ShaderPipelineCache.PrecompileBatchSize=200
; ========================
; DEV ONLY
; ========================
r.PSOPrecache.Validation=2
r.PSOPrecache.Validation.TrackMinimalPSOs=1
r.ShaderPipelineCache.ExcludePrecachePSO=1
r.ShaderPipelineCache.ReportPSO=1
r.ShaderPipelineCache.LogPSO=1
r.ShaderPipelineCache.SaveBoundPSOLog=1
; ========================
; SHIPPING ONLY
; ========================
r.PSOPrecache.Validation=1
r.ShaderPipelineCache.ExcludePrecachePSO=0
The issue we’re seeing:
- A certain number of shaders are always compiled on game launch, no matter how many times the game is restarted.
- On Steam builds, caching appears to happen very slowly, whereas on EOS builds the caching completes almost instantly. Both builds use the same
.spc asset.
- If we flip
r.ShaderPipelineCache.ExcludePrecachePSO=1 on Steam builds, the progress bar advances much faster — but the loading screen still flashes briefly. Ideally, the user shouldn’t see this screen if everything has already been cached.
Question:
Is there anything missing from our setup that could explain this behavior, or any known issues with Steam vs EOS in this context?
Thanks in advance,
Chris
Steps to Reproduce
Steps to Reproduce the Issue
- Collect PSO data
- Run QA playthroughs with
r.ShaderPipelineCache.ReportPSO=1 and r.ShaderPipelineCache.LogPSO=1 enabled.
- Gather
.rec.upipelinecache files.
- Merge PSO data
- Merge
.rec.upipelinecache files into a single SM6 .spc file using the latest cooked .shk assets.
- Set up runtime saving
- At the end of the shader precompile screen, call:
FShaderPipelineCache::SavePipelineFileCache(FPipelineFileCacheManager::SaveMode::Incremental)
- On exit, call:
FShaderPipelineCache::SavePipelineFileCache(FPipelineFileCacheManager::SaveMode::BoundPSOsOnly)
- Build and run the game
- Launch the game multiple times (tested on Steam and EOS builds).
-
Observe shader precompile behavior:
- **Steam**: Shader screen shows a number of shaders compiling slowly, every launch.+ **EOS**: Shader screen resolves almost instantly, using the same `.spc` asset.
- Toggle setting for comparison
- Set
r.ShaderPipelineCache.ExcludePrecachePSO=1 in Steam build.
- Shader screen progresses quickly, but still flashes briefly (instead of being skipped entirely).
Hi there,
I am trying to understand what your exact setup is for PSO compilation, so I have a few follow-ups:
- Which recommended settings are you referring to
- Why do you have PSO precaching disabled in your builds? We recommend that people use that system first and foremost, with bundled PSOs to cover any gaps.
- On which hardware have you confirmed that this slow compilation is occurring? Does this happen across different vendors or any particular IHV?
Please let me know if you have any further questions.
Hi,
- (1) We are following the recommended PSO documentation settings for the ini, spc and shader loading screen setup.
- (2) That was an oversight on my part — I forgot to mention that we were seeing a hitch during the intro video caused by PSO precaching. To address this, we now enable it once the intro video has finished loading using:
IConsoleVariable* CVarStartupMode = IConsoleManager::Get().FindConsoleVariable(TEXT("r.ShaderPipelineCache.StartupMode"));
if (CVarStartupMode)
{
CVarStartupMode->Set(1);
}
IConsoleVariable* CVarPSOPrecache = IConsoleManager::Get().FindConsoleVariable(TEXT("r.PSOPrecaching"));
if (CVarPSOPrecache)
{
CVarPSOPrecache->Set(1);
}
FShaderPipelineCache::ResumeBatching();
FShaderPipelineCache::SetBatchMode(FShaderPipelineCache::BatchMode::Fast);
- (3) We’ve tested this across a range of hardware (NVIDIA, AMD, and Steam Deck) and are still experiencing the same slow compilation behavior.
Thanks in advance,
Chris
Hi Chris,
I appreciate the extra clarification, but based on this, I could not tell you why you would be seeing slower PSO loading/compilation times on EOS/EGS builds versus Steam. Would it be possible for you to send over some Unreal Insights captures from a build that you grabbed from EGS and Steam? I would need to have the default, contextswitch, and task trace channels in these traces (-trace=default,task,contextswitch). Do note that you will need to run the game in administrator mode to be able to record the context switches.