r.Substrate.DBufferPass.DedicatedTiles

r.Substrate.DBufferPass.DedicatedTiles

#Overview

name: r.Substrate.DBufferPass.DedicatedTiles

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.Substrate.DBufferPass.DedicatedTiles is to control the use of dedicated tiles for DBuffer application in the Substrate rendering system of Unreal Engine 5. This setting is specifically related to the rendering system, particularly the Substrate subsystem.

The Unreal Engine subsystem that relies on this setting variable is the Renderer module, specifically the Substrate component within it. This can be seen from the file path where the variable is defined and used: Engine/Source/Runtime/Renderer/Private/Substrate/Substrate.cpp.

The value of this variable is set using a console variable (CVar) system. It’s initialized with a default value of 0, meaning it’s disabled by default. Developers can change this value at runtime or through configuration files.

This variable interacts closely with the DBuffer (Decal Buffer) system. It’s used in conjunction with other variables and functions related to DBuffer processing, such as IsDBufferPassEnabled and DBufferTextures.

Developers must be aware that this variable affects the tile allocation strategy for DBuffer application. When enabled (set to a value greater than 0), it uses dedicated tiles for DBuffer application, which can impact rendering performance and memory usage.

Best practices when using this variable include:

  1. Only enable it if you need specific DBuffer application behavior that requires dedicated tiles.
  2. Test thoroughly to ensure it doesn’t negatively impact performance on your target platforms.
  3. Be aware of its interaction with other Substrate and DBuffer-related settings.

Regarding the associated variable CVarSubstrateDBufferPassDedicatedTiles:

This is the actual CVar object that controls the r.Substrate.DBufferPass.DedicatedTiles setting. It’s defined as a TAutoConsoleVariable, which means it’s an integer console variable that can be changed at runtime.

The purpose of CVarSubstrateDBufferPassDedicatedTiles is to provide a programmatic interface to read and modify the r.Substrate.DBufferPass.DedicatedTiles setting within the C++ code.

It’s used in the Substrate namespace, specifically in functions like AddSubstrateMaterialClassificationPass and AddSubstrateDBufferPass. These functions use the value of this variable to determine whether to use dedicated tiles for DBuffer processing.

The value of this variable is typically read using the GetValueOnRenderThread() method, which ensures thread-safe access to the current value.

Developers should be aware that changes to this variable will affect the behavior of the Substrate rendering system, particularly in how it handles DBuffer application. It’s important to coordinate any changes to this variable with the overall rendering strategy and performance goals of the project.

Best practices for using CVarSubstrateDBufferPassDedicatedTiles include:

  1. Use GetValueOnRenderThread() when accessing the value to ensure thread safety.
  2. Consider the performance implications of enabling or disabling this feature, especially on console platforms.
  3. Coordinate changes to this variable with other Substrate and DBuffer-related settings to ensure consistent behavior.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Substrate/Substrate.cpp:52

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarSubstrateDBufferPassDedicatedTiles(
	TEXT("r.Substrate.DBufferPass.DedicatedTiles"),
	0,
	TEXT("Use dedicated tile for DBuffer application when DBuffer pass is enabled."),
	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarSubstrateAllocationMode(
	TEXT("r.Substrate.AllocationMode"),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Substrate/Substrate.cpp:51

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarSubstrateDBufferPassDedicatedTiles(
	TEXT("r.Substrate.DBufferPass.DedicatedTiles"),
	0,
	TEXT("Use dedicated tile for DBuffer application when DBuffer pass is enabled."),
	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarSubstrateAllocationMode(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Substrate/Substrate.cpp:1281

Scope (from outer to inner):

file
namespace    Substrate
function     void AddSubstrateMaterialClassificationPass

Source code excerpt:


			// If Dbuffer pass (i.e. apply DBuffer data after the base-pass) is enabled, run special classification for outputing tile with/without tiles
			const bool bDBufferTiles = IsDBufferPassEnabled(Platform) && CVarSubstrateDBufferPassDedicatedTiles.GetValueOnRenderThread() > 0 && DBufferTextures.IsValid() && IsConsolePlatform(View.GetShaderPlatform());

			FSubstrateMaterialTileClassificationPassCS::FPermutationDomain PermutationVector;
			PermutationVector.Set< FSubstrateMaterialTileClassificationPassCS::FCmask >(bSupportCMask);
			PermutationVector.Set< FSubstrateMaterialTileClassificationPassCS::FWaveOps >(bWaveOps);
			PermutationVector.Set< FSubstrateMaterialTileClassificationPassCS::FDecal>(bDBufferTiles);
			TShaderMapRef<FSubstrateMaterialTileClassificationPassCS> ComputeShader(View.ShaderMap, PermutationVector);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Substrate/Substrate.cpp:1478

Scope (from outer to inner):

file
namespace    Substrate
function     void AddSubstrateDBufferPass

Source code excerpt:

		};

		const bool bDbufferTiles = CVarSubstrateDBufferPassDedicatedTiles.GetValueOnRenderThread() > 0;
		DBufferPass(bDbufferTiles ? ESubstrateTileType::EDecalComplex : ESubstrateTileType::EComplex);
		DBufferPass(bDbufferTiles ? ESubstrateTileType::EDecalSingle : ESubstrateTileType::ESingle);
		DBufferPass(bDbufferTiles ? ESubstrateTileType::EDecalSimple : ESubstrateTileType::ESimple);
	}
}