wp.Runtime.HLOD.WarmupVTSizeClamp
wp.Runtime.HLOD.WarmupVTSizeClamp
#Overview
name: wp.Runtime.HLOD.WarmupVTSizeClamp
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Clamp VT warmup requests for safety.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of wp.Runtime.HLOD.WarmupVTSizeClamp is to limit the maximum size of Virtual Texture (VT) warmup requests for safety in the Hierarchical Level of Detail (HLOD) system of Unreal Engine 5.
This setting variable is primarily used in the World Partition and HLOD subsystems of Unreal Engine 5. It’s specifically utilized in the HLODRuntimeSubsystem, which is part of the Engine module.
The value of this variable is set as a console variable (CVar) with a default value of 2048. It can be modified at runtime through the console or configuration files.
The variable interacts closely with another variable named CVarHLODWarmupVTSizeClamp, which is the actual TAutoConsoleVariable that stores and provides access to the value.
Developers must be aware that this variable acts as a safety measure to prevent excessively large VT warmup requests. It’s used to clamp the pixel size of VT requests, which could potentially impact texture quality and memory usage.
Best practices when using this variable include:
- Carefully considering the implications of modifying its value, as it directly affects the HLOD system’s behavior.
- Monitoring performance and memory usage when adjusting this value, as larger values may increase memory consumption and loading times.
- Using it in conjunction with other HLOD and VT-related settings for optimal performance.
Regarding the associated variable CVarHLODWarmupVTSizeClamp:
The purpose of CVarHLODWarmupVTSizeClamp is to provide a programmatic interface to the wp.Runtime.HLOD.WarmupVTSizeClamp setting within the C++ code.
This variable is used directly in the Engine module, specifically in the HLODRuntimeSubsystem.
The value of CVarHLODWarmupVTSizeClamp is set when the console variable is initialized, using the same default value (2048) as wp.Runtime.HLOD.WarmupVTSizeClamp.
CVarHLODWarmupVTSizeClamp interacts closely with the wp.Runtime.HLOD.WarmupVTSizeClamp setting, essentially serving as its in-code representation.
Developers should be aware that modifying CVarHLODWarmupVTSizeClamp directly in code will have the same effect as changing the wp.Runtime.HLOD.WarmupVTSizeClamp setting.
Best practices for using CVarHLODWarmupVTSizeClamp include:
- Using GetValueOnAnyThread() when accessing its value, as shown in the provided code snippet.
- Considering thread safety when accessing or modifying this variable, as it might be accessed from multiple threads.
- Using it consistently throughout the codebase when clamping VT warmup request sizes for HLOD.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/WorldPartition/HLOD/HLODRuntimeSubsystem.cpp:67
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarHLODWarmupVTSizeClamp(
TEXT("wp.Runtime.HLOD.WarmupVTSizeClamp"),
2048,
TEXT("Clamp VT warmup requests for safety."));
static void HLODRuntimeSubsystemCVarSinkFunction()
{
for (UWorld* World : TObjectRange<UWorld>(RF_ClassDefaultObject | RF_ArchetypeObject, true, EInternalObjectFlags::Garbage))
#Associated Variable and Callsites
This variable is associated with another variable named CVarHLODWarmupVTSizeClamp
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/WorldPartition/HLOD/HLODRuntimeSubsystem.cpp:66
Scope: file
Source code excerpt:
TEXT("Scale the VT size we ask to prefetch by this factor."));
static TAutoConsoleVariable<int32> CVarHLODWarmupVTSizeClamp(
TEXT("wp.Runtime.HLOD.WarmupVTSizeClamp"),
2048,
TEXT("Clamp VT warmup requests for safety."));
static void HLODRuntimeSubsystemCVarSinkFunction()
{
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/WorldPartition/HLOD/HLODRuntimeSubsystem.cpp:418
Scope (from outer to inner):
file
function static void PrepareVTRequests
Source code excerpt:
// Clamp for safety
PixelSize = FMath::Min(PixelSize, CVarHLODWarmupVTSizeClamp.GetValueOnAnyThread());
for (UMaterialInterface* MaterialInterface : InStaticMeshComponent->GetMaterials())
{
// We have a VT we'd like to prefetch, add or update a request in our request map.
// If the texture was already requested by another component, fetch the highest required resolution only.
float& CurrentMaxPixel = InOutVTRequests.FindOrAdd(MaterialInterface);