r.RDG.ClobberResources
r.RDG.ClobberResources
#Overview
name: r.RDG.ClobberResources
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Clears all render targets and texture / buffer UAVs with the requested clear color at allocation time. Useful for debugging.\n 0:off (default);\n 1: 1000 on RGBA channels;\n 2: NaN on RGBA channels;\n 3: +INFINITY on RGBA channels.\n
It is referenced in 7
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.RDG.ClobberResources is to assist in debugging render target and texture/buffer UAV issues within the Render Dependency Graph (RDG) system of Unreal Engine 5. It clears all render targets and texture/buffer UAVs with a specified clear color at allocation time.
This setting variable is primarily used by the Render Dependency Graph (RDG) system, which is part of Unreal Engine’s rendering pipeline. It’s specifically utilized in the RenderCore module, as evidenced by the file locations in the provided code excerpts.
The value of this variable is set through the console variable system (CVarRDGClobberResources) and can also be set via command-line parameter. It has four possible values: 0: Off (default) 1: Clear with 1000 on RGBA channels 2: Clear with NaN on RGBA channels 3: Clear with +INFINITY on RGBA channels
The associated variable GRDGClobberResources directly interacts with r.RDG.ClobberResources, sharing the same value. This internal variable is used throughout the RDG system to control the clobbering behavior.
Developers should be aware that:
- This variable is intended for debugging purposes only and should not be enabled in production builds.
- Enabling this feature may impact performance due to the additional clearing operations.
- The clobbering only occurs when RDG validation is enabled and clobbering is allowed for auxiliary passes.
Best practices for using this variable include:
- Use it only when debugging render target or UAV-related issues.
- Be mindful of the performance impact when enabled.
- Remember to disable it after debugging to restore normal rendering behavior.
Regarding the associated variable GRDGClobberResources:
- It’s an internal representation of the console variable.
- It’s used directly in the code to control clobbering behavior.
- It’s defined differently based on whether RDG_ENABLE_DEBUG is set, defaulting to 0 when debugging is disabled.
- Developers should generally interact with the console variable (r.RDG.ClobberResources) rather than this internal variable directly.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderGraphPrivate.cpp:76
Scope: file
Source code excerpt:
int32 GRDGClobberResources = 0;
FAutoConsoleVariableRef CVarRDGClobberResources(
TEXT("r.RDG.ClobberResources"),
GRDGClobberResources,
TEXT("Clears all render targets and texture / buffer UAVs with the requested clear color at allocation time. Useful for debugging.\n")
TEXT(" 0:off (default);\n")
TEXT(" 1: 1000 on RGBA channels;\n")
TEXT(" 2: NaN on RGBA channels;\n")
TEXT(" 3: +INFINITY on RGBA channels.\n"),
#Associated Variable and Callsites
This variable is associated with another variable named GRDGClobberResources
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderGraphBuilder.cpp:4268
Scope (from outer to inner):
file
function void FRDGBuilder::ClobberPassOutputs
Source code excerpt:
void FRDGBuilder::ClobberPassOutputs(const FRDGPass* Pass)
{
if (!GRDGValidation || !GRDGClobberResources || !AuxiliaryPasses.IsClobberAllowed())
{
return;
}
RDG_RECURSION_COUNTER_SCOPE(AuxiliaryPasses.Clobber);
RDG_EVENT_SCOPE(*this, "RDG ClobberResources");
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderGraphPrivate.cpp:74
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
int32 GRDGClobberResources = 0;
FAutoConsoleVariableRef CVarRDGClobberResources(
TEXT("r.RDG.ClobberResources"),
GRDGClobberResources,
TEXT("Clears all render targets and texture / buffer UAVs with the requested clear color at allocation time. Useful for debugging.\n")
TEXT(" 0:off (default);\n")
TEXT(" 1: 1000 on RGBA channels;\n")
TEXT(" 2: NaN on RGBA channels;\n")
TEXT(" 3: +INFINITY on RGBA channels.\n"),
ECVF_Cheat | ECVF_RenderThreadSafe);
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderGraphPrivate.cpp:186
Scope (from outer to inner):
file
function static float GetClobberValue
Source code excerpt:
static float GetClobberValue()
{
switch (GRDGClobberResources)
{
case 1:
return 1000.0f;
case 2:
return NAN;
case 3:
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderGraphPrivate.cpp:551
Scope (from outer to inner):
file
function void InitRenderGraph
Source code excerpt:
if (FParse::Param(FCommandLine::Get(), TEXT("rdgclobberresources")))
{
GRDGClobberResources = 1;
}
int32 OverlapUAVsValue = 0;
if (FParse::Value(FCommandLine::Get(), TEXT("rdgoverlapuavs="), OverlapUAVsValue))
{
GRDGOverlapUAVs = OverlapUAVsValue;
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderGraphPrivate.h:30
Scope: file
Source code excerpt:
#if RDG_ENABLE_DEBUG
extern int32 GRDGAsyncCompute;
extern int32 GRDGClobberResources;
extern int32 GRDGValidation;
extern int32 GRDGDebug;
extern int32 GRDGDebugFlushGPU;
extern int32 GRDGDebugExtendResourceLifetimes;
extern int32 GRDGDebugDisableTransientResources;
extern int32 GRDGBreakpoint;
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderGraphPrivate.h:93
Scope: file
Source code excerpt:
#else // !RDG_ENABLE_DEBUG
const int32 GRDGClobberResources = 0;
const int32 GRDGValidation = 0;
const int32 GRDGDebug = 0;
const int32 GRDGDebugFlushGPU = 0;
const int32 GRDGDebugExtendResourceLifetimes = 0;
const int32 GRDGDebugDisableTransientResources = 0;
const int32 GRDGBreakpoint = 0;