p.Chaos.AccelerationStructureTimeSlicingMaxBytesCopy
p.Chaos.AccelerationStructureTimeSlicingMaxBytesCopy
#Overview
name: p.Chaos.AccelerationStructureTimeSlicingMaxBytesCopy
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
The Maximum number of bytes to copy to the external acceleration structure during Copy Time Slicing
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.AccelerationStructureTimeSlicingMaxBytesCopy is to control the maximum number of bytes that can be copied to the external acceleration structure during Copy Time Slicing in Unreal Engine’s Chaos physics system. This setting is primarily used for performance optimization in the physics simulation.
This setting variable is primarily used in the Chaos physics subsystem, which is part of Unreal Engine’s experimental physics engine. It’s specifically utilized in the acceleration structure management of the physics simulation.
The value of this variable is set using an FAutoConsoleVariableRef, which means it can be adjusted at runtime through console commands or configuration files. The default value is set to 100,000 bytes.
The associated variable AccelerationStructureTimeSlicingMaxBytesCopy interacts directly with this setting. They share the same value and are used interchangeably in the code.
Developers should be aware that this variable affects the time-slicing behavior of the physics simulation. Time-slicing is a technique used to spread out computationally expensive operations over multiple frames to maintain performance. By limiting the number of bytes copied per frame, this setting helps prevent physics calculations from causing frame rate drops.
Best practices when using this variable include:
- Adjusting the value based on the specific needs of your game and the target hardware. Higher values may improve physics accuracy but could impact frame rate.
- Monitoring performance metrics when changing this value to ensure it’s not negatively impacting overall game performance.
- Consider the relationship between this setting and other physics-related settings, as they may interact in complex ways.
Regarding the associated variable AccelerationStructureTimeSlicingMaxBytesCopy:
This variable is used directly in the code to control the amount of data copied during the time-slicing process. It’s used in the UpdateStructure function of the FChaosAccelerationStructureTask class, which is part of the physics simulation update loop.
The variable is used in conjunction with a force full build flag (IsForceFullBuild). When force full build is enabled, the time-slicing limit is ignored (-1 is passed instead of the variable’s value), allowing for a complete rebuild of the acceleration structure in a single frame.
Developers should be aware that this variable directly impacts the balance between physics simulation accuracy and frame rate stability. Careful tuning and testing are necessary to find the optimal value for specific game scenarios.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolution.cpp:53
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
CHAOS_API int32 AccelerationStructureTimeSlicingMaxBytesCopy = 100000;
FAutoConsoleVariableRef CVarAccelerationStructureTimeSlicingMaxBytesCopy(TEXT("p.Chaos.AccelerationStructureTimeSlicingMaxBytesCopy"), AccelerationStructureTimeSlicingMaxBytesCopy, TEXT("The Maximum number of bytes to copy to the external acceleration structure during Copy Time Slicing"));
CHAOS_API FBroadPhaseConfig BroadPhaseConfig;
FAutoConsoleVariableRef CVarBroadphaseIsTree(TEXT("p.BroadphaseType"), BroadPhaseConfig.BroadphaseType, TEXT(""));
FAutoConsoleVariableRef CVarBoundingVolumeNumCells(TEXT("p.BoundingVolumeNumCells"), BroadPhaseConfig.BVNumCells, TEXT(""));
FAutoConsoleVariableRef CVarMaxChildrenInLeaf(TEXT("p.MaxChildrenInLeaf"), BroadPhaseConfig.MaxChildrenInLeaf, TEXT(""));
#Associated Variable and Callsites
This variable is associated with another variable named AccelerationStructureTimeSlicingMaxBytesCopy
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolution.cpp:52
Scope (from outer to inner):
file
namespace Chaos
Source code excerpt:
FAutoConsoleVariableRef CVarAccelerationStructureTimeSlicingMaxQueueSizeBeforeForce(TEXT("p.Chaos.AccelerationStructureTimeSlicingMaxQueueSizeBeforeForce"), AccelerationStructureTimeSlicingMaxQueueSizeBeforeForce, TEXT("If the update queue reaches this limit, time slicing will be disabled, and the acceleration structure will be built at once"));
CHAOS_API int32 AccelerationStructureTimeSlicingMaxBytesCopy = 100000;
FAutoConsoleVariableRef CVarAccelerationStructureTimeSlicingMaxBytesCopy(TEXT("p.Chaos.AccelerationStructureTimeSlicingMaxBytesCopy"), AccelerationStructureTimeSlicingMaxBytesCopy, TEXT("The Maximum number of bytes to copy to the external acceleration structure during Copy Time Slicing"));
CHAOS_API FBroadPhaseConfig BroadPhaseConfig;
FAutoConsoleVariableRef CVarBroadphaseIsTree(TEXT("p.BroadphaseType"), BroadPhaseConfig.BroadphaseType, TEXT(""));
FAutoConsoleVariableRef CVarBoundingVolumeNumCells(TEXT("p.BoundingVolumeNumCells"), BroadPhaseConfig.BVNumCells, TEXT(""));
FAutoConsoleVariableRef CVarMaxChildrenInLeaf(TEXT("p.MaxChildrenInLeaf"), BroadPhaseConfig.MaxChildrenInLeaf, TEXT(""));
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolution.cpp:391
Scope (from outer to inner):
file
namespace Chaos
function void FPBDRigidsEvolutionBase::FChaosAccelerationStructureTask::UpdateStructure
Source code excerpt:
AccelerationSUBStructureCopy->PrepareCopyTimeSliced(*SubStructure);
ensure(!AccelerationSUBStructureCopy->IsAsyncTimeSlicingComplete());
AccelerationSUBStructureCopy->ProgressCopyTimeSliced(*SubStructure, IsForceFullBuild ? -1 : AccelerationStructureTimeSlicingMaxBytesCopy);
if (!AccelerationSUBStructureCopy->IsAsyncTimeSlicingComplete())
{
IsTimeSlicingProgressing = true;
}
}
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolution.cpp:430
Scope (from outer to inner):
file
namespace Chaos
function void FPBDRigidsEvolutionBase::FChaosAccelerationStructureTask::UpdateStructure
Source code excerpt:
{
SCOPE_CYCLE_COUNTER(STAT_AccelerationStructureTimeSliceCopy);
AccelerationSUBStructureCopy->ProgressCopyTimeSliced(*SubStructure, IsForceFullBuild ? -1 : AccelerationStructureTimeSlicingMaxBytesCopy);
if (!AccelerationSUBStructureCopy->IsAsyncTimeSlicingComplete())
{
IsTimeSlicingProgressing = true;
}
}
else
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDRigidsEvolution.cpp:471
Scope (from outer to inner):
file
namespace Chaos
function void FPBDRigidsEvolutionBase::FChaosAccelerationStructureTask::UpdateStructure
Source code excerpt:
{
AccelerationSUBStructureCopy->PrepareCopyTimeSliced(*NewStruct);
AccelerationSUBStructureCopy->ProgressCopyTimeSliced(*NewStruct, IsForceFullBuild ? -1 : AccelerationStructureTimeSlicingMaxBytesCopy);
IsTimeSlicingProgressing |= !AccelerationSUBStructureCopy->IsAsyncTimeSlicingComplete();
}
//If new structure is not done mark time slicing in progress
IsTimeSlicingProgressing |= !NewStruct->IsAsyncTimeSlicingComplete();