r.FastVRam.ForwardLightingCullingResources
r.FastVRam.ForwardLightingCullingResources
#Overview
name: r.FastVRam.ForwardLightingCullingResources
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.ForwardLightingCullingResources is to control the allocation of forward lighting culling resources in fast VRAM. This setting is part of the rendering system in Unreal Engine 5, specifically related to the forward rendering pipeline and lighting optimization.
The Unreal Engine subsystem that relies on this setting variable is the Renderer module, as evidenced by its presence in the SceneRendering.cpp and SceneRendering.h files.
The value of this variable is set using the FASTVRAM_CVAR macro, which likely creates a console variable (CVar) that can be adjusted at runtime. In the provided code, it’s initially set to 1.
This variable interacts with the associated variable ForwardLightingCullingResources, which is of type EBufferUsageFlags. The r.FastVRam.ForwardLightingCullingResources CVar is used to update the ForwardLightingCullingResources flag in the FFastVramConfig::Update() function.
Developers must be aware that this variable affects the allocation of forward lighting culling resources in fast VRAM. Changing this setting could impact rendering performance, particularly in scenes with complex lighting setups.
Best practices when using this variable include:
- Only modify it if you have a good understanding of the engine’s rendering pipeline and memory management.
- Monitor performance impacts when adjusting this setting, especially on different hardware configurations.
- Consider the trade-offs between using fast VRAM for these resources versus other rendering resources.
Regarding the associated variable ForwardLightingCullingResources:
The purpose of ForwardLightingCullingResources is to store the buffer usage flags for forward lighting culling resources. It’s part of the FFastVramConfig struct, which manages fast VRAM allocation for various rendering resources.
This variable is used within the Renderer module to determine how forward lighting culling resources should be allocated in memory.
The value of ForwardLightingCullingResources is updated in the FFastVramConfig::Update() function based on the r.FastVRam.ForwardLightingCullingResources CVar.
It interacts directly with the r.FastVRam.ForwardLightingCullingResources CVar and is part of a larger system managing fast VRAM allocation for various rendering resources.
Developers should be aware that modifying ForwardLightingCullingResources directly is not recommended. Instead, they should use the r.FastVRam.ForwardLightingCullingResources CVar to control its behavior.
Best practices include:
- Treat ForwardLightingCullingResources as a read-only variable within your code.
- Use the r.FastVRam.ForwardLightingCullingResources CVar to indirectly control ForwardLightingCullingResources.
- Be cautious when modifying any fast VRAM allocation settings, as they can have significant performance implications.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:512
Scope: file
Source code excerpt:
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 ForwardLightingCullingResources
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:512
Scope: file
Source code excerpt:
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:711
Scope (from outer to inner):
file
function void FFastVramConfig::Update
Source code excerpt:
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))
{
SceneColor = SceneColor & (~(TexCreate_FastVRAM | TexCreate_FastVRAMPartialAlloc));
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.h:2863
Scope: file
Source code excerpt:
EBufferUsageFlags DistanceFieldTileIntersectionResources;
EBufferUsageFlags DistanceFieldAOScreenGridResources;
EBufferUsageFlags ForwardLightingCullingResources;
EBufferUsageFlags GlobalDistanceFieldCullGridBuffers;
bool bDirty;
private:
bool UpdateTextureFlagFromCVar(TAutoConsoleVariable<int32>& CVar, ETextureCreateFlags& InOutValue);
bool UpdateBufferFlagFromCVar(TAutoConsoleVariable<int32>& CVar, EBufferUsageFlags& InOutValue);