r.ScreenPercentage.Default.Mobile.Mode
r.ScreenPercentage.Default.Mobile.Mode
#Overview
name: r.ScreenPercentage.Default.Mobile.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.Mobile.Mode is to control the default screen percentage mode for mobile devices in Unreal Engine 5. This setting is part of the rendering system, specifically related to the screen resolution and performance optimization for mobile platforms.
This setting variable is primarily used by the Legacy Screen Percentage Driver module within the Unreal Engine’s rendering system. It’s defined in the Engine module, specifically in the LegacyScreenPercentageDriver.cpp file.
The value of this variable is set using a console variable (CVar) system. It’s initialized with the default value of EScreenPercentageMode::Manual, which corresponds to the integer value 0.
This variable interacts closely with other screen percentage-related variables, such as those for desktop and VR modes. It’s associated with the C++ variable CVarScreenPercentageDefaultMobileMode, which is used to access and modify its value within the engine code.
Developers must be aware that this variable affects the default behavior of screen percentage scaling on mobile devices. The value is clamped between 0 and 2, corresponding to different modes of the EScreenPercentageMode enum.
Best practices when using this variable include:
- Understanding the performance implications of different modes on mobile devices.
- Testing thoroughly on various mobile devices to ensure the chosen mode provides the best balance between visual quality and performance.
- Considering platform-specific optimizations, as mobile devices often have more constrained resources.
Regarding the associated variable CVarScreenPercentageDefaultMobileMode:
The purpose of CVarScreenPercentageDefaultMobileMode is to provide a programmatic interface to access and modify the r.ScreenPercentage.Default.Mobile.Mode setting within the engine’s C++ code.
This variable is used directly in the FStaticResolutionFractionHeuristic::FUserSettings::PullRunTimeRenderingSettings function to determine the screen percentage mode for mobile views.
The value of this variable is set through the CVar system and can be modified at runtime.
It interacts with similar variables for other platforms (desktop, VR) to provide a comprehensive screen percentage management system across different device types.
Developers should be aware that changes to this variable will directly affect the mobile rendering pipeline’s behavior regarding screen percentage.
Best practices include:
- Using the GetValueOnGameThread() method to safely access the current value.
- Considering the implications of changing this value at runtime, especially regarding performance and visual consistency.
- Coordinating changes to this variable with other screen percentage settings to maintain a consistent user experience across different device types.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LegacyScreenPercentageDriver.cpp:18
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarScreenPercentageDefaultMobileMode(
TEXT("r.ScreenPercentage.Default.Mobile.Mode"), int32(EScreenPercentageMode::Manual),
TEXT(""),
ECVF_Scalability | ECVF_Default);
static TAutoConsoleVariable<int32> CVarScreenPercentageDefaultVRMode(
TEXT("r.ScreenPercentage.Default.VR.Mode"), int32(EScreenPercentageMode::Manual),
TEXT(""),
#Associated Variable and Callsites
This variable is associated with another variable named CVarScreenPercentageDefaultMobileMode
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LegacyScreenPercentageDriver.cpp:17
Scope: file
Source code excerpt:
ECVF_Scalability | ECVF_Default);
static TAutoConsoleVariable<int32> CVarScreenPercentageDefaultMobileMode(
TEXT("r.ScreenPercentage.Default.Mobile.Mode"), int32(EScreenPercentageMode::Manual),
TEXT(""),
ECVF_Scalability | ECVF_Default);
static TAutoConsoleVariable<int32> CVarScreenPercentageDefaultVRMode(
TEXT("r.ScreenPercentage.Default.VR.Mode"), int32(EScreenPercentageMode::Manual),
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/LegacyScreenPercentageDriver.cpp:242
Scope (from outer to inner):
file
function void FStaticResolutionFractionHeuristic::FUserSettings::PullRunTimeRenderingSettings
Source code excerpt:
else if (ViewStatus == EViewStatusForScreenPercentage::Mobile)
{
Mode = EScreenPercentageMode(FMath::Clamp(CVarScreenPercentageDefaultMobileMode.GetValueOnGameThread(), 0, 2));
}
else if (ViewStatus == EViewStatusForScreenPercentage::Desktop)
{
Mode = EScreenPercentageMode(FMath::Clamp(CVarScreenPercentageDefaultDesktopMode.GetValueOnGameThread(), 0, 2));
}
else