r.Test.PrimaryScreenPercentageMethodOverride
r.Test.PrimaryScreenPercentageMethodOverride
#Overview
name: r.Test.PrimaryScreenPercentageMethodOverride
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Override the screen percentage method for all view family.\n 0: view family\'s screen percentage interface choose; (default)\n 1: old fashion upscaling pass at the very end right before before UI;\n 2: TemporalAA upsample.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Test.PrimaryScreenPercentageMethodOverride is to override the screen percentage method for all view families in the rendering system. This console variable allows developers to test different upscaling methods without changing the core rendering code.
This setting variable is primarily used in the Renderer module of Unreal Engine 5, specifically in the scene rendering subsystem. It affects how the engine handles screen percentage and upscaling for all view families.
The value of this variable is set through the console or configuration files. It’s defined as a TAutoConsoleVariable, which means it can be changed at runtime.
The associated variable CVarTestPrimaryScreenPercentageMethodOverride directly interacts with r.Test.PrimaryScreenPercentageMethodOverride. They share the same value and purpose.
Developers must be aware that this variable is intended for testing purposes only. It overrides the default behavior of the screen percentage interface, which could lead to unexpected results if used in production.
Best practices when using this variable include:
- Use it only for testing and debugging purposes.
- Be aware of the performance implications of different upscaling methods.
- Reset the value to 0 (default) after testing to ensure normal engine behavior.
Regarding the associated variable CVarTestPrimaryScreenPercentageMethodOverride:
The purpose of CVarTestPrimaryScreenPercentageMethodOverride is the same as r.Test.PrimaryScreenPercentageMethodOverride. It’s the actual console variable implementation that controls the screen percentage method override.
This variable is used in the Renderer module, specifically in the FSceneRenderer::PrepareViewRectsForRendering function.
The value is set when the console variable is created, with a default value of 0. It can be changed at runtime through console commands.
CVarTestPrimaryScreenPercentageMethodOverride directly affects the View.PrimaryScreenPercentageMethod property of each view being rendered.
Developers should be aware that changing this variable will affect all view families, potentially impacting the entire rendering pipeline.
Best practices include:
- Use GetValueOnRenderThread() to safely access the value in render thread code.
- Consider the performance implications of each option (0: default, 1: spatial upscale, 2: temporal upscale, 3: raw output).
- Reset to 0 after testing to ensure normal engine behavior.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:404
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarTestPrimaryScreenPercentageMethodOverride(
TEXT("r.Test.PrimaryScreenPercentageMethodOverride"),
0,
TEXT("Override the screen percentage method for all view family.\n")
TEXT(" 0: view family's screen percentage interface choose; (default)\n")
TEXT(" 1: old fashion upscaling pass at the very end right before before UI;\n")
TEXT(" 2: TemporalAA upsample."));
#Associated Variable and Callsites
This variable is associated with another variable named CVarTestPrimaryScreenPercentageMethodOverride
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:403
Scope: file
Source code excerpt:
ECVF_Default);
static TAutoConsoleVariable<int32> CVarTestPrimaryScreenPercentageMethodOverride(
TEXT("r.Test.PrimaryScreenPercentageMethodOverride"),
0,
TEXT("Override the screen percentage method for all view family.\n")
TEXT(" 0: view family's screen percentage interface choose; (default)\n")
TEXT(" 1: old fashion upscaling pass at the very end right before before UI;\n")
TEXT(" 2: TemporalAA upsample."));
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:3139
Scope (from outer to inner):
file
function void FSceneRenderer::PrepareViewRectsForRendering
Source code excerpt:
// For testing purpose, override the screen percentage method.
{
switch (CVarTestPrimaryScreenPercentageMethodOverride.GetValueOnRenderThread())
{
case 1: View.PrimaryScreenPercentageMethod = EPrimaryScreenPercentageMethod::SpatialUpscale; break;
case 2: View.PrimaryScreenPercentageMethod = EPrimaryScreenPercentageMethod::TemporalUpscale; break;
case 3: View.PrimaryScreenPercentageMethod = EPrimaryScreenPercentageMethod::RawOutput; break;
}
}