r.VT.MaxUploadsPerFrameInEditor

r.VT.MaxUploadsPerFrameInEditor

#Overview

name: r.VT.MaxUploadsPerFrameInEditor

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.MaxUploadsPerFrameInEditor is to control the maximum number of virtual texture page uploads per frame when working in the Unreal Engine editor. This setting is specifically designed for the virtual texturing system, which is part of Unreal Engine’s rendering subsystem.

This setting variable is primarily used in the VirtualTextureScalability namespace, which is part of the Engine module. It’s specifically utilized in the rendering thread, as indicated by the ECVF_RenderThreadSafe flag.

The value of this variable is set through the console variable system, with a default value of 32. It can be modified at runtime through console commands or project settings.

The associated variable CVarVTMaxUploadsPerFrameInEditor directly interacts with r.VT.MaxUploadsPerFrameInEditor. They share the same value and are used interchangeably in the code.

Developers should be aware that this variable only affects the editor environment. It’s designed to ensure responsive updates while editing, bypassing the regular scalability settings that might limit virtual texture uploads in a game environment.

Best practices when using this variable include:

  1. Adjusting it if you experience performance issues related to virtual texture uploads in the editor.
  2. Keeping in mind that increasing this value may improve responsiveness but could also increase memory usage and potentially impact editor performance.
  3. Using it in conjunction with other virtual texturing settings for optimal performance.

Regarding the associated variable CVarVTMaxUploadsPerFrameInEditor:

The purpose of CVarVTMaxUploadsPerFrameInEditor is to provide a programmatic interface to the r.VT.MaxUploadsPerFrameInEditor setting within the engine’s C++ code.

This variable is used in the VirtualTextureScalability namespace, specifically in the GetMaxUploadsPerFrame() and GetMaxUploadsPerFrameForStreamingVT() functions. These functions are likely part of the virtual texturing system’s core logic for managing texture uploads.

The value of CVarVTMaxUploadsPerFrameInEditor is set when the r.VT.MaxUploadsPerFrameInEditor console variable is initialized.

This variable interacts directly with the editor state (GIsEditor) to determine whether to use the editor-specific upload limit or the general game upload limit.

Developers should be aware that this variable is only defined and used when WITH_EDITOR is defined, meaning it’s not available in shipping builds.

Best practices for using this variable include:

  1. Using GetValueOnAnyThread() when accessing its value, as shown in the provided code snippets.
  2. Considering the impact on editor performance when modifying this value.
  3. Testing any changes thoroughly in the editor environment to ensure they don’t negatively impact the editing experience.

#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:10

Scope (from outer to inner):

file
namespace    VirtualTextureScalability

Source code excerpt:

#if WITH_EDITOR
	static TAutoConsoleVariable<int32> CVarVTMaxUploadsPerFrameInEditor(
		TEXT("r.VT.MaxUploadsPerFrameInEditor"),
		32,
		TEXT("Max number of page uploads per frame when in editor"),
		ECVF_RenderThreadSafe
	);
#endif 

#Associated Variable and Callsites

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

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

Scope (from outer to inner):

file
namespace    VirtualTextureScalability

Source code excerpt:

{
#if WITH_EDITOR
	static TAutoConsoleVariable<int32> CVarVTMaxUploadsPerFrameInEditor(
		TEXT("r.VT.MaxUploadsPerFrameInEditor"),
		32,
		TEXT("Max number of page uploads per frame when in editor"),
		ECVF_RenderThreadSafe
	);
#endif 

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

Scope (from outer to inner):

file
namespace    VirtualTextureScalability
function     int32 GetMaxUploadsPerFrame

Source code excerpt:

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

	int32 GetMaxUploadsPerFrameForStreamingVT()

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

Scope (from outer to inner):

file
namespace    VirtualTextureScalability
function     int32 GetMaxUploadsPerFrameForStreamingVT

Source code excerpt:

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

	int32 GetMaxPagesProducedPerFrame()