r.FastVRam.DistanceFieldAOScreenGridResources
r.FastVRam.DistanceFieldAOScreenGridResources
#Overview
name: r.FastVRam.DistanceFieldAOScreenGridResources
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.FastVRam.DistanceFieldAOScreenGridResources is to control the allocation of distance field ambient occlusion (AO) screen grid resources in fast VRAM. This setting is part of the rendering system, specifically related to the Distance Field Ambient Occlusion feature in Unreal Engine 5.
The Unreal Engine subsystem that relies on this setting variable is the Renderer module, as evidenced by its usage in the SceneRendering.cpp and SceneRendering.h files within the Runtime/Renderer directory.
The value of this variable is set using the FASTVRAM_CVAR macro, which likely creates a console variable (CVar) that can be modified at runtime. In the provided code, it’s initially set to 1.
This variable interacts with the associated variable DistanceFieldAOScreenGridResources. They share the same value and are used together in the FFastVramConfig::Update function to determine if the fast VRAM configuration needs updating.
Developers must be aware that changing this variable will affect the performance and memory usage of the Distance Field Ambient Occlusion feature. Setting it to 1 (true) will allocate these resources in fast VRAM, which can improve performance but may consume more of the limited fast VRAM space.
Best practices when using this variable include:
- Only enable it if Distance Field Ambient Occlusion is being used in the project.
- Monitor performance and memory usage when enabling or disabling this feature.
- Consider the trade-offs with other resources that might benefit from fast VRAM allocation.
Regarding the associated variable DistanceFieldAOScreenGridResources:
The purpose of DistanceFieldAOScreenGridResources is to represent the buffer usage flags for the Distance Field Ambient Occlusion screen grid resources. It’s used within the FFastVramConfig struct to store the current state of these resources’ allocation in fast VRAM.
This variable is part of the rendering system’s fast VRAM configuration management.
The value of this variable is set in the FFastVramConfig::Update function, where it’s updated based on the r.FastVRam.DistanceFieldAOScreenGridResources console variable.
It interacts directly with the r.FastVRam.DistanceFieldAOScreenGridResources CVar and is used to determine if the fast VRAM configuration has changed (bDirty flag).
Developers should be aware that this variable represents the current state of the fast VRAM allocation for these resources and is used internally by the renderer to manage memory allocation.
Best practices include:
- Not modifying this variable directly, but instead using the r.FastVRam.DistanceFieldAOScreenGridResources console variable to control its value.
- Understanding that changes to this variable may impact rendering performance and memory usage.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:511
Scope: file
Source code excerpt:
FASTVRAM_CVAR(DistanceFieldCulledObjectBuffers, 1);
FASTVRAM_CVAR(DistanceFieldTileIntersectionResources, 1);
FASTVRAM_CVAR(DistanceFieldAOScreenGridResources, 1);
FASTVRAM_CVAR(ForwardLightingCullingResources, 1);
FASTVRAM_CVAR(GlobalDistanceFieldCullGridBuffers, 1);
TSharedPtr<FVirtualShadowMapClipmap> FVisibleLightInfo::FindShadowClipmapForView(const FViewInfo* View) const
{
for (const auto& Clipmap : VirtualShadowMapClipmaps)
#Associated Variable and Callsites
This variable is associated with another variable named DistanceFieldAOScreenGridResources
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:511
Scope: file
Source code excerpt:
FASTVRAM_CVAR(DistanceFieldCulledObjectBuffers, 1);
FASTVRAM_CVAR(DistanceFieldTileIntersectionResources, 1);
FASTVRAM_CVAR(DistanceFieldAOScreenGridResources, 1);
FASTVRAM_CVAR(ForwardLightingCullingResources, 1);
FASTVRAM_CVAR(GlobalDistanceFieldCullGridBuffers, 1);
TSharedPtr<FVirtualShadowMapClipmap> FVisibleLightInfo::FindShadowClipmapForView(const FViewInfo* View) const
{
for (const auto& Clipmap : VirtualShadowMapClipmaps)
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:710
Scope (from outer to inner):
file
function void FFastVramConfig::Update
Source code excerpt:
bDirty |= UpdateBufferFlagFromCVar(CVarFastVRam_DistanceFieldCulledObjectBuffers, DistanceFieldCulledObjectBuffers);
bDirty |= UpdateBufferFlagFromCVar(CVarFastVRam_DistanceFieldTileIntersectionResources, DistanceFieldTileIntersectionResources);
bDirty |= UpdateBufferFlagFromCVar(CVarFastVRam_DistanceFieldAOScreenGridResources, DistanceFieldAOScreenGridResources);
bDirty |= UpdateBufferFlagFromCVar(CVarFastVRam_ForwardLightingCullingResources, ForwardLightingCullingResources);
bDirty |= UpdateBufferFlagFromCVar(CVarFastVRam_GlobalDistanceFieldCullGridBuffers, GlobalDistanceFieldCullGridBuffers);
// When Substrate is enable, remove Scene color from fast VRAM to leave space for material buffer which has more impact on performance
if (Substrate::IsSubstrateEnabled() && !IsForwardShadingEnabled(GMaxRHIShaderPlatform))
{
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.h:2862
Scope: file
Source code excerpt:
EBufferUsageFlags DistanceFieldCulledObjectBuffers;
EBufferUsageFlags DistanceFieldTileIntersectionResources;
EBufferUsageFlags DistanceFieldAOScreenGridResources;
EBufferUsageFlags ForwardLightingCullingResources;
EBufferUsageFlags GlobalDistanceFieldCullGridBuffers;
bool bDirty;
private:
bool UpdateTextureFlagFromCVar(TAutoConsoleVariable<int32>& CVar, ETextureCreateFlags& InOutValue);