r.Test.SecondaryUpscaleOverride
r.Test.SecondaryUpscaleOverride
#Overview
name: r.Test.SecondaryUpscaleOverride
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Override the secondary upscale.\n 0: disabled; (default)\n 1: use secondary view fraction = 0.5 with nearest secondary upscale.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Test.SecondaryUpscaleOverride is to provide a testing mechanism for overriding the secondary upscale in Unreal Engine’s rendering system.
-
This setting variable is primarily used by the rendering system, specifically for testing and debugging purposes related to screen percentage and upscaling.
-
The Unreal Engine subsystem that relies on this setting variable is the renderer, as evidenced by its location in the SceneRendering.cpp file within the Runtime/Renderer module.
-
The value of this variable is set through the console variable system (CVarTestSecondaryUpscaleOverride) with a default value of 0, meaning it’s disabled by default.
-
This variable interacts with ViewFamily.SecondaryViewFraction and ViewFamily.SecondaryScreenPercentageMethod. When enabled, it overrides these properties to test different secondary upscale configurations.
-
Developers must be aware that this is a testing variable and should not be used in production environments. It’s designed for debugging and performance testing purposes only.
-
Best practices when using this variable include:
- Only enable it in non-shipping builds for testing purposes.
- Be cautious when using it, as it can significantly affect rendering performance and quality.
- Always reset it to 0 after testing to ensure it doesn’t interfere with normal rendering.
Regarding the associated variable CVarTestSecondaryUpscaleOverride:
- This is the actual console variable that controls the r.Test.SecondaryUpscaleOverride setting.
- It’s defined as an integer with three possible values: 0: Disabled (default) 1: Use secondary view fraction = 0.5 with nearest secondary upscale
- It’s used in the FSceneRenderer constructor to override the SecondaryViewFraction and SecondaryScreenPercentageMethod when enabled.
- Developers should use this console variable to toggle the secondary upscale override for testing, rather than directly modifying the r.Test.SecondaryUpscaleOverride value.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:412
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarTestSecondaryUpscaleOverride(
TEXT("r.Test.SecondaryUpscaleOverride"),
0,
TEXT("Override the secondary upscale.\n")
TEXT(" 0: disabled; (default)\n")
TEXT(" 1: use secondary view fraction = 0.5 with nearest secondary upscale."));
#endif
#Associated Variable and Callsites
This variable is associated with another variable named CVarTestSecondaryUpscaleOverride
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:411
Scope: file
Source code excerpt:
TEXT(" 2: TemporalAA upsample."));
static TAutoConsoleVariable<int32> CVarTestSecondaryUpscaleOverride(
TEXT("r.Test.SecondaryUpscaleOverride"),
0,
TEXT("Override the secondary upscale.\n")
TEXT(" 0: disabled; (default)\n")
TEXT(" 1: use secondary view fraction = 0.5 with nearest secondary upscale."));
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:2795
Scope (from outer to inner):
file
function FSceneRenderer::FSceneRenderer
Source code excerpt:
// Override secondary screen percentage for testing purpose.
if (CVarTestSecondaryUpscaleOverride.GetValueOnGameThread() > 0 && !ViewFamily.Views[0]->bIsReflectionCapture)
{
ViewFamily.SecondaryViewFraction = 1.0 / float(CVarTestSecondaryUpscaleOverride.GetValueOnGameThread());
ViewFamily.SecondaryScreenPercentageMethod = ESecondaryScreenPercentageMethod::NearestSpatialUpscale;
}
#endif
// If any viewpoint has been locked, set time to zero to avoid time-based
// rendering differences in materials.