r.VT.RefreshEntirePageTable

r.VT.RefreshEntirePageTable

#Overview

name: r.VT.RefreshEntirePageTable

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.VT.RefreshEntirePageTable is to control the refresh behavior of the Virtual Texture (VT) page table in Unreal Engine’s rendering system. It is specifically used to determine whether the entire page table texture should be refreshed every frame.

This setting variable is primarily used in the Virtual Texturing subsystem of Unreal Engine’s rendering module. Based on the callsites, it’s clear that this variable is integral to the VirtualTextureSpace functionality.

The value of this variable is set through a console variable (CVar) system. It’s defined with a default value of 0, meaning that by default, the entire page table is not refreshed every frame.

The associated variable CVarVTRefreshEntirePageTable directly interacts with r.VT.RefreshEntirePageTable. They share the same value and purpose.

Developers must be aware that enabling this variable (setting it to 1) will cause the entire page table texture to be refreshed every frame, which could have performance implications. This should be used cautiously and only when necessary, such as for debugging or specific rendering scenarios that require it.

Best practices when using this variable include:

  1. Leave it at the default value (0) for normal operation.
  2. Only enable it (set to 1) when debugging Virtual Texturing issues or when specifically required by the rendering technique being used.
  3. Monitor performance when enabled, as refreshing the entire page table every frame could be computationally expensive.

Regarding the associated variable CVarVTRefreshEntirePageTable:

The purpose of CVarVTRefreshEntirePageTable is identical to r.VT.RefreshEntirePageTable. It’s the C++ variable that directly controls the behavior specified by the console variable.

This variable is used within the Renderer module, specifically in the Virtual Texturing system. It’s checked in the ApplyUpdates function of the FVirtualTextureSpace class to determine whether to refresh the entire page table.

The value of CVarVTRefreshEntirePageTable is set by the console variable system when r.VT.RefreshEntirePageTable is modified.

Developers should be aware that this variable is accessed on the render thread, as indicated by the GetValueOnRenderThread() call. This means any changes to the console variable will be reflected in the rendering pipeline on the next frame.

Best practices for CVarVTRefreshEntirePageTable align with those for r.VT.RefreshEntirePageTable, as they are essentially the same setting exposed in different ways (console variable and C++ variable).

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VT/VirtualTextureSpace.cpp:21

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarVTRefreshEntirePageTable(
	TEXT("r.VT.RefreshEntirePageTable"),
	0,
	TEXT("Refreshes the entire page table texture every frame"),
	ECVF_RenderThreadSafe
	);

static TAutoConsoleVariable<int32> CVarVTMaskedPageTableUpdates(

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VT/VirtualTextureSpace.cpp:20

Scope: file

Source code excerpt:

DEFINE_LOG_CATEGORY_STATIC(LogVirtualTextureSpace, Log, All);

static TAutoConsoleVariable<int32> CVarVTRefreshEntirePageTable(
	TEXT("r.VT.RefreshEntirePageTable"),
	0,
	TEXT("Refreshes the entire page table texture every frame"),
	ECVF_RenderThreadSafe
	);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VT/VirtualTextureSpace.cpp:378

Scope (from outer to inner):

file
function     void FVirtualTextureSpace::ApplyUpdates

Source code excerpt:

	{
		FTexturePageMap& PageMap = PhysicalPageMap[LayerIndex];
		if (bForceEntireUpdate || CVarVTRefreshEntirePageTable.GetValueOnRenderThread())
		{
			PageMap.RefreshEntirePageTable(System, ExpandedUpdates[LayerIndex]);
		}
		else
		{
			for (const FPageTableUpdate& Update : PageTableUpdates[LayerIndex])