r.DynamicRes.TargetedGPUHeadRoomPercentage
r.DynamicRes.TargetedGPUHeadRoomPercentage
#Overview
name: r.DynamicRes.TargetedGPUHeadRoomPercentage
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Targeted GPU headroom (in percent from r.DynamicRes.FrameTimeBudget).
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.DynamicRes.TargetedGPUHeadRoomPercentage is to control the targeted GPU headroom as a percentage of the frame time budget in Unreal Engine’s dynamic resolution system. This setting is part of the engine’s performance optimization and rendering pipeline.
The Unreal Engine subsystem that relies on this setting variable is the Dynamic Resolution system, which is part of the rendering module. This can be inferred from the file location (DynamicResolution.cpp) and the variable’s name.
The value of this variable is set as a console variable (CVar) with a default value of 10.0f. It can be modified at runtime through console commands or programmatically.
The associated variable CVarTargetedGPUHeadRoomPercentage directly interacts with r.DynamicRes.TargetedGPUHeadRoomPercentage. They share the same value and are used interchangeably in the code.
Developers must be aware that this variable affects the dynamic resolution system’s behavior. It determines how much headroom the system aims to maintain in GPU performance, which can impact both visual quality and performance.
Best practices when using this variable include:
- Adjusting it carefully to balance between performance and visual quality.
- Testing thoroughly with different values to find the optimal setting for your specific game or application.
- Considering the target hardware when setting this value, as different GPUs may require different headroom settings.
Regarding the associated variable CVarTargetedGPUHeadRoomPercentage:
- Its purpose is the same as r.DynamicRes.TargetedGPUHeadRoomPercentage, serving as the internal representation of the console variable.
- It is used in the DynamicRenderScaling::FHeuristicSettings GetPrimaryDynamicResolutionSettings function to calculate the targeted headroom for the dynamic resolution system.
- The value is converted from a percentage to a fraction using the GetPercentageCVarToFraction function before being used in calculations.
- Developers should be aware that modifying CVarTargetedGPUHeadRoomPercentage directly in code will have the same effect as changing r.DynamicRes.TargetedGPUHeadRoomPercentage through console commands.
#Setting Variables
#References In INI files
Location: <Workspace>/Projects/Lyra/Config/DefaultDeviceProfiles.ini:77, section: [IOS DeviceProfile]
- INI Section:
IOS DeviceProfile
- Raw value:
5.0
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DynamicResolution.cpp:72
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarTargetedGPUHeadRoomPercentage(
TEXT("r.DynamicRes.TargetedGPUHeadRoomPercentage"),
10.0f,
TEXT("Targeted GPU headroom (in percent from r.DynamicRes.FrameTimeBudget)."),
ECVF_RenderThreadSafe | ECVF_Default);
/** On desktop, the swap chain doesn't allow tear amount configuration, so an overbudget frame can be droped with r.VSync=1.
* So need to lower the heuristic's target budget to lower chances to go overbudget.
#Associated Variable and Callsites
This variable is associated with another variable named CVarTargetedGPUHeadRoomPercentage
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DynamicResolution.cpp:71
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarTargetedGPUHeadRoomPercentage(
TEXT("r.DynamicRes.TargetedGPUHeadRoomPercentage"),
10.0f,
TEXT("Targeted GPU headroom (in percent from r.DynamicRes.FrameTimeBudget)."),
ECVF_RenderThreadSafe | ECVF_Default);
/** On desktop, the swap chain doesn't allow tear amount configuration, so an overbudget frame can be droped with r.VSync=1.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DynamicResolution.cpp:154
Scope (from outer to inner):
file
function DynamicRenderScaling::FHeuristicSettings GetPrimaryDynamicResolutionSettings
Source code excerpt:
BudgetSetting.BudgetMs = CVarFrameTimeBudget.GetValueOnAnyThread() * (1.0f - DynamicRenderScaling::GetPercentageCVarToFraction(CVarOverBudgetGPUHeadRoomPercentage));
BudgetSetting.ChangeThreshold = DynamicRenderScaling::GetPercentageCVarToFraction(CVarChangeThreshold);
BudgetSetting.TargetedHeadRoom = DynamicRenderScaling::GetPercentageCVarToFraction(CVarTargetedGPUHeadRoomPercentage);
BudgetSetting.IncreaseAmortizationFactor = CVarIncreaseAmortizationFactor.GetValueOnAnyThread();
return BudgetSetting;
}
DynamicRenderScaling::FBudget GDynamicPrimaryResolutionFraction(TEXT("DynamicPrimaryResolution"), &GetPrimaryDynamicResolutionSettings);