r.VT.MaxUploadRequests
r.VT.MaxUploadRequests
#Overview
name: r.VT.MaxUploadRequests
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Maximum number of virtual texture tile upload requests that can be in flight.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.VT.MaxUploadRequests is to control the maximum number of virtual texture tile upload requests that can be in flight simultaneously. This setting is crucial for managing the performance and memory usage of the virtual texturing system in Unreal Engine 5.
This setting variable is primarily used by the rendering system, specifically the virtual texturing subsystem within the Engine module. Based on the callsites, it’s evident that the FVirtualTextureUploadCache class in the VirtualTextureUploadCache.cpp file relies on this setting.
The value of this variable is set using a TAutoConsoleVariable, which means it can be adjusted at runtime through console commands. The default value is set to 2000, but this can be changed as needed.
The associated variable CVarMaxUploadRequests interacts directly with r.VT.MaxUploadRequests. They share the same value and purpose. This variable is used in the IsInMemoryBudget function of the FVirtualTextureUploadCache class to determine if the current number of pending uploads and releases is within the specified limit.
Developers must be aware that this variable directly impacts the performance and memory usage of the virtual texturing system. Setting it too high might lead to excessive memory consumption, while setting it too low could bottleneck the texture uploading process and affect rendering quality.
Best practices when using this variable include:
- Monitoring performance metrics to find the optimal value for your specific use case.
- Adjusting the value based on the target hardware capabilities.
- Considering the relationship between this variable and other virtual texturing settings, such as r.VT.MaxUploadMemory.
- Using profiling tools to ensure that the virtual texturing system is not becoming a bottleneck due to this setting.
Regarding the associated variable CVarMaxUploadRequests:
The purpose of CVarMaxUploadRequests is the same as r.VT.MaxUploadRequests - to control the maximum number of virtual texture tile upload requests in flight.
It is used directly in the Engine module, specifically in the virtual texturing subsystem. The FVirtualTextureUploadCache class uses this variable to manage upload requests.
The value is set through the TAutoConsoleVariable declaration, with a default of 2000. It can be modified at runtime using console commands.
CVarMaxUploadRequests interacts directly with r.VT.MaxUploadRequests, as they share the same value. It’s also used in conjunction with CVarVTMaxUploadMemory to determine if the system is within memory budget.
Developers should be aware that this variable is accessed on the render thread (GetValueOnRenderThread()), which means changes to it will be applied on the next frame.
Best practices for CVarMaxUploadRequests are the same as for r.VT.MaxUploadRequests, focusing on performance optimization and hardware considerations.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/VT/VirtualTextureUploadCache.cpp:34
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarMaxUploadRequests(
TEXT("r.VT.MaxUploadRequests"),
2000,
TEXT("Maximum number of virtual texture tile upload requests that can be in flight."),
ECVF_RenderThreadSafe);
uint32 FVTUploadTileAllocator::Allocate(FRHICommandList& RHICmdList, EPixelFormat InFormat, uint32 InTileSize)
#Associated Variable and Callsites
This variable is associated with another variable named CVarMaxUploadRequests
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/VT/VirtualTextureUploadCache.cpp:33
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarMaxUploadRequests(
TEXT("r.VT.MaxUploadRequests"),
2000,
TEXT("Maximum number of virtual texture tile upload requests that can be in flight."),
ECVF_RenderThreadSafe);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/VT/VirtualTextureUploadCache.cpp:507
Scope (from outer to inner):
file
function uint32 FVirtualTextureUploadCache::IsInMemoryBudget
Source code excerpt:
{
return
PendingUpload.Num() + PendingRelease.Num() <= CVarMaxUploadRequests.GetValueOnRenderThread() &&
TileAllocator.TotalAllocatedBytes() <= (uint32)CVarVTMaxUploadMemory.GetValueOnRenderThread() * 1024u * 1024u;
}