r.ShaderCompiler.DumpDebugInfoForCacheHits
r.ShaderCompiler.DumpDebugInfoForCacheHits
#Overview
name: r.ShaderCompiler.DumpDebugInfoForCacheHits
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
If true, debug info (via IShaderFormat::OutputDebugData) will be output for all jobs including duplicates and cache/DDC hits. If false, only jobs that actually executed compilation will dump debug info.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.ShaderCompiler.DumpDebugInfoForCacheHits is to control the output of debug information for shader compilation jobs in Unreal Engine 5’s rendering system.
This setting variable is primarily used by the shader compiler subsystem within Unreal Engine’s rendering module. It affects the behavior of shader compilation and debugging processes.
The value of this variable is set through a console variable (CVar) system. It is initialized with a default value of true in the ShaderCore.cpp file.
The associated variable CVarDumpDebugInfoForCacheHits directly interacts with r.ShaderCompiler.DumpDebugInfoForCacheHits. They share the same value and purpose.
Developers must be aware that:
- When set to true, debug information will be output for all shader compilation jobs, including duplicates and cache/DDC (Derived Data Cache) hits.
- When set to false, debug information will only be output for jobs that actually executed compilation.
Best practices when using this variable:
- Enable it (set to true) during shader development and debugging phases to get comprehensive information about all shader jobs.
- Disable it (set to false) in production or when performance is a priority, as it will reduce the amount of debug output and potentially improve compilation speed.
- Use in conjunction with other shader debugging tools and console variables for a complete debugging experience.
Regarding the associated variable CVarDumpDebugInfoForCacheHits:
The purpose of CVarDumpDebugInfoForCacheHits is identical to r.ShaderCompiler.DumpDebugInfoForCacheHits. It’s an internal representation of the console variable within the engine’s C++ code.
This variable is used directly in the shader compilation process, specifically in the FShaderCompileJob::OnComplete() function. It determines whether to output debug data for shader jobs that were retrieved from cache or didn’t require actual compilation.
Developers should be aware that modifying CVarDumpDebugInfoForCacheHits directly in code will have the same effect as changing r.ShaderCompiler.DumpDebugInfoForCacheHits through the console or configuration files.
Best practices for CVarDumpDebugInfoForCacheHits align with those of r.ShaderCompiler.DumpDebugInfoForCacheHits, as they are essentially the same variable represented in different contexts.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/ShaderCore.cpp:56
Scope: file
Source code excerpt:
static TAutoConsoleVariable<bool> CVarDumpDebugInfoForCacheHits(
TEXT("r.ShaderCompiler.DumpDebugInfoForCacheHits"),
true,
TEXT("If true, debug info (via IShaderFormat::OutputDebugData) will be output for all jobs including duplicates and cache/DDC hits. If false, only jobs that actually executed compilation will dump debug info."),
ECVF_Default);
void UpdateShaderDevelopmentMode()
{
#Associated Variable and Callsites
This variable is associated with another variable named CVarDumpDebugInfoForCacheHits
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/ShaderCore.cpp:55
Scope: file
Source code excerpt:
ECVF_Default);
static TAutoConsoleVariable<bool> CVarDumpDebugInfoForCacheHits(
TEXT("r.ShaderCompiler.DumpDebugInfoForCacheHits"),
true,
TEXT("If true, debug info (via IShaderFormat::OutputDebugData) will be output for all jobs including duplicates and cache/DDC hits. If false, only jobs that actually executed compilation will dump debug info."),
ECVF_Default);
void UpdateShaderDevelopmentMode()
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/ShaderCore.cpp:3828
Scope (from outer to inner):
file
function void FShaderCompileJob::OnComplete
Source code excerpt:
// if we only want debug info for jobs which actually compiled, check the CompileTime
// (jobs deserialized from the cache/wait list/ddc will have a compiletime of 0.0)
&& (CVarDumpDebugInfoForCacheHits.GetValueOnAnyThread() || Output.CompileTime > 0.0f))
{
if (SecondaryPreprocessOutput.IsValid() && SecondaryOutput.IsValid())
{
ShaderFormat->OutputDebugData(Input, PreprocessOutput, *SecondaryPreprocessOutput, Output, *SecondaryOutput);
}
else