![]() |
Jolt Physics
A multi core friendly Game Physics Engine
|
#include <LargeIslandSplitter.h>
Classes | |
struct | Split |
Describes a split of constraints and contacts. More... | |
class | Splits |
Structure that describes the resulting splits from the large island splitter. More... | |
Public Types | |
enum class | EStatus { WaitingForBatch , BatchRetrieved , AllBatchesDone } |
Status code for retrieving a batch. More... | |
Public Member Functions | |
~LargeIslandSplitter () | |
Destructor. | |
void | Prepare (const IslandBuilder &inIslandBuilder, uint32 inNumActiveBodies, TempAllocator *inTempAllocator) |
Prepare the island splitter by allocating memory. | |
uint | AssignSplit (const Body *inBody1, const Body *inBody2) |
Assign two bodies to a split. Returns the split index. | |
uint | AssignToNonParallelSplit (const Body *inBody) |
Force a body to be in a non parallel split. Returns the split index. | |
bool | SplitIsland (uint32 inIslandIndex, const IslandBuilder &inIslandBuilder, const BodyManager &inBodyManager, const ContactConstraintManager &inContactManager, Constraint **inActiveConstraints, CalculateSolverSteps &ioStepsCalculator) |
Splits up an island, the created splits will be added to the list of batches and can be fetched with FetchNextBatch. Returns false if the island did not need splitting. | |
EStatus | FetchNextBatch (uint &outSplitIslandIndex, uint32 *&outConstraintsBegin, uint32 *&outConstraintsEnd, uint32 *&outContactsBegin, uint32 *&outContactsEnd, bool &outFirstIteration) |
Fetch the next batch to process, returns a handle in outSplitIslandIndex that must be provided to MarkBatchProcessed when complete. | |
void | MarkBatchProcessed (uint inSplitIslandIndex, const uint32 *inConstraintsBegin, const uint32 *inConstraintsEnd, const uint32 *inContactsBegin, const uint32 *inContactsEnd, bool &outLastIteration, bool &outFinalBatch) |
Mark a batch as processed. | |
uint32 | GetIslandIndex (uint inSplitIslandIndex) const |
Get the island index of the island that was split for a particular split island index. | |
void | PrepareForSolvePositions () |
Prepare the island splitter for iterating over the split islands again for position solving. Marks all batches as startable. | |
void | Reset (TempAllocator *inTempAllocator) |
Reset the island splitter. | |
![]() | |
NonCopyable ()=default | |
NonCopyable (const NonCopyable &)=delete | |
void | operator= (const NonCopyable &)=delete |
Static Public Attributes | |
static constexpr uint | cNumSplits = sizeof(SplitMask) * 8 |
static constexpr uint | cNonParallelSplitIdx = cNumSplits - 1 |
static constexpr uint | cLargeIslandTreshold = 128 |
If the number of constraints + contacts in an island is larger than this, we will try to split the island. | |
Assigns bodies in large islands to multiple groups that can run in parallel
This basically implements what is described in: High-Performance Physical Simulations on Next-Generation Architecture with Many Cores by Chen et al. See: http://web.eecs.umich.edu/~msmelyan/papers/physsim_onmanycore_itj.pdf section "PARALLELIZATION METHODOLOGY"
WARNING: This class is an internal part of PhysicsSystem, it has no functions that can be called by users of the library.
|
strong |
LargeIslandSplitter::~LargeIslandSplitter | ( | ) |
Destructor.
Assign two bodies to a split. Returns the split index.
Force a body to be in a non parallel split. Returns the split index.
LargeIslandSplitter::EStatus LargeIslandSplitter::FetchNextBatch | ( | uint & | outSplitIslandIndex, |
uint32 *& | outConstraintsBegin, | ||
uint32 *& | outConstraintsEnd, | ||
uint32 *& | outContactsBegin, | ||
uint32 *& | outContactsEnd, | ||
bool & | outFirstIteration ) |
Fetch the next batch to process, returns a handle in outSplitIslandIndex that must be provided to MarkBatchProcessed when complete.
Get the island index of the island that was split for a particular split island index.
void LargeIslandSplitter::MarkBatchProcessed | ( | uint | inSplitIslandIndex, |
const uint32 * | inConstraintsBegin, | ||
const uint32 * | inConstraintsEnd, | ||
const uint32 * | inContactsBegin, | ||
const uint32 * | inContactsEnd, | ||
bool & | outLastIteration, | ||
bool & | outFinalBatch ) |
Mark a batch as processed.
void LargeIslandSplitter::Prepare | ( | const IslandBuilder & | inIslandBuilder, |
uint32 | inNumActiveBodies, | ||
TempAllocator * | inTempAllocator ) |
Prepare the island splitter by allocating memory.
void LargeIslandSplitter::PrepareForSolvePositions | ( | ) |
Prepare the island splitter for iterating over the split islands again for position solving. Marks all batches as startable.
void LargeIslandSplitter::Reset | ( | TempAllocator * | inTempAllocator | ) |
Reset the island splitter.
bool LargeIslandSplitter::SplitIsland | ( | uint32 | inIslandIndex, |
const IslandBuilder & | inIslandBuilder, | ||
const BodyManager & | inBodyManager, | ||
const ContactConstraintManager & | inContactManager, | ||
Constraint ** | inActiveConstraints, | ||
CalculateSolverSteps & | ioStepsCalculator ) |
Splits up an island, the created splits will be added to the list of batches and can be fetched with FetchNextBatch. Returns false if the island did not need splitting.
|
staticconstexpr |
If the number of constraints + contacts in an island is larger than this, we will try to split the island.
|
staticconstexpr |
|
staticconstexpr |