r.Shadow.Scene.DebugDrawLightActiveStateTracking
r.Shadow.Scene.DebugDrawLightActiveStateTracking
#Overview
name: r.Shadow.Scene.DebugDrawLightActiveStateTracking
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Shadow.Scene.DebugDrawLightActiveStateTracking is to enable debug drawing for light active state tracking in the shadow rendering system. This setting variable is part of Unreal Engine 5’s rendering system, specifically the shadow rendering subsystem.
Based on the details in the Callsites section, this variable is primarily used in the Renderer module, particularly in the ShadowScene.cpp file. This suggests that the shadow rendering subsystem relies on this setting variable for debugging purposes.
The value of this variable is set through the TAutoConsoleVariable mechanism, which allows it to be changed at runtime through console commands. It is initialized with a default value of 0, indicating that the debug drawing is disabled by default.
The associated variable CVarDebugDrawLightActiveStateTracking interacts directly with r.Shadow.Scene.DebugDrawLightActiveStateTracking. They share the same value and purpose, with CVarDebugDrawLightActiveStateTracking being the C++ variable used to access the console variable’s value in the code.
Developers must be aware that this variable is intended for debugging purposes only. It should not be enabled in shipping or test builds, as evidenced by the #if !(UE_BUILD_SHIPPING || UE_BUILD_TEST) conditional compilation directive.
Best practices when using this variable include:
- Only enable it when actively debugging shadow rendering issues.
- Be aware that enabling this debug drawing may impact performance, so it should be used judiciously.
- Remember to disable it after debugging to avoid unnecessary performance overhead.
Regarding the associated variable CVarDebugDrawLightActiveStateTracking:
- Its purpose is to provide a programmatic way to access the value of r.Shadow.Scene.DebugDrawLightActiveStateTracking within the C++ code.
- It is used in the Renderer module, specifically in the shadow rendering system.
- Its value is set indirectly through the console variable r.Shadow.Scene.DebugDrawLightActiveStateTracking.
- It interacts directly with r.Shadow.Scene.DebugDrawLightActiveStateTracking, sharing the same value.
- Developers should be aware that this variable is used to control debug rendering and should only be accessed on the render thread, as indicated by the ECVF_RenderThreadSafe flag.
- Best practices include using GetValueOnRenderThread() to access its value, as demonstrated in the provided code excerpt, to ensure thread-safe access.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Shadows/ShadowScene.cpp:10
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarDebugDrawLightActiveStateTracking(
TEXT("r.Shadow.Scene.DebugDrawLightActiveStateTracking"),
0,
TEXT("."),
ECVF_RenderThreadSafe
);
TAutoConsoleVariable<int32> CVarShadowSceneLightActiveFrameCount(
#Associated Variable and Callsites
This variable is associated with another variable named CVarDebugDrawLightActiveStateTracking
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Shadows/ShadowScene.cpp:9
Scope: file
Source code excerpt:
#endif
TAutoConsoleVariable<int32> CVarDebugDrawLightActiveStateTracking(
TEXT("r.Shadow.Scene.DebugDrawLightActiveStateTracking"),
0,
TEXT("."),
ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Shadows/ShadowScene.cpp:157
Scope (from outer to inner):
file
function void FShadowScene::DebugRender
Source code excerpt:
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
if (CVarDebugDrawLightActiveStateTracking.GetValueOnRenderThread() != 0)
{
SceneChangeUpdateTask.Wait();
for (FViewInfo& View : Views)
{
FViewElementPDI DebugPDI(&View, nullptr, &View.DynamicPrimitiveCollector);