r.VT.PoolAutoGrow

r.VT.PoolAutoGrow

#Overview

name: r.VT.PoolAutoGrow

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.VT.PoolAutoGrow is to enable automatic growing of physical pools for virtual textures when oversubscription occurs in Unreal Engine 5’s rendering system.

This setting variable is primarily used by the Virtual Texture (VT) system, which is part of Unreal Engine’s rendering subsystem. It’s specifically related to the management of virtual texture pools.

The value of this variable is set through a console variable (CVar) named CVarVTPoolAutoGrow. It’s defined in the Engine module, specifically in the VirtualTexturePoolConfig.cpp file.

There is an associated variable named bPoolAutoGrowInEditor in the UVirtualTexturePoolConfig class. While r.VT.PoolAutoGrow applies to cooked builds, bPoolAutoGrowInEditor serves a similar purpose but is specific to the editor environment.

Developers should be aware that enabling this variable allows physical pools to grow to the maximum size requested so far. This can potentially lead to increased memory usage, so it should be used cautiously and monitored closely.

Best practices when using this variable include:

  1. Only enable it when necessary, as it can impact memory usage.
  2. Monitor the performance and memory usage when enabled.
  3. Consider using bPoolAutoGrowInEditor for development and testing, and r.VT.PoolAutoGrow for final builds if needed.
  4. Be aware of the potential performance implications, especially on platforms with limited memory.

Regarding the associated variable CVarVTPoolAutoGrow:

The purpose of CVarVTPoolAutoGrow is to implement the r.VT.PoolAutoGrow setting as a console variable within the engine’s code.

This variable is used directly by the VirtualTexturePool class to determine whether pool auto-growing should be enabled. It’s part of the Engine module and is specifically used in the virtual texturing system.

The value of CVarVTPoolAutoGrow is set when the engine initializes its console variables, and it can be changed at runtime through console commands.

CVarVTPoolAutoGrow interacts directly with the VirtualTexturePool class, specifically in the GetPoolAutoGrow function.

Developers should be aware that this is a render-thread safe variable, meaning it can be safely accessed from the render thread.

Best practices for using CVarVTPoolAutoGrow include:

  1. Use it for runtime toggling of the pool auto-grow feature, if needed.
  2. Be cautious about changing its value during performance-critical sections of code.
  3. Consider its impact on memory usage and performance when enabling or disabling it.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/VT/VirtualTexturePoolConfig.cpp:25

Scope: file

Source code excerpt:


static TAutoConsoleVariable<bool> CVarVTPoolAutoGrow(
	TEXT("r.VT.PoolAutoGrow"),
	false,
	TEXT("Enable physical pool growing on oversubscription."),
	ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<int32> CVarVTSplitPhysicalPoolSize(

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/VT/VirtualTexturePoolConfig.h:62

Scope (from outer to inner):

file
class        class UVirtualTexturePoolConfig : public UDeveloperSettings

Source code excerpt:

	 * Enable physical pools growing on oversubscription.
	 * Each physical pool will grow to the maximum size so far requested.
	 * This setting applies to the editor only. To have similar behavior in a cooked build use r.VT.PoolAutoGrow.
	 */
	UPROPERTY(config, EditAnywhere, Category = PoolConfig)
	bool bPoolAutoGrowInEditor = true;

	/** 
	 * Serialized array of configs. 
	 * A virtual texture physical pool iterates these from last to first and uses the first matching config that it finds. 
	 */
	UPROPERTY(config, EditAnywhere, Category = PoolConfig, meta=(DisplayName="Fixed Pools", TitleProperty = "Formats"))
	TArray<FVirtualTextureSpacePoolConfig> Pools;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/VT/VirtualTexturePoolConfig.cpp:24

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<bool> CVarVTPoolAutoGrow(
	TEXT("r.VT.PoolAutoGrow"),
	false,
	TEXT("Enable physical pool growing on oversubscription."),
	ECVF_RenderThreadSafe
);

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/VT/VirtualTexturePoolConfig.cpp:290

Scope (from outer to inner):

file
function     bool VirtualTexturePool::GetPoolAutoGrow

Source code excerpt:

	}
#endif
	return CVarVTPoolAutoGrow.GetValueOnAnyThread();
}

int32 VirtualTexturePool::GetSplitPhysicalPoolSize()
{
	return FMath::Max(CVarVTSplitPhysicalPoolSize.GetValueOnAnyThread(), 0);
}