a.ForceParallelAnimUpdate
a.ForceParallelAnimUpdate
#Overview
name: a.ForceParallelAnimUpdate
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
If != 0, then we update animations on worker threads regardless of the setting on the project or anim blueprint.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of a.ForceParallelAnimUpdate is to force the animation update process to run on worker threads, bypassing any project or animation blueprint settings. This variable is part of Unreal Engine’s animation system and is used to control parallel processing of animations.
Based on the Callsites section, this setting variable is primarily used in the Engine module, specifically within the animation and skeletal mesh components. It’s closely related to the animation update and evaluation subsystems.
The value of this variable is set as a console variable, which means it can be adjusted at runtime. Its default value is 0, as seen in the source code:
TAutoConsoleVariable<int32> CVarForceUseParallelAnimUpdate(TEXT("a.ForceParallelAnimUpdate"), 0, TEXT("If != 0, then we update animations on worker threads regardless of the setting on the project or anim blueprint."));
This variable interacts with other animation-related variables, particularly CVarUseParallelAnimUpdate. They work together to determine whether animation updates should be performed in parallel.
Developers must be aware that using this variable will override any existing project or animation blueprint settings related to parallel animation updates. This could potentially impact performance and behavior, especially in projects that have been optimized for specific threading models.
Best practices when using this variable include:
- Use it primarily for testing and debugging purposes.
- Be cautious when enabling it in production builds, as it may affect performance unexpectedly.
- Monitor performance metrics when adjusting this setting to ensure it’s providing the desired benefits.
Regarding the associated variable CVarForceUseParallelAnimUpdate:
The purpose of CVarForceUseParallelAnimUpdate is identical to a.ForceParallelAnimUpdate. It’s an internal representation of the console variable within the C++ code.
This variable is used in the Engine module, specifically within the AnimInstance class. It’s checked in the NeedsImmediateUpdate function to determine if parallel animation updates should be forced:
const bool bUseParallelUpdateAnimation = (GetDefault<UEngine>()->bAllowMultiThreadedAnimationUpdate && bUseMultiThreadedAnimationUpdate) || (CVarForceUseParallelAnimUpdate.GetValueOnGameThread() != 0);
The value of this variable is set through the console variable system and can be accessed using GetValueOnGameThread().
CVarForceUseParallelAnimUpdate interacts with other animation-related variables and engine settings to determine the final behavior of animation updates.
Developers should be aware that this variable can override other animation update settings, potentially affecting performance and behavior across the entire project.
Best practices for using CVarForceUseParallelAnimUpdate are the same as those for a.ForceParallelAnimUpdate, as they represent the same setting.
#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:54
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarUseParallelAnimationEvaluation(TEXT("a.ParallelAnimEvaluation"), 1, TEXT("If 1, animation evaluation will be run across the task graph system. If 0, evaluation will run purely on the game thread"));
TAutoConsoleVariable<int32> CVarUseParallelAnimUpdate(TEXT("a.ParallelAnimUpdate"), 1, TEXT("If != 0, then we update animation blend tree, native update, asset players and montages (is possible) on worker threads."));
TAutoConsoleVariable<int32> CVarForceUseParallelAnimUpdate(TEXT("a.ForceParallelAnimUpdate"), 0, TEXT("If != 0, then we update animations on worker threads regardless of the setting on the project or anim blueprint."));
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."));
#Associated Variable and Callsites
This variable is associated with another variable named CVarForceUseParallelAnimUpdate
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Animation/AnimInstance.cpp:89
Scope: file
Source code excerpt:
extern TAutoConsoleVariable<int32> CVarUseParallelAnimUpdate;
extern TAutoConsoleVariable<int32> CVarUseParallelAnimationEvaluation;
extern TAutoConsoleVariable<int32> CVarForceUseParallelAnimUpdate;
ENGINE_API float RK4_SPRING_INTERPOLATOR_UPDATE_RATE = 60.f;
static FAutoConsoleVariableRef CVarRK4SpringInterpolatorUpdateRate(TEXT("p.RK4SpringInterpolator.UpdateRate"), RK4_SPRING_INTERPOLATOR_UPDATE_RATE, TEXT("RK4 Spring Interpolator's rate of update"), ECVF_Default);
ENGINE_API int32 RK4_SPRING_INTERPOLATOR_MAX_ITER = 4;
static FAutoConsoleVariableRef CVarRK4SpringInterpolatorMaxIter(TEXT("p.RK4SpringInterpolator.MaxIter"), RK4_SPRING_INTERPOLATOR_MAX_ITER, TEXT("RK4 Spring Interpolator's max number of iterations"), ECVF_Default);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Animation/AnimInstance.cpp:778
Scope (from outer to inner):
file
function bool UAnimInstance::NeedsImmediateUpdate
Source code excerpt:
bool UAnimInstance::NeedsImmediateUpdate(float DeltaSeconds, bool bNeedsValidRootMotion) const
{
const bool bUseParallelUpdateAnimation = (GetDefault<UEngine>()->bAllowMultiThreadedAnimationUpdate && bUseMultiThreadedAnimationUpdate) || (CVarForceUseParallelAnimUpdate.GetValueOnGameThread() != 0);
#if WITH_EDITOR
UAnimBlueprintGeneratedClass* GeneratedClass = Cast<UAnimBlueprintGeneratedClass>(GetClass());
UBlueprint* Blueprint = GeneratedClass ? Cast<UBlueprint>(GeneratedClass->ClassGeneratedBy) : nullptr;
#endif
return
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/SkeletalMeshComponent.cpp:54
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarUseParallelAnimationEvaluation(TEXT("a.ParallelAnimEvaluation"), 1, TEXT("If 1, animation evaluation will be run across the task graph system. If 0, evaluation will run purely on the game thread"));
TAutoConsoleVariable<int32> CVarUseParallelAnimUpdate(TEXT("a.ParallelAnimUpdate"), 1, TEXT("If != 0, then we update animation blend tree, native update, asset players and montages (is possible) on worker threads."));
TAutoConsoleVariable<int32> CVarForceUseParallelAnimUpdate(TEXT("a.ForceParallelAnimUpdate"), 0, TEXT("If != 0, then we update animations on worker threads regardless of the setting on the project or anim blueprint."));
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."));