r.Shadow.Scene.DebugDrawLightActiveStateTracking

r.Shadow.Scene.DebugDrawLightActiveStateTracking

#Overview

name: r.Shadow.Scene.DebugDrawLightActiveStateTracking

This variable is created as a Console Variable (cvar).

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:

  1. Only enable it when actively debugging shadow rendering issues.
  2. Be aware that enabling this debug drawing may impact performance, so it should be used judiciously.
  3. Remember to disable it after debugging to avoid unnecessary performance overhead.

Regarding the associated variable CVarDebugDrawLightActiveStateTracking:

#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);