Unable to compile shader during packaging

Somehow when trying to package my project I get this error in the output log and the texture of my landscape just defaults to the default material.
When in editor the material looks just fine.
Does anybone have an idea what might cause this error?
Using UE5.1.1, DX12 and SM6.

[2023.08.24-11.07.16:784][629]UATHelper: Packaging (Windows): /Engine/Private/BasePassPixelShader.usf:2097:6: error: use of undeclared identifier ‘ManualDepthTestEqual’
[2023.08.24-11.07.16:784][629]UATHelper: Packaging (Windows): if (ManualDepthTestEqual(In.SvPosition, Out.Depth))
[2023.08.24-11.07.16:784][629]UATHelper: Packaging (Windows): ^
[2023.08.24-11.07.16:784][629]UATHelper: Packaging (Windows): D3DCompileToDxil failed. Error code: Niet nader omschreven fout (0x80004005).

2 Likes

Same problem here. For me this happened when I switched to Android Vulkan Mobile Preview settings as a recommendation from Meta XR Tools plugin. I’ve met this problem before however. This is caused because the maximum amount of Texture samples in one shader is exceeded. Here is a warning in console at initialization of project.
C:\Engine\Private\MobileBasePassPixelShader.usf.intermediate.hlsl(57,14-41): err0r X4510: maximum ps_5_0 sampler register index (16) exceeded
You can change the index at source from 16 to a 24 (as max recommendation from forums).
[error X4510: maximum ps_5_0 sampler register index (16) exceeded]
Here is reference to other topics:

Unity - maximum-ps_5_0-sampler-register-index

Hope this helps.