r.RDG.Debug.FlushGPU

r.RDG.Debug.FlushGPU

#Overview

name: r.RDG.Debug.FlushGPU

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

It is referenced in 7 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.RDG.Debug.FlushGPU is to enable GPU flushing after every pass in the Render Dependency Graph (RDG) system of Unreal Engine 5. This setting is primarily used for debugging and performance analysis in the rendering system.

This setting variable is used in the RenderCore module of Unreal Engine 5, specifically within the Render Dependency Graph (RDG) subsystem. The RDG is responsible for managing the execution of render passes and their dependencies.

The value of this variable is set through the console variable system in Unreal Engine. It can be changed at runtime using console commands or through configuration files.

The associated variable GRDGDebugFlushGPU interacts directly with r.RDG.Debug.FlushGPU, sharing the same value. This internal variable is used within the C++ code to control the behavior.

Developers must be aware of the following when using this variable:

  1. Enabling this setting (set to 1) will force the GPU to flush after every render pass, which can significantly impact performance.
  2. It automatically disables async compute (r.RDG.AsyncCompute=0) and parallel execution (r.RDG.ParallelExecute=0) when enabled.
  3. This setting is intended for debugging purposes and should not be enabled in production builds.

Best practices when using this variable include:

  1. Use it only when debugging specific rendering issues or analyzing GPU performance.
  2. Remember to disable it after debugging to restore normal rendering performance.
  3. Be aware of its impact on async compute and parallel execution when enabled.

Regarding the associated variable GRDGDebugFlushGPU:

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:

int32 GRDGDebugFlushGPU = 0;
FAutoConsoleVariableRef CVarRDGDebugFlushGPU(
	TEXT("r.RDG.Debug.FlushGPU"),
	GRDGDebugFlushGPU,
	TEXT("Enables flushing the GPU after every pass. Disables async compute (r.RDG.AsyncCompute=0) and parallel execute (r.RDG.ParallelExecute=0) when set.\n")
	TEXT(" 0: disabled (default);\n")
	TEXT(" 1: enabled."),
	ECVF_RenderThreadSafe);

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderGraphBuilder.cpp:3031

Scope (from outer to inner):

file
function     void FRDGBuilder::ExecutePass

Source code excerpt:

	}

	if (GRDGDebugFlushGPU)
	{
		check(!GRDGAsyncCompute && !ParallelExecute.bEnabled);
		RHICmdList.SubmitCommandsAndFlushGPU();
		RHICmdList.BlockUntilGPUIdle();
	}
}

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

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe);

int32 GRDGDebugFlushGPU = 0;
FAutoConsoleVariableRef CVarRDGDebugFlushGPU(
	TEXT("r.RDG.Debug.FlushGPU"),
	GRDGDebugFlushGPU,
	TEXT("Enables flushing the GPU after every pass. Disables async compute (r.RDG.AsyncCompute=0) and parallel execute (r.RDG.ParallelExecute=0) when set.\n")
	TEXT(" 0: disabled (default);\n")
	TEXT(" 1: enabled."),
	ECVF_RenderThreadSafe);

int32 GRDGDebugExtendResourceLifetimes = 0;

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

Scope (from outer to inner):

file
lambda-function

Source code excerpt:

	GRDGAsyncCompute = CVarRDGAsyncCompute.GetValueOnGameThread();

	if (GRDGDebugFlushGPU)
	{
		GRDGAsyncCompute = 0;
	}

	if (!IsAsyncComputeSupported())
	{

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

Scope (from outer to inner):

file
function     bool IsParallelExecuteEnabled

Source code excerpt:

		&& !IsImmediateMode()
		&& !GRDGDebug
		&& !GRDGDebugFlushGPU
		&& !GRDGTransitionLog
		&& !IsMobilePlatform(GMaxRHIShaderPlatform)
		&& !IsOpenGLPlatform(GMaxRHIShaderPlatform)
		&& !IsVulkanMobileSM5Platform(GMaxRHIShaderPlatform)
		&& GRHISupportsMultithreadedShaderCreation
#if WITH_DUMPGPU

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

Scope: file

Source code excerpt:

extern int32 GRDGValidation;
extern int32 GRDGDebug;
extern int32 GRDGDebugFlushGPU;
extern int32 GRDGDebugExtendResourceLifetimes;
extern int32 GRDGDebugDisableTransientResources;
extern int32 GRDGBreakpoint;
extern int32 GRDGTransitionLog;
extern int32 GRDGImmediateMode;
extern int32 GRDGOverlapUAVs;

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

Scope: file

Source code excerpt:

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