How to debug global shaders in 5.2?

It looks like global shaders are not as easy to debug as they were in 5.1. With the same debug flags as I used in 5.1, the shader source now appears as assembly instead of proper unoptimized source code that is easily debuggable. I also noticed that they have a different file name with a .usf.intermediate.hlsl file extension. How can I make them debuggable like before?

Renderdoc shows the following compiler flags used:
/Zi /Od /Zpr /Gec /O1 /T ps_5_0

The engine flags I use are:
r.Shaders.GenerateSymbols=1
r.ShaderDevelopmentMode=1
r.Shaders.Optimize=0
r.Shaders.Symbols=1
r.Shaders.ExtraData=1

1 Like

[

hi @norsfell_max
In the 5.2 documentation is the section

UPDATE @norsfell_max
you need to ADD


<BuildConfiguration>
bDisableDebugInfoForGeneratedCode>false</bDisableDebugInfoForGeneratedCode>
<BuildConfiguration>

to Located at: UnrealEngine\Engine\Saved\UnrealBuildTool\BuildConfiguration.xml
see
Build Configuration for Unreal Engine | Unreal Engine 5.2 Documentation

Example: Debugging Shaders Locally

In this case, the user should edit the [Platform]Engine.ini locally and add the following:

[ShaderCompiler]
r.Shaders.WriteSymbols=1

Shader Debugging Workflows Unreal Engine | Unreal Engine 5.2 Documentation

Unreal Engine 5.2 Release Notes | Unreal Engine 5.2 Documentation
Control +F Search “Materials and Shaders”

Build machines will now output shader debug info for failed shaders as a build artifact.
Due to size limits, this output is limited to ten items. The number of debug info outputs is tracked and incremented when we dump a debug info (which happens on a worker thread), and is read on the main thread so the value is atomic.
Removed old code for dumping the debug info to the log.

Also 5.2 onward defaults templates to shader model 6 NOT 5 like in 5.1.

I have had immense trouble with Shader 6 (so much has changed) default in templates and Shaders 5 in GPU Lightmass converting from 5.1 and my version is at 5.3 now as 5.2 wont work (no shadows)