r.DynamicRes.OverBudgetGPUHeadRoomPercentage

r.DynamicRes.OverBudgetGPUHeadRoomPercentage

#Overview

name: r.DynamicRes.OverBudgetGPUHeadRoomPercentage

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.OverBudgetGPUHeadRoomPercentage is to control the amount of GPU headroom needed before a frame is considered over budget in Unreal Engine’s dynamic resolution system. This setting is specifically for platforms that do not support controllable tearing with VSync.

This setting variable is primarily used by the dynamic resolution system, which is part of Unreal Engine’s rendering subsystem. It’s referenced in the DynamicResolution.cpp file, which suggests it’s an integral part of the engine’s dynamic resolution implementation.

The value of this variable is set as a console variable (CVar) with a default value of 0.0f. It can be modified at runtime through the console or configuration files.

This variable interacts closely with other dynamic resolution settings, particularly r.DynamicRes.FrameTimeBudget. The OverBudgetGPUHeadRoomPercentage is used to calculate a portion of the frame time budget that should be reserved as headroom.

Developers should be aware that this setting is specifically for platforms without controllable tearing support with VSync. It’s expressed as a percentage of the r.DynamicRes.FrameTimeBudget value.

Best practices when using this variable include:

  1. Adjusting it based on the specific platform requirements.
  2. Considering the trade-off between performance and visual quality.
  3. Testing thoroughly on target platforms to ensure optimal settings.

Regarding the associated variable CVarOverBudgetGPUHeadRoomPercentage:

This is the actual C++ variable that holds the console variable. It’s used internally by the engine to access and modify the r.DynamicRes.OverBudgetGPUHeadRoomPercentage value.

The purpose of CVarOverBudgetGPUHeadRoomPercentage is to provide a programmatic interface to the r.DynamicRes.OverBudgetGPUHeadRoomPercentage setting within the C++ code of the engine.

This variable is used in the DynamicResolution.cpp file, specifically in the GetPrimaryDynamicResolutionSettings function of the DynamicRenderScaling namespace. Here, it’s used to calculate the BudgetMs value for the dynamic resolution system.

The value of this variable is set when the console variable is initialized, and it can be accessed or modified through the GetValueOnAnyThread() method.

CVarOverBudgetGPUHeadRoomPercentage interacts directly with other dynamic resolution settings in the calculation of budget settings.

Developers working directly with the engine source code should be aware that this is the actual variable they should use when referencing the OverBudgetGPUHeadRoomPercentage in C++ code.

Best practices when using this variable in C++ code include:

  1. Always access its value using the GetValueOnAnyThread() method to ensure thread-safety.
  2. Be aware that changes to this variable will affect the dynamic resolution system’s behavior.
  3. Consider the implications on performance and visual quality when modifying this value programmatically.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DynamicResolution.cpp:85

Scope: file

Source code excerpt:

 */
static TAutoConsoleVariable<float> CVarOverBudgetGPUHeadRoomPercentage(
	TEXT("r.DynamicRes.OverBudgetGPUHeadRoomPercentage"),
	0.0f,
	TEXT("Amount of GPU headroom needed from which the frame is considered over budget. This is for platform not supporting controllable tearing with VSync (in percent from r.DynamicRes.FrameTimeBudget)."),
	ECVF_RenderThreadSafe | ECVF_Default);

static TAutoConsoleVariable<int32> CVarHistorySize(
	TEXT("r.DynamicRes.HistorySize"),

#Associated Variable and Callsites

This variable is associated with another variable named CVarOverBudgetGPUHeadRoomPercentage. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DynamicResolution.cpp:84

Scope: file

Source code excerpt:

 * Given we can measure other application's GPU cost, need to leave enough headroom for them all the time.
 */
static TAutoConsoleVariable<float> CVarOverBudgetGPUHeadRoomPercentage(
	TEXT("r.DynamicRes.OverBudgetGPUHeadRoomPercentage"),
	0.0f,
	TEXT("Amount of GPU headroom needed from which the frame is considered over budget. This is for platform not supporting controllable tearing with VSync (in percent from r.DynamicRes.FrameTimeBudget)."),
	ECVF_RenderThreadSafe | ECVF_Default);

static TAutoConsoleVariable<int32> CVarHistorySize(

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DynamicResolution.cpp:152

Scope (from outer to inner):

file
function     DynamicRenderScaling::FHeuristicSettings GetPrimaryDynamicResolutionSettings

Source code excerpt:

	BudgetSetting.ThrottlingMaxResolutionFraction = DynamicRenderScaling::GetPercentageCVarToFraction(CVarDynamicResThrottlingMaxSP);
	BudgetSetting.UpperBoundQuantization     = CVarUpperBoundQuantization.GetValueOnAnyThread();
	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;
}