p.Chaos.GC.ISMPoolDebugDraw
p.Chaos.GC.ISMPoolDebugDraw
#Overview
name: p.Chaos.GC.ISMPoolDebugDraw
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Show debug drawing for the ISM pools
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.GC.ISMPoolDebugDraw is to enable debug drawing for the ISM (Instanced Static Mesh) pools in the Geometry Collection system of Unreal Engine’s Chaos physics framework.
This setting variable is primarily used in the Geometry Collection Engine module, which is part of Unreal Engine’s experimental features for physics simulation and rendering of large numbers of geometric objects.
The value of this variable is set through a console command, as it’s defined as a TAutoConsoleVariable. It’s initialized with a default value of 0, meaning the debug drawing is disabled by default.
The associated variable CVarISMPoolDebugDraw directly interacts with p.Chaos.GC.ISMPoolDebugDraw. They share the same value and are used interchangeably in the code.
Developers must be aware that enabling this variable will impact performance, as it adds debug rendering overhead. It should primarily be used for development and debugging purposes, not in production builds.
Best practices when using this variable include:
- Only enable it when necessary for debugging ISM pools.
- Disable it in production builds to avoid performance overhead.
- Use in conjunction with other debugging tools to get a comprehensive view of the Geometry Collection system’s behavior.
Regarding the associated variable CVarISMPoolDebugDraw:
The purpose of CVarISMPoolDebugDraw is to provide a programmatic way to access the value of p.Chaos.GC.ISMPoolDebugDraw within the C++ code.
It’s used in the GeometryCollectionISMPoolDebugDrawComponent to control the visibility of debug information. Specifically, it affects:
- Whether the component’s tick function is enabled (UpdateTickEnabled method)
- Whether debug information is rendered in the viewport (TickComponent method)
- Whether a debug scene proxy is created for rendering (CreateDebugSceneProxy method)
The value of CVarISMPoolDebugDraw is typically retrieved using the GetValueOnAnyThread() method, which allows it to be checked from any thread safely.
Developers should be aware that changes to CVarISMPoolDebugDraw will trigger a lambda function that updates all GeometryCollectionISMPoolDebugDrawComponents and recreates the render state context.
Best practices for using CVarISMPoolDebugDraw include:
- Use it for conditional logic in debug-related code paths.
- Be aware of the performance implications when enabling it.
- Consider exposing it through in-game debug menus for easier toggling during development.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Public/GeometryCollection/GeometryCollectionISMPoolDebugDrawComponent.cpp:30
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarISMPoolDebugDraw(
TEXT("p.Chaos.GC.ISMPoolDebugDraw"),
0,
TEXT("Show debug drawing for the ISM pools"),
FConsoleVariableDelegate::CreateLambda([](IConsoleVariable* InVariable) { UGeometryCollectionISMPoolDebugDrawComponent::UpdateAllTickEnabled(); FGlobalComponentRecreateRenderStateContext Context; }),
ECVF_Default);
#Associated Variable and Callsites
This variable is associated with another variable named CVarISMPoolDebugDraw
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Public/GeometryCollection/GeometryCollectionISMPoolDebugDrawComponent.cpp:29
Scope: file
Source code excerpt:
ECVF_Default);
static TAutoConsoleVariable<int32> CVarISMPoolDebugDraw(
TEXT("p.Chaos.GC.ISMPoolDebugDraw"),
0,
TEXT("Show debug drawing for the ISM pools"),
FConsoleVariableDelegate::CreateLambda([](IConsoleVariable* InVariable) { UGeometryCollectionISMPoolDebugDrawComponent::UpdateAllTickEnabled(); FGlobalComponentRecreateRenderStateContext Context; }),
ECVF_Default);
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Public/GeometryCollection/GeometryCollectionISMPoolDebugDrawComponent.cpp:77
Scope (from outer to inner):
file
function void UGeometryCollectionISMPoolDebugDrawComponent::UpdateTickEnabled
Source code excerpt:
{
const bool bForceShowStats = CVarISMPoolStats.GetValueOnAnyThread() != 0;
const bool bForceShowBounds = CVarISMPoolDebugDraw.GetValueOnAnyThread() != 0;
PrimaryComponentTick.SetTickFunctionEnable(bShowStats || bForceShowStats || bShowBounds || bForceShowBounds);
}
void UGeometryCollectionISMPoolDebugDrawComponent::UpdateAllTickEnabled()
{
for (TObjectIterator<UGeometryCollectionISMPoolDebugDrawComponent> It; It; ++It)
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Public/GeometryCollection/GeometryCollectionISMPoolDebugDrawComponent.cpp:135
Scope (from outer to inner):
file
function void UGeometryCollectionISMPoolDebugDrawComponent::TickComponent
Source code excerpt:
const bool bForceShowStats = CVarISMPoolStats.GetValueOnAnyThread() != 0;
const bool bForceShowBounds = CVarISMPoolDebugDraw.GetValueOnAnyThread() != 0;
if (bShowStats || bForceShowStats || bShowBounds || bForceShowBounds)
{
#if WITH_EDITOR
if (GCurrentLevelEditingViewportClient)
{
FViewport* Viewport = GCurrentLevelEditingViewportClient->Viewport;
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Public/GeometryCollection/GeometryCollectionISMPoolDebugDrawComponent.cpp:245
Scope (from outer to inner):
file
function FDebugRenderSceneProxy* UGeometryCollectionISMPoolDebugDrawComponent::CreateDebugSceneProxy
Source code excerpt:
FDebugRenderSceneProxy* UGeometryCollectionISMPoolDebugDrawComponent::CreateDebugSceneProxy()
{
const bool bForceShowBounds = CVarISMPoolDebugDraw.GetValueOnAnyThread() != 0;
if (!(SelectedComponent && (bShowBounds || bForceShowBounds)))
{
return nullptr;
}
FDebugRenderSceneProxy* DebugProxy = new FGeometryCollectionISMPoolDebugDrawSceneProxy(this);