CriticalPathStall.ParallelAnimation

CriticalPathStall.ParallelAnimation

#Overview

name: CriticalPathStall.ParallelAnimation

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 CriticalPathStall.ParallelAnimation is to introduce an artificial delay in parallel animation tasks for debugging and critical path analysis in Unreal Engine 5. This setting variable is primarily used for performance testing and optimization of the animation system.

This setting variable is utilized in the Engine module, specifically within the SkeletalMeshComponent subsystem. It’s part of the animation system and is used to simulate performance issues or force changes in the critical path of animation processing.

The value of this variable is set through the console variable system in Unreal Engine. It’s defined as a TAutoConsoleVariable, which means it can be adjusted at runtime through console commands or configuration files.

The associated variable CVarStallParallelAnimation directly interacts with CriticalPathStall.ParallelAnimation. They share the same value and purpose.

Developers must be aware that this variable is intended for debugging and testing purposes only. It should not be used in production builds or left enabled in shipping games, as it intentionally introduces performance delays.

Best practices when using this variable include:

  1. Only use it during development and testing phases.
  2. Be cautious when setting high values, as it can significantly impact performance.
  3. Remember to disable it or set it to 0 before creating production builds.
  4. Use it in conjunction with profiling tools to analyze the impact on the critical path.

Regarding the associated variable CVarStallParallelAnimation:

The purpose of CVarStallParallelAnimation is identical to CriticalPathStall.ParallelAnimation. It’s a static TAutoConsoleVariable that directly controls the artificial delay in parallel animation tasks.

This variable is used in the SkeletalMeshComponent of the Engine module, specifically within the FParallelAnimationEvaluationTask.

The value is set when the engine initializes the console variables, and it can be modified at runtime through console commands.

CVarStallParallelAnimation interacts directly with the animation system, introducing delays in the DoTask function of FParallelAnimationEvaluationTask when its value is greater than 0.

Developers should be aware that this variable is only active in non-shipping and non-test builds, as indicated by the preprocessor conditions in the code.

Best practices for CVarStallParallelAnimation are the same as for CriticalPathStall.ParallelAnimation, emphasizing its use for debugging and performance analysis only.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/SkeletalMeshComponent.cpp:58

Scope: file

Source code excerpt:


static TAutoConsoleVariable<float> CVarStallParallelAnimation(
	TEXT("CriticalPathStall.ParallelAnimation"),
	0.0f,
	TEXT("Sleep for the given time in each parallel animation task. Time is given in ms. This is a debug option used for critical path analysis and forcing a change in the critical path."));

static TAutoConsoleVariable<int32> CVarHiPriSkinnedMeshesTicks(
	TEXT("tick.HiPriSkinnedMeshes"),
	1,

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/SkeletalMeshComponent.cpp:57

Scope: file

Source code excerpt:

TAutoConsoleVariable<int32> CVarUseParallelAnimationInterpolation(TEXT("a.ParallelAnimInterpolation"), 1, TEXT("If 1, animation interpolation will be run across the task graph system. If 0, interpolation will run purely on the game thread"));

static TAutoConsoleVariable<float> CVarStallParallelAnimation(
	TEXT("CriticalPathStall.ParallelAnimation"),
	0.0f,
	TEXT("Sleep for the given time in each parallel animation task. Time is given in ms. This is a debug option used for critical path analysis and forcing a change in the critical path."));

static TAutoConsoleVariable<int32> CVarHiPriSkinnedMeshesTicks(
	TEXT("tick.HiPriSkinnedMeshes"),

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/SkeletalMeshComponent.cpp:208

Scope (from outer to inner):

file
class        class FParallelAnimationEvaluationTask
function     void DoTask

Source code excerpt:

			FScopeCycleCounterUObject ContextScope(Comp);
#if !UE_BUILD_TEST && !UE_BUILD_SHIPPING
			float Stall = CVarStallParallelAnimation.GetValueOnAnyThread();
			if (Stall > 0.0f)
			{
				FPlatformProcess::Sleep(Stall / 1000.0f);
			}
#endif
			if (CurrentThread != ENamedThreads::GameThread)