r.LumenScene.UploadEveryFrame
r.LumenScene.UploadEveryFrame
#Overview
name: r.LumenScene.UploadEveryFrame
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to upload the entire Lumen Scene\'s data every frame. Useful for debugging.
It is referenced in 7
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.LumenScene.UploadEveryFrame is to control whether the entire Lumen Scene’s data should be uploaded every frame. This setting is primarily used for debugging purposes in the Lumen lighting system of Unreal Engine 5.
-
This setting variable is used in the Lumen subsystem, which is part of the rendering module in Unreal Engine 5. Specifically, it affects the Lumen Scene, Lumen Mesh Cards, and related components.
-
The value of this variable is set through the console variable system in Unreal Engine. It’s defined as an integer (int32) and initialized to 0 by default.
-
The associated variable GLumenSceneUploadEveryFrame directly interacts with r.LumenScene.UploadEveryFrame. They share the same value, with GLumenSceneUploadEveryFrame being the actual variable used in the C++ code.
-
Developers must be aware that enabling this setting (setting it to a non-zero value) will cause the engine to upload the entire Lumen Scene data every frame. This can have significant performance implications and should only be used for debugging purposes.
-
Best practices when using this variable:
- Keep it disabled (set to 0) during normal development and gameplay.
- Only enable it when debugging specific issues related to the Lumen Scene data.
- Be aware of the performance impact when enabled.
- After debugging, ensure it’s set back to 0 to restore normal performance.
Regarding the associated variable GLumenSceneUploadEveryFrame:
- Its purpose is to provide a direct C++ accessible version of the r.LumenScene.UploadEveryFrame setting.
- It’s used in various parts of the Lumen system, including LumenMeshCards and LumenScene.
- The value is set by the console variable system when r.LumenScene.UploadEveryFrame is modified.
- It’s used as a condition to trigger full updates of various Lumen-related data structures, such as heightfields, primitives, and cards.
- Developers should treat this variable as read-only in their code, as its value is controlled by the console variable system.
- When this variable is non-zero, it causes more frequent and comprehensive updates to the Lumen scene data, which can be useful for debugging but may impact performance.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScene.cpp:54
Scope: file
Source code excerpt:
int32 GLumenSceneUploadEveryFrame = 0;
FAutoConsoleVariableRef CVarLumenSceneUploadEveryFrame(
TEXT("r.LumenScene.UploadEveryFrame"),
GLumenSceneUploadEveryFrame,
TEXT("Whether to upload the entire Lumen Scene's data every frame. Useful for debugging."),
ECVF_RenderThreadSafe
);
TAutoConsoleVariable<int32> CVarLumenSceneUpdateViewOrigin(
#Associated Variable and Callsites
This variable is associated with another variable named GLumenSceneUploadEveryFrame
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenMeshCards.cpp:122
Scope: file
Source code excerpt:
);
extern int32 GLumenSceneUploadEveryFrame;
namespace LumenMeshCards
{
FVector3f GetAxisAlignedDirection(uint32 AxisAlignedDirectionIndex);
};
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenMeshCards.cpp:297
Scope (from outer to inner):
file
function void UpdateLumenMeshCards
Source code excerpt:
QUICK_SCOPE_CYCLE_COUNTER(UpdateLumenMeshCards);
extern int32 GLumenSceneUploadEveryFrame;
if (GLumenSceneUploadEveryFrame)
{
LumenSceneData.HeightfieldIndicesToUpdateInBuffer.Reset();
for (int32 i = 0; i < LumenSceneData.Heightfields.Num(); ++i)
{
LumenSceneData.HeightfieldIndicesToUpdateInBuffer.Add(i);
}
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenMeshCards.cpp:423
Scope (from outer to inner):
file
function void UpdateLumenMeshCards
Source code excerpt:
QUICK_SCOPE_CYCLE_COUNTER(UpdateSceneInstanceIndexToMeshCardsIndexBuffer);
if (GLumenSceneUploadEveryFrame)
{
LumenSceneData.PrimitivesToUpdateMeshCards.Reset();
for (int32 PrimitiveIndex = 0; PrimitiveIndex < Scene.Primitives.Num(); ++PrimitiveIndex)
{
LumenSceneData.PrimitivesToUpdateMeshCards.Add(PrimitiveIndex);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenMeshCards.cpp:503
Scope (from outer to inner):
file
function void Lumen::UpdateCardSceneBuffer
Source code excerpt:
}
if (GLumenSceneUploadEveryFrame)
{
LumenSceneData.CardIndicesToUpdateInBuffer.Reset();
for (int32 i = 0; i < LumenSceneData.Cards.Num(); i++)
{
LumenSceneData.CardIndicesToUpdateInBuffer.Add(i);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScene.cpp:52
Scope: file
Source code excerpt:
);
int32 GLumenSceneUploadEveryFrame = 0;
FAutoConsoleVariableRef CVarLumenSceneUploadEveryFrame(
TEXT("r.LumenScene.UploadEveryFrame"),
GLumenSceneUploadEveryFrame,
TEXT("Whether to upload the entire Lumen Scene's data every frame. Useful for debugging."),
ECVF_RenderThreadSafe
);
TAutoConsoleVariable<int32> CVarLumenSceneUpdateViewOrigin(
TEXT("r.LumenScene.UpdateViewOrigin"),
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScene.cpp:424
Scope (from outer to inner):
file
function void FLumenSceneData::UploadPageTable
Source code excerpt:
RDG_GPU_MASK_SCOPE(GraphBuilder, FRHIGPUMask::All());
if (GLumenSceneUploadEveryFrame != 0)
{
PageTableIndicesToUpdateInBuffer.SetNum(PageTable.Num());
for (int32 PageIndex = 0; PageIndex < PageTable.Num(); ++PageIndex)
{
PageTableIndicesToUpdateInBuffer[PageIndex] = PageIndex;