dp.AllowScalabilityGroupsToChangeAtRuntime

dp.AllowScalabilityGroupsToChangeAtRuntime

#Overview

name: dp.AllowScalabilityGroupsToChangeAtRuntime

The value of this variable can be defined or overridden in .ini config files. 5 .ini config files referencing this setting variable.

This variable is created as a Console Variable (cvar).

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of dp.AllowScalabilityGroupsToChangeAtRuntime is to control whether device profile scalability bucket console variables (CVars) can be changed at runtime. This setting is primarily used for the device profile and scalability systems in Unreal Engine 5.

This setting variable is relied upon by the Device Profile Manager subsystem, which is part of the Engine module. It’s specifically used in the UDeviceProfileManager class to determine how to handle scalability-related console variables.

The value of this variable is set in two ways:

  1. It’s initialized with a default value of 0 when the TAutoConsoleVariable is created.
  2. It can be overridden by a value in the [ConsoleVariables] section of the Engine.ini file.

The associated variable CVarAllowScalabilityGroupsToChangeAtRuntime directly interacts with dp.AllowScalabilityGroupsToChangeAtRuntime. They share the same value and purpose.

Developers must be aware that:

  1. By default, this setting is off (set to 0).
  2. When enabled, it allows scalability bucket CVars to be changed at runtime, which can impact performance and visual quality dynamically.
  3. This setting affects how the Device Profile Manager applies CVars, particularly those starting with “sg.” (scalability group).

Best practices when using this variable include:

  1. Only enable it if runtime changes to scalability settings are necessary for your project.
  2. Be cautious when enabling it, as it can lead to unexpected behavior if scalability settings change during gameplay.
  3. If enabled, ensure proper testing across various scenarios to verify that runtime changes don’t negatively impact the user experience.

Regarding the associated variable CVarAllowScalabilityGroupsToChangeAtRuntime:

Developers should treat CVarAllowScalabilityGroupsToChangeAtRuntime as the in-code representation of the dp.AllowScalabilityGroupsToChangeAtRuntime setting, using it for conditional logic related to scalability group behavior.

#Setting Variables

#References In INI files

Location: <Workspace>/Projects/Lyra/Config/Android/AndroidEngine.ini:8, section: [ConsoleVariables]

Location: <Workspace>/Projects/Lyra/Config/IOS/IOSEngine.ini:2, section: [ConsoleVariables]

Location: <Workspace>/Projects/Lyra/Config/Linux/LinuxEngine.ini:2, section: [ConsoleVariables]

Location: <Workspace>/Projects/Lyra/Config/Mac/MacEngine.ini:2, section: [ConsoleVariables]

Location: <Workspace>/Projects/Lyra/Config/Windows/WindowsEngine.ini:2, section: [ConsoleVariables]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DeviceProfiles/DeviceProfileManager.cpp:37

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarAllowScalabilityGroupsToChangeAtRuntime(
	TEXT("dp.AllowScalabilityGroupsToChangeAtRuntime"),
	0,
	TEXT("If true, device profile scalability bucket cvars will be set with scalability")
	TEXT("priority which allows them to be changed at runtime. Off by default."),
	ECVF_Default);

TMap<FString, FString> UDeviceProfileManager::DeviceProfileScalabilityCVars;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DeviceProfiles/DeviceProfileManager.cpp:410

Scope (from outer to inner):

file
function     void UDeviceProfileManager::SetDeviceProfileCVars

Source code excerpt:

	if (const FConfigSection* Section = GConfig->GetSection(TEXT("ConsoleVariables"), false, *GEngineIni))
	{
		static FName AllowScalabilityAtRuntimeName = TEXT("dp.AllowScalabilityGroupsToChangeAtRuntime");
		if (const FConfigValue* Value = Section->Find(AllowScalabilityAtRuntimeName))
		{
			const FString& KeyString = AllowScalabilityAtRuntimeName.ToString();
			const FString& ValueString = Value->GetValue();
			UE::ConfigUtilities::OnSetCVarFromIniEntry(*GEngineIni, *KeyString, *ValueString, ECVF_SetBySystemSettingsIni);
		}

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DeviceProfiles/DeviceProfileManager.cpp:36

Scope: file

Source code excerpt:

	ECVF_Default);

static TAutoConsoleVariable<int32> CVarAllowScalabilityGroupsToChangeAtRuntime(
	TEXT("dp.AllowScalabilityGroupsToChangeAtRuntime"),
	0,
	TEXT("If true, device profile scalability bucket cvars will be set with scalability")
	TEXT("priority which allows them to be changed at runtime. Off by default."),
	ECVF_Default);

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DeviceProfiles/DeviceProfileManager.cpp:443

Scope (from outer to inner):

file
function     void UDeviceProfileManager::SetDeviceProfileCVars

Source code excerpt:

		// Cache any scalability related cvars so we can conveniently reapply them later as a way to reset the device defaults
		bool bIsScalabilityBucket = CVarKey.StartsWith(TEXT("sg."));
		if (bIsScalabilityBucket && CVarAllowScalabilityGroupsToChangeAtRuntime.GetValueOnGameThread() > 0)
		{
			DeviceProfileScalabilityCVars.Add(*CVarKey, *CVarValue);
		}

		// Set by scalability or DP, depending
		uint32 CVarPriority = bIsScalabilityBucket ? ECVF_SetByScalability : ECVF_SetByDeviceProfile;