r.RDG.TransientExtractedResources

r.RDG.TransientExtractedResources

#Overview

name: r.RDG.TransientExtractedResources

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.TransientExtractedResources is to control how the Render Dependency Graph (RDG) allocates extracted resources in Unreal Engine 5’s rendering system. This setting variable determines whether extracted resources are allocated as transient or non-transient.

This setting variable is primarily used by the rendering system, specifically within the Render Dependency Graph (RDG) subsystem. The RDG is a crucial part of Unreal Engine’s rendering pipeline, responsible for managing and optimizing rendering operations.

The value of this variable is set through the console variable system. It is initialized with a default value of 1 and can be changed at runtime using the console command “r.RDG.TransientExtractedResources”.

The associated variable GRDGTransientExtractedResources interacts directly with r.RDG.TransientExtractedResources. They share the same value and are used interchangeably in the code.

Developers must be aware that this variable has three possible values, each with different implications: 0: Disables external transient resources 1: Enables external transient resources (default) 2: Force enables all external transient resources (not recommended)

Best practices when using this variable include:

  1. Generally, leave it at the default value (1) unless there’s a specific need to change it.
  2. Avoid setting it to 2 unless absolutely necessary, as it’s not recommended and may have performance implications.
  3. If experiencing rendering issues related to resource management, experimenting with this setting might help diagnose the problem.

Regarding the associated variable GRDGTransientExtractedResources:

The purpose of GRDGTransientExtractedResources is to provide a C++ accessible version of the r.RDG.TransientExtractedResources console variable. It is used internally by the RDG system to determine how to handle extracted resources.

This variable is used within the RenderCore module of Unreal Engine, specifically in the RDG implementation.

The value of GRDGTransientExtractedResources is set by the console variable system when r.RDG.TransientExtractedResources is modified.

It interacts directly with the IsTransientInternal function in the FRDGBuilder class, which determines whether a resource should be treated as transient.

Developers should be aware that modifying GRDGTransientExtractedResources directly in code is not recommended. Instead, they should use the console variable r.RDG.TransientExtractedResources to change its value.

Best practices for GRDGTransientExtractedResources include:

  1. Treat it as a read-only variable in most cases.
  2. Use it for conditional logic in rendering code when necessary, but avoid relying on it too heavily.
  3. If needed, modify its value through the r.RDG.TransientExtractedResources console variable rather than directly in code.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:

int32 GRDGTransientExtractedResources = 1;
FAutoConsoleVariableRef CVarRDGTransientExtractedResource(
	TEXT("r.RDG.TransientExtractedResources"), GRDGTransientExtractedResources,
	TEXT("RDG will allocate extracted resources as transient, unless explicitly marked non-transient by the user.")
	TEXT(" 0: disables external transient resources;")
	TEXT(" 1: enables external transient resources (default);")
	TEXT(" 2: force enables all external transient resources (not recommended);"),
	ECVF_RenderThreadSafe);

#Associated Variable and Callsites

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

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

Scope (from outer to inner):

file
function     bool FRDGBuilder::IsTransientInternal

Source code excerpt:

		if (Resource->bExtracted)
		{
			if (GRDGTransientExtractedResources == 0)
			{
				return false;
			}

			if (GRDGTransientExtractedResources == 1 && Resource->TransientExtractionHint == FRDGViewableResource::ETransientExtractionHint::Disable)
			{
				return false;
			}
		}
	}

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

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe);

int32 GRDGTransientExtractedResources = 1;
FAutoConsoleVariableRef CVarRDGTransientExtractedResource(
	TEXT("r.RDG.TransientExtractedResources"), GRDGTransientExtractedResources,
	TEXT("RDG will allocate extracted resources as transient, unless explicitly marked non-transient by the user.")
	TEXT(" 0: disables external transient resources;")
	TEXT(" 1: enables external transient resources (default);")
	TEXT(" 2: force enables all external transient resources (not recommended);"),
	ECVF_RenderThreadSafe);

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

Scope: file

Source code excerpt:

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

#if RDG_ENABLE_PARALLEL_TASKS

extern int32 GRDGParallelDestruction;
extern int32 GRDGParallelSetup;