[5.8.2] bShareMaterialShaderCode: "Missing shader resource for hash" - fatal on Android/Vulkan (global shadermap), all materials break on iOS/Metal. Worked in 5.7.4

Summary

With bShareMaterialShaderCode=True, shader maps written into the shared shader library cannot be resolved at runtime. On Android/Vulkan this hits section 0 of the global shadermap and the game terminates during startup. On iOS/macOS (Metal) the same error hits material shader maps and the whole 3D scene loses its materials. The cook reports no error or warning in either case. Setting bShareMaterialShaderCode=False is the only workaround we found. Both platforms worked correctly in UE 5.7.4.

Note on the Android symptom: in a Shipping build there is no diagnostic at all, because logging is compiled out. The only visible symptom is a clean System.exit(0) roughly 35 ms after the Vulkan RHI is initialised - no signal, no tombstone, no dialog. It looks like a silent crash but it is RequestExit. The error below is only visible in a Development build.

What Type of Bug are you experiencing?

Rendering (Graphics / Niagara)

Steps to Reproduce

  1. Take a project cooked and packaged on Windows for Android arm64, Vulkan, ASTC, IoStore,
    2 pak chunks, bPackageDataInsideApk=False.
  2. Set bShareMaterialShaderCode=True under [/Script/UnrealEd.ProjectPackagingSettings] in
    Config/Windows/WindowsGame.ini. Note: the cooker reads packaging settings from the editor
    CDO, i.e. from the HOST platform config - putting this in Config/Android/AndroidGame.ini
    has no effect at all.
  3. Cook and package for Android in the Development configuration.
  4. Install the APK, push the OBB to /sdcard/Android/obb//, launch on device.
  5. Read logcat (tag UE) or the game log from the external files directory.

Expected Result

The game starts, as it does with bShareMaterialShaderCode=False and as it did in UE 5.7.4 with
the setting enabled.

Observed Result

The engine aborts during startup, immediately after RHI initialisation:

LogInit: Running DelayedAutoRegister Phase ShaderTypesReady
LogShaders: Error: Missing shader resource for hash ‘1D784F4151C519AA’ for shader platform
‘VULKAN_ES3_1_ANDROID’ in the shader library while serializing asset None
LogAndroid: Error: === Critical error: ===
LogAndroid: Error: Fatal error: [File:./Runtime/RenderCore/Private/GlobalShader.cpp] [Line: 897]
LogAndroid: Error: Could not load section 0 (of 194) of the global shadermap.

The shader library itself opens correctly - there is no “Failed to load Shared Shader Library”.
A single resource inside the library is missing.

In a Shipping build of the same content the process just calls System.exit(0) about 35 ms after
the Vulkan RHI comes up, with no message of any kind.

Affects Versions

5.8

Platform(s)

Android
iOS

Upload an image

For crash reports, include your callstack

Fatal error: [File:./Runtime/RenderCore/Private/GlobalShader.cpp] [Line: 897]
Could not load section 0 (of 194) of the global shadermap.

[Callstack] 0x0000007AD03A6184 libUnreal.so(0x0000000004A4C184)Unknown
[Callstack] 0x0000007AD35007D0 libUnreal.so(0x0000000007BA67D0)Unknown
[Callstack] 0x0000007AD6358070 libUnreal.so(0x000000000A9FE070)Unknown
[Callstack] 0x0000007AD6349C4C libUnreal.so(0x000000000A9EFC4C)Unknown
[Callstack] 0x0000007AD63507C8 libUnreal.so(0x000000000A9F67C8)Unknown
[Callstack] 0x0000007AD636C148 libUnreal.so(0x000000000AA12148)Unknown
[Callstack] 0x0000007DFDCFF778 libc.so(0x00000000000C3778)Unknown
[Callstack] 0x0000007DFDC99048 libc.so(0x000000000005D048)Unknown

(Unsymbolised - binary Epic Launcher build, no engine PDBs. The file and line above are exact.)

Additional Notes

Device: Samsung Galaxy A52s 5G (SM-A528B), Adreno 642L, Android 14 (SDK 34), Vulkan,
shader platform SF_VULKAN_ES31_ANDROID, feature level ES3_1.
Engine: 5.8.2, binary build from the Epic Games Launcher. Regression from 5.7.4.
Project config: bBuildForES31=True, bSupportsVulkan=True, bUseIoStore=True,
bGenerateChunks=True, bCompressed=True, MinSDKVersion=26, TargetSDKVersion=36.

RULED OUT BY MEASUREMENT

  • The OBB is complete (unpacked and verified; all pak/ucas/utoc present).
  • Shader archives are present in the containers: 4 ShaderArchive entries in pakchunk0.utoc and
    2 in pakchunk1.utoc - an identical layout to the Windows build from the same cook run, which
    works correctly.
  • Vulkan initialises correctly on the device (the Adreno instance is created twice, no error).
  • The cook logs contain no “non-deterministic” record and no LogShaderLibrary warning.
  • Only one variable differs between a working build and a failing build: this setting.

THE METAL SIDE OF THE SAME BUG
On iOS and macOS the identical “LogShaders: Missing shader resource for hash …” appears, but
against material shader maps. Instead of exiting, the game renders the whole 3D scene in a single
flat sand/tan tone: terrain, rocks, foliage and characters lose their textures and their
per-material colour, a few meshes go dark grey, while lighting, shadows and all UI text still
render correctly (screenshot attached). About 28 materials are affected in our project.
There the cook additionally logs “Cache put found non-deterministic record for
MaterialShaderMap/…”. That line is ABSENT on Android, yet the runtime error is the same - so
non-deterministic Metal shader compilation does not explain the whole picture. The shared shader
library / IoStore shader archive path itself looks like the common factor.
Metal toolchain: macOS 26, Xcode 26, Apple Silicon.

RELATED EXISTING REPORTS (same error family, different scenarios, both unresolved)

What appears to be new here: a plain packaged build (no DLC, no cross-compilation), the failure
landing on section 0 of the GLOBAL shadermap on Android/Vulkan, and a cook that emits no warning.
Full engine log available on request.

1 Like

Desktop shader platforms from the same host cook are unaffected: Windows
(SF_D3D12_SM6 / SM5) and Linux (SF_VULKAN_SM5 / SM6) both packaged and ran
correctly with bShareMaterialShaderCode=True. The failure appears limited
to SF_VULKAN_ES31_ANDROID and the Metal platforms.

Cost of the workaround for us: Android OBB grows from 135.2 MB to 146.3 MB
(+8%). Disabling shared shader code is not a free workaround for
size-constrained mobile builds.

Quick way to verify the setting actually took effect for a given cook:
check for Saved/Cooked///Content/ShaderArchive-*.ushaderbytecode

  • present means shared shader code is on, absent means off. Worth stating
    because the setting silently does nothing when placed in the target
    platform’s config instead of the host’s.