Download

Tech Note: WinGDK PSO cache fix

Oct 27, 2021.Knowledge

Description: Games shipping on D3D12 generally need to include a PSO cache to ensure smooth framerate from the very beginning. However, due to an omission in the engine code, precompilation of the PSOs from the cache was enabled only for Windows platform, but not for WinGDK.

Potential Impact: Critical: The game may hitch (experience stutter) when running on WinGDK platform, especially for the first time. This issue can potentially affect 4.25Plus, 4.26, 4.27 and 4.27.1.

Solution: This solution assumes that the cache was already collected according to documentation about collecting and shipping a PSO cache, and the only problem is lack of parity between Windows and WinGDK platforms.

For 4.27, a fix was added in CL 17925294 will be included in hotfix 4.27.2.

In 4.25Plus and 4.26, to fix this issue, please modify the code in WinGDKDynamicRHI.cpp from line 20 onwards, i.e. right before the creation of the D3D12 RHI (new code surrounded by #if !WITH_EDITOR):

else { #if !WITH_EDITOR // Enable -psocache by default on DX12. Since RHI is selected at runtime we can’t set this at compile time with PIPELINE_CACHE_DEFAULT_ENABLED. auto PSOFileCacheEnabledCVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT(“r.ShaderPipelineCache.Enabled”)); *PSOFileCacheEnabledCVar = 1; auto PSOFileCacheReportCVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT(“r.ShaderPipelineCache.ReportPSO”)); *PSOFileCacheReportCVar = 1; auto PSOFileCacheUserCacheCVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT(“r.ShaderPipelineCache.SaveUserCache”)); *PSOFileCacheUserCacheCVar = UE_BUILD_SHIPPING; #endif DynamicRHI = DynamicRHIModule->CreateRHI();}