ShowFlag.QuadOverdraw
ShowFlag.QuadOverdraw
#Overview
name: ShowFlag.QuadOverdraw
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Allows to override a specific showflag (works in editor and game, \
It is referenced in 15
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of ShowFlag.QuadOverdraw is to visualize screen quads in the Unreal Engine rendering system. This setting is primarily used for debugging and performance optimization purposes in the rendering pipeline.
This setting variable is relied upon by the following Unreal Engine subsystems and modules:
- Renderer module
- Engine module
- Debug view modes system
The value of this variable is typically set through the engine show flags system, which allows developers to toggle various debug visualization options.
ShowFlag.QuadOverdraw interacts with several other variables and systems:
- It is closely associated with the QuadOverdraw variable, which shares the same value.
- It is used in conjunction with ShaderComplexity and ShaderComplexityWithQuadOverdraw flags.
- It affects the DebugViewShaderMode and ViewModeIndex selection.
Developers should be aware of the following when using this variable:
- It is only available in non-shipping builds, as indicated by the SHOWFLAG_FIXED_IN_SHIPPING macro.
- It is categorized as a hidden show flag (SFG_Hidden), meaning it’s not typically exposed in the main user interface.
- Using this flag may impact performance, as it requires additional rendering passes and texture allocations.
Best practices when using this variable include:
- Only enable it when necessary for debugging or performance analysis.
- Be aware of its impact on frame rate and memory usage.
- Use it in conjunction with other debug view modes to get a comprehensive understanding of rendering complexity.
Regarding the associated variable QuadOverdraw:
The purpose of QuadOverdraw is to store and represent the actual quad overdraw data in the rendering pipeline. It is used as a texture resource in various parts of the rendering code, particularly in debug view modes and shader complexity visualizations.
QuadOverdraw is primarily used in the Renderer module and is closely tied to the ShowFlag.QuadOverdraw setting. It is typically initialized as a UAV (Unordered Access View) texture in the SceneTextures structure.
Developers should be aware that:
- QuadOverdraw is only allocated and used when certain debug view modes are active.
- It requires additional GPU memory and may impact performance when in use.
Best practices for using QuadOverdraw include:
- Ensure it’s only enabled when necessary for debugging or profiling.
- Clear the texture at the beginning of each frame when it’s in use.
- Be mindful of its impact on GPU memory usage, especially on platforms with limited resources.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:361
Scope: file
Source code excerpt:
SHOWFLAG_FIXED_IN_SHIPPING(0, HLODColoration, SFG_Hidden, NSLOCTEXT("UnrealEd", "VisualizeHLODColoration", "Visualize HLOD Coloration"))
/** Visualize screen quads */
SHOWFLAG_FIXED_IN_SHIPPING(0, QuadOverdraw, SFG_Hidden, NSLOCTEXT("UnrealEd", "QuadOverdrawSF", "Quad Overdraw"))
/** Visualize the overhead of material quads */
SHOWFLAG_FIXED_IN_SHIPPING(0, ShaderComplexityWithQuadOverdraw, SFG_Hidden, NSLOCTEXT("UnrealEd", "ShaderComplexityWithQuadOverdraw", "Shader Complexity With Quad Overdraw"))
/** Visualize the accuracy of the primitive distance computed for texture streaming */
SHOWFLAG_FIXED_IN_SHIPPING(0, PrimitiveDistanceAccuracy, SFG_Hidden, NSLOCTEXT("UnrealEd", "PrimitiveDistanceAccuracy", "Primitive Distance Accuracy"))
/** Visualize the accuracy of the mesh UV density computed for texture streaming */
SHOWFLAG_FIXED_IN_SHIPPING(0, MeshUVDensityAccuracy, SFG_Hidden, NSLOCTEXT("UnrealEd", "MeshUVDensityAccuracy", "Mesh UV Densities Accuracy"))
#Associated Variable and Callsites
This variable is associated with another variable named QuadOverdraw
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneView.cpp:3058
Scope (from outer to inner):
file
function EDebugViewShaderMode FSceneViewFamily::ChooseDebugViewShaderMode
Source code excerpt:
if (EngineShowFlags.ShaderComplexity)
{
if (EngineShowFlags.QuadOverdraw)
{
return DVSM_QuadComplexity;
}
else if (EngineShowFlags.ShaderComplexityWithQuadOverdraw)
{
return DVSM_ShaderComplexityContainedQuadOverhead;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShowFlags.cpp:728
Scope (from outer to inner):
file
function EViewModeIndex FindViewMode
Source code excerpt:
}
// Test QuadComplexity before ShaderComplexity because QuadComplexity also use ShaderComplexity
else if (EngineShowFlags.QuadOverdraw)
{
return VMI_QuadOverdraw;
}
else if (EngineShowFlags.ShaderComplexityWithQuadOverdraw)
{
return VMI_ShaderComplexityWithQuadOverdraw;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:361
Scope: file
Source code excerpt:
SHOWFLAG_FIXED_IN_SHIPPING(0, HLODColoration, SFG_Hidden, NSLOCTEXT("UnrealEd", "VisualizeHLODColoration", "Visualize HLOD Coloration"))
/** Visualize screen quads */
SHOWFLAG_FIXED_IN_SHIPPING(0, QuadOverdraw, SFG_Hidden, NSLOCTEXT("UnrealEd", "QuadOverdrawSF", "Quad Overdraw"))
/** Visualize the overhead of material quads */
SHOWFLAG_FIXED_IN_SHIPPING(0, ShaderComplexityWithQuadOverdraw, SFG_Hidden, NSLOCTEXT("UnrealEd", "ShaderComplexityWithQuadOverdraw", "Shader Complexity With Quad Overdraw"))
/** Visualize the accuracy of the primitive distance computed for texture streaming */
SHOWFLAG_FIXED_IN_SHIPPING(0, PrimitiveDistanceAccuracy, SFG_Hidden, NSLOCTEXT("UnrealEd", "PrimitiveDistanceAccuracy", "Primitive Distance Accuracy"))
/** Visualize the accuracy of the mesh UV density computed for texture streaming */
SHOWFLAG_FIXED_IN_SHIPPING(0, MeshUVDensityAccuracy, SFG_Hidden, NSLOCTEXT("UnrealEd", "MeshUVDensityAccuracy", "Mesh UV Densities Accuracy"))
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Internal/SceneTextures.h:91
Scope: file
Source code excerpt:
// Texture used by the quad overdraw debug view mode when enabled.
FRDGTextureRef QuadOverdraw{};
// (Mobile) Texture used by mobile PPR in the next frame.
FRDGTextureRef PixelProjectedReflection{};
// Textures used to composite editor primitives. Also used by the base pass when in wireframe mode.
#if WITH_EDITOR
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/BasePassRendering.cpp:1062
Scope (from outer to inner):
file
function void FDeferredShadingSceneRenderer::RenderBasePass
Source code excerpt:
if (bRequiresRHIClear)
{
if (ViewFamily.EngineShowFlags.ShaderComplexity && SceneTextures.QuadOverdraw)
{
AddClearUAVPass(GraphBuilder, GraphBuilder.CreateUAV(SceneTextures.QuadOverdraw), FUintVector4(0, 0, 0, 0));
}
if (ViewFamily.EngineShowFlags.ShaderComplexity || ViewFamily.EngineShowFlags.StationaryLightOverlap)
{
SceneColorClearValue = FLinearColor(0, 0, 0, kSceneColorClearAlpha);
}
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/BasePassRendering.cpp:1398
Scope (from outer to inner):
file
function void FDeferredShadingSceneRenderer::RenderBasePassInternal
lambda-function
Source code excerpt:
NaniteColorTarget,
NaniteDepthTarget,
SceneTextures.QuadOverdraw
);
}
else
#endif
{
RDG_GPU_STAT_SCOPE(GraphBuilder, NaniteBasePass);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/BasePassRendering.cpp:1465
Scope (from outer to inner):
file
function void FDeferredShadingSceneRenderer::RenderBasePassInternal
Source code excerpt:
{
// Override the base pass with one of the debug view shader mode (see EDebugViewShaderMode) if required.
RenderDebugViewMode(GraphBuilder, InViews, SceneTextures.QuadOverdraw, BasePassRenderTargets);
}
}
else
{
SCOPE_CYCLE_COUNTER(STAT_BasePassDrawTime);
RDG_EVENT_SCOPE(GraphBuilder, "BasePass");
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DebugViewModeRendering.cpp:155
Scope (from outer to inner):
file
function TRDGUniformBufferRef<FDebugViewModePassUniformParameters> CreateDebugViewModePassUniformBuffer
Source code excerpt:
SetupSceneTextureUniformParameters(GraphBuilder, View.GetSceneTexturesChecked(), View.FeatureLevel, ESceneTextureSetupMode::None, UniformBufferParameters->SceneTextures);
SetupDebugViewModePassUniformBufferConstants(View, UniformBufferParameters->DebugViewMode);
UniformBufferParameters->QuadOverdraw = GraphBuilder.CreateUAV(QuadOverdrawTexture);
return GraphBuilder.CreateUniformBuffer(UniformBufferParameters);
}
FDebugViewModeVS::FDebugViewModeVS() = default;
FDebugViewModeVS::FDebugViewModeVS(const FMeshMaterialShaderType::CompiledShaderInitializerType& Initializer)
: FMeshMaterialShader(Initializer)
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DebugViewModeRendering.h:36
Scope: file
Source code excerpt:
SHADER_PARAMETER_STRUCT(FSceneTextureUniformParameters, SceneTextures)
SHADER_PARAMETER_STRUCT(FDebugViewModeUniformParameters, DebugViewMode)
SHADER_PARAMETER_RDG_TEXTURE_UAV(RWTexture2D<uint>, QuadOverdraw)
END_GLOBAL_SHADER_PARAMETER_STRUCT()
#if WITH_DEBUG_VIEW_MODES
void SetupDebugViewModePassUniformBufferConstants(const FViewInfo& ViewInfo, FDebugViewModeUniformParameters& Parameters);
TRDGUniformBufferRef<FDebugViewModePassUniformParameters> CreateDebugViewModePassUniformBuffer(FRDGBuilder& GraphBuilder, const FViewInfo& View, FRDGTextureRef QuadOverdrawTexture);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/MobileBasePassRendering.cpp:356
Scope (from outer to inner):
file
function TRDGUniformBufferRef<FMobileBasePassUniformParameters> CreateMobileBasePassUniformBuffer
Source code excerpt:
#endif
// QuadOverdraw is a UAV so it needs to be initialized even if not used
const FSceneTextures* SceneTextures = View.GetSceneTexturesChecked();
FRDGTextureRef QuadOverdrawTexture = SceneTextures ? SceneTextures->QuadOverdraw : nullptr;
if (!QuadOverdrawTexture)
{
QuadOverdrawTexture = GraphBuilder.CreateTexture(FRDGTextureDesc::Create2D(FIntPoint(1, 1), PF_R32_UINT, FClearValueBinding::None, TexCreate_UAV), TEXT("DummyOverdrawUAV"));
}
BasePassParameters->QuadOverdraw = GraphBuilder.CreateUAV(QuadOverdrawTexture);
return GraphBuilder.CreateUniformBuffer(BasePassParameters);
}
void SetupMobileDirectionalLightUniformParameters(
const FScene& Scene,
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/MobileBasePassRendering.h:49
Scope: file
Source code excerpt:
SHADER_PARAMETER_STRUCT(FSubstrateMobileForwardPassUniformParameters, Substrate)
SHADER_PARAMETER_STRUCT(FDebugViewModeUniformParameters, DebugViewMode)
SHADER_PARAMETER_RDG_TEXTURE_UAV(RWTexture2D<uint>, QuadOverdraw)
SHADER_PARAMETER_STRUCT(FReflectionUniformParameters, ReflectionsParameters)
SHADER_PARAMETER_TEXTURE(Texture2D, PreIntegratedGFTexture)
SHADER_PARAMETER_SAMPLER(SamplerState, PreIntegratedGFSampler)
SHADER_PARAMETER_RDG_BUFFER_SRV(StructuredBuffer<float4>, EyeAdaptationBuffer)
SHADER_PARAMETER_RDG_BUFFER_UAV(RWStructuredBuffer<uint>, RWOcclusionBufferUAV)
SHADER_PARAMETER_RDG_TEXTURE(Texture2D, AmbientOcclusionTexture)
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/MobileShadingRenderer.cpp:1065
Scope (from outer to inner):
file
function void FMobileSceneRenderer::Render
Source code excerpt:
{
#if WITH_DEBUG_VIEW_MODES
if (ViewFamily.UseDebugViewPS() && ViewFamily.EngineShowFlags.ShaderComplexity && SceneTextures.QuadOverdraw)
{
AddClearUAVPass(GraphBuilder, GraphBuilder.CreateUAV(SceneTextures.QuadOverdraw), FUintVector4(0, 0, 0, 0));
}
#endif
if (bUseVirtualTexturing)
{
FVirtualTextureSystem::Get().EndUpdate(GraphBuilder, MoveTemp(VirtualTextureUpdater), FeatureLevel);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessVisualizeComplexity.cpp:126
Scope (from outer to inner):
file
function FScreenPassTexture AddVisualizeComplexityPass
Source code excerpt:
FVisualizeComplexityApplyPS::EQuadOverdraw QuadOverdrawEnum = FVisualizeComplexityApplyPS::EQuadOverdraw::Disable;
if (SceneTextures.QuadOverdraw)
{
const FRDGSystemTextures& SystemTextures = FRDGSystemTextures::Get(GraphBuilder);
PassParameters->QuadOverdrawTexture = HasBeenProduced(SceneTextures.QuadOverdraw) ? SceneTextures.QuadOverdraw : GSystemTextures.GetZeroUIntDummy(GraphBuilder);
PassParameters->DebugViewShaderMode = DebugViewShaderMode;
QuadOverdrawEnum = FVisualizeComplexityApplyPS::EQuadOverdraw::Enable;
}
PassParameters->bLegend = Inputs.bDrawLegend;
PassParameters->bShowError = PassParameters->DebugViewShaderMode != DVSM_QuadComplexity;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneTextures.cpp:635
Scope (from outer to inner):
file
function void FSceneTextures::InitializeViewFamily
Source code excerpt:
const FRDGTextureDesc QuadOverdrawDesc(FRDGTextureDesc::Create2D(QuadOverdrawExtent, PF_R32_UINT, FClearValueBinding::None, TexCreate_ShaderResource | TexCreate_RenderTargetable | TexCreate_UAV));
SceneTextures.QuadOverdraw = GraphBuilder.CreateTexture(QuadOverdrawDesc, TEXT("QuadOverdrawTexture"));
}
#endif
}
uint32 FSceneTextures::GetGBufferRenderTargets(
TArrayView<FTextureRenderTargetBinding> RenderTargets,