r.FastVRam.Upscale
r.FastVRam.Upscale
#Overview
name: r.FastVRam.Upscale
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 6
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.FastVRam.Upscale is to control the usage of fast VRAM (Video RAM) for the upscaling process in Unreal Engine 5’s rendering pipeline. This setting is part of the engine’s optimization strategy for managing video memory allocation and usage.
-
The Unreal Engine’s rendering system, specifically the post-processing and upscaling modules, rely on this setting variable.
-
The value of this variable is set through the FASTVRAM_CVAR macro, which is defined in the SceneRendering.cpp file. It’s initialized with a default value of 1, indicating that fast VRAM usage for upscaling is enabled by default.
-
This variable interacts with the associated variable named ‘Upscale’, which is part of the FFastVramConfig struct. The r.FastVRam.Upscale console variable controls the value of this struct member.
-
Developers must be aware that changing this variable affects the memory allocation strategy for upscaling textures. Setting it to 1 (enabled) may improve performance but could increase VRAM usage.
-
Best practices when using this variable include:
- Monitoring VRAM usage when enabling or disabling this feature.
- Testing performance impacts on various hardware configurations.
- Considering the trade-off between performance and memory usage.
Regarding the associated variable ‘Upscale’:
-
Its purpose is to store the actual texture creation flags used for upscaling textures.
-
It’s used in the renderer module, specifically in the PostProcessUpscale.cpp file, where it affects the creation of upscaling render targets.
-
The value is set in the FFastVramConfig::Update function, which updates the Upscale member based on the r.FastVRam.Upscale console variable.
-
It interacts directly with the r.FastVRam.Upscale console variable and is used in texture creation calls.
-
Developers should be aware that this variable directly affects how upscaling textures are created and stored in memory.
-
Best practices include ensuring that changes to r.FastVRam.Upscale are reflected in this associated variable, and understanding the impact on texture creation and rendering performance.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:481
Scope: file
Source code excerpt:
FASTVRAM_CVAR(MotionBlur, 1);
FASTVRAM_CVAR(Tonemap, 1);
FASTVRAM_CVAR(Upscale, 1);
FASTVRAM_CVAR(DistanceFieldNormal, 1);
FASTVRAM_CVAR(DistanceFieldAOHistory, 1);
FASTVRAM_CVAR(DistanceFieldAODownsampledBentNormal, 1);
FASTVRAM_CVAR(DistanceFieldAOBentNormal, 0);
FASTVRAM_CVAR(DistanceFieldIrradiance, 0);
FASTVRAM_CVAR(DistanceFieldShadows, 1);
#Associated Variable and Callsites
This variable is associated with another variable named Upscale
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessUpscale.cpp:188
Scope (from outer to inner):
file
function FScreenPassTexture ISpatialUpscaler::AddDefaultUpscalePass
Source code excerpt:
Inputs.SceneColor.Texture->Desc.Format,
FClearValueBinding::Black,
TexCreate_ShaderResource | TexCreate_RenderTargetable | GFastVRamConfig.Upscale);
if (Inputs.Stage == EUpscaleStage::PrimaryToSecondary)
{
const FIntPoint SecondaryViewRectSize = View.GetSecondaryViewRectSize();
QuantizeSceneBufferSize(SecondaryViewRectSize, OutputDesc.Extent);
Output.ViewRect.Min = FIntPoint::ZeroValue;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessUpscale.cpp:203
Scope (from outer to inner):
file
function FScreenPassTexture ISpatialUpscaler::AddDefaultUpscalePass
Source code excerpt:
}
Output.Texture = GraphBuilder.CreateTexture(OutputDesc, TEXT("Upscale"));
Output.LoadAction = ERenderTargetLoadAction::EClear;
}
const FScreenPassTextureViewport InputViewport(Inputs.SceneColor);
const FScreenPassTextureViewport OutputViewport(Output);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:481
Scope: file
Source code excerpt:
FASTVRAM_CVAR(MotionBlur, 1);
FASTVRAM_CVAR(Tonemap, 1);
FASTVRAM_CVAR(Upscale, 1);
FASTVRAM_CVAR(DistanceFieldNormal, 1);
FASTVRAM_CVAR(DistanceFieldAOHistory, 1);
FASTVRAM_CVAR(DistanceFieldAODownsampledBentNormal, 1);
FASTVRAM_CVAR(DistanceFieldAOBentNormal, 0);
FASTVRAM_CVAR(DistanceFieldIrradiance, 0);
FASTVRAM_CVAR(DistanceFieldShadows, 1);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:681
Scope (from outer to inner):
file
function void FFastVramConfig::Update
Source code excerpt:
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_MotionBlur, MotionBlur);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_Tonemap, Tonemap);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_Upscale, Upscale);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_DistanceFieldNormal, DistanceFieldNormal);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_DistanceFieldAOHistory, DistanceFieldAOHistory);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_DistanceFieldAODownsampledBentNormal, DistanceFieldAODownsampledBentNormal);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_DistanceFieldAOBentNormal, DistanceFieldAOBentNormal);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_DistanceFieldIrradiance, DistanceFieldIrradiance);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_DistanceFieldShadows, DistanceFieldShadows);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.h:2830
Scope: file
Source code excerpt:
ETextureCreateFlags MotionBlur;
ETextureCreateFlags Tonemap;
ETextureCreateFlags Upscale;
ETextureCreateFlags DistanceFieldNormal;
ETextureCreateFlags DistanceFieldAOHistory;
ETextureCreateFlags DistanceFieldAOBentNormal;
ETextureCreateFlags DistanceFieldAODownsampledBentNormal;
ETextureCreateFlags DistanceFieldShadows;
ETextureCreateFlags DistanceFieldIrradiance;