p.Chaos.SkinPhysicsMesh.ISPC
p.Chaos.SkinPhysicsMesh.ISPC
#Overview
name: p.Chaos.SkinPhysicsMesh.ISPC
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to use ISPC optimizations on skinned physics meshes
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.SkinPhysicsMesh.ISPC is to control whether ISPC (Intel SPMD Program Compiler) optimizations are used for skinned physics meshes in the Chaos cloth simulation system.
This setting variable is primarily used by the Chaos Cloth plugin, which is part of Unreal Engine’s physics and simulation subsystem. Specifically, it affects the skinning process of physics meshes in cloth simulations.
The value of this variable is set through a console variable (cvar) system. It’s initialized with the default value CHAOS_SKIN_PHYSICS_MESH_ISPC_ENABLED_DEFAULT and can be changed at runtime in non-shipping builds.
The associated variable bChaos_SkinPhysicsMesh_ISPC_Enabled directly interacts with p.Chaos.SkinPhysicsMesh.ISPC. They share the same value, with bChaos_SkinPhysicsMesh_ISPC_Enabled being the C++ boolean variable that’s checked in the code to determine whether to use ISPC optimizations.
Developers should be aware that:
- This optimization is only available when INTEL_ISPC is defined and not in shipping builds.
- The optimization affects the performance of physics mesh skinning in cloth simulations.
- There are several static assertions checking the size compatibility of data structures between ISPC and C++ code, which is crucial for the correct functioning of the optimization.
Best practices when using this variable include:
- Test the performance with and without ISPC optimizations to ensure it provides benefits for your specific use case.
- Be cautious when modifying related data structures, as they need to maintain size compatibility with their ISPC counterparts.
- Consider leaving this optimization enabled by default unless you encounter specific issues.
Regarding the associated variable bChaos_SkinPhysicsMesh_ISPC_Enabled:
- Its purpose is to provide a C++ accessible boolean flag for the ISPC optimization setting.
- It’s used directly in the SkinPhysicsMesh function to determine whether to use the ISPC optimized path.
- In shipping builds or when INTEL_ISPC is not defined, it’s set as a constexpr boolean to allow compile-time optimizations.
- In other cases, it’s an external variable that can be modified at runtime.
- Developers should be aware that changing this variable at runtime will immediately affect the cloth simulation performance and behavior.
- Best practice is to set this variable early in the application lifecycle and avoid frequent toggling unless necessary for debugging or performance profiling.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/ChaosCloth/Source/ChaosCloth/Private/ChaosCloth/ChaosClothingSimulationMesh.cpp:18
Scope: file
Source code excerpt:
#if INTEL_ISPC && !UE_BUILD_SHIPPING
bool bChaos_SkinPhysicsMesh_ISPC_Enabled = CHAOS_SKIN_PHYSICS_MESH_ISPC_ENABLED_DEFAULT;
FAutoConsoleVariableRef CVarChaosSkinPhysicsMeshISPCEnabled(TEXT("p.Chaos.SkinPhysicsMesh.ISPC"), bChaos_SkinPhysicsMesh_ISPC_Enabled, TEXT("Whether to use ISPC optimizations on skinned physics meshes"));
static_assert(sizeof(ispc::FVector3f) == sizeof(Chaos::Softs::FSolverVec3), "sizeof(ispc::FVector3f) != sizeof(Chaos::Softs::FSolverVec3)");
static_assert(sizeof(ispc::FVector3f) == sizeof(FVector3f), "sizeof(ispc::FVector3f) != sizeof(FVector3f)");
static_assert(sizeof(ispc::FMatrix44f) == sizeof(FMatrix44f), "sizeof(ispc::FMatrix44f) != sizeof(FMatrix44f)");
static_assert(sizeof(ispc::FTransform3f) == sizeof(FTransform3f), "sizeof(ispc::FTransform3f) != sizeof(FTransform3f)");
static_assert(sizeof(ispc::FClothVertBoneData) == sizeof(FClothVertBoneData), "sizeof(ispc::FClothVertBoneData) != sizeof(Chaos::FClothVertBoneData)");
#Associated Variable and Callsites
This variable is associated with another variable named bChaos_SkinPhysicsMesh_ISPC_Enabled
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/ChaosCloth/Source/ChaosCloth/Private/ChaosCloth/ChaosClothingSimulationMesh.cpp:17
Scope: file
Source code excerpt:
#if INTEL_ISPC && !UE_BUILD_SHIPPING
bool bChaos_SkinPhysicsMesh_ISPC_Enabled = CHAOS_SKIN_PHYSICS_MESH_ISPC_ENABLED_DEFAULT;
FAutoConsoleVariableRef CVarChaosSkinPhysicsMeshISPCEnabled(TEXT("p.Chaos.SkinPhysicsMesh.ISPC"), bChaos_SkinPhysicsMesh_ISPC_Enabled, TEXT("Whether to use ISPC optimizations on skinned physics meshes"));
static_assert(sizeof(ispc::FVector3f) == sizeof(Chaos::Softs::FSolverVec3), "sizeof(ispc::FVector3f) != sizeof(Chaos::Softs::FSolverVec3)");
static_assert(sizeof(ispc::FVector3f) == sizeof(FVector3f), "sizeof(ispc::FVector3f) != sizeof(FVector3f)");
static_assert(sizeof(ispc::FMatrix44f) == sizeof(FMatrix44f), "sizeof(ispc::FMatrix44f) != sizeof(FMatrix44f)");
static_assert(sizeof(ispc::FTransform3f) == sizeof(FTransform3f), "sizeof(ispc::FTransform3f) != sizeof(FTransform3f)");
static_assert(sizeof(ispc::FClothVertBoneData) == sizeof(FClothVertBoneData), "sizeof(ispc::FClothVertBoneData) != sizeof(Chaos::FClothVertBoneData)");
#Loc: <Workspace>/Engine/Plugins/ChaosCloth/Source/ChaosCloth/Private/ChaosCloth/ChaosClothingSimulationMesh.cpp:431
Scope (from outer to inner):
file
namespace Chaos
function void FClothingSimulationMesh::SkinPhysicsMesh
Source code excerpt:
#if INTEL_ISPC
if (bChaos_SkinPhysicsMesh_ISPC_Enabled)
{
ispc::SkinPhysicsMesh(
(ispc::FVector3f*)OutPositions,
(ispc::FVector3f*)OutNormals,
(ispc::FVector3f*)Positions.GetData(),
(ispc::FVector3f*)Normals.GetData(),
#Loc: <Workspace>/Engine/Plugins/ChaosCloth/Source/ChaosCloth/Public/ChaosCloth/ChaosClothingSimulationMesh.h:232
Scope: file
Source code excerpt:
// Support run-time toggling on supported platforms in non-shipping configurations
#if !INTEL_ISPC || UE_BUILD_SHIPPING
static constexpr bool bChaos_SkinPhysicsMesh_ISPC_Enabled = INTEL_ISPC && CHAOS_SKIN_PHYSICS_MESH_ISPC_ENABLED_DEFAULT;
#else
extern bool bChaos_SkinPhysicsMesh_ISPC_Enabled;
#endif