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).

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:

  1. Adjusting it carefully to balance between performance and visual quality.
  2. Testing thoroughly with different values to find the optimal setting for your specific game or application.
  3. Considering the target hardware when setting this value, as different GPUs may require different headroom settings.

Regarding the associated variable CVarTargetedGPUHeadRoomPercentage:

#Setting Variables

#References In INI files

Location: <Workspace>/Projects/Lyra/Config/DefaultDeviceProfiles.ini:77, section: [IOS DeviceProfile]

#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);