r.HalfResDepthNoFastClear
r.HalfResDepthNoFastClear
#Overview
name: r.HalfResDepthNoFastClear
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Remove fast clear on half resolution depth buffer (checkerboard and minmax)
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.HalfResDepthNoFastClear is to control the fast clear operation on half-resolution depth buffers used for checkerboard rendering and min-max depth calculations in Unreal Engine’s rendering system.
This setting variable is primarily used in the rendering subsystem of Unreal Engine 5, specifically in the scene rendering module. It affects the creation and handling of half-resolution depth textures.
The value of this variable is set through a console variable (CVarHalfResDepthNoFastClear) with a default value of 1, meaning that by default, fast clear is removed for half-resolution depth buffers.
The associated variable CVarHalfResDepthNoFastClear interacts directly with r.HalfResDepthNoFastClear. They share the same value and purpose.
Developers must be aware that:
- This setting affects performance and memory usage in the rendering pipeline.
- It specifically targets half-resolution depth buffers used for checkerboard rendering and min-max depth calculations.
- Changing this value may impact rendering performance and quality.
Best practices when using this variable include:
- Only modify if you’re experiencing specific issues related to half-resolution depth buffers or checkerboard rendering.
- Test thoroughly after changes, as it can affect both performance and visual quality.
- Consider the trade-offs between potential performance gains and any visual artifacts that may occur.
Regarding the associated variable CVarHalfResDepthNoFastClear:
- It’s an auto console variable of type int32.
- It’s defined in the scene rendering code and is render thread safe.
- Its value is checked during the creation of half-resolution and quarter-resolution depth textures.
- When enabled (value != 0), it adds the TexCreate_NoFastClear flag to texture creation, potentially affecting rendering performance and behavior.
Developers should be cautious when modifying this variable, as it directly impacts the low-level rendering behavior of the engine. Any changes should be thoroughly tested across different hardware configurations to ensure consistent performance and visual quality.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:6085
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarHalfResDepthNoFastClear(
TEXT("r.HalfResDepthNoFastClear"),
1,
TEXT("Remove fast clear on half resolution depth buffer (checkerboard and minmax)"),
ECVF_RenderThreadSafe);
FRDGTextureRef CreateHalfResolutionDepthCheckerboardMinMax(FRDGBuilder& GraphBuilder, TArrayView<const FViewInfo> Views, FRDGTextureRef SceneDepthTexture)
{
#Associated Variable and Callsites
This variable is associated with another variable named CVarHalfResDepthNoFastClear
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:6084
Scope: file
Source code excerpt:
}
static TAutoConsoleVariable<int32> CVarHalfResDepthNoFastClear(
TEXT("r.HalfResDepthNoFastClear"),
1,
TEXT("Remove fast clear on half resolution depth buffer (checkerboard and minmax)"),
ECVF_RenderThreadSafe);
FRDGTextureRef CreateHalfResolutionDepthCheckerboardMinMax(FRDGBuilder& GraphBuilder, TArrayView<const FViewInfo> Views, FRDGTextureRef SceneDepthTexture)
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:6095
Scope (from outer to inner):
file
function FRDGTextureRef CreateHalfResolutionDepthCheckerboardMinMax
Source code excerpt:
const FIntPoint SmallDepthExtent = GetDownscaledExtent(SceneDepthTexture->Desc.Extent, DownscaleFactor);
const ETextureCreateFlags NoFastClearFlags = (CVarHalfResDepthNoFastClear.GetValueOnAnyThread() != 0) ? TexCreate_NoFastClear : TexCreate_None;
const FRDGTextureDesc SmallDepthDesc = FRDGTextureDesc::Create2D(SmallDepthExtent, PF_DepthStencil, FClearValueBinding::None, TexCreate_DepthStencilTargetable | TexCreate_ShaderResource | NoFastClearFlags);
FRDGTextureRef SmallDepthTexture = GraphBuilder.CreateTexture(SmallDepthDesc, TEXT("HalfResolutionDepthCheckerboardMinMax"));
for (const FViewInfo& View : Views)
{
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:6115
Scope (from outer to inner):
file
function FRDGTextureRef CreateQuarterResolutionDepthMinAndMax
Source code excerpt:
{
const FIntPoint SmallDepthExtent = GetDownscaledExtent(InputDepthTexture->Desc.Extent, 2);
const ETextureCreateFlags NoFastClearFlags = (CVarHalfResDepthNoFastClear.GetValueOnAnyThread() != 0) ? TexCreate_NoFastClear : TexCreate_None;
const FRDGTextureDesc SmallTextureDesc = FRDGTextureDesc::Create2D(SmallDepthExtent, PF_G16R16F, FClearValueBinding::None, TexCreate_RenderTargetable | TexCreate_ShaderResource | NoFastClearFlags);
FRDGTextureRef SmallTexture = GraphBuilder.CreateTexture(SmallTextureDesc, TEXT("HalfResolutionDepthMinAndMax"));
for (const FViewInfo& View : Views)
{
RDG_GPU_MASK_SCOPE(GraphBuilder, View.GPUMask);