r.Mobile.Shadow.CSMShaderCullingDebugGfx
r.Mobile.Shadow.CSMShaderCullingDebugGfx
#Overview
name: r.Mobile.Shadow.CSMShaderCullingDebugGfx
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.Mobile.Shadow.CSMShaderCullingDebugGfx is to enable debug visualization for Cascaded Shadow Map (CSM) shader culling on mobile platforms. This setting variable is primarily used in the rendering system, specifically for mobile shadow rendering.
This setting variable is utilized in the Renderer module of Unreal Engine, as evident from its location in the ShadowSetupMobile.cpp file within the Runtime/Renderer directory.
The value of this variable is set using a TAutoConsoleVariable, which means it can be changed at runtime through console commands. Its default value is 0, indicating that the debug visualization is disabled by default.
The associated variable CVarCsmShaderCullingDebugGfx interacts directly with r.Mobile.Shadow.CSMShaderCullingDebugGfx, as they share the same value and purpose.
Developers should be aware that enabling this debug visualization may have performance implications, especially on mobile devices. It should primarily be used for debugging and optimization purposes during development.
Best practices when using this variable include:
- Only enable it when necessary for debugging CSM shader culling issues.
- Disable it in production builds to avoid unnecessary performance overhead.
- Use it in conjunction with other shadow-related debugging tools for a comprehensive analysis.
Regarding the associated variable CVarCsmShaderCullingDebugGfx:
The purpose of CVarCsmShaderCullingDebugGfx is to provide a programmatic way to access and modify the r.Mobile.Shadow.CSMShaderCullingDebugGfx setting within the C++ code.
This variable is used in the Renderer module, specifically in the mobile shadow rendering system. It allows the engine to check the current state of the debug visualization setting and act accordingly.
The value of CVarCsmShaderCullingDebugGfx is set when the TAutoConsoleVariable is initialized, which occurs at engine startup. Its value can be retrieved using the GetValueOnRenderThread() method.
CVarCsmShaderCullingDebugGfx interacts directly with the r.Mobile.Shadow.CSMShaderCullingDebugGfx console variable, serving as its C++ representation.
Developers should be aware that this variable is marked as ECVF_RenderThreadSafe, meaning it’s safe to access from the render thread. However, they should still ensure thread-safe access when used in multi-threaded contexts.
Best practices for using CVarCsmShaderCullingDebugGfx include:
- Use GetValueOnRenderThread() to retrieve its value within render thread operations.
- Avoid frequently checking its value in performance-critical code paths.
- Consider caching its value if used repeatedly within the same frame or function.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShadowSetupMobile.cpp:23
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarCsmShaderCullingDebugGfx(
TEXT("r.Mobile.Shadow.CSMShaderCullingDebugGfx"),
0,
TEXT(""),
ECVF_RenderThreadSafe);
const uint32 CSMShaderCullingMethodDefault = 1;
static TAutoConsoleVariable<int32> CVarsCsmShaderCullingMethod(
#Associated Variable and Callsites
This variable is associated with another variable named CVarCsmShaderCullingDebugGfx
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShadowSetupMobile.cpp:22
Scope: file
Source code excerpt:
#include "StaticMeshBatch.h"
static TAutoConsoleVariable<int32> CVarCsmShaderCullingDebugGfx(
TEXT("r.Mobile.Shadow.CSMShaderCullingDebugGfx"),
0,
TEXT(""),
ECVF_RenderThreadSafe);
const uint32 CSMShaderCullingMethodDefault = 1;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShadowSetupMobile.cpp:607
Scope (from outer to inner):
file
function void FMobileSceneRenderer::BuildCSMVisibilityState
Source code excerpt:
}
if (CVarCsmShaderCullingDebugGfx.GetValueOnRenderThread())
{
VisualizeMobileDynamicCSMSubjectCapsules(View, LightSceneInfo, ProjectedShadowInfo);
}
INC_DWORD_STAT_BY(STAT_CSMSubjects, ShadowSubjectPrimitives.Num());
}
MobileCSMVisibilityInfo.bMobileDynamicCSMInUse = bStaticCSMReceiversFound;