r.FastVRam.HZB
r.FastVRam.HZB
#Overview
name: r.FastVRam.HZB
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 51
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.FastVRam.HZB is to control the texture creation flags for the Hierarchical Z-Buffer (HZB) in Unreal Engine 5. This setting variable is primarily used in the rendering system, specifically for optimizing the storage and access of HZB textures in GPU memory.
The HZB is a crucial component in various rendering techniques, including occlusion culling, screen space reflections, and other depth-based effects. It’s a mip-mapped version of the depth buffer, allowing for efficient depth testing at different resolutions.
Key points about r.FastVRam.HZB:
-
It’s used in the renderer module, particularly in scene rendering and depth-related processing.
-
The value is set using the FASTVRAM_CVAR macro, which likely creates a console variable that can be adjusted at runtime.
-
It’s associated with the HZB variable in the FFastVramConfig struct, which is used to apply texture creation flags.
-
The setting affects how the HZB textures are allocated in GPU memory, potentially improving performance by using faster memory for these frequently accessed resources.
-
It’s used in various parts of the engine, including deferred shading, mobile rendering, and specific features like Lumen (Unreal’s global illumination system).
-
The default value is set to 1, indicating that by default, the engine attempts to allocate HZB textures in fast VRAM.
Best practices:
- Generally, keep this setting enabled (1) for optimal performance, as HZB is frequently accessed.
- If experiencing memory pressure on the GPU, you might consider disabling it, but this should be done cautiously and with performance testing.
- When implementing custom rendering features that use HZB, respect this setting to maintain consistency with the engine’s memory management.
Developers should be aware that changing this setting could impact performance and memory usage. It’s important to profile your specific use case if you’re considering modifying this value.
The associated variable HZB is used throughout the rendering pipeline wherever the Hierarchical Z-Buffer is needed. It’s crucial for various depth-based rendering techniques and optimizations. The same considerations apply to this variable as to the r.FastVRam.HZB setting.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:466
Scope: file
Source code excerpt:
FASTVRAM_CVAR(GBufferF, 0);
FASTVRAM_CVAR(GBufferVelocity, 0);
FASTVRAM_CVAR(HZB, 1);
FASTVRAM_CVAR(SceneDepth, 1);
FASTVRAM_CVAR(SceneColor, 1);
FASTVRAM_CVAR(Bloom, 1);
FASTVRAM_CVAR(BokehDOF, 1);
FASTVRAM_CVAR(CircleDOF, 1);
FASTVRAM_CVAR(CombineLUTs, 1);
#Associated Variable and Callsites
This variable is associated with another variable named HZB
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/WaterQuadTreeGPU.cpp:774
Scope (from outer to inner):
file
class class FWaterQuadTreeClearPerViewBuffersCS : public FGlobalShader
Source code excerpt:
const EOcclusionQueryMode OcclusionQueryMode = static_cast<EOcclusionQueryMode>(GWaterQuadTreeOcclusionCulling);
const bool bHZBOcclusionQueries = OcclusionQueryMode == EOcclusionQueryMode::HZB || OcclusionQueryMode == EOcclusionQueryMode::HZBAndPixelPrecise;
const bool bPixelPreciseOcclusionQueries = OcclusionQueryMode == EOcclusionQueryMode::PixelPrecise || OcclusionQueryMode == EOcclusionQueryMode::HZBAndPixelPrecise;
FRDGBuffer* OcclusionQueryIndirectArgsBuffer = nullptr;
FRDGBufferUAV* OcclusionQueryIndirectArgsBufferUAV = nullptr;
if (bPixelPreciseOcclusionQueries)
{
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/WaterQuadTreeGPU.cpp:876
Scope: file
Source code excerpt:
PassParameters->WaterZBoundsTexture = WaterZBoundsTextureRDG;
PassParameters->WaterBodyRenderData = WaterBodyRenderDataBufferSRV;
PassParameters->HZBTexture = (ViewInfo && ViewInfo->HZB) ? ViewInfo->HZB : GSystemTextures.GetBlackDummy(GraphBuilder);
PassParameters->HZBSampler = TStaticSamplerState<SF_Point, AM_Clamp, AM_Clamp, AM_Clamp>::GetRHI();
PassParameters->CullingBoundsAABB = FVector4f(Params.CullingBounds.Min.X, Params.CullingBounds.Min.Y, Params.CullingBounds.Max.X, Params.CullingBounds.Max.Y);
PassParameters->HZBSize = ViewInfo ? FVector2f(ViewInfo->HZBMipmap0Size) : FVector2f::ZeroVector;
PassParameters->HZBViewSize = ViewInfo ? FVector2f(ViewInfo->ViewRect.Size()) : FVector2f::ZeroVector;
PassParameters->QuadTreePosition = QuadTreePositionTranslatedWorldSpace;
PassParameters->ObserverPosition = ObserverPositionTranslatedWorldSpace;
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/WaterQuadTreeGPU.cpp:892
Scope: file
Source code excerpt:
PassParameters->NumLODs = NumMipLevels;
PassParameters->NumDispatchedThreads = NumTexelsTotal;
PassParameters->bHZBOcclusionCullingEnabled = bHZBOcclusionQueries && (ViewInfo && ViewInfo->HZB);
FComputeShaderUtils::AddPass(GraphBuilder, RDG_EVENT_NAME("WaterQuadTreeTraverse(View: %i)", ViewIndex), ComputeShader, PassParameters, FComputeShaderUtils::GetGroupCount(NumTexelsTotal, 64));
}
// Raster occlusion queries
if (bPixelPreciseOQForThisView)
#Loc: <Workspace>/Engine/Plugins/Experimental/Water/Source/Runtime/Private/WaterQuadTreeGPU.h:92
Scope (from outer to inner):
file
class class FWaterQuadTreeGPU
Source code excerpt:
{
Disabled = 0,
HZB = 1,
PixelPrecise = 2,
HZBAndPixelPrecise = 3
};
/** Mipped texture representing the water quadtree on the GPU */
TRefCountPtr<FRHITexture> QuadTreeTexture;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CompositionLighting/CompositionLighting.cpp:132
Scope (from outer to inner):
file
function static FSSAOCommonParameters GetSSAOCommonParameters
Source code excerpt:
CommonParameters.SceneTexturesViewport = FScreenPassTextureViewport(SceneTextureParameters.SceneDepthTexture, View.ViewRect);
CommonParameters.HZBInput = FScreenPassTexture(View.HZB);
CommonParameters.GBufferA = bAllowGBufferRead ? FScreenPassTexture(SceneTextureParameters.GBufferATexture, View.ViewRect) : FScreenPassTexture();
CommonParameters.SceneDepth = FScreenPassTexture(SceneTextureParameters.SceneDepthTexture, View.ViewRect);
CommonParameters.Levels = Levels;
CommonParameters.ShaderQuality = FSSAOHelper::GetAmbientOcclusionShaderLevel(View);
CommonParameters.DownscaleType = GetDownscaleSSAOType(View);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CompositionLighting/CompositionLighting.cpp:161
Scope (from outer to inner):
file
function FGTAOCommonParameters GetGTAOCommonParameters
Source code excerpt:
CommonParameters.SceneTexturesViewport = FScreenPassTextureViewport(SceneTextureParameters.SceneDepthTexture, View.ViewRect);
CommonParameters.HZBInput = FScreenPassTexture(View.HZB);
CommonParameters.SceneDepth = FScreenPassTexture(SceneTextureParameters.SceneDepthTexture, View.ViewRect);
CommonParameters.SceneVelocity = FScreenPassTexture(SceneTextureParameters.GBufferVelocityTexture, View.ViewRect);
CommonParameters.ShaderQuality = FSSAOHelper::GetAmbientOcclusionShaderLevel(View);
CommonParameters.DownscaleFactor = CVarGTAODownsample.GetValueOnRenderThread() > 0 ? 2 : 1;
CommonParameters.GTAOType = GTAOType;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/CompositionLighting/CompositionLighting.cpp:553
Scope (from outer to inner):
file
function void FCompositionLighting::TryInit
Source code excerpt:
ViewConfig.bSSAOAsync = FSSAOHelper::IsAmbientOcclusionAsyncCompute(View, ViewConfig.Levels);
ViewConfig.SSAOLocation = View.HZB != nullptr && (ViewConfig.bSSAOAsync || bForwardShading)
? ESSAOLocation::BeforeBasePass
: ESSAOLocation::AfterBasePass;
}
}
bInitialized = true;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DeferredShadingRenderer.cpp:434
Scope (from outer to inner):
file
function bool FDeferredShadingSceneRenderer::RenderHzb
Source code excerpt:
bool FDeferredShadingSceneRenderer::RenderHzb(FRDGBuilder& GraphBuilder, FRDGTextureRef SceneDepthTexture, const FBuildHZBAsyncComputeParams* AsyncComputeParams)
{
RDG_GPU_STAT_SCOPE(GraphBuilder, HZB);
for (int32 ViewIndex = 0; ViewIndex < Views.Num(); ViewIndex++)
{
FViewInfo& View = Views[ViewIndex];
RDG_GPU_MASK_SCOPE(GraphBuilder, View.GPUMask);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DeferredShadingRenderer.cpp:470
Scope (from outer to inner):
file
function bool FDeferredShadingSceneRenderer::RenderHzb
Source code excerpt:
{
View.HZBMipmap0Size = FurthestHZBTexture->Desc.Extent;
View.HZB = FurthestHZBTexture;
// Extract furthest HZB texture.
if (View.ViewState)
{
if (ShouldRenderNanite() || FInstanceCullingContext::IsOcclusionCullingEnabled())
{
GraphBuilder.QueueTextureExtraction(FurthestHZBTexture, &View.ViewState->PrevFrameViewInfo.HZB);
}
else
{
View.ViewState->PrevFrameViewInfo.HZB = nullptr;
}
}
// Extract closest HZB texture.
if (ViewPipelineState.bClosestHZB)
{
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/DeferredShadingRenderer.cpp:1403
Scope (from outer to inner):
file
function void FDeferredShadingSceneRenderer::RenderNanite
Source code excerpt:
CullingConfig,
ViewRect,
!bIsEarlyDepthComplete ? View.PrevViewInfo.NaniteHZB : View.PrevViewInfo.HZB
);
FSceneInstanceCullingQuery *SceneInstanceCullQuery = SceneCullingRenderer.CullInstances(GraphBuilder, ViewsToRenderCullingVolumes);
NaniteRenderer->DrawGeometry(
Scene->NaniteRasterPipelines[ENaniteMeshPass::BasePass],
RasterResults.VisibilityQuery,
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GenerateConservativeDepthBuffer.cpp:40
Scope (from outer to inner):
file
function void AddGenerateConservativeDepthBufferPass
Source code excerpt:
void AddGenerateConservativeDepthBufferPass(FViewInfo& View, FRDGBuilder& GraphBuilder, FRDGTextureRef ConservativeDepthTexture, int32 DestinationPixelSizeAtFullRes)
{
if (View.HZB)
{
FGenerateConservativeDepthBufferCS::FPermutationDomain Permutation;
TShaderMapRef<FGenerateConservativeDepthBufferCS> ComputeShader(GetGlobalShaderMap(View.GetFeatureLevel()), Permutation);
FIntVector ConservativeDepthTextureSize3D = ConservativeDepthTexture->Desc.GetSize();
FIntPoint ConservativeDepthTextureSize = FIntPoint(ConservativeDepthTextureSize3D.X, ConservativeDepthTextureSize3D.Y);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/GenerateConservativeDepthBuffer.cpp:53
Scope (from outer to inner):
file
function void AddGenerateConservativeDepthBufferPass
Source code excerpt:
Parameters->ConservativeDepthTextureSize = ConservativeDepthTextureSize;
Parameters->DestinationPixelSizeAtFullRes = DestinationPixelSizeAtFullRes;
Parameters->HZBTexture = View.HZB;
Parameters->HZBSampler = TStaticSamplerState< SF_Point, AM_Clamp, AM_Clamp, AM_Clamp >::GetRHI();
Parameters->HZBSize = View.HZB->Desc.Extent;
Parameters->HZBViewSize = FVector2f(View.ViewRect.Size());
const FIntVector DispatchCount = DispatchCount.DivideAndRoundUp(FIntVector(ConservativeDepthTextureSize.X, ConservativeDepthTextureSize.Y, 1), FIntVector(8, 8, 1));
FComputeShaderUtils::AddPass(
GraphBuilder, RDG_EVENT_NAME("GenerateConservativeDepthBuffer"),
ComputeShader, Parameters, DispatchCount);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/InstanceCulling/InstanceCullingOcclusionQuery.cpp:525
Scope (from outer to inner):
file
function uint32 FInstanceCullingOcclusionQueryRenderer::Render
Source code excerpt:
FRDGTextureRef DepthTexture = View.GetSceneTextures().Depth.Target;
FRDGTextureRef HZBTexture = View.HZB;
checkf(DepthTexture && HZBTexture,
TEXT("Occlusion query instance culling pass requires scene depth texture and HZB. See FInstanceCullingOcclusionQueryRenderer::IsCompatibleWithView()"));
const FIntVector HZBSize = HZBTexture->Desc.GetSize();
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/InstanceCulling/InstanceCullingOcclusionQuery.cpp:732
Scope (from outer to inner):
file
function bool FInstanceCullingOcclusionQueryRenderer::IsCompatibleWithView
Source code excerpt:
return FDataDrivenShaderPlatformInfo::GetSupportsVertexShaderSRVs(View.GetShaderPlatform())
&& View.GetSceneTextures().Depth.Target
&& View.HZB
&& VisibilityMaskFormat != PF_Unknown
&& CVarInstanceCullingOcclusionQueries.GetValueOnRenderThread() != 0;
}
// Debugging utilities
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/InstanceCulling/InstanceCullingOcclusionQuery.cpp:848
Scope: file
Source code excerpt:
FRDGTextureRef DepthTexture = View.GetSceneTextures().Depth.Target;
FRDGTextureRef HZBTexture = View.HZB;
checkf(DepthTexture && HZBTexture,
TEXT("Occlusion query instance culling requires scene depth texture and HZB. See FInstanceCullingOcclusionQueryRenderer::IsCompatibleWithView()"));
const FIntVector HZBSize = HZBTexture->Desc.GetSize();
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/LightSceneInfo.h:182
Scope (from outer to inner):
file
class class FPersistentShadowState
Source code excerpt:
FIntRect HZBTestViewRect;
TRefCountPtr<IPooledRenderTarget> HZB; // Direct HZB. nullptr for Atlas rendering.
};
/**
* The information used to render a light. This is the rendering thread's mirror of the game thread's ULightComponent.
* FLightSceneInfo is internal to the renderer module and contains internal scene state.
*/
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/LocalFogVolumeRendering.cpp:300
Scope (from outer to inner):
file
function class FLocalFogVolumeTiledCullingCS : public FGlobalShader { /*ARE_GLOBAL_SHADER
class class FLocalFogVolumeTiledCullingCS : public FGlobalShader
Source code excerpt:
PassParameters->TileDrawIndirectBufferUAV = View.LocalFogVolumeViewData.GPUTileDrawIndirectBufferUAV;
PassParameters->HZBTexture = View.HZB;
PassParameters->HZBSampler = TStaticSamplerState<SF_Point, AM_Clamp, AM_Clamp, AM_Clamp>::GetRHI();
PassParameters->HZBSize = FVector2f(View.HZBMipmap0Size);
PassParameters->HZBViewSize = FVector2f(View.ViewRect.Size());
PassParameters->HZBViewRect = FIntRect(0, 0, View.ViewRect.Width(), View.ViewRect.Height());
auto ConvertPlanToVector4f = [&](FVector4f& OutVec4f, auto& Plane, bool bFlipPlane)
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/LocalFogVolumeRendering.cpp:352
Scope: file
Source code excerpt:
FLocalFogVolumeTiledCullingCS::FPermutationDomain PermutationVector;
PermutationVector.Set<FLocalFogVolumeTiledCullingCS::FUseHZB>(View.HZB != nullptr && CVarLocalFogVolumeUseHZB.GetValueOnRenderThread());
TShaderMapRef<FLocalFogVolumeTiledCullingCS> ComputeShader(View.ShaderMap, PermutationVector);
FComputeShaderUtils::AddPass(GraphBuilder, RDG_EVENT_NAME("LocalFogVolume.TiledCulling"), PassFlag, ComputeShader, PassParameters, NumGroups);
}
/*=============================================================================
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenMeshSDFCulling.cpp:770
Scope (from outer to inner):
file
function void CullObjectsToGrid
Source code excerpt:
PassParameters->PS.MaxNumberOfCulledObjects = Context.MaxNumberOfCulledObjects;
PassParameters->PS.ClosestHZBTexture = View.ClosestHZB ? View.ClosestHZB : GSystemTextures.GetBlackDummy(GraphBuilder);
PassParameters->PS.FurthestHZBTexture = View.HZB;
PassParameters->PS.HZBMipLevel = FMath::Max<float>((int32)FMath::FloorLog2(GridPixelsPerCellXY) - 1, 0.0f);
PassParameters->PS.HaveClosestHZB = View.ClosestHZB ? 1 : 0;
PassParameters->PS.ViewportUVToHZBBufferUV = FVector2f(
float(View.ViewRect.Width()) / float(2 * View.HZBMipmap0Size.X),
float(View.ViewRect.Height()) / float(2 * View.HZBMipmap0Size.Y)
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenReflectionTracing.cpp:1068
Scope (from outer to inner):
file
function void TraceReflections
Source code excerpt:
PassParameters->SampleSceneColorNormalTreshold = LumenReflections::GetSampleSceneColorNormalTreshold();
PassParameters->DistantScreenTraceFurthestHZBTexture = View.HZB;
PassParameters->DistantScreenTraceSlopeCompareTolerance = GLumenReflectionDistantScreenTraceSlopeCompareTolerance;
PassParameters->DistantScreenTraceMaxTraceDistance = GLumenReflectionDistantScreenTraceMaxTraceDistance;
FReflectionTraceVoxelsCS::FPermutationDomain PermutationVector;
PermutationVector.Set< FReflectionTraceVoxelsCS::FThreadGroupSize32 >(Lumen::UseThreadGroupSize32());
PermutationVector.Set< FReflectionTraceVoxelsCS::FTraceGlobalSDF >(Lumen::UseGlobalSDFTracing(*View.Family));
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSceneRendering.cpp:2084
Scope (from outer to inner):
file
function void FDeferredShadingSceneRenderer::UpdateLumenScene
Source code excerpt:
TRefCountPtr<IPooledRenderTarget> NullRef;
FPlatformMemory::Memcpy(&SharedView->PrevViewInfo.HZB, &NullRef, sizeof(SharedView->PrevViewInfo.HZB));
SharedView->CachedViewUniformShaderParameters = MakeUnique<FViewUniformShaderParameters>(); //TODO: remove?
// Overrides must be send to the view uniform buffer that is accessed by Substrate when BSDFs are sanitized for instance.
SharedView->CachedViewUniformShaderParameters->DiffuseOverrideParameter = Views[0].CachedViewUniformShaderParameters->DiffuseOverrideParameter;
SharedView->CachedViewUniformShaderParameters->RoughnessOverrideParameter = Views[0].CachedViewUniformShaderParameters->RoughnessOverrideParameter;
SharedView->CachedViewUniformShaderParameters->SpecularOverrideParameter = Views[0].CachedViewUniformShaderParameters->SpecularOverrideParameter;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenProbeTracing.cpp:696
Scope (from outer to inner):
file
function void TraceScreenProbes
lambda-function
Source code excerpt:
PassParameters->Substrate = Substrate::BindSubstrateGlobalUniformParameters(View);
PassParameters->FurthestHZBTexture = View.HZB;
PassParameters->LightingChannelsTexture = LightingChannelsTexture;
PassParameters->MaxHierarchicalScreenTraceIterations = GLumenScreenProbeGatherHierarchicalScreenTracesMaxIterations;
PassParameters->RelativeDepthThickness = GLumenScreenProbeGatherRelativeDepthThickness * View.ViewMatrices.GetPerProjectionDepthThicknessScale();
PassParameters->HistoryDepthTestRelativeThickness = GLumenScreenProbeGatherHistoryDepthTestRelativeThickness * View.ViewMatrices.GetPerProjectionDepthThicknessScale();
PassParameters->NumThicknessStepsToDetermineCertainty = GLumenScreenProbeGatherHierarchicalScreenTracesSkipFoliageHits ? 0 : GLumenScreenProbeGatherNumThicknessStepsToDetermineCertainty;
PassParameters->MinimumTracingThreadOccupancy = GLumenScreenProbeGatherScreenTracesMinimumOccupancy;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenSpaceBentNormal.cpp:188
Scope (from outer to inner):
file
function FLumenScreenSpaceBentNormalParameters ComputeScreenSpaceShortRangeAO
lambda-function
Source code excerpt:
1.0f / ViewportUVToHZBBufferUV.Y);
PassParameters->FurthestHZBTexture = View.HZB;
PassParameters->FurthestHZBTextureSampler = TStaticSamplerState<SF_Point>::GetRHI();
PassParameters->SlopeCompareToleranceScale = GLumenShortRangeAOSlopeCompareToleranceScale;
if (bNeedTraceHairScreen)
{
PassParameters->HairStrands = HairStrands::BindHairStrandsViewUniformParameters(View);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenTranslucencyRadianceCache.cpp:364
Scope: file
Source code excerpt:
MarkPassParameters.RadianceCacheMarkParameters.InvClipmapFadeSizeForMark = 1.0f / FMath::Clamp(GLumenTranslucencyVolumeRadianceCacheClipmapFadeSize, .001f, 16.0f);
MarkPassParameters.FurthestHZBTexture = View.HZB;
MarkPassParameters.ViewportUVToHZBBufferUV = FVector2f(
float(View.ViewRect.Width()) / float(2 * View.HZBMipmap0Size.X),
float(View.ViewRect.Height()) / float(2 * View.HZBMipmap0Size.Y));
MarkPassParameters.HZBMipLevel = FMath::Max<float>((int32)FMath::FloorLog2((float)GLumenTranslucencyReflectionsMarkDownsampleFactor) - 1, 0.0f);
PassParameters->MarkPass = GraphBuilder.CreateUniformBuffer(&MarkPassParameters);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenTranslucencyVolumeLighting.cpp:601
Scope (from outer to inner):
file
function FLumenTranslucencyLightingVolumeParameters GetTranslucencyLightingVolumeParameters
Source code excerpt:
Parameters.TranslucencyVolumeTracingOctahedronResolution = GTranslucencyVolumeTracingOctahedronResolution;
Parameters.FurthestHZBTexture = View.HZB;
Parameters.HZBMipLevel = FMath::Max<float>((int32)FMath::FloorLog2(GTranslucencyFroxelGridPixelSize) - 1, 0.0f);
Parameters.ViewportUVToHZBBufferUV = FVector2f(
float(View.ViewRect.Width()) / float(2 * View.HZBMipmap0Size.X),
float(View.ViewRect.Height()) / float(2 * View.HZBMipmap0Size.Y));
return Parameters;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/MobileShadingRenderer.cpp:2303
Scope (from outer to inner):
file
function void FMobileSceneRenderer::RenderHZB
Source code excerpt:
void FMobileSceneRenderer::RenderHZB(FRDGBuilder& GraphBuilder, FRDGTextureRef SceneDepthTexture)
{
RDG_GPU_STAT_SCOPE(GraphBuilder, HZB);
for (int32 ViewIndex = 0; ViewIndex < Views.Num(); ViewIndex++)
{
FViewInfo& View = Views[ViewIndex];
if (View.ShouldRenderView())
{
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/MobileShadingRenderer.cpp:2327
Scope (from outer to inner):
file
function void FMobileSceneRenderer::RenderHZB
Source code excerpt:
View.HZBMipmap0Size = FurthestHZBTexture->Desc.Extent;
View.HZB = FurthestHZBTexture;
if (View.ViewState)
{
if (FInstanceCullingContext::IsOcclusionCullingEnabled())
{
GraphBuilder.QueueTextureExtraction(FurthestHZBTexture, &View.ViewState->PrevFrameViewInfo.HZB);
}
else
{
View.ViewState->PrevFrameViewInfo.HZB = nullptr;
}
}
}
if (Scene->InstanceCullingOcclusionQueryRenderer && View.ViewState)
{
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessAmbientOcclusionMobile.cpp:770
Scope: file
Source code excerpt:
CommonParameters.SceneTexturesViewport = FScreenPassTextureViewport(SceneDepthTexture, View.ViewRect);
CommonParameters.HZBInput = FScreenPassTexture(View.HZB);
CommonParameters.SceneDepth = FScreenPassTexture(SceneDepthTexture);
return CommonParameters;
}
static FMobileSSAOShaderParameters GetMobileSSAOShaderParameters(
const FViewInfo& View,
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/RendererScene.cpp:862
Scope: file
Source code excerpt:
GetRenderTargetGPUSizeBytes(GBufferB, bLogSizes) +
GetRenderTargetGPUSizeBytes(GBufferC, bLogSizes) +
GetRenderTargetGPUSizeBytes(HZB, bLogSizes) +
GetRenderTargetGPUSizeBytes(NaniteHZB, bLogSizes) +
GetRenderTargetGPUSizeBytes(CompressedDepthViewNormal, bLogSizes) +
GetRenderTargetGPUSizeBytes(CompressedOpaqueDepth, bLogSizes) +
GetRenderTargetGPUSizeBytes(CompressedOpaqueShadingModel, bLogSizes) +
GetRenderTargetGPUSizeBytes(ScreenSpaceRayTracingInput, bLogSizes) +
TemporalAAHistory.GetGPUSizeBytes(bLogSizes) +
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneOcclusion.cpp:1023
Scope: file
Source code excerpt:
PassParameters->BoundsCenterTexture = BoundsCenterTexture;
PassParameters->BoundsExtentTexture = BoundsExtentTexture;
PassParameters->HZBTexture = View.HZB;
PassParameters->RenderTargets[0] = FRenderTargetBinding(ResultsTextureGPU, ERenderTargetLoadAction::ENoAction);
PassParameters->HZBSize = FVector2f(View.HZBMipmap0Size);
PassParameters->HZBViewSize = FVector2f(View.ViewRect.Size());
PassParameters->HZBSampler = TStaticSamplerState<SF_Point, AM_Clamp, AM_Clamp, AM_Clamp>::GetRHI();
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneOcclusion.cpp:1389
Scope (from outer to inner):
file
function void FDeferredShadingSceneRenderer::RenderOcclusion
Source code excerpt:
if (bIsOcclusionTesting)
{
RDG_GPU_STAT_SCOPE(GraphBuilder, HZB);
uint32 DownsampleFactor = 1;
FRDGTextureRef SceneDepthTexture = SceneTextures.Depth.Target;
FRDGTextureRef OcclusionDepthTexture = SceneDepthTexture;
// Update the quarter-sized depth buffer with the current contents of the scene depth texture.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:466
Scope: file
Source code excerpt:
FASTVRAM_CVAR(GBufferF, 0);
FASTVRAM_CVAR(GBufferVelocity, 0);
FASTVRAM_CVAR(HZB, 1);
FASTVRAM_CVAR(SceneDepth, 1);
FASTVRAM_CVAR(SceneColor, 1);
FASTVRAM_CVAR(Bloom, 1);
FASTVRAM_CVAR(BokehDOF, 1);
FASTVRAM_CVAR(CircleDOF, 1);
FASTVRAM_CVAR(CombineLUTs, 1);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:666
Scope (from outer to inner):
file
function void FFastVramConfig::Update
Source code excerpt:
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_GBufferF, GBufferF);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_GBufferVelocity, GBufferVelocity);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_HZB, HZB);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_SceneDepth, SceneDepth);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_SceneColor, SceneColor);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_Bloom, Bloom);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_BokehDOF, BokehDOF);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_CircleDOF, CircleDOF);
bDirty |= UpdateTextureFlagFromCVar(CVarFastVRam_CombineLUTs, CombineLUTs);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:4257
Scope (from outer to inner):
file
function void FSceneRenderer::SetupMeshPass
Source code excerpt:
Scene,
View,
FInstanceCullingContext(PassName, ShaderPlatform, &InstanceCullingManager, ViewIds, View.PrevViewInfo.HZB, InstanceCullingMode, CullingFlags),
PassType,
BasePassDepthStencilAccess,
MeshPassProcessor,
View.DynamicMeshElements,
&View.DynamicMeshElementsPassRelevance,
View.NumVisibleDynamicMeshElements[PassType],
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.h:1067
Scope: file
Source code excerpt:
TRefCountPtr<IPooledRenderTarget> GBufferC;
TRefCountPtr<IPooledRenderTarget> HZB;
TRefCountPtr<IPooledRenderTarget> NaniteHZB;
// Bit mask used to interpret per-instance occlusion query results for this view.
// Expected to contain a single active bit or zero if instance occlusion query data is not available.
// See FInstanceCullingOcclusionQueryRenderer.
uint32 InstanceOcclusionQueryMask = 0;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.h:1487
Scope: file
Source code excerpt:
// Furthest and closest Hierarchical Z Buffer
FRDGTextureRef HZB = nullptr;
FRDGTextureRef ClosestHZB = nullptr;
int32 NumBoxReflectionCaptures;
int32 NumSphereReflectionCaptures;
float FurthestReflectionCaptureDistance;
TUniformBufferRef<FReflectionCaptureShaderData> ReflectionCaptureUniformBuffer;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.h:2815
Scope: file
Source code excerpt:
ETextureCreateFlags GBufferF;
ETextureCreateFlags GBufferVelocity;
ETextureCreateFlags HZB;
ETextureCreateFlags SceneDepth;
ETextureCreateFlags SceneColor;
ETextureCreateFlags Bloom;
ETextureCreateFlags BokehDOF;
ETextureCreateFlags CircleDOF;
ETextureCreateFlags CombineLUTs;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneTextureReductions.cpp:134
Scope: file
Source code excerpt:
TexCreate_ShaderResource | (bUseCompute ? TexCreate_UAV : TexCreate_RenderTargetable),
NumMips);
HZBDesc.Flags |= GFastVRamConfig.HZB;
/** Closest and furthest HZB are intentionally in separate render target, because majority of the case you only one or the other.
* Keeping them separate avoid doubling the size in cache for this cases, to avoid performance regression.
*/
FRDGTextureRef FurthestHZBTexture = GraphBuilder.CreateTexture(HZBDesc, FurthestHZBName);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceRayTracing.cpp:224
Scope (from outer to inner):
file
namespace ScreenSpaceRayTracing
function void SetupCommonScreenSpaceRayParameters
Source code excerpt:
}
OutParameters->FurthestHZBTexture = View.HZB;
OutParameters->FurthestHZBTextureSampler = TStaticSamplerState<SF_Point>::GetRHI();
OutParameters->ColorTexture = PrevSceneColor.SceneColor;
OutParameters->ColorTextureSampler = TStaticSamplerState<SF_Point>::GetRHI();
OutParameters->AlphaTexture = PrevSceneColor.SceneAlpha;
OutParameters->AlphaTextureSampler = TStaticSamplerState<SF_Point>::GetRHI();
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceRayTracing.cpp:353
Scope (from outer to inner):
file
namespace anonymous
Source code excerpt:
SHADER_PARAMETER_RDG_TEXTURE_SRV(Texture2D, SceneColor)
SHADER_PARAMETER_SAMPLER(SamplerState, SceneColorSampler)
SHADER_PARAMETER_RDG_TEXTURE(Texture2D, HZB)
SHADER_PARAMETER_SAMPLER(SamplerState, HZBSampler)
SHADER_PARAMETER_RDG_TEXTURE_UAV(RWTexture2D<float4>, ScreenSpaceRayTracingDebugOutput)
END_SHADER_PARAMETER_STRUCT()
enum class ELightingTerm
{
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceRayTracing.cpp:734
Scope (from outer to inner):
file
namespace ScreenSpaceRayTracing
function FPrevSceneColorMip ReducePrevSceneColorMip
Source code excerpt:
RDG_EVENT_SCOPE(GraphBuilder, "SSGI SceneColorReduction");
FRDGTexture* FurthestHZBTexture = View.HZB;
FRDGTexture* ClosestHZBTexture = View.ClosestHZB;
// Number of mip skipped at the begining of the mip chain.
const int32 DownSamplingMip = 1;
// Number of mip in the mip chain
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceRayTracing.cpp:925
Scope (from outer to inner):
file
namespace ScreenSpaceRayTracing
function FSSRTTileClassificationParameters RenderHorizonTileClassification
Source code excerpt:
FIntPoint SceneTexturesExtent = SceneTextures.SceneDepthTexture->Desc.Extent;
FRDGTextureRef FurthestHZBTexture = View.HZB;
FRDGTextureRef ClosestHZBTexture = View.ClosestHZB;
FSSRTTileClassificationParameters ClassificationParameters;
{
FRDGBufferRef TileClassificationBuffer;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ScreenSpaceRayTracing.cpp:1163
Scope (from outer to inner):
file
namespace ScreenSpaceRayTracing
function void RenderScreenSpaceReflections
lambda-function
Source code excerpt:
PassParameters->SceneColorSampler = GSSRHalfResSceneColor ? TStaticSamplerState<SF_Bilinear>::GetRHI() : TStaticSamplerState<SF_Point>::GetRHI();
PassParameters->HZB = View.HZB;
PassParameters->HZBSampler = TStaticSamplerState<SF_Point>::GetRHI();
};
FScreenSpaceReflectionsPS::FPermutationDomain PermutationVector;
PermutationVector.Set<FSSRQualityDim>(SSRQuality);
PermutationVector.Set<FSSROutputForDenoiser>(bDenoiser);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShadowDepthRendering.cpp:1372
Scope (from outer to inner):
file
function static void UpdateCurrentFrameHZB
Source code excerpt:
}
static void UpdateCurrentFrameHZB(FLightSceneInfo& LightSceneInfo, const FPersistentShadowStateKey& ShadowKey, const FProjectedShadowInfo* ProjectedShadowInfo, const TRefCountPtr<IPooledRenderTarget>& HZB, int32 CubeFaceIndex = -1)
{
FPersistentShadowState State;
State.ViewMatrices = ProjectedShadowInfo->GetShadowDepthRenderingViewMatrices(CubeFaceIndex);
State.HZBTestViewRect = ProjectedShadowInfo->GetInnerViewRect();
State.HZB = HZB;
LightSceneInfo.PersistentShadows.Add(ShadowKey, State);
}
// Serialize tasks that touch the persistent shadow map.
static UE::Tasks::FPipe GPersistentShadowsPipe(UE_SOURCE_LOCATION);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShadowDepthRendering.cpp:1817
Scope (from outer to inner):
file
function void FSceneRenderer::RenderShadowDepthMaps
Source code excerpt:
SharedContext.Pipeline = Nanite::EPipeline::Shadows;
TRefCountPtr<IPooledRenderTarget> PrevHZB = (PrevShadowState && bUseHZB) ? PrevShadowState->HZB : nullptr;
Nanite::FConfiguration CullingConfig = { 0 };
CullingConfig.bTwoPassOcclusion = true;
CullingConfig.bUpdateStreaming = bUpdateStreaming;
if (ProjectedShadowInfo->CacheMode == SDCM_StaticPrimitivesOnly)
{
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShadowDepthRendering.cpp:1890
Scope (from outer to inner):
file
function void FSceneRenderer::RenderShadowDepthMaps
Source code excerpt:
bUseGeometryShader);
TRefCountPtr<IPooledRenderTarget> HZB;
if (bUseHZB)
{
FRDGTextureRef FurthestHZBTexture;
BuildHZBFurthest(
GraphBuilder,
GraphBuilder.RegisterExternalTexture(GSystemTextures.BlackDummy),
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShadowDepthRendering.cpp:1904
Scope (from outer to inner):
file
function void FSceneRenderer::RenderShadowDepthMaps
Source code excerpt:
/* OutFurthestHZBTexture = */ &FurthestHZBTexture);
HZB = GraphBuilder.ConvertToExternalTexture(FurthestHZBTexture);
}
UpdateCurrentFrameHZB(LightSceneInfo, ShadowKey, ProjectedShadowInfo, HZB, CubemapFaceIndex);
}
}
}
// Make readable because ShadowDepthTexture is not tracked via RDG yet
ShadowMap.RenderTargets.DepthTarget = ConvertToExternalAccessTexture(GraphBuilder, ExternalAccessQueue, ShadowDepthTexture);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/TranslucentRendering.cpp:836
Scope (from outer to inner):
file
function TRDGUniformBufferRef<FTranslucentBasePassUniformParameters> CreateTranslucentBasePassUniformBuffer
Source code excerpt:
float PrevSceneColorPreExposureInvValue = 1.0f / View.PreExposure;
if (View.HZB)
{
BasePassParameters.HZBTexture = View.HZB;
BasePassParameters.HZBSampler = TStaticSamplerState<SF_Point, AM_Clamp, AM_Clamp, AM_Clamp>::GetRHI();
FRDGTextureSRVRef PrevSceneColorTexture = GraphBuilder.CreateSRV(FRDGTextureSRVDesc(SystemTextures.Black));
FIntRect PrevSceneColorViewRect = FIntRect(0, 0, 1, 1);
if (View.PrevViewInfo.CustomSSRInput.IsValid())
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VirtualShadowMaps/VirtualShadowMapCacheManager.cpp:725
Scope (from outer to inner):
file
function TRefCountPtr<IPooledRenderTarget> FVirtualShadowMapArrayCacheManager::SetHZBPhysicalPoolSize
Source code excerpt:
Format,
FClearValueBinding::None,
GFastVRamConfig.HZB,
TexCreate_ShaderResource | TexCreate_UAV,
false,
FVirtualShadowMap::NumHZBLevels);
GRenderTargetPool.FindFreeElement(GraphBuilder.RHICmdList, Desc, HZBPhysicalPagePool, TEXT("Shadow.Virtual.HZBPhysicalPagePool"));
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/WaterInfoTextureRendering.cpp:826
Scope (from outer to inner):
file
function void RenderWaterInfoTexture
Source code excerpt:
TRefCountPtr<IPooledRenderTarget> NullRef;
FPlatformMemory::Memcpy(&WaterView.PrevViewInfo.HZB, &NullRef, sizeof(WaterView.PrevViewInfo.HZB));
WaterView.SetupCommonViewUniformBufferParameters(
*WaterView.CachedViewUniformShaderParameters,
TextureSize,
1,
Initializer.ConstrainedViewRect,