r.VT.CsvStats

r.VT.CsvStats

#Overview

name: r.VT.CsvStats

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.CsvStats is to control the sending of virtual texturing statistics to the CSV profiler in Unreal Engine 5. This setting variable is part of the rendering system, specifically focusing on the virtual texturing subsystem.

The Unreal Engine subsystem that relies on this setting variable is the Renderer module, particularly the virtual texturing system within it. This can be seen from the file path Engine/Source/Runtime/Renderer/Private/VT/VirtualTextureSystem.cpp.

The value of this variable is set through a console variable (CVar) named CVarVTCsvStats. It’s initialized with a default value of 1, meaning the CSV stats are enabled by default.

The associated variable CVarVTCsvStats interacts directly with r.VT.CsvStats. They share the same value and purpose. CVarVTCsvStats is used in the C++ code to check the current setting and control the behavior of the virtual texturing system accordingly.

Developers must be aware that this variable has three possible values: 0: CSV stats are off 1: CSV stats are on (default) 2: CSV stats are on with verbose output

When using this variable, developers should consider the following best practices:

  1. Use the default value (1) for normal development and debugging scenarios.
  2. Set it to 0 if you want to reduce overhead in performance-critical situations where virtual texturing stats are not needed.
  3. Set it to 2 when you need more detailed information about the virtual texturing system for in-depth analysis or troubleshooting.
  4. Be mindful that enabling verbose stats (2) might have a performance impact, so use it judiciously.

Regarding the associated variable CVarVTCsvStats: This is the C++ representation of the r.VT.CsvStats console variable. It’s used within the engine code to check the current setting and control the behavior of the virtual texturing system. The UpdateCsvStats() function in the FVirtualTextureSystem class uses this variable to determine whether to collect and report stats, and at what level of detail.

When working with CVarVTCsvStats, developers should:

  1. Use GetValueOnRenderThread() to safely access its value in render thread code.
  2. Be aware that changing this value at runtime will affect the performance and behavior of the virtual texturing system.
  3. Consider exposing this setting in user-facing options if detailed control over virtual texturing profiling is needed in the final product.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VT/VirtualTextureSystem.cpp:152

Scope: file

Source code excerpt:

);
static TAutoConsoleVariable<int32> CVarVTCsvStats(
	TEXT("r.VT.CsvStats"),
	1,
	TEXT("Send virtual texturing stats to CSV profiler\n")
	TEXT("0=off, 1=on, 2=verbose"),
	ECVF_Default
);
static TAutoConsoleVariable<int32> CVarVTAsyncPageRequestTask(

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VT/VirtualTextureSystem.cpp:151

Scope: file

Source code excerpt:

	ECVF_Default
);
static TAutoConsoleVariable<int32> CVarVTCsvStats(
	TEXT("r.VT.CsvStats"),
	1,
	TEXT("Send virtual texturing stats to CSV profiler\n")
	TEXT("0=off, 1=on, 2=verbose"),
	ECVF_Default
);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VT/VirtualTextureSystem.cpp:2924

Scope (from outer to inner):

file
function     void FVirtualTextureSystem::UpdateCsvStats

Source code excerpt:

{
#if CSV_PROFILER
	if (CVarVTCsvStats.GetValueOnRenderThread() == 0)
	{
		return;
	}

	float MaxResidencyMipMapBias = 0.f;
	for (int32 SpaceIndex = 0u; SpaceIndex < PhysicalSpaces.Num(); ++SpaceIndex)

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VT/VirtualTextureSystem.cpp:2938

Scope (from outer to inner):

file
function     void FVirtualTextureSystem::UpdateCsvStats

Source code excerpt:

			MaxResidencyMipMapBias = FMath::Max(MaxResidencyMipMapBias, ResidencyMipMapBias);

			if (CVarVTCsvStats.GetValueOnRenderThread() == 2)
			{
				PhysicalSpace->UpdateCsvStats();
			}
		}
	}