r.DynamicRes.OperationMode

r.DynamicRes.OperationMode

#Overview

name: r.DynamicRes.OperationMode

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 5 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.DynamicRes.OperationMode is to control the operation mode for dynamic resolution in Unreal Engine 5. This setting variable is primarily used in the rendering system to determine whether dynamic resolution should be enabled and under what conditions.

This setting variable is mainly utilized by the Engine module, as evidenced by its references in UnrealEngine.cpp and Engine.h. It’s also used in the FunctionalTesting module for automated testing purposes.

The value of this variable is set through a console variable (CVarDynamicResOperationMode) defined in UnrealEngine.cpp. It can take three possible values: 0: Disabled (default) 1: Enable according to the game user settings 2: Enable regardless of the game user settings

The associated variable CVarDynamicResOperationMode interacts directly with r.DynamicRes.OperationMode, as they share the same value and purpose.

Developers must be aware that this variable affects the dynamic resolution system, which can impact game performance and visual quality. The chosen mode determines whether dynamic resolution is disabled, enabled based on user settings, or forcibly enabled.

Best practices when using this variable include:

  1. Use mode 1 (Enable according to the game user settings) in most cases to give players control over dynamic resolution.
  2. Use mode 2 (Enable regardless of the game user settings) cautiously, as it might override user preferences.
  3. Consider performance implications when enabling dynamic resolution, especially on lower-end hardware.
  4. Test thoroughly with different modes to ensure proper functionality and visual quality across various scenarios.

Regarding the associated variable CVarDynamicResOperationMode: This is a console variable that directly controls the r.DynamicRes.OperationMode setting. It’s defined in the Engine module and is used to get and set the operation mode for dynamic resolution. The variable is accessed in the UEngine::ShouldEnableDynamicResolutionState() function to determine whether dynamic resolution should be enabled. Developers should use this variable when they need to programmatically check or modify the dynamic resolution operation mode at runtime.

#Setting Variables

#References In INI files

Location: <Workspace>/Projects/Lyra/Config/DefaultDeviceProfiles.ini:79, 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/UnrealEngine.cpp:426

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int> CVarDynamicResOperationMode(
	TEXT("r.DynamicRes.OperationMode"),
	0,
	TEXT("Select the operation mode for dynamic resolution.\n")
	TEXT(" 0: Disabled (default);\n")
	TEXT(" 1: Enable according to the game user settings;\n")
	TEXT(" 2: Enable regardless of the game user settings."),
	ECVF_RenderThreadSafe | ECVF_Default);

#Loc: <Workspace>/Engine/Source/Developer/FunctionalTesting/Private/AutomationBlueprintFunctionLibrary.cpp:250

Scope (from outer to inner):

file
function     FAutomationTestScreenshotEnvSetup::FAutomationTestScreenshotEnvSetup

Source code excerpt:

	, ScreenPercentage(TEXT("r.ScreenPercentage"))
	, DynamicResTestScreenPercentage(TEXT("r.DynamicRes.TestScreenPercentage"))
	, DynamicResOperationMode(TEXT("r.DynamicRes.OperationMode"))
	, SecondaryScreenPercentage(TEXT("r.SecondaryScreenPercentage.GameViewport"))
{
}

FAutomationTestScreenshotEnvSetup::~FAutomationTestScreenshotEnvSetup()
{

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Engine/Engine.h:120

Scope: file

Source code excerpt:

	Unsupported,

	// Dynamic resolution is disabled by project setting cvar r.DynamicRes.OperationMode=0 or disabled by game user
	// settings with r.DynamicRes.OperationMode=1.
	Disabled,

	// Dynamic resolution has been paused by game thread.
	Paused,

	// Dynamic resolution is currently enabled.

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UnrealEngine.cpp:425

Scope: file

Source code excerpt:

#endif // !UE_BUILD_SHIPPING

static TAutoConsoleVariable<int> CVarDynamicResOperationMode(
	TEXT("r.DynamicRes.OperationMode"),
	0,
	TEXT("Select the operation mode for dynamic resolution.\n")
	TEXT(" 0: Disabled (default);\n")
	TEXT(" 1: Enable according to the game user settings;\n")
	TEXT(" 2: Enable regardless of the game user settings."),

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UnrealEngine.cpp:13177

Scope (from outer to inner):

file
function     bool UEngine::ShouldEnableDynamicResolutionState

Source code excerpt:

	}

	int32 OperationMode = CVarDynamicResOperationMode.GetValueOnGameThread();
	
	// Whether dynamic resolution is allowed to be enabled.
	bool bEnable = ((OperationMode == 2) || (OperationMode == 1 && bDynamicResolutionEnableUserSetting)) && !bIsDynamicResolutionPaused;

#if WITH_EDITOR
	if (GIsEditor && bEnable)