p.BodySetupSkipDDCThreshold

p.BodySetupSkipDDCThreshold

#Overview

name: p.BodySetupSkipDDCThreshold

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 p.BodySetupSkipDDCThreshold is to optimize performance by allowing the engine to skip the Derived Data Cache (DDC) for body setups with a vertex count below a certain threshold. This setting is primarily used in the physics engine, specifically for body setup operations.

This setting variable is used in the Engine module, particularly in the PhysicsEngine subsystem. It’s referenced in the BodySetup.cpp file, which handles physics body setup operations.

The value of this variable is set using a console variable (CVar) system. It’s initialized with a default value of 16384, but can be changed at runtime through console commands or configuration files.

The associated variable CVarBodySetupSkipDDCThreshold directly interacts with p.BodySetupSkipDDCThreshold. They share the same value and purpose.

Developers must be aware that this variable is only available in the editor (WITH_EDITOR preprocessor condition). It affects the performance of body setup operations, particularly for objects with a low vertex count.

Best practices when using this variable include:

  1. Carefully consider the threshold value based on your project’s needs and performance requirements.
  2. Monitor performance impacts when adjusting this value, especially for projects with many small objects.
  3. Be aware that skipping the DDC might lead to increased memory usage, as data may need to be recomputed more frequently.

Regarding the associated variable CVarBodySetupSkipDDCThreshold:

The purpose of CVarBodySetupSkipDDCThreshold is to provide a runtime-configurable way to access and modify the p.BodySetupSkipDDCThreshold value.

It’s used in the same Engine module and PhysicsEngine subsystem as p.BodySetupSkipDDCThreshold.

The value is set when the CVar is initialized, but can be changed at runtime using console commands.

This variable directly interacts with p.BodySetupSkipDDCThreshold, effectively controlling its value.

Developers should be aware that changes to this CVar will immediately affect the DDC skipping behavior for body setups.

Best practices for using CVarBodySetupSkipDDCThreshold include:

  1. Use it for debugging or performance tuning in development builds.
  2. Consider exposing it as a configurable option in your project settings for easier adjustment.
  3. Be cautious when changing its value in shipping builds, as it may have performance implications.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/BodySetup.cpp:105

Scope: file

Source code excerpt:

#if WITH_EDITOR
ENGINE_API TAutoConsoleVariable<int32> CVarBodySetupSkipDDCThreshold(
	TEXT("p.BodySetupSkipDDCThreshold"),
	16384,
	TEXT("Enables skipping the DDC for body setups with vertice count under threshold. Default: 16384"),
	ECVF_Default);
#endif

void FBodySetupUVInfo::GetResourceSizeEx(FResourceSizeEx& CumulativeResourceSize) const

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/BodySetup.cpp:104

Scope: file

Source code excerpt:


#if WITH_EDITOR
ENGINE_API TAutoConsoleVariable<int32> CVarBodySetupSkipDDCThreshold(
	TEXT("p.BodySetupSkipDDCThreshold"),
	16384,
	TEXT("Enables skipping the DDC for body setups with vertice count under threshold. Default: 16384"),
	ECVF_Default);
#endif

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/PhysicsEngine/BodySetup.cpp:1253

Scope (from outer to inner):

file
function     bool ShouldSkipDDC

Source code excerpt:

	// that its preferable to avoid using DDC queries unless we have to process something significant.

	const int32 SkipDDCThreshold = CVarBodySetupSkipDDCThreshold.GetValueOnAnyThread();
	if (SkipDDCThreshold > 0)
	{
		TRACE_CPUPROFILER_EVENT_SCOPE(ShouldSkipDDC);

		// Some numbers on AMD TR 3970X single-thread
		//    18603 verts 6976 indices takes 13 ms to build