r.DumpGPU.Draws

r.DumpGPU.Draws

#Overview

name: r.DumpGPU.Draws

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

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.DumpGPU.Draws is to control whether the Unreal Engine should dump GPU resources after each individual draw call. This setting is primarily used for debugging and profiling purposes in the rendering system.

This setting variable is primarily used in the RenderCore module of Unreal Engine, specifically in the DumpGPU functionality. It’s part of the rendering subsystem and is used for diagnostic purposes.

The value of this variable is set through a console command. It’s initialized with a default value of 0 (disabled) in the C++ code, but can be changed at runtime using the console command “r.DumpGPU.Draws”.

The associated variable GDumpGPUDraws interacts directly with r.DumpGPU.Draws. They share the same value and purpose. GDumpGPUDraws is used in the C++ code to check the current state of this setting.

Developers must be aware that enabling this variable can have a significant performance impact, as it will cause the engine to dump GPU resources after every draw call. This should only be used when necessary for debugging or profiling purposes.

Best practices when using this variable include:

  1. Only enable it when needed for debugging or profiling.
  2. Be prepared for a performance hit when enabled.
  3. Disable it as soon as the necessary information has been gathered.
  4. Use in conjunction with other GPU profiling tools for a comprehensive analysis.

Regarding the associated variable GDumpGPUDraws:

The purpose of GDumpGPUDraws is to provide a programmatic way to access the value of r.DumpGPU.Draws within the C++ code of the engine.

It’s used in the RenderCore module, specifically in the FRDGBuilder class, which is part of the Render Dependency Graph system in Unreal Engine.

The value of GDumpGPUDraws is set automatically based on the value of r.DumpGPU.Draws. It’s accessed using the GetValueOnRenderThread() method, which ensures thread-safe access to the current value.

GDumpGPUDraws interacts directly with r.DumpGPU.Draws, effectively serving as its in-code representation.

Developers should be aware that GDumpGPUDraws should be accessed using GetValueOnRenderThread() to ensure thread-safe operations, especially in render thread contexts.

Best practices for using GDumpGPUDraws include:

  1. Always use GetValueOnRenderThread() when accessing its value.
  2. Be aware of the performance implications when it’s enabled.
  3. Use it in conjunction with other RDG (Render Dependency Graph) debugging tools and methods.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/DumpGPU.cpp:120

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:


static TAutoConsoleVariable<int32> GDumpGPUDraws(
	TEXT("r.DumpGPU.Draws"), 0,
	TEXT("Whether to dump resource after each individual draw call (disabled by default)."),
	ECVF_Default);

static TAutoConsoleVariable<int32> GDumpGPUMask(
	TEXT("r.DumpGPU.Mask"), 1,
	TEXT("Whether to include GPU mask in the name of each Pass (has no effect unless system has multiple GPUs)."),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/DumpGPU.cpp:119

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:

	ECVF_Default);

static TAutoConsoleVariable<int32> GDumpGPUDraws(
	TEXT("r.DumpGPU.Draws"), 0,
	TEXT("Whether to dump resource after each individual draw call (disabled by default)."),
	ECVF_Default);

static TAutoConsoleVariable<int32> GDumpGPUMask(
	TEXT("r.DumpGPU.Mask"), 1,

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/DumpGPU.cpp:2698

Scope (from outer to inner):

file
function     void FRDGBuilder::BeginPassDump

Source code excerpt:

	FRDGResourceDumpContext* ResourceDumpContext = GRDGResourceDumpContext_RenderThread;

	if (!GDumpGPUDraws.GetValueOnRenderThread())
	{
		return;
	}

	if (!EnumHasAnyFlags(Pass->GetFlags(), ERDGPassFlags::Raster))
	{

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/DumpGPU.cpp:2876

Scope (from outer to inner):

file
function     bool FRDGBuilder::IsDumpingDraws

Source code excerpt:

	}

	return GDumpGPUDraws.GetValueOnRenderThread() != 0;
}

#endif // RDG_DUMP_RESOURCES_AT_EACH_DRAW