r.VT.MaxUploadsPerFrame
r.VT.MaxUploadsPerFrame
#Overview
name: r.VT.MaxUploadsPerFrame
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Max number of page uploads per frame in game
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.VT.MaxUploadsPerFrame is to control the maximum number of virtual texture page uploads that can occur per frame in the game. This setting is part of Unreal Engine’s virtual texturing system, which is a crucial component of the rendering pipeline.
This setting variable is primarily used by the Virtual Texturing subsystem within Unreal Engine’s rendering module. Based on the callsites, it’s evident that this variable is utilized in the VirtualTextureScalability namespace, indicating its role in managing the scalability of virtual textures.
The value of this variable is set through the console variable system in Unreal Engine. It’s initialized with a default value of 8, but can be modified at runtime or through configuration files.
The associated variable CVarVTMaxUploadsPerFrame directly interacts with r.VT.MaxUploadsPerFrame. They share the same value and purpose. This console variable is used to retrieve the current setting value in the engine code.
Developers must be aware that this variable affects the rendering performance and memory usage. Setting it too high might lead to increased memory consumption and potential frame rate drops, while setting it too low might result in slower texture streaming and visual popping.
Best practices when using this variable include:
- Adjusting it based on the target hardware capabilities.
- Balancing it with other virtual texturing settings for optimal performance.
- Testing thoroughly with different values to find the sweet spot for your specific game.
- Considering different values for different quality settings in your game.
Regarding the associated variable CVarVTMaxUploadsPerFrame:
The purpose of CVarVTMaxUploadsPerFrame is to provide programmatic access to the r.VT.MaxUploadsPerFrame setting within the engine code. It’s an instance of TAutoConsoleVariable
This variable is used directly in the VirtualTextureScalability namespace to retrieve the current setting value. It’s particularly important in the GetMaxUploadsPerFrame() function, which determines the maximum uploads per frame based on whether the engine is running in editor mode or not.
The value of CVarVTMaxUploadsPerFrame is set automatically by the engine when r.VT.MaxUploadsPerFrame is modified, ensuring they always have the same value.
Developers should be aware that this variable is marked as render thread safe (ECVF_RenderThreadSafe) and as a scalability setting (ECVF_Scalability). This means it can be safely accessed from the render thread and is intended to be adjusted for different quality presets.
Best practices for using CVarVTMaxUploadsPerFrame include:
- Using GetValueOnAnyThread() when accessing its value, as shown in the provided code.
- Being cautious when modifying it directly, as it should generally be controlled through r.VT.MaxUploadsPerFrame.
- Considering the different behavior in editor mode vs. game mode when using this variable.
#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:18
Scope (from outer to inner):
file
namespace VirtualTextureScalability
Source code excerpt:
static TAutoConsoleVariable<int32> CVarVTMaxUploadsPerFrame(
TEXT("r.VT.MaxUploadsPerFrame"),
8,
TEXT("Max number of page uploads per frame in game"),
ECVF_RenderThreadSafe | ECVF_Scalability
);
static TAutoConsoleVariable<int32> CVarVTMaxUploadsPerFrameStreaming(
#Associated Variable and Callsites
This variable is associated with another variable named CVarVTMaxUploadsPerFrame
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/VT/VirtualTextureScalability.cpp:17
Scope (from outer to inner):
file
namespace VirtualTextureScalability
Source code excerpt:
#endif
static TAutoConsoleVariable<int32> CVarVTMaxUploadsPerFrame(
TEXT("r.VT.MaxUploadsPerFrame"),
8,
TEXT("Max number of page uploads per frame in game"),
ECVF_RenderThreadSafe | ECVF_Scalability
);
#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()
{
int32 Budget = CVarVTMaxUploadsPerFrameStreaming.GetValueOnAnyThread();