r.TSR.Debug.ArraySize

r.TSR.Debug.ArraySize

#Overview

name: r.TSR.Debug.ArraySize

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

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.TSR.Debug.ArraySize is to control the size of the array for TSR (Temporal Super Resolution) debug textures in Unreal Engine’s rendering system. This setting variable is specifically used for debugging purposes within the Temporal Super Resolution feature.

This setting variable is primarily used in the Renderer module of Unreal Engine, specifically within the Temporal Super Resolution subsystem. Based on the callsites, it’s clear that this variable is utilized in the PostProcess/TemporalSuperResolution.cpp file.

The value of this variable is set through a console variable (CVarTSRDebugArraySize) using the TAutoConsoleVariable template. It’s initialized with a default value of 1, but can be changed at runtime through console commands or programmatically.

The associated variable CVarTSRDebugArraySize directly interacts with r.TSR.Debug.ArraySize. They essentially represent the same value, with CVarTSRDebugArraySize being the actual console variable object that stores and manages the value.

Developers must be aware that this variable is only compiled and used when COMPILE_TSR_DEBUG_PASSES is defined. This suggests it’s intended for debug builds or when specific debug features are enabled.

Best practices when using this variable include:

  1. Only modify it for debugging purposes, as it affects the size of debug textures.
  2. Be mindful of performance implications when increasing the array size, as it may consume more memory.
  3. Use it in conjunction with other TSR debug features for comprehensive analysis.
  4. Reset it to its default value (1) when not actively debugging to minimize resource usage.

Regarding the associated variable CVarTSRDebugArraySize:

The purpose of CVarTSRDebugArraySize is to provide a runtime-configurable way to set the r.TSR.Debug.ArraySize value. It’s implemented as a console variable, allowing for easy modification during development and debugging.

This variable is used in the same Renderer module and Temporal Super Resolution subsystem as r.TSR.Debug.ArraySize. It’s defined and used in the TemporalSuperResolution.cpp file.

The value of CVarTSRDebugArraySize is set when the console variable is created, with an initial value of 1. It can be modified at runtime using console commands.

CVarTSRDebugArraySize directly controls the value of r.TSR.Debug.ArraySize. It’s used to retrieve the current value in the code where the array size for debug textures is determined.

Developers should be aware that changes to CVarTSRDebugArraySize will immediately affect the size of debug texture arrays in the TSR system. It’s important to use this variable responsibly and be mindful of potential performance impacts.

Best practices for using CVarTSRDebugArraySize include:

  1. Use it for debugging and development purposes only.
  2. Be cautious when setting large values, as it could significantly increase memory usage.
  3. Remember to reset it to the default value after debugging sessions.
  4. Use in combination with other TSR debug tools for effective problem-solving.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/TemporalSuperResolution.cpp:311

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:


TAutoConsoleVariable<int32> CVarTSRDebugArraySize(
	TEXT("r.TSR.Debug.ArraySize"), 1,
	TEXT("Size of array for the TSR.Debug.* RDG textures"),
	ECVF_RenderThreadSafe);

#endif

BEGIN_SHADER_PARAMETER_STRUCT(FTSRCommonParameters, )

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/TemporalSuperResolution.cpp:310

Scope (from outer to inner):

file
namespace    anonymous

Source code excerpt:

#if COMPILE_TSR_DEBUG_PASSES

TAutoConsoleVariable<int32> CVarTSRDebugArraySize(
	TEXT("r.TSR.Debug.ArraySize"), 1,
	TEXT("Size of array for the TSR.Debug.* RDG textures"),
	ECVF_RenderThreadSafe);

#endif

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/TemporalSuperResolution.cpp:1513

Scope (from outer to inner):

file
function     FDefaultTemporalUpscaler::FOutputs AddTemporalSuperResolutionPasses
lambda-function

Source code excerpt:

	{
#if COMPILE_TSR_DEBUG_PASSES
		uint16 ArraySize = uint16(FMath::Clamp(CVarTSRDebugArraySize.GetValueOnRenderThread(), 1, GMaxTextureArrayLayers));
#else
		const uint16 ArraySize = 1;
#endif

		FRDGTextureDesc DebugDesc = FRDGTextureDesc::Create2DArray(
			Extent,