r.VT.Residency.UpperBound
r.VT.Residency.UpperBound
#Overview
name: r.VT.Residency.UpperBound
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Virtual Texture pool residency above which we increase mip bias.\nDefault 0.95
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.VT.Residency.UpperBound is to control the upper bound of the Virtual Texture (VT) pool residency, above which the system will increase the mip bias. This setting is part of Unreal Engine’s Virtual Texturing system, which is a key component of the rendering subsystem.
This setting variable is primarily used by the Renderer module, specifically within the Virtual Texturing subsystem. It’s defined and used in the VirtualTexturePhysicalSpace.cpp file, which handles the management of physical space for virtual textures.
The value of this variable is set through a console variable (CVar) system, with a default value of 0.95 (95%). This means that by default, when the VT pool residency exceeds 95%, the system will start increasing the mip bias to manage memory usage.
The variable interacts closely with other VT residency-related variables, such as CVarVTResidencyLowerBound and CVarVTResidencyLockedUpperBound. These variables work together to manage the residency of virtual textures in memory.
Developers should be aware that this variable directly affects the quality and performance trade-off in virtual texturing. A higher value allows for higher quality textures to remain in memory longer but may increase memory pressure. A lower value may improve performance but could lead to more frequent texture streaming and potentially lower visual quality.
Best practices when using this variable include:
- Monitoring its impact on performance and visual quality.
- Adjusting it in conjunction with other VT residency variables for optimal results.
- Testing different values in various scenarios to find the best balance for your specific game or application.
The associated variable CVarVTResidencyUpperBound is the actual CVar object that stores and manages the r.VT.Residency.UpperBound value. It’s used to retrieve the current value of the setting in the rendering code, specifically in the FVirtualTexturePhysicalSpace::UpdateResidencyTracking function. This function appears to be responsible for updating the residency tracking of virtual textures, using the upper bound value to determine when to adjust the mip bias.
When working with CVarVTResidencyUpperBound, developers should:
- Use GetValueOnRenderThread() to safely access its value from the render thread.
- Be aware that changes to this value at runtime will affect the behavior of the Virtual Texturing system.
- Consider the performance implications of frequently accessing or changing this value, as it’s used in render thread operations.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VT/VirtualTexturePhysicalSpace.cpp:26
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarVTResidencyUpperBound(
TEXT("r.VT.Residency.UpperBound"),
0.95f,
TEXT("Virtual Texture pool residency above which we increase mip bias.\n")
TEXT("Default 0.95"),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<float> CVarVTResidencyLowerBound(
#Associated Variable and Callsites
This variable is associated with another variable named CVarVTResidencyUpperBound
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VT/VirtualTexturePhysicalSpace.cpp:25
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<float> CVarVTResidencyUpperBound(
TEXT("r.VT.Residency.UpperBound"),
0.95f,
TEXT("Virtual Texture pool residency above which we increase mip bias.\n")
TEXT("Default 0.95"),
ECVF_RenderThreadSafe);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VT/VirtualTexturePhysicalSpace.cpp:218
Scope (from outer to inner):
file
function void FVirtualTexturePhysicalSpace::UpdateResidencyTracking
Source code excerpt:
float LockedUpperBound = CVarVTResidencyLockedUpperBound.GetValueOnRenderThread();
float LowerBound = CVarVTResidencyLowerBound.GetValueOnRenderThread();
float UpperBound = CVarVTResidencyUpperBound.GetValueOnRenderThread();
float AdjustmentRate = CVarVTResidencyAdjustmentRate.GetValueOnRenderThread();
float MaxMipMapBias = CVarVTResidencyMaxMipMapBias.GetValueOnRenderThread();
const uint32 NumPages = Pool.GetNumPages();
const uint32 NumLockedPages = Pool.GetNumLockedPages();
const float LockedPageResidency = (float)NumLockedPages / (float)NumPages;