r.VT.MaxContinuousUpdatesPerFrameInEditor

r.VT.MaxContinuousUpdatesPerFrameInEditor

#Overview

name: r.VT.MaxContinuousUpdatesPerFrameInEditor

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.MaxContinuousUpdatesPerFrameInEditor is to control the maximum number of page uploads for Virtual Texture (VT) pages that are already mapped when in the Unreal Engine editor.

This setting variable is primarily used by the Virtual Texture system, which is part of the rendering subsystem in Unreal Engine 5. It specifically affects the behavior of Virtual Texture updates in the editor environment.

The value of this variable is set through a console variable (CVar) system, initialized with a default value of 8. It can be modified at runtime through console commands or project settings.

This variable interacts closely with its associated variable CVarVTMaxContinuousUpdatesPerFrameInEditor. They share the same value and purpose, with CVarVTMaxContinuousUpdatesPerFrameInEditor being the actual CVar object used in the code.

Developers should be aware that this variable only affects the editor environment, as indicated by the #if WITH_EDITOR preprocessor directive. It’s designed to prevent scalability settings from affecting the editor, where reactive updates are crucial for features like GPULightmass.

Best practices when using this variable include:

  1. Adjusting it carefully to balance between performance and update responsiveness in the editor.
  2. Considering the impact on memory usage and rendering performance when increasing this value.
  3. Being aware that this setting doesn’t affect packaged games, only the editor environment.

Regarding the associated variable CVarVTMaxContinuousUpdatesPerFrameInEditor:

This is the actual CVar object used to store and retrieve the value of r.VT.MaxContinuousUpdatesPerFrameInEditor. It’s defined as a static TAutoConsoleVariable, which means it’s an integer console variable that can be modified at runtime.

The value of CVarVTMaxContinuousUpdatesPerFrameInEditor is used in the GetMaxContinuousUpdatesPerFrame function, which determines the maximum number of continuous updates per frame. In the editor, this function returns the value of CVarVTMaxContinuousUpdatesPerFrameInEditor, while in non-editor builds, it returns the value of a different variable (CVarVTMaxContinuousUpdatesPerFrame).

Developers should note that modifying this variable directly in code or through console commands will affect the behavior of Virtual Texture updates in the editor. It’s important to consider the trade-offs between update frequency and performance when adjusting this value.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/VT/VirtualTextureScalability.cpp:42

Scope (from outer to inner):

file
namespace    VirtualTextureScalability

Source code excerpt:

#if WITH_EDITOR
	static TAutoConsoleVariable<int32> CVarVTMaxContinuousUpdatesPerFrameInEditor(
		TEXT("r.VT.MaxContinuousUpdatesPerFrameInEditor"),
		8,
		TEXT("Max number of page uploads for pages that are already mapped when in editor."),
		ECVF_RenderThreadSafe | ECVF_Scalability
	);
#endif

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/VT/VirtualTextureScalability.cpp:41

Scope (from outer to inner):

file
namespace    VirtualTextureScalability

Source code excerpt:


#if WITH_EDITOR
	static TAutoConsoleVariable<int32> CVarVTMaxContinuousUpdatesPerFrameInEditor(
		TEXT("r.VT.MaxContinuousUpdatesPerFrameInEditor"),
		8,
		TEXT("Max number of page uploads for pages that are already mapped when in editor."),
		ECVF_RenderThreadSafe | ECVF_Scalability
	);
#endif

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/VT/VirtualTextureScalability.cpp:190

Scope (from outer to inner):

file
namespace    VirtualTextureScalability
function     int32 GetMaxContinuousUpdatesPerFrame

Source code excerpt:

#if WITH_EDITOR
		// Don't want this scalability setting to affect editor because we rely on reactive updates while editing, like GPULightmass.
		return GIsEditor ? CVarVTMaxContinuousUpdatesPerFrameInEditor.GetValueOnAnyThread() : CVarVTMaxContinuousUpdatesPerFrame.GetValueOnAnyThread();
#else
		return CVarVTMaxContinuousUpdatesPerFrame.GetValueOnAnyThread();
#endif
	}

	int32 GetMaxAllocatedVTReleasedPerFrame()