r.ShaderCompiler.DebugValidateJobCache
r.ShaderCompiler.DebugValidateJobCache
#Overview
name: r.ShaderCompiler.DebugValidateJobCache
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Enables debug mode for job cache which will fully execute all jobs and validate that job outputs with matching input hashes match.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.ShaderCompiler.DebugValidateJobCache is to enable a debug mode for the shader compiler’s job cache. This setting is primarily used in the rendering system, specifically for shader compilation and validation.
This setting variable is utilized by the Unreal Engine’s shader compilation subsystem, which is part of the rendering module. It’s primarily referenced in the ShaderCompiler.cpp file, indicating its close association with shader compilation processes.
The value of this variable is set through a console variable (CVar) system. It’s defined as a boolean value, defaulting to false, and can be changed at runtime through console commands or configuration files.
The associated variable CVarShaderCompilerDebugValidateJobCache directly interacts with r.ShaderCompiler.DebugValidateJobCache. They share the same value and purpose.
Developers must be aware that enabling this variable will have a performance impact. When activated, it fully executes all shader compilation jobs and validates that job outputs with matching input hashes match. This is a debugging feature and should not be enabled in production builds.
Best practices when using this variable include:
- Only enable it when debugging shader compilation issues.
- Be prepared for increased compilation times when this is enabled.
- Use it in conjunction with other shader debugging tools for comprehensive analysis.
- Disable it in production builds to avoid unnecessary performance overhead.
Regarding the associated variable CVarShaderCompilerDebugValidateJobCache:
The purpose of CVarShaderCompilerDebugValidateJobCache is identical to r.ShaderCompiler.DebugValidateJobCache. It’s the actual console variable that controls the debug validation feature for the shader compiler’s job cache.
This variable is used within the ShaderCompiler namespace, specifically in the IsJobCacheDebugValidateEnabled() function. This function checks if both the job cache is enabled and if this debug validation flag is set.
The value of CVarShaderCompilerDebugValidateJobCache is set when the console variable is defined, defaulting to false. It can be changed at runtime using console commands.
Developers should be aware that this variable is thread-safe, as evidenced by the use of GetValueOnAnyThread() when accessing its value.
Best practices for CVarShaderCompilerDebugValidateJobCache align with those of r.ShaderCompiler.DebugValidateJobCache, as they are essentially the same setting represented in different ways within the engine’s codebase.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShaderCompiler/ShaderCompiler.cpp:104
Scope: file
Source code excerpt:
static TAutoConsoleVariable<bool> CVarShaderCompilerDebugValidateJobCache(
TEXT("r.ShaderCompiler.DebugValidateJobCache"),
false,
TEXT("Enables debug mode for job cache which will fully execute all jobs and validate that job outputs with matching input hashes match."),
ECVF_Default
);
int32 GShaderCompilerMaxJobCacheMemoryMB = 16LL * 1024LL;
#Associated Variable and Callsites
This variable is associated with another variable named CVarShaderCompilerDebugValidateJobCache
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShaderCompiler/ShaderCompiler.cpp:103
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<bool> CVarShaderCompilerDebugValidateJobCache(
TEXT("r.ShaderCompiler.DebugValidateJobCache"),
false,
TEXT("Enables debug mode for job cache which will fully execute all jobs and validate that job outputs with matching input hashes match."),
ECVF_Default
);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShaderCompiler/ShaderCompiler.cpp:1263
Scope (from outer to inner):
file
namespace ShaderCompiler
function bool IsJobCacheDebugValidateEnabled
Source code excerpt:
bool IsJobCacheDebugValidateEnabled()
{
return IsJobCacheEnabled() && CVarShaderCompilerDebugValidateJobCache.GetValueOnAnyThread();
}
bool IsRemoteCompilingAllowed()
{
// commandline switches override the CVars
static bool bDisabledFromCommandline = FParse::Param(FCommandLine::Get(), TEXT("NoRemoteShaderCompile"));