r.RDG.TransientAllocator.IndirectArgumentBuffers

r.RDG.TransientAllocator.IndirectArgumentBuffers

#Overview

name: r.RDG.TransientAllocator.IndirectArgumentBuffers

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.RDG.TransientAllocator.IndirectArgumentBuffers is to control whether indirect argument buffers should use the transient resource allocator in Unreal Engine’s Render Dependency Graph (RDG) system. This setting is part of the rendering system, specifically the RDG subsystem.

The Render Dependency Graph system in Unreal Engine’s rendering pipeline relies on this setting variable. It is primarily used in the RenderCore module, as evident from the file paths in the callsites.

The value of this variable is set through a console variable (CVar) system. It’s initialized to 0 by default, meaning indirect argument buffers do not use the transient resource allocator.

The associated variable GRDGTransientIndirectArgBuffers interacts directly with this setting. They share the same value and are used interchangeably in the code.

Developers must be aware that this variable was introduced as a fix for random GPU crashes on draw indirects across multiple hardware vendors (IHVs). The default value of 0 forces all indirect argument buffers to be non-transient.

Best practices when using this variable include:

  1. Generally, leave it at the default value (0) unless specific performance improvements are needed and thoroughly tested.
  2. If enabling it (setting to 1), extensive testing should be done across various hardware configurations to ensure stability.
  3. Monitor performance metrics when modifying this setting, as it can impact memory usage and potentially rendering performance.

Regarding the associated variable GRDGTransientIndirectArgBuffers:

The purpose of GRDGTransientIndirectArgBuffers is to serve as the internal representation of the r.RDG.TransientAllocator.IndirectArgumentBuffers setting within the engine’s C++ code.

This variable is used in the RenderCore module, specifically in the RDG system implementation.

Its value is set by the console variable system, mirroring the value of r.RDG.TransientAllocator.IndirectArgumentBuffers.

It interacts directly with the RDG builder and is used to determine whether certain buffers should be treated as transient.

Developers should be aware that this variable directly affects the behavior of the IsTransient function in the FRDGBuilder class, which determines whether a buffer should use transient allocation.

Best practices for using this variable include:

  1. Treat it as read-only within the codebase, as its value should only be modified through the console variable system.
  2. When implementing new features or modifying existing ones in the RDG system, consider the implications of this variable’s state on buffer allocation and performance.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:

int32 GRDGTransientIndirectArgBuffers = 0;
FAutoConsoleVariableRef CVarRDGIndirectArgBufferTransientAllocated(
	TEXT("r.RDG.TransientAllocator.IndirectArgumentBuffers"), GRDGTransientIndirectArgBuffers,
	TEXT("Whether indirect argument buffers should use transient resource allocator. Default: 0"),
	ECVF_RenderThreadSafe);

#if CSV_PROFILER
int32 GRDGVerboseCSVStats = 0;
FAutoConsoleVariableRef CVarRDGVerboseCSVStats(

#Associated Variable and Callsites

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

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

Scope (from outer to inner):

file
function     bool FRDGBuilder::IsTransient

Source code excerpt:

	}

	if (!GRDGTransientIndirectArgBuffers && EnumHasAnyFlags(Buffer->Desc.Usage, BUF_DrawIndirect))
	{
		return false;
	}

	return EnumHasAnyFlags(Buffer->Desc.Usage, BUF_UnorderedAccess);
}

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

Scope: file

Source code excerpt:


// Fix for random GPU crashes on draw indirects on multiple IHVs. Force all indirect arg buffers as non transient (see UE-115982)
int32 GRDGTransientIndirectArgBuffers = 0;
FAutoConsoleVariableRef CVarRDGIndirectArgBufferTransientAllocated(
	TEXT("r.RDG.TransientAllocator.IndirectArgumentBuffers"), GRDGTransientIndirectArgBuffers,
	TEXT("Whether indirect argument buffers should use transient resource allocator. Default: 0"),
	ECVF_RenderThreadSafe);

#if CSV_PROFILER
int32 GRDGVerboseCSVStats = 0;
FAutoConsoleVariableRef CVarRDGVerboseCSVStats(

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

Scope: file

Source code excerpt:

extern int32 GRDGTransientAllocator;
extern int32 GRDGTransientExtractedResources;
extern int32 GRDGTransientIndirectArgBuffers;

#if RDG_ENABLE_PARALLEL_TASKS

extern int32 GRDGParallelDestruction;
extern int32 GRDGParallelSetup;
extern int32 GRDGParallelExecute;