p.Chaos.Solver.CheckParticleViews

p.Chaos.Solver.CheckParticleViews

#Overview

name: p.Chaos.Solver.CheckParticleViews

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

It is referenced in 5 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of p.Chaos.Solver.CheckParticleViews is to enable debug validation of Particle Views every frame in the Chaos physics system of Unreal Engine 5.

This setting variable is primarily used by the Chaos physics system, which is an experimental physics solver in Unreal Engine 5. It is part of the Runtime/Experimental/Chaos module.

The value of this variable is set in the C++ code as a console variable (CVar) with an initial value of false. It can be changed at runtime through the console or configuration files.

The associated variable bChaosSolverCheckParticleViews directly interacts with p.Chaos.Solver.CheckParticleViews. They share the same value, and bChaosSolverCheckParticleViews is used in the code to control the execution of debug validation.

Developers must be aware that:

  1. This is a debug feature and should not be enabled in production builds.
  2. Enabling this variable may impact performance, as it adds additional checks every frame.
  3. It’s primarily useful for diagnosing issues related to Particle Views in the Chaos physics system.

Best practices when using this variable include:

  1. Use it only during development and debugging phases.
  2. Disable it before creating release builds to avoid unnecessary performance overhead.
  3. When encountering issues with Particle Views, enable this variable to gather more information about potential problems.

Regarding the associated variable bChaosSolverCheckParticleViews:

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolutionGBF.cpp:185

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

		// Set to true to enable some debug validation of the Particle Views every frame
		bool bChaosSolverCheckParticleViews = false;
		FAutoConsoleVariableRef CVarChaosSolverCheckParticleViews(TEXT("p.Chaos.Solver.CheckParticleViews"), bChaosSolverCheckParticleViews, TEXT(""));

		// Enable improved midphase distribution among worker threads. Without this the midphase and narrowphase run on whatever thread the
		// broadphas eoverlap was detected on which tends to give poor distribution.
		bool bChaosMidPhaseRedistributionEnabled = true;
		FAutoConsoleVariableRef CVarChaosSolverMidPhaseRedistributionEnabled(TEXT("p.Chaos.BroadPhase.MidPhaseRedistributionEnabled"), bChaosMidPhaseRedistributionEnabled, TEXT(""));
	}

#Associated Variable and Callsites

This variable is associated with another variable named bChaosSolverCheckParticleViews. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolutionGBF.cpp:184

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

		
		// Set to true to enable some debug validation of the Particle Views every frame
		bool bChaosSolverCheckParticleViews = false;
		FAutoConsoleVariableRef CVarChaosSolverCheckParticleViews(TEXT("p.Chaos.Solver.CheckParticleViews"), bChaosSolverCheckParticleViews, TEXT(""));

		// Enable improved midphase distribution among worker threads. Without this the midphase and narrowphase run on whatever thread the
		// broadphas eoverlap was detected on which tends to give poor distribution.
		bool bChaosMidPhaseRedistributionEnabled = true;
		FAutoConsoleVariableRef CVarChaosSolverMidPhaseRedistributionEnabled(TEXT("p.Chaos.BroadPhase.MidPhaseRedistributionEnabled"), bChaosMidPhaseRedistributionEnabled, TEXT(""));
	}

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolutionGBF.cpp:314

Scope (from outer to inner):

file
namespace    Chaos
function     void CheckParticleViewsForErrors

Source code excerpt:

void CheckParticleViewsForErrors(FPBDRigidsSOAs& Particles)
{
	if (CVars::bChaosSolverCheckParticleViews)
	{
		QUICK_SCOPE_CYCLE_COUNTER(STAT_Evolution_CheckParticleViewsForErrors);

		CheckParticleViewsForDupes(Particles);
		CheckMovingKinematicFlag(Particles);
	}

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/PBDRigidsSOAs.h:10

Scope (from outer to inner):

file
namespace    Chaos
namespace    CVars

Source code excerpt:

{
	extern CHAOS_API bool bRemoveParticleFromMovingKinematicsOnDisable;
	extern CHAOS_API bool bChaosSolverCheckParticleViews;
}

// A helper function to get the debug name for a particle or "UNKNOWN" when debug names are unavailable
template<typename TParticleType>
const FString& GetParticleDebugName(const TParticleType& Particle)
{

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/PBDRigidsSOAs.h:1098

Scope (from outer to inner):

file
namespace    Chaos
class        class FPBDRigidsSOAs
function     void CheckParticleViewMask

Source code excerpt:

		// It should be cheap when the cvar is disabled but we fully remove it in shipping anyway
#if !UE_BUILD_SHIPPING
		if (CVars::bChaosSolverCheckParticleViews)
		{
			CheckParticleViewMaskImpl(Particle);
		}
#endif
	}