r.RDG.Breakpoint

r.RDG.Breakpoint

#Overview

name: r.RDG.Breakpoint

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

It is referenced in 8 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.RDG.Breakpoint is to control debug breakpoints in the Render Dependency Graph (RDG) system of Unreal Engine 5. It allows developers to set breakpoints at specific points during the rendering process for debugging purposes.

This setting variable is primarily used by the RDG system, which is part of Unreal Engine’s rendering subsystem. It’s referenced in the RenderCore module, specifically in the RenderGraphPrivate.cpp and RenderGraphPrivate.h files.

The value of this variable is set through the console or command line. It can be set at runtime using the console command r.RDG.Breakpoint, or at startup by passing the command-line argument -rdgbreakpoint=<value>.

The r.RDG.Breakpoint variable interacts closely with its associated variable GRDGBreakpoint. They share the same value, with GRDGBreakpoint being the actual integer variable used in the C++ code.

Developers should be aware that this variable can significantly impact performance when enabled, as it introduces breakpoints in the rendering pipeline. It should only be used for debugging purposes and not left enabled in production builds.

Best practices for using this variable include:

  1. Only enable it when actively debugging RDG-related issues.
  2. Use it in conjunction with other RDG debug tools and logs for comprehensive debugging.
  3. Be aware of the different breakpoint modes (1: RDG warnings, 2: Graph/pass compilation, 3: Graph/pass execution, 4: Graph/pass/resource creation or destruction).
  4. Disable it when not needed to avoid performance impacts.

Regarding the associated variable GRDGBreakpoint:

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderGraphPrivate.cpp:64

Scope: file

Source code excerpt:

int32 GRDGBreakpoint = 0;
FAutoConsoleVariableRef CVarRDGBreakpoint(
	TEXT("r.RDG.Breakpoint"),
	GRDGBreakpoint,
	TEXT("Breakpoint in debugger when certain conditions are met.\n")
	TEXT(" 0: off (default);\n")
	TEXT(" 1: On an RDG warning;\n")
	TEXT(" 2: When a graph / pass matching the debug filters compiles;\n")
	TEXT(" 3: When a graph / pass matching the debug filters executes;\n")

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderGraphPrivate.cpp:62

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe);

int32 GRDGBreakpoint = 0;
FAutoConsoleVariableRef CVarRDGBreakpoint(
	TEXT("r.RDG.Breakpoint"),
	GRDGBreakpoint,
	TEXT("Breakpoint in debugger when certain conditions are met.\n")
	TEXT(" 0: off (default);\n")
	TEXT(" 1: On an RDG warning;\n")
	TEXT(" 2: When a graph / pass matching the debug filters compiles;\n")
	TEXT(" 3: When a graph / pass matching the debug filters executes;\n")
	TEXT(" 4: When a graph / pass / resource matching the debug filters is created or destroyed;\n"),

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderGraphPrivate.cpp:239

Scope (from outer to inner):

file
function     void EmitRDGWarning

Source code excerpt:

			UE_LOG(LogRDG, Warning, TEXT("%s"), *WarningMessage);

			if (GRDGBreakpoint == RDG_BREAKPOINT_WARNINGS)
			{
				UE_DEBUG_BREAK();
			}
		}
	}
	else

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderGraphPrivate.cpp:249

Scope (from outer to inner):

file
function     void EmitRDGWarning

Source code excerpt:

		UE_LOG(LogRDG, Warning, TEXT("%s"), *WarningMessage);

		if (GRDGBreakpoint == RDG_BREAKPOINT_WARNINGS)
		{
			UE_DEBUG_BREAK();
		}
	}
}

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderGraphPrivate.cpp:546

Scope (from outer to inner):

file
function     void InitRenderGraph

Source code excerpt:

	if (FParse::Value(FCommandLine::Get(), TEXT("rdgbreakpoint="), BreakpointValue))
	{
		GRDGBreakpoint = BreakpointValue;
	}

	if (FParse::Param(FCommandLine::Get(), TEXT("rdgclobberresources")))
	{
		GRDGClobberResources = 1;
	}

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderGraphPrivate.h:36

Scope: file

Source code excerpt:

extern int32 GRDGDebugExtendResourceLifetimes;
extern int32 GRDGDebugDisableTransientResources;
extern int32 GRDGBreakpoint;
extern int32 GRDGTransitionLog;
extern int32 GRDGImmediateMode;
extern int32 GRDGOverlapUAVs;
extern bool  GRDGAllowRHIAccess;

class FRDGAllowRHIAccessScope

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderGraphPrivate.h:72

Scope (from outer to inner):

file
function     inline void ConditionalDebugBreak

Source code excerpt:

inline void ConditionalDebugBreak(int32 BreakpointCVarValue, const TCHAR* GraphName, const TCHAR* PassName)
{
	if (GRDGBreakpoint == BreakpointCVarValue && IsDebugAllowedForGraph(GraphName) && IsDebugAllowedForPass(PassName))
	{
		UE_DEBUG_BREAK();
	}
}

inline void ConditionalDebugBreak(int32 BreakpointCVarValue, const TCHAR* GraphName, const TCHAR* PassName, const TCHAR* ResourceName)
{
	if (GRDGBreakpoint == BreakpointCVarValue && IsDebugAllowedForGraph(GraphName) && IsDebugAllowedForPass(PassName) && IsDebugAllowedForResource(ResourceName))
	{
		UE_DEBUG_BREAK();
	}
}

void EmitRDGWarning(const FString& WarningMessage);

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderGraphPrivate.h:99

Scope: file

Source code excerpt:

const int32 GRDGDebugExtendResourceLifetimes = 0;
const int32 GRDGDebugDisableTransientResources = 0;
const int32 GRDGBreakpoint = 0;
const int32 GRDGTransitionLog = 0;
const int32 GRDGImmediateMode = 0;
const int32 GRDGOverlapUAVs = 1;

#define RDG_ALLOW_RHI_ACCESS_SCOPE()