r.ShaderCompiler.DumpDDCKeys

r.ShaderCompiler.DumpDDCKeys

#Overview

name: r.ShaderCompiler.DumpDDCKeys

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.ShaderCompiler.DumpDDCKeys is to control whether Derived Data Cache (DDC) keys for each shader map should be dumped into the project’s Saved directory, specifically in the ShaderDDCKeys subdirectory.

This setting variable is primarily used by the shader compilation system within Unreal Engine. It’s part of the rendering subsystem, specifically the shader compiler module.

The value of this variable is set through a console variable (CVar) named CVarShaderCompilerDumpDDCKeys. It’s initialized as a boolean value, defaulting to false.

The associated variable CVarShaderCompilerDumpDDCKeys directly interacts with r.ShaderCompiler.DumpDDCKeys. They share the same value and purpose.

Developers must be aware that enabling this variable will cause additional file I/O operations, as it will write DDC keys to disk. This could potentially impact performance, especially in scenarios with frequent shader compilation.

Best practices when using this variable include:

  1. Only enable it when debugging shader compilation issues or when you need to inspect DDC keys.
  2. Remember to disable it in production builds to avoid unnecessary disk writes.
  3. Be cautious when enabling it in performance-critical scenarios.

Regarding the associated variable CVarShaderCompilerDumpDDCKeys:

#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:298

Scope: file

Source code excerpt:


static TAutoConsoleVariable<bool> CVarShaderCompilerDumpDDCKeys(
	TEXT("r.ShaderCompiler.DumpDDCKeys"),
	false,
	TEXT("if != 0, DDC keys for each shadermap will be dumped into project's Saved directory (ShaderDDCKeys subdirectory)"),
	ECVF_Default
);

int32 GShaderCompilerDebugDiscardCacheOutputs = 0;

#Associated Variable and Callsites

This variable is associated with another variable named CVarShaderCompilerDumpDDCKeys. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShaderCompiler/ShaderCompiler.cpp:297

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<bool> CVarShaderCompilerDumpDDCKeys(
	TEXT("r.ShaderCompiler.DumpDDCKeys"),
	false,
	TEXT("if != 0, DDC keys for each shadermap will be dumped into project's Saved directory (ShaderDDCKeys subdirectory)"),
	ECVF_Default
);

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShaderCompiler/ShaderCompiler.cpp:1225

Scope (from outer to inner):

file
function     bool ShouldDumpShaderDDCKeys

Source code excerpt:

bool ShouldDumpShaderDDCKeys()
{
	return CVarShaderCompilerDumpDDCKeys.GetValueOnAnyThread();
}

void DumpShaderDDCKeyToFile(const EShaderPlatform InPlatform, bool bWithEditor, const FString& FileName, const FString& DDCKey)
{
	// deprecated version
	const FString SubDirectory = bWithEditor ? TEXT("Editor") : TEXT("Game");