dp.Override
dp.Override
#Overview
name: dp.Override
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
DeviceProfile override - setting this will use the named DP as the active DP. In addition, it will restore any\n previous overrides before setting (does a dp.OverridePop before setting after the first time).\n The commandline -dp option will override this on startup, but not when setting this at runtime\n
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of dp.Override is to provide a runtime override mechanism for the active Device Profile in Unreal Engine 5. It allows developers to dynamically change the Device Profile being used, which can affect various rendering and performance settings across the engine.
This setting variable is primarily used by the Device Profile Manager subsystem within Unreal Engine. It’s part of the Engine module, specifically within the DeviceProfiles functionality.
The value of this variable is set through a console variable (CVar) named “dp.Override”. It can be set via command line, in-game console, or programmatically at runtime.
The dp.Override variable interacts closely with an associated C++ variable named CVarDeviceProfileOverride. This is a TAutoConsoleVariable
Developers should be aware of several key points when using this variable:
- Setting this variable will change the active Device Profile, which can have wide-ranging effects on engine performance and rendering.
- It automatically restores any previous overrides before setting a new one (it performs a dp.OverridePop operation).
- The -dp command line option will override this setting on startup, but not when set at runtime.
- Changes to this variable trigger a callback that invokes UDeviceProfileManager::HandleDeviceProfileOverrideChange().
Best practices for using this variable include:
- Use it primarily for testing and debugging purposes, not for shipping builds.
- Be aware of its interaction with command line arguments and other Device Profile settings.
- Monitor performance carefully when changing Device Profiles at runtime.
- Use in conjunction with other Device Profile tools and settings for comprehensive control.
Regarding the associated variable CVarDeviceProfileOverride:
This is the C++ implementation of the dp.Override console variable. It’s defined as a static TAutoConsoleVariable
The CVarDeviceProfileOverride variable is used internally by the engine to store and retrieve the current override value. It’s set up with a callback that triggers the HandleDeviceProfileOverrideChange() function in the UDeviceProfileManager class whenever its value changes.
Developers working directly with the engine source code might interact with CVarDeviceProfileOverride instead of using the console command directly. The same considerations and best practices apply to both the console variable and its C++ counterpart.
#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:29
Scope: file
Source code excerpt:
static TAutoConsoleVariable<FString> CVarDeviceProfileOverride(
TEXT("dp.Override"),
TEXT(""),
TEXT("DeviceProfile override - setting this will use the named DP as the active DP. In addition, it will restore any\n")
TEXT(" previous overrides before setting (does a dp.OverridePop before setting after the first time).\n")
TEXT(" The commandline -dp option will override this on startup, but not when setting this at runtime\n"),
ECVF_Default);
#Associated Variable and Callsites
This variable is associated with another variable named CVarDeviceProfileOverride
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DeviceProfiles/DeviceProfileManager.cpp:28
Scope: file
Source code excerpt:
DEFINE_LOG_CATEGORY_STATIC(LogDeviceProfileManager, Log, All);
static TAutoConsoleVariable<FString> CVarDeviceProfileOverride(
TEXT("dp.Override"),
TEXT(""),
TEXT("DeviceProfile override - setting this will use the named DP as the active DP. In addition, it will restore any\n")
TEXT(" previous overrides before setting (does a dp.OverridePop before setting after the first time).\n")
TEXT(" The commandline -dp option will override this on startup, but not when setting this at runtime\n"),
ECVF_Default);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DeviceProfiles/DeviceProfileManager.cpp:78
Scope (from outer to inner):
file
function UDeviceProfileManager& UDeviceProfileManager::Get
Source code excerpt:
// now we allow the cvar changes to be acknowledged
CVarDeviceProfileOverride.AsVariable()->SetOnChangedCallback(FConsoleVariableDelegate::CreateLambda([](IConsoleVariable* Variable)
{
UDeviceProfileManager::Get().HandleDeviceProfileOverrideChange();
}));
IConsoleManager::Get().RegisterConsoleCommand(
TEXT("dp.Override.Restore"),
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DeviceProfiles/DeviceProfileManager.cpp:1120
Scope (from outer to inner):
file
function void UDeviceProfileManager::HandleDeviceProfileOverrideChange
Source code excerpt:
void UDeviceProfileManager::HandleDeviceProfileOverrideChange()
{
FString CVarValue = CVarDeviceProfileOverride.GetValueOnGameThread();
// only handle when the value is different
if (CVarValue.Len() > 0 && CVarValue != GetActiveProfile()->GetName())
{
FString PlatformName = ANSI_TO_TCHAR(FPlatformProperties::IniPlatformName());
TArray<FString> DeviceProfileNameAndTypes;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/DeviceProfiles/DeviceProfileManager.cpp:1253
Scope (from outer to inner):
file
function const FString UDeviceProfileManager::GetPlatformDeviceProfileName
Source code excerpt:
// look for cvar override
OverrideProfileName = CVarDeviceProfileOverride.GetValueOnGameThread();
if (OverrideProfileName.Len() > 0)
{
return OverrideProfileName;
}
if (IDeviceProfileSelectorModule* DPSelectorModule = GetDeviceProfileSelectorModule())