r.RDG.TransientAllocator
r.RDG.TransientAllocator
#Overview
name: r.RDG.TransientAllocator
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
RDG will use the RHITransientResourceAllocator to allocate all transient resources. 0: disables the transient allocator; 1: enables the transient allocator (default); 2: enables the transient allocator for resources with FastVRAM flag only
It is referenced in 6
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.RDG.TransientAllocator is to control the usage of the RHITransientResourceAllocator for allocating transient resources in the Render Dependency Graph (RDG) system of Unreal Engine 5.
This setting variable is primarily used by the rendering system, specifically within the RDG subsystem. The RDG is a crucial part of Unreal Engine’s rendering pipeline, responsible for managing render passes and resource dependencies.
The value of this variable is set through the console variable system, as evidenced by the FAutoConsoleVariableRef declaration. It can be set to 0 (disabled), 1 (enabled for all resources, default), or 2 (enabled only for resources with FastVRAM flag).
The associated variable GRDGTransientAllocator interacts directly with r.RDG.TransientAllocator, sharing the same value. This internal variable is used throughout the RDG implementation to determine the behavior of transient resource allocation.
Developers should be aware of the following when using this variable:
- Setting it to 0 disables the transient allocator completely.
- Setting it to 1 (default) enables the transient allocator for all resources.
- Setting it to 2 enables the transient allocator only for resources with the FastVRAM flag.
Best practices when using this variable include:
- Consider the target platform’s memory characteristics when deciding whether to use the transient allocator.
- Monitor performance and memory usage to determine the optimal setting for your specific use case.
- Be cautious when changing this value during runtime, as it may affect ongoing rendering processes.
Regarding the associated variable GRDGTransientAllocator:
The purpose of GRDGTransientAllocator is to provide an internal representation of the r.RDG.TransientAllocator setting within the engine’s C++ code.
This variable is used directly in the RDG implementation, particularly in the FRDGBuilder class and the IsTransientInternal function. It determines whether the TransientResourceAllocator should be used and how it should be applied to different types of resources.
The value of GRDGTransientAllocator is set based on the r.RDG.TransientAllocator console variable, and it can also be influenced by command-line arguments during engine initialization.
Developers should be aware that this variable affects the behavior of resource allocation in the RDG system, potentially impacting performance and memory usage. It’s particularly important to consider its interaction with FastVRAM features and immediate mode rendering.
Best practices for using GRDGTransientAllocator include:
- Avoid directly modifying this variable in code; instead, use the r.RDG.TransientAllocator console variable to control its behavior.
- When debugging RDG-related issues, consider the value of this variable and its impact on resource allocation.
- Be mindful of its interaction with other RDG settings and features, such as parallel execution and debug validation.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderGraphPrivate.cpp:305
Scope: file
Source code excerpt:
int32 GRDGTransientAllocator = 1;
FAutoConsoleVariableRef CVarRDGUseTransientAllocator(
TEXT("r.RDG.TransientAllocator"), GRDGTransientAllocator,
TEXT("RDG will use the RHITransientResourceAllocator to allocate all transient resources.")
TEXT(" 0: disables the transient allocator;")
TEXT(" 1: enables the transient allocator (default);")
TEXT(" 2: enables the transient allocator for resources with FastVRAM flag only"),
ECVF_RenderThreadSafe);
#Associated Variable and Callsites
This variable is associated with another variable named GRDGTransientAllocator
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderGraphBuilder.cpp:491
Scope (from outer to inner):
file
function bool FRDGBuilder::IsTransientInternal
Source code excerpt:
if (!bFastVRAM || !FPlatformMemory::SupportsFastVRAMMemory())
{
if (GRDGTransientAllocator == 2)
{
return false;
}
if (Resource->bForceNonTransient)
{
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderGraphBuilder.cpp:540
Scope (from outer to inner):
file
function FRDGBuilder::FRDGBuilder
Source code excerpt:
, Blackboard(Allocators.Root)
, BuilderName(InName)
, TransientResourceAllocator(GRDGTransientAllocator != 0 && !::IsImmediateMode() ? GRDGTransientResourceAllocator.Get() : nullptr)
, ExtendResourceLifetimeScope(RHICmdList)
#if RDG_ENABLE_DEBUG
, UserValidation(Allocators.Root, ParallelExecute.bEnabled)
, BarrierValidation(&Passes, BuilderName)
#endif
{
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderGraphPrivate.cpp:303
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
int32 GRDGTransientAllocator = 1;
FAutoConsoleVariableRef CVarRDGUseTransientAllocator(
TEXT("r.RDG.TransientAllocator"), GRDGTransientAllocator,
TEXT("RDG will use the RHITransientResourceAllocator to allocate all transient resources.")
TEXT(" 0: disables the transient allocator;")
TEXT(" 1: enables the transient allocator (default);")
TEXT(" 2: enables the transient allocator for resources with FastVRAM flag only"),
ECVF_RenderThreadSafe);
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderGraphPrivate.cpp:582
Scope (from outer to inner):
file
function void InitRenderGraph
Source code excerpt:
if (FParse::Value(FCommandLine::Get(), TEXT("rdgtransientallocator="), TransientAllocatorValue))
{
GRDGTransientAllocator = TransientAllocatorValue;
}
int32 CullPassesValue = 0;
if (FParse::Value(FCommandLine::Get(), TEXT("rdgcullpasses="), CullPassesValue))
{
GRDGCullPasses = CullPassesValue;
#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderGraphPrivate.h:113
Scope: file
Source code excerpt:
extern int32 GRDGCullPasses;
extern int32 GRDGMergeRenderPasses;
extern int32 GRDGTransientAllocator;
extern int32 GRDGTransientExtractedResources;
extern int32 GRDGTransientIndirectArgBuffers;
#if RDG_ENABLE_PARALLEL_TASKS
extern int32 GRDGParallelDestruction;