Startup crash when enabling bShareMaterialShaderCode for PSO bundling [5.4]

Hi!

I’m trying to bundle PSO caches following this guide:

After adding all required config entries from the guide and testing by commenting them out, I discovered that

bShareMaterialShaderCode=True

is the line that causes the project to crash after packaging and launching the project:

Fatal error: [File:D:\build\++UE5\Sync\Engine\Source\Runtime\RenderCore\Private\GlobalShader.cpp] [Line: 808] Could not load section 0 (of 409) of the global shadermap.

FGlobalShaderMap::LoadFromGlobalArchive()
TBaseRawMethodDelegateInstance<0,FShaderCompilingManager,void __cdecl(void),FDefaultDelegateUserPolicy>::TryGetBoundFunctionName()
CompileGlobalShaderMap()
FEngineLoop::PreInitPreStartupScreen()
GuardedMain()
GuardedMainWrapper()
LaunchWindowsStartup()
WinMain()
__scrt_common_main_seh() [D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
kernel32
ntdll

I’ve tried updating GPU drivers, deleting Intermediate and DerivedDataCache folders, but nothing helps. This crash prevents me from even completing the “Setup and Required Settings” step of the guide. Does anyone know how to fix this or what might be causing it?

EDIT1: what I’ve tried so far:

  • added both bShareMaterialShaderCode=True and bSharedMaterialNativeLibraries=True under in DefaultEngine.ini, DefaultEditor.ini, and DefaultGame.inito be sure that these lines are read
  • did a full clean recook and package
  • confirmed that .ushaderbytecode files are generated under Saved\Cooked\Windows\MyGame\Metadata\ShaderLibrarySource but the directory PipelineCaches is not created
  • verified no ShaderArchive-*.ushaderbytecode in Content/Paks
  • crash still occurs on startup with the same error despite my efforts

EDIT2: I followed all the steps from the guide on a completely new project (Third Person Template), but the PipelineCache directory still isn’t created, and launching the freshly cooked and packaged game results in a crash right at startup:

I’m running out of ideas - any hints appreciated!

OMG, I finally found what was causing the problem!
In DefaultEngine.ini, I was annotating what each config entry does, like this:

r.SkinCache.Mode=0 ; Fixes usage of Pre-Skinned shader material nodes

But for some reason, when I added any comment on the same line as this entry here:

[DevOptions.Shaders]  
NeedsShaderStableKeys=true ; <any comment here>  

it caused the PipelineCaches directory to not generate at all, which in turn made the project crash on startup.

Seriously, such a weird and frustrating cause for this issue. Removing the comment fixed everything immediately… Hope this helps someone else stuck on this!

1 Like