r.ManyLights.FixedStateFrameIndex
r.ManyLights.FixedStateFrameIndex
#Overview
name: r.ManyLights.FixedStateFrameIndex
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to override View.StateFrameIndex for debugging.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.ManyLights.FixedStateFrameIndex is to provide a debugging tool for the rendering system, specifically for the Many Lights system in Unreal Engine 5. It allows developers to override the View.StateFrameIndex for debugging purposes.
This setting variable is primarily used in the Renderer module of Unreal Engine, particularly within the Many Lights subsystem. The Many Lights system is responsible for efficiently rendering multiple light sources in a scene.
The value of this variable is set through the console variable system in Unreal Engine. It’s defined as a TAutoConsoleVariable with a default value of -1, which means it’s not active by default.
The associated variable CVarManyLightsFixedStateFrameIndex interacts directly with r.ManyLights.FixedStateFrameIndex. They share the same value and purpose.
Developers must be aware that this variable is intended for debugging purposes only. When set to a value greater than or equal to 0, it will override the normal StateFrameIndex calculation, which could affect the rendering behavior and performance of the Many Lights system.
Best practices when using this variable include:
- Only use it for debugging purposes.
- Reset it to -1 (or use the console command to clear it) after debugging to ensure normal rendering behavior.
- Be cautious when using it in production builds, as it may impact performance or visual quality.
- Document its usage clearly when employing it in debugging sessions to avoid confusion among team members.
Regarding the associated variable CVarManyLightsFixedStateFrameIndex:
The purpose of CVarManyLightsFixedStateFrameIndex is identical to r.ManyLights.FixedStateFrameIndex. It’s the actual C++ variable that stores and provides access to the console variable’s value.
This variable is used within the Renderer module, specifically in the ManyLights namespace. It’s primarily accessed in the GetStateFrameIndex function, which is likely a key part of the Many Lights system’s state management.
The value of CVarManyLightsFixedStateFrameIndex is set when the console variable r.ManyLights.FixedStateFrameIndex is modified. It’s accessed using the GetValueOnRenderThread() method, ensuring thread-safe access in the render thread.
No other variables directly interact with CVarManyLightsFixedStateFrameIndex beyond its relationship with r.ManyLights.FixedStateFrameIndex.
Developers should be aware that this variable is accessed on the render thread, so any modifications should be done with thread safety in mind.
Best practices for CVarManyLightsFixedStateFrameIndex are the same as for r.ManyLights.FixedStateFrameIndex, with an additional note to be cautious about direct modifications to this variable in C++ code, as it’s primarily intended to be controlled via the console variable system.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ManyLights/ManyLights.cpp:115
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int> CVarManyLightsFixedStateFrameIndex(
TEXT("r.ManyLights.FixedStateFrameIndex"),
-1,
TEXT("Whether to override View.StateFrameIndex for debugging."),
ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<int> CVarManyLightsTexturedRectLights(
#Associated Variable and Callsites
This variable is associated with another variable named CVarManyLightsFixedStateFrameIndex
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ManyLights/ManyLights.cpp:114
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int> CVarManyLightsFixedStateFrameIndex(
TEXT("r.ManyLights.FixedStateFrameIndex"),
-1,
TEXT("Whether to override View.StateFrameIndex for debugging."),
ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ManyLights/ManyLights.cpp:186
Scope (from outer to inner):
file
namespace ManyLights
function uint32 GetStateFrameIndex
Source code excerpt:
uint32 StateFrameIndex = ViewState ? ViewState->GetFrameIndex() : 0;
if (CVarManyLightsFixedStateFrameIndex.GetValueOnRenderThread() >= 0)
{
StateFrameIndex = CVarManyLightsFixedStateFrameIndex.GetValueOnRenderThread();
}
return StateFrameIndex;
}
FIntPoint GetNumSamplesPerPixel2d()