r.ManyLights.Debug
r.ManyLights.Debug
#Overview
name: r.ManyLights.Debug
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to enabled debug mode, which prints various extra debug information from shaders.0 - Disable\n1 - Visualize sampling\n2 - Visualize tracing\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.ManyLights.Debug is to enable debug mode for the many lights system in Unreal Engine’s rendering pipeline. This setting variable is used to control the level of debug information printed from shaders related to the many lights system.
This setting variable is primarily used within the Renderer module of Unreal Engine, specifically in the ManyLights subsystem. Based on the callsites, it’s clear that this variable is part of the rendering system and is used to debug the many lights feature.
The value of this variable is set through a console variable (CVarManyLightsDebug) with three possible values: 0 - Disable debug mode 1 - Visualize sampling 2 - Visualize tracing
The associated variable CVarManyLightsDebug is directly linked to r.ManyLights.Debug. It’s an instance of TAutoConsoleVariable
Developers must be aware that this variable is render thread safe (ECVF_RenderThreadSafe), meaning it can be safely accessed and modified from the render thread. When using this variable, developers should consider the performance impact of enabling debug visualizations, especially in production builds.
Best practices when using this variable include:
- Using it primarily during development and debugging phases.
- Ensuring it’s disabled in release builds to avoid performance overhead.
- Understanding the different visualization modes (sampling and tracing) to effectively debug lighting issues.
- Using it in conjunction with other rendering debug tools for comprehensive analysis.
Regarding the associated variable CVarManyLightsDebug:
- It’s a console variable that directly controls the r.ManyLights.Debug setting.
- It’s accessed in the GetDebugMode() function within the ManyLights namespace, which suggests it’s used to determine the current debug mode in various parts of the many lights system.
- Developers should use this variable through the console or game settings interface rather than modifying it directly in code, to maintain consistency with the engine’s console variable system.
- When querying its value, it’s important to use GetValueOnRenderThread() to ensure thread-safe access in rendering code.
#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:82
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarManyLightsDebug(
TEXT("r.ManyLights.Debug"),
0,
TEXT("Whether to enabled debug mode, which prints various extra debug information from shaders.")
TEXT("0 - Disable\n")
TEXT("1 - Visualize sampling\n")
TEXT("2 - Visualize tracing\n"),
ECVF_RenderThreadSafe
#Associated Variable and Callsites
This variable is associated with another variable named CVarManyLightsDebug
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ManyLights/ManyLights.cpp:81
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarManyLightsDebug(
TEXT("r.ManyLights.Debug"),
0,
TEXT("Whether to enabled debug mode, which prints various extra debug information from shaders.")
TEXT("0 - Disable\n")
TEXT("1 - Visualize sampling\n")
TEXT("2 - Visualize tracing\n"),
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ManyLights/ManyLights.cpp:202
Scope (from outer to inner):
file
namespace ManyLights
function int32 GetDebugMode
Source code excerpt:
int32 GetDebugMode()
{
return CVarManyLightsDebug.GetValueOnRenderThread();
}
bool UseWaveOps(EShaderPlatform ShaderPlatform)
{
return CVarManyLightsWaveOps.GetValueOnRenderThread() != 0
&& GRHISupportsWaveOperations