r.RDG.OverlapUAVs

r.RDG.OverlapUAVs

#Overview

name: r.RDG.OverlapUAVs

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

It is referenced in 6 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.RDG.OverlapUAVs is to control the behavior of Unreal Engine’s Render Dependency Graph (RDG) system regarding Unordered Access View (UAV) work overlapping. This setting is primarily used in the rendering system of Unreal Engine 5.

The RDG subsystem within the RenderCore module relies on this setting variable. It is part of the render thread optimization mechanisms.

The value of this variable is set initially to 1 (enabled) in the C++ code. It can be modified through the console variable system or via command-line arguments.

The associated variable GRDGOverlapUAVs directly interacts with r.RDG.OverlapUAVs. They share the same value and purpose.

Developers must be aware that:

  1. When enabled (set to 1), RDG will attempt to overlap UAV work when requested.
  2. When disabled (set to 0), UAV barriers are always inserted, potentially impacting performance.

Best practices when using this variable:

  1. Keep it enabled by default for optimal performance.
  2. Use it for debugging or profiling render thread performance issues.
  3. Be cautious when disabling it, as it may impact rendering performance.

Regarding the associated variable GRDGOverlapUAVs:

Developers should be aware that modifying GRDGOverlapUAVs directly in code is not recommended. Instead, they should use the console variable system to change the value of r.RDG.OverlapUAVs, which will automatically update GRDGOverlapUAVs.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:

int32 GRDGOverlapUAVs = 1;
FAutoConsoleVariableRef CVarRDGOverlapUAVs(
	TEXT("r.RDG.OverlapUAVs"), GRDGOverlapUAVs,
	TEXT("RDG will overlap UAV work when requested; if disabled, UAV barriers are always inserted."),
	ECVF_RenderThreadSafe);

int32 GRDGTransitionLog = 0;
FAutoConsoleVariableRef CVarRDGTransitionLog(
	TEXT("r.RDG.TransitionLog"), GRDGTransitionLog,

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	ECVF_Cheat | ECVF_RenderThreadSafe);

int32 GRDGOverlapUAVs = 1;
FAutoConsoleVariableRef CVarRDGOverlapUAVs(
	TEXT("r.RDG.OverlapUAVs"), GRDGOverlapUAVs,
	TEXT("RDG will overlap UAV work when requested; if disabled, UAV barriers are always inserted."),
	ECVF_RenderThreadSafe);

int32 GRDGTransitionLog = 0;
FAutoConsoleVariableRef CVarRDGTransitionLog(
	TEXT("r.RDG.TransitionLog"), GRDGTransitionLog,

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

Scope (from outer to inner):

file
function     void InitRenderGraph

Source code excerpt:

	if (FParse::Value(FCommandLine::Get(), TEXT("rdgoverlapuavs="), OverlapUAVsValue))
	{
		GRDGOverlapUAVs = OverlapUAVsValue;
	}

	FString GraphFilter;
	if (FParse::Value(FCommandLine::Get(), TEXT("rdgdebuggraphfilter="), GraphFilter))
	{
		CVarRDGDebugGraphFilter->Set(*GraphFilter);

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

Scope: file

Source code excerpt:

extern int32 GRDGTransitionLog;
extern int32 GRDGImmediateMode;
extern int32 GRDGOverlapUAVs;
extern bool  GRDGAllowRHIAccess;

class FRDGAllowRHIAccessScope
{
public:
	FRDGAllowRHIAccessScope()

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

Scope: file

Source code excerpt:

const int32 GRDGTransitionLog = 0;
const int32 GRDGImmediateMode = 0;
const int32 GRDGOverlapUAVs = 1;

#define RDG_ALLOW_RHI_ACCESS_SCOPE()

#define EmitRDGWarningf(WarningMessageFormat, ...)

#endif

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

Scope (from outer to inner):

file
function     inline bool SkipUAVBarrier

Source code excerpt:

{
	// Barrier if previous / next don't have a matching valid skip-barrier UAV handle.
	if (GRDGOverlapUAVs != 0 && NextHandle.IsValid() && PreviousHandle == NextHandle)
	{
		return true;
	}

	return false;
}