r.ShaderCompiler.JobCacheDDCEnableRemotePolicy
r.ShaderCompiler.JobCacheDDCEnableRemotePolicy
#Overview
name: r.ShaderCompiler.JobCacheDDCEnableRemotePolicy
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
If true, individual shader jobs will be cached to remote/shared DDC instances in all operation modes; if false they will only cache to DDC instances on the local machine.\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.ShaderCompiler.JobCacheDDCEnableRemotePolicy is to control the caching behavior of individual shader jobs in the Unreal Engine shader compilation system. Specifically, it determines whether shader jobs will be cached to remote/shared DDC (Derived Data Cache) instances or only to local DDC instances.
This setting variable is primarily used by the shader compilation subsystem within Unreal Engine. Based on the callsites, it’s part of the ShaderCompiler module in the Engine.
The value of this variable is set through a console variable (CVar) system. It’s defined as a TAutoConsoleVariable with a default value of false, meaning by default, shader jobs are only cached to local DDC instances.
The associated variable CVarJobCacheDDCPolicy directly interacts with r.ShaderCompiler.JobCacheDDCEnableRemotePolicy. They share the same value and purpose.
Developers must be aware that this variable is marked as ECVF_ReadOnly, which means its value can only be set at startup and cannot be changed during runtime. Also, this setting affects all operation modes of the engine.
Best practices when using this variable include:
- Consider enabling it in large team environments where sharing compiled shaders across machines can improve overall compilation times.
- Be cautious about network performance and storage requirements when enabling remote caching, especially for large projects.
- Understand the implications on build times and disk usage when enabling or disabling this option.
Regarding the associated variable CVarJobCacheDDCPolicy:
The purpose of CVarJobCacheDDCPolicy is identical to r.ShaderCompiler.JobCacheDDCEnableRemotePolicy. It’s the internal representation of the console variable within the C++ code.
This variable is used in the IsShaderJobCacheDDCRemotePolicyEnabled() function, which determines whether remote DDC caching is enabled for shader jobs. This function also considers another variable (CVarJobCacheDDCCookPolicy) when running in cook commandlet mode.
Developers should be aware that changing r.ShaderCompiler.JobCacheDDCEnableRemotePolicy will directly affect the behavior of CVarJobCacheDDCPolicy and, consequently, the IsShaderJobCacheDDCRemotePolicyEnabled() function.
Best practices for CVarJobCacheDDCPolicy align with those of r.ShaderCompiler.JobCacheDDCEnableRemotePolicy, as they are essentially the same setting.
#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:148
Scope: file
Source code excerpt:
static TAutoConsoleVariable<bool> CVarJobCacheDDCPolicy(
TEXT("r.ShaderCompiler.JobCacheDDCEnableRemotePolicy"),
false,
TEXT("If true, individual shader jobs will be cached to remote/shared DDC instances in all operation modes; if false they will only cache to DDC instances on the local machine.\n"),
ECVF_ReadOnly);
static TAutoConsoleVariable<bool> CVarJobCacheDDCCookPolicy(
TEXT("r.ShaderCompiler.JobCacheDDCCookEnableRemotePolicy"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarJobCacheDDCPolicy
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShaderCompiler/ShaderCompiler.cpp:147
Scope: file
Source code excerpt:
ECVF_ReadOnly);
static TAutoConsoleVariable<bool> CVarJobCacheDDCPolicy(
TEXT("r.ShaderCompiler.JobCacheDDCEnableRemotePolicy"),
false,
TEXT("If true, individual shader jobs will be cached to remote/shared DDC instances in all operation modes; if false they will only cache to DDC instances on the local machine.\n"),
ECVF_ReadOnly);
static TAutoConsoleVariable<bool> CVarJobCacheDDCCookPolicy(
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShaderCompiler/ShaderCompiler.cpp:235
Scope (from outer to inner):
file
function static bool IsShaderJobCacheDDCRemotePolicyEnabled
Source code excerpt:
static bool IsShaderJobCacheDDCRemotePolicyEnabled()
{
return CVarJobCacheDDCPolicy.GetValueOnAnyThread() || (IsRunningCookCommandlet() && CVarJobCacheDDCCookPolicy.GetValueOnAnyThread());
}
bool IsShaderJobCacheDDCEnabled()
{
#if WITH_EDITOR