r.ScreenPercentage.Default.Desktop.Mode
r.ScreenPercentage.Default.Desktop.Mode
#Overview
name: r.ScreenPercentage.Default.Desktop.Mode
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.ScreenPercentage.Default.Desktop.Mode is to control the default screen percentage mode for desktop platforms in Unreal Engine 5. This setting is part of the rendering system and specifically relates to the screen resolution scaling feature.
This setting variable is primarily used in the Engine module, specifically within the legacy screen percentage driver. It’s referenced in the LegacyScreenPercentageDriver.cpp file, which suggests it’s part of the engine’s core rendering system.
The value of this variable is set using a console variable (CVar) system. It’s initialized with a default value of EScreenPercentageMode::BasedOnDisplayResolution, which corresponds to an integer value of 1 (as seen in the enum declaration).
This variable interacts closely with CVarScreenPercentageDefaultDesktopMode, which is the associated C++ variable that directly accesses and uses the console variable’s value.
Developers should be aware that this variable affects how screen percentage is calculated on desktop platforms. It can be set to different modes, including manual mode or based on display resolution. The value is clamped between 0 and 2, corresponding to different EScreenPercentageMode enum values.
Best practices when using this variable include:
- Consider the target hardware when setting this value, as it can affect performance and visual quality.
- Be aware that changing this value can impact the game’s appearance across different desktop configurations.
- Test thoroughly on various desktop setups to ensure consistent visual quality.
Regarding the associated variable CVarScreenPercentageDefaultDesktopMode:
This C++ variable is a TAutoConsoleVariable
The purpose of CVarScreenPercentageDefaultDesktopMode is to provide a programmatic interface to the console variable, allowing C++ code to easily access and modify the screen percentage mode setting.
This variable is primarily used in the Engine module, specifically within the legacy screen percentage driver system.
The value of this variable is set when the console variable is initialized, but it can be changed at runtime through console commands or programmatically.
Developers should be aware that changes to this variable will directly affect the screen percentage behavior on desktop platforms. It’s important to use this variable consistently with the console variable and to consider its impact on rendering performance and quality.
Best practices for using CVarScreenPercentageDefaultDesktopMode include:
- Use the GetValueOnGameThread() method to safely retrieve the current value.
- Consider thread safety when accessing or modifying this variable, as it’s accessed in the game thread.
- Be cautious when modifying this value, as it can have significant impacts on rendering behavior and performance.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LegacyScreenPercentageDriver.cpp:13
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarScreenPercentageDefaultDesktopMode(
TEXT("r.ScreenPercentage.Default.Desktop.Mode"), int32(EScreenPercentageMode::BasedOnDisplayResolution),
TEXT(""),
ECVF_Scalability | ECVF_Default);
static TAutoConsoleVariable<int32> CVarScreenPercentageDefaultMobileMode(
TEXT("r.ScreenPercentage.Default.Mobile.Mode"), int32(EScreenPercentageMode::Manual),
TEXT(""),
#Associated Variable and Callsites
This variable is associated with another variable named CVarScreenPercentageDefaultDesktopMode
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LegacyScreenPercentageDriver.cpp:12
Scope: file
Source code excerpt:
ECVF_Scalability | ECVF_Default);
static TAutoConsoleVariable<int32> CVarScreenPercentageDefaultDesktopMode(
TEXT("r.ScreenPercentage.Default.Desktop.Mode"), int32(EScreenPercentageMode::BasedOnDisplayResolution),
TEXT(""),
ECVF_Scalability | ECVF_Default);
static TAutoConsoleVariable<int32> CVarScreenPercentageDefaultMobileMode(
TEXT("r.ScreenPercentage.Default.Mobile.Mode"), int32(EScreenPercentageMode::Manual),
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LegacyScreenPercentageDriver.cpp:246
Scope (from outer to inner):
file
function void FStaticResolutionFractionHeuristic::FUserSettings::PullRunTimeRenderingSettings
Source code excerpt:
else if (ViewStatus == EViewStatusForScreenPercentage::Desktop)
{
Mode = EScreenPercentageMode(FMath::Clamp(CVarScreenPercentageDefaultDesktopMode.GetValueOnGameThread(), 0, 2));
}
else
{
unimplemented();
}
}