r.DynamicRes.TestScreenPercentage
r.DynamicRes.TestScreenPercentage
#Overview
name: r.DynamicRes.TestScreenPercentage
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Forces the screen percentage to a particular value with dynamic res.\n 0: Disabled (default); > 0: Screen percentage is enabled.\n
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.DynamicRes.TestScreenPercentage is to force the screen percentage to a specific value when using dynamic resolution in Unreal Engine 5. This setting variable is primarily used for testing and debugging the dynamic resolution feature.
This setting variable is mainly used in the rendering system, specifically in the dynamic resolution subsystem of Unreal Engine 5. It is utilized in the Engine module and the FunctionalTesting module.
The value of this variable is set through the console variable system in Unreal Engine. It is defined as a TAutoConsoleVariable in the UnrealEngine.cpp file.
The r.DynamicRes.TestScreenPercentage variable interacts with the CVarForceDynamicResScreenPercentage variable, which is its associated console variable. They share the same value and purpose.
Developers must be aware that this variable is only available in non-shipping builds and when dynamic resolution is enabled (WITH_DYNAMIC_RESOLUTION is defined). It’s intended for testing and debugging purposes, not for use in production builds.
Best practices when using this variable include:
- Only use it for testing and debugging purposes.
- Be aware that it overrides the normal dynamic resolution behavior.
- Remember to disable it (set to 0) when not actively testing to avoid unintended effects on performance or visual quality.
- Use it in conjunction with other dynamic resolution settings for comprehensive testing.
Regarding the associated variable CVarForceDynamicResScreenPercentage:
The purpose of CVarForceDynamicResScreenPercentage is the same as r.DynamicRes.TestScreenPercentage. It’s the actual console variable implementation that controls the forced screen percentage for dynamic resolution testing.
This variable is used in the Engine module, specifically in the GetDynamicResolutionCurrentStateInfos function of the UEngine class.
The value of CVarForceDynamicResScreenPercentage is set through the console variable system, and it’s accessed using the GetValueOnGameThread() method.
CVarForceDynamicResScreenPercentage directly interacts with the dynamic resolution system by forcing a specific screen percentage value.
Developers should be aware that this variable is only available in non-shipping builds and when dynamic resolution is enabled. It’s used to override the normal dynamic resolution behavior for testing purposes.
Best practices for using CVarForceDynamicResScreenPercentage are the same as those for r.DynamicRes.TestScreenPercentage, as they are essentially the same setting exposed through different interfaces.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UnrealEngine.cpp:386
Scope: file
Source code excerpt:
#if !UE_BUILD_SHIPPING && WITH_DYNAMIC_RESOLUTION
static TAutoConsoleVariable<float> CVarForceDynamicResScreenPercentage(
TEXT("r.DynamicRes.TestScreenPercentage"),
0,
TEXT("Forces the screen percentage to a particular value with dynamic res.\n")
TEXT(" 0: Disabled (default); > 0: Screen percentage is enabled.\n"),
ECVF_Default | ECVF_RenderThreadSafe);
#endif
#Loc: <Workspace>/Engine/Source/Developer/FunctionalTesting/Private/AutomationBlueprintFunctionLibrary.cpp:249
Scope (from outer to inner):
file
function FAutomationTestScreenshotEnvSetup::FAutomationTestScreenshotEnvSetup
Source code excerpt:
, TonemapperSharpen(TEXT("r.Tonemapper.Sharpen"))
, 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:130
Scope: file
Source code excerpt:
Enabled,
// Forced enabled at static resolution fraction for profiling purpose with r.DynamicRes.TestScreenPercentage.
DebugForceEnabled,
};
/** Information about the state of dynamic resolution. */
struct FDynamicResolutionStateInfos
{
#Associated Variable and Callsites
This variable is associated with another variable named CVarForceDynamicResScreenPercentage
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UnrealEngine.cpp:385
Scope: file
Source code excerpt:
#if !UE_BUILD_SHIPPING && WITH_DYNAMIC_RESOLUTION
static TAutoConsoleVariable<float> CVarForceDynamicResScreenPercentage(
TEXT("r.DynamicRes.TestScreenPercentage"),
0,
TEXT("Forces the screen percentage to a particular value with dynamic res.\n")
TEXT(" 0: Disabled (default); > 0: Screen percentage is enabled.\n"),
ECVF_Default | ECVF_RenderThreadSafe);
#endif
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/UnrealEngine.cpp:13110
Scope (from outer to inner):
file
function void UEngine::GetDynamicResolutionCurrentStateInfos
Source code excerpt:
#if !UE_BUILD_SHIPPING
ForceResolutionFraction = CVarForceDynamicResScreenPercentage.GetValueOnGameThread() / 100.0f;
#endif
if (!DynamicResolutionState.IsValid() || !DynamicResolutionState->IsSupported())
{
return;
}