dynamicsWorldMt: make island mgr aware of whether a parallel solver is present and make handoff from parallel solver to solver-pool more explicit

This commit is contained in:
Lunkhound
2018-03-05 20:05:38 -08:00
parent d900a74939
commit 45fd4acf6e
5 changed files with 116 additions and 150 deletions

View File

@@ -200,11 +200,11 @@ public:
/// ///
/// myParallelIslandDispatch -- wrap default parallel dispatch for profiling and to get the number of simulation islands /// myParallelIslandDispatch -- wrap default parallel dispatch for profiling and to get the number of simulation islands
// //
void myParallelIslandDispatch( btAlignedObjectArray<btSimulationIslandManagerMt::Island*>* islandsPtr, btSimulationIslandManagerMt::IslandCallback* callback ) void myParallelIslandDispatch( btAlignedObjectArray<btSimulationIslandManagerMt::Island*>* islandsPtr, const btSimulationIslandManagerMt::SolverParams& solverParams)
{ {
ProfileHelper prof( Profiler::kRecordDispatchIslands ); ProfileHelper prof( Profiler::kRecordDispatchIslands );
gNumIslands = islandsPtr->size(); gNumIslands = islandsPtr->size();
btSimulationIslandManagerMt::parallelIslandDispatch( islandsPtr, callback ); btSimulationIslandManagerMt::parallelIslandDispatch( islandsPtr, solverParams );
} }
@@ -239,9 +239,10 @@ public:
MyDiscreteDynamicsWorld( btDispatcher* dispatcher, MyDiscreteDynamicsWorld( btDispatcher* dispatcher,
btBroadphaseInterface* pairCache, btBroadphaseInterface* pairCache,
btConstraintSolverPoolMt* constraintSolver, btConstraintSolverPoolMt* constraintSolver,
btSequentialImpulseConstraintSolverMt* constraintSolverMt,
btCollisionConfiguration* collisionConfiguration btCollisionConfiguration* collisionConfiguration
) : ) :
btDiscreteDynamicsWorldMt( dispatcher, pairCache, constraintSolver, collisionConfiguration ) btDiscreteDynamicsWorldMt( dispatcher, pairCache, constraintSolver, constraintSolverMt, collisionConfiguration )
{ {
btSimulationIslandManagerMt* islandMgr = static_cast<btSimulationIslandManagerMt*>( m_islandManager ); btSimulationIslandManagerMt* islandMgr = static_cast<btSimulationIslandManagerMt*>( m_islandManager );
islandMgr->setIslandDispatchFunction( myParallelIslandDispatch ); islandMgr->setIslandDispatchFunction( myParallelIslandDispatch );
@@ -347,11 +348,12 @@ static btTaskSchedulerManager gTaskSchedulerMgr;
#if BT_THREADSAFE #if BT_THREADSAFE
static bool gMultithreadedWorld = true; static bool gMultithreadedWorld = true;
static bool gDisplayProfileInfo = true; static bool gDisplayProfileInfo = true;
static SolverType gSolverType = SOLVER_TYPE_SEQUENTIAL_IMPULSE_MT;
#else #else
static bool gMultithreadedWorld = false; static bool gMultithreadedWorld = false;
static bool gDisplayProfileInfo = false; static bool gDisplayProfileInfo = false;
static SolverType gSolverType = SOLVER_TYPE_SEQUENTIAL_IMPULSE;
#endif #endif
static SolverType gSolverType = SOLVER_TYPE_SEQUENTIAL_IMPULSE_MT;
static int gSolverMode = SOLVER_SIMD | static int gSolverMode = SOLVER_SIMD |
SOLVER_USE_WARMSTARTING | SOLVER_USE_WARMSTARTING |
// SOLVER_RANDMIZE_ORDER | // SOLVER_RANDMIZE_ORDER |
@@ -547,16 +549,28 @@ void CommonRigidBodyMTBase::createEmptyDynamicsWorld()
btConstraintSolverPoolMt* solverPool; btConstraintSolverPoolMt* solverPool;
{ {
SolverType poolSolverType = m_solverType;
if (poolSolverType == SOLVER_TYPE_SEQUENTIAL_IMPULSE_MT)
{
// pool solvers shouldn't be parallel solvers, we don't allow that kind of
// nested parallelism because of performance issues
poolSolverType = SOLVER_TYPE_SEQUENTIAL_IMPULSE;
}
btConstraintSolver* solvers[ BT_MAX_THREAD_COUNT ]; btConstraintSolver* solvers[ BT_MAX_THREAD_COUNT ];
int maxThreadCount = BT_MAX_THREAD_COUNT; int maxThreadCount = BT_MAX_THREAD_COUNT;
for ( int i = 0; i < maxThreadCount; ++i ) for ( int i = 0; i < maxThreadCount; ++i )
{ {
solvers[ i ] = createSolverByType( m_solverType ); solvers[ i ] = createSolverByType( poolSolverType );
} }
solverPool = new btConstraintSolverPoolMt( solvers, maxThreadCount ); solverPool = new btConstraintSolverPoolMt( solvers, maxThreadCount );
m_solver = solverPool; m_solver = solverPool;
} }
btDiscreteDynamicsWorld* world = new MyDiscreteDynamicsWorld( m_dispatcher, m_broadphase, solverPool, m_collisionConfiguration ); btSequentialImpulseConstraintSolverMt* solverMt = NULL;
if ( m_solverType == SOLVER_TYPE_SEQUENTIAL_IMPULSE_MT )
{
solverMt = new MySequentialImpulseConstraintSolverMt();
}
btDiscreteDynamicsWorld* world = new MyDiscreteDynamicsWorld( m_dispatcher, m_broadphase, solverPool, solverMt, m_collisionConfiguration );
m_dynamicsWorld = world; m_dynamicsWorld = world;
m_multithreadedWorld = true; m_multithreadedWorld = true;
btAssert( btGetTaskScheduler() != NULL ); btAssert( btGetTaskScheduler() != NULL );
@@ -579,6 +593,8 @@ void CommonRigidBodyMTBase::createEmptyDynamicsWorld()
SolverType solverType = m_solverType; SolverType solverType = m_solverType;
if ( solverType == SOLVER_TYPE_SEQUENTIAL_IMPULSE_MT ) if ( solverType == SOLVER_TYPE_SEQUENTIAL_IMPULSE_MT )
{ {
// using the parallel solver with the single-threaded world works, but is
// disabled here to avoid confusion
solverType = SOLVER_TYPE_SEQUENTIAL_IMPULSE; solverType = SOLVER_TYPE_SEQUENTIAL_IMPULSE;
} }
m_solver = createSolverByType( solverType ); m_solver = createSolverByType( solverType );

View File

@@ -50,63 +50,6 @@ subject to the following restrictions:
#include "LinearMath/btSerializer.h" #include "LinearMath/btSerializer.h"
struct InplaceSolverIslandCallbackMt : public btSimulationIslandManagerMt::IslandCallback
{
btContactSolverInfo* m_solverInfo;
btConstraintSolver* m_solver;
btIDebugDraw* m_debugDrawer;
btDispatcher* m_dispatcher;
InplaceSolverIslandCallbackMt(
btConstraintSolver* solver,
btStackAlloc* stackAlloc,
btDispatcher* dispatcher)
:m_solverInfo(NULL),
m_solver(solver),
m_debugDrawer(NULL),
m_dispatcher(dispatcher)
{
}
InplaceSolverIslandCallbackMt& operator=(InplaceSolverIslandCallbackMt& other)
{
btAssert(0);
(void)other;
return *this;
}
SIMD_FORCE_INLINE void setup ( btContactSolverInfo* solverInfo, btIDebugDraw* debugDrawer)
{
btAssert(solverInfo);
m_solverInfo = solverInfo;
m_debugDrawer = debugDrawer;
}
virtual void processIsland( btCollisionObject** bodies,
int numBodies,
btPersistentManifold** manifolds,
int numManifolds,
btTypedConstraint** constraints,
int numConstraints,
int islandId
)
{
m_solver->solveGroup( bodies,
numBodies,
manifolds,
numManifolds,
constraints,
numConstraints,
*m_solverInfo,
m_debugDrawer,
m_dispatcher
);
}
};
/// ///
/// btConstraintSolverPoolMt /// btConstraintSolverPoolMt
@@ -209,7 +152,12 @@ void btConstraintSolverPoolMt::reset()
/// btDiscreteDynamicsWorldMt /// btDiscreteDynamicsWorldMt
/// ///
btDiscreteDynamicsWorldMt::btDiscreteDynamicsWorldMt(btDispatcher* dispatcher, btBroadphaseInterface* pairCache, btConstraintSolverPoolMt* constraintSolver, btCollisionConfiguration* collisionConfiguration) btDiscreteDynamicsWorldMt::btDiscreteDynamicsWorldMt(btDispatcher* dispatcher,
btBroadphaseInterface* pairCache,
btConstraintSolverPoolMt* constraintSolver,
btConstraintSolver* constraintSolverMt,
btCollisionConfiguration* collisionConfiguration
)
: btDiscreteDynamicsWorld(dispatcher,pairCache,constraintSolver,collisionConfiguration) : btDiscreteDynamicsWorld(dispatcher,pairCache,constraintSolver,collisionConfiguration)
{ {
if (m_ownsIslandManager) if (m_ownsIslandManager)
@@ -217,31 +165,18 @@ btDiscreteDynamicsWorldMt::btDiscreteDynamicsWorldMt(btDispatcher* dispatcher, b
m_islandManager->~btSimulationIslandManager(); m_islandManager->~btSimulationIslandManager();
btAlignedFree( m_islandManager); btAlignedFree( m_islandManager);
} }
{
void* mem = btAlignedAlloc(sizeof(InplaceSolverIslandCallbackMt),16);
m_solverIslandCallbackMt = new (mem) InplaceSolverIslandCallbackMt (m_constraintSolver, 0, dispatcher);
}
{ {
void* mem = btAlignedAlloc(sizeof(btSimulationIslandManagerMt),16); void* mem = btAlignedAlloc(sizeof(btSimulationIslandManagerMt),16);
btSimulationIslandManagerMt* im = new (mem) btSimulationIslandManagerMt(); btSimulationIslandManagerMt* im = new (mem) btSimulationIslandManagerMt();
im->setMinimumSolverBatchSize( m_solverInfo.m_minimumSolverBatchSize ); im->setMinimumSolverBatchSize( m_solverInfo.m_minimumSolverBatchSize );
m_islandManager = im; m_islandManager = im;
} }
m_constraintSolverMt = constraintSolverMt;
} }
btDiscreteDynamicsWorldMt::~btDiscreteDynamicsWorldMt() btDiscreteDynamicsWorldMt::~btDiscreteDynamicsWorldMt()
{ {
if (m_solverIslandCallbackMt)
{
m_solverIslandCallbackMt->~InplaceSolverIslandCallbackMt();
btAlignedFree(m_solverIslandCallbackMt);
}
if (m_ownsConstraintSolver)
{
m_constraintSolver->~btConstraintSolver();
btAlignedFree(m_constraintSolver);
}
} }
@@ -249,12 +184,17 @@ void btDiscreteDynamicsWorldMt::solveConstraints(btContactSolverInfo& solverInfo
{ {
BT_PROFILE("solveConstraints"); BT_PROFILE("solveConstraints");
m_solverIslandCallbackMt->setup(&solverInfo, getDebugDrawer());
m_constraintSolver->prepareSolve(getCollisionWorld()->getNumCollisionObjects(), getCollisionWorld()->getDispatcher()->getNumManifolds()); m_constraintSolver->prepareSolve(getCollisionWorld()->getNumCollisionObjects(), getCollisionWorld()->getDispatcher()->getNumManifolds());
/// solve all the constraints for this island /// solve all the constraints for this island
btSimulationIslandManagerMt* im = static_cast<btSimulationIslandManagerMt*>(m_islandManager); btSimulationIslandManagerMt* im = static_cast<btSimulationIslandManagerMt*>(m_islandManager);
im->buildAndProcessIslands( getCollisionWorld()->getDispatcher(), getCollisionWorld(), m_constraints, m_solverIslandCallbackMt ); btSimulationIslandManagerMt::SolverParams solverParams;
solverParams.m_solverPool = m_constraintSolver;
solverParams.m_solverMt = m_constraintSolverMt;
solverParams.m_solverInfo = &solverInfo;
solverParams.m_debugDrawer = m_debugDrawer;
solverParams.m_dispatcher = getCollisionWorld()->getDispatcher();
im->buildAndProcessIslands( getCollisionWorld()->getDispatcher(), getCollisionWorld(), m_constraints, solverParams );
m_constraintSolver->allSolved(solverInfo, m_debugDrawer); m_constraintSolver->allSolved(solverInfo, m_debugDrawer);
} }

View File

@@ -21,7 +21,6 @@ subject to the following restrictions:
#include "btSimulationIslandManagerMt.h" #include "btSimulationIslandManagerMt.h"
#include "BulletDynamics/ConstraintSolver/btConstraintSolver.h" #include "BulletDynamics/ConstraintSolver/btConstraintSolver.h"
struct InplaceSolverIslandCallbackMt;
/// ///
/// btConstraintSolverPoolMt - masquerades as a constraint solver, but really it is a threadsafe pool of them. /// btConstraintSolverPoolMt - masquerades as a constraint solver, but really it is a threadsafe pool of them.
@@ -88,7 +87,7 @@ private:
ATTRIBUTE_ALIGNED16(class) btDiscreteDynamicsWorldMt : public btDiscreteDynamicsWorld ATTRIBUTE_ALIGNED16(class) btDiscreteDynamicsWorldMt : public btDiscreteDynamicsWorld
{ {
protected: protected:
InplaceSolverIslandCallbackMt* m_solverIslandCallbackMt; btConstraintSolver* m_constraintSolverMt;
virtual void solveConstraints(btContactSolverInfo& solverInfo) BT_OVERRIDE; virtual void solveConstraints(btContactSolverInfo& solverInfo) BT_OVERRIDE;
@@ -126,6 +125,7 @@ public:
btDiscreteDynamicsWorldMt(btDispatcher* dispatcher, btDiscreteDynamicsWorldMt(btDispatcher* dispatcher,
btBroadphaseInterface* pairCache, btBroadphaseInterface* pairCache,
btConstraintSolverPoolMt* constraintSolver, // Note this should be a solver-pool for multi-threading btConstraintSolverPoolMt* constraintSolver, // Note this should be a solver-pool for multi-threading
btConstraintSolver* constraintSolverMt, // single multi-threaded solver for large islands (or NULL)
btCollisionConfiguration* collisionConfiguration btCollisionConfiguration* collisionConfiguration
); );
virtual ~btDiscreteDynamicsWorldMt(); virtual ~btDiscreteDynamicsWorldMt();

View File

@@ -276,7 +276,7 @@ btSimulationIslandManagerMt::Island* btSimulationIslandManagerMt::allocateIsland
void btSimulationIslandManagerMt::buildIslands( btDispatcher* dispatcher, btCollisionWorld* collisionWorld ) void btSimulationIslandManagerMt::buildIslands( btDispatcher* dispatcher, btCollisionWorld* collisionWorld )
{ {
BT_PROFILE("islandUnionFindAndQuickSort"); BT_PROFILE("buildIslands");
btCollisionObjectArray& collisionObjects = collisionWorld->getCollisionObjectArray(); btCollisionObjectArray& collisionObjects = collisionWorld->getCollisionObjectArray();
@@ -545,53 +545,58 @@ void btSimulationIslandManagerMt::mergeIslands()
} }
void btSimulationIslandManagerMt::serialIslandDispatch( btAlignedObjectArray<Island*>* islandsPtr, IslandCallback* callback ) void btSimulationIslandManagerMt::solveIsland(btConstraintSolver* solver, Island& island, const SolverParams& solverParams)
{
btPersistentManifold** manifolds = island.manifoldArray.size() ? &island.manifoldArray[ 0 ] : NULL;
btTypedConstraint** constraintsPtr = island.constraintArray.size() ? &island.constraintArray[ 0 ] : NULL;
solver->solveGroup( &island.bodyArray[ 0 ],
island.bodyArray.size(),
manifolds,
island.manifoldArray.size(),
constraintsPtr,
island.constraintArray.size(),
*solverParams.m_solverInfo,
solverParams.m_debugDrawer,
solverParams.m_dispatcher
);
}
void btSimulationIslandManagerMt::serialIslandDispatch( btAlignedObjectArray<Island*>* islandsPtr, const SolverParams& solverParams )
{ {
BT_PROFILE( "serialIslandDispatch" ); BT_PROFILE( "serialIslandDispatch" );
// serial dispatch // serial dispatch
btAlignedObjectArray<Island*>& islands = *islandsPtr; btAlignedObjectArray<Island*>& islands = *islandsPtr;
btConstraintSolver* solver = solverParams.m_solverMt ? solverParams.m_solverMt : solverParams.m_solverPool;
for ( int i = 0; i < islands.size(); ++i ) for ( int i = 0; i < islands.size(); ++i )
{ {
Island* island = islands[ i ]; solveIsland(solver, *islands[ i ], solverParams);
btPersistentManifold** manifolds = island->manifoldArray.size() ? &island->manifoldArray[ 0 ] : NULL;
btTypedConstraint** constraintsPtr = island->constraintArray.size() ? &island->constraintArray[ 0 ] : NULL;
callback->processIsland( &island->bodyArray[ 0 ],
island->bodyArray.size(),
manifolds,
island->manifoldArray.size(),
constraintsPtr,
island->constraintArray.size(),
island->id
);
} }
} }
struct UpdateIslandDispatcher : public btIParallelForBody struct UpdateIslandDispatcher : public btIParallelForBody
{ {
btAlignedObjectArray<btSimulationIslandManagerMt::Island*>* islandsPtr; btAlignedObjectArray<btSimulationIslandManagerMt::Island*>& m_islandsPtr;
btSimulationIslandManagerMt::IslandCallback* callback; const btSimulationIslandManagerMt::SolverParams& m_solverParams;
UpdateIslandDispatcher(btAlignedObjectArray<btSimulationIslandManagerMt::Island*>& islandsPtr, const btSimulationIslandManagerMt::SolverParams& solverParams)
: m_islandsPtr(islandsPtr), m_solverParams(solverParams)
{}
void forLoop( int iBegin, int iEnd ) const BT_OVERRIDE void forLoop( int iBegin, int iEnd ) const BT_OVERRIDE
{ {
btConstraintSolver* solver = m_solverParams.m_solverPool;
for ( int i = iBegin; i < iEnd; ++i ) for ( int i = iBegin; i < iEnd; ++i )
{ {
btSimulationIslandManagerMt::Island* island = ( *islandsPtr )[ i ]; btSimulationIslandManagerMt::Island* island = m_islandsPtr[ i ];
btPersistentManifold** manifolds = island->manifoldArray.size() ? &island->manifoldArray[ 0 ] : NULL; btSimulationIslandManagerMt::solveIsland( solver, *island, m_solverParams );
btTypedConstraint** constraintsPtr = island->constraintArray.size() ? &island->constraintArray[ 0 ] : NULL;
callback->processIsland( &island->bodyArray[ 0 ],
island->bodyArray.size(),
manifolds,
island->manifoldArray.size(),
constraintsPtr,
island->constraintArray.size(),
island->id
);
} }
} }
}; };
void btSimulationIslandManagerMt::parallelIslandDispatch( btAlignedObjectArray<Island*>* islandsPtr, IslandCallback* callback ) void btSimulationIslandManagerMt::parallelIslandDispatch( btAlignedObjectArray<Island*>* islandsPtr, const SolverParams& solverParams )
{ {
BT_PROFILE( "parallelIslandDispatch" ); BT_PROFILE( "parallelIslandDispatch" );
// //
@@ -617,24 +622,25 @@ void btSimulationIslandManagerMt::parallelIslandDispatch( btAlignedObjectArray<I
// any gains from parallelism. // any gains from parallelism.
// //
UpdateIslandDispatcher dispatcher; UpdateIslandDispatcher dispatcher(*islandsPtr, solverParams);
dispatcher.islandsPtr = islandsPtr;
dispatcher.callback = callback;
// We take advantage of the fact the islands are sorted in order of decreasing size // We take advantage of the fact the islands are sorted in order of decreasing size
int iBegin = 0; int iBegin = 0;
while (iBegin < islandsPtr->size()) if (solverParams.m_solverMt)
{ {
btSimulationIslandManagerMt::Island* island = (*islandsPtr)[ iBegin ]; while ( iBegin < islandsPtr->size() )
if (island->manifoldArray.size() < btSequentialImpulseConstraintSolverMt::s_minimumContactManifoldsForBatching)
{ {
// OK to submit the rest of the array in parallel btSimulationIslandManagerMt::Island* island = ( *islandsPtr )[ iBegin ];
break; if ( island->manifoldArray.size() < btSequentialImpulseConstraintSolverMt::s_minimumContactManifoldsForBatching )
{
// OK to submit the rest of the array in parallel
break;
}
// serial dispatch to parallel solver for large islands (if any)
solveIsland(solverParams.m_solverMt, *island, solverParams);
++iBegin;
} }
++iBegin;
} }
// serial dispatch for large islands (if any) // parallel dispatch to sequential solvers for rest
dispatcher.forLoop(0, iBegin);
// parallel dispatch for rest
btParallelFor( iBegin, islandsPtr->size(), 1, dispatcher ); btParallelFor( iBegin, islandsPtr->size(), 1, dispatcher );
} }
@@ -643,15 +649,14 @@ void btSimulationIslandManagerMt::parallelIslandDispatch( btAlignedObjectArray<I
void btSimulationIslandManagerMt::buildAndProcessIslands( btDispatcher* dispatcher, void btSimulationIslandManagerMt::buildAndProcessIslands( btDispatcher* dispatcher,
btCollisionWorld* collisionWorld, btCollisionWorld* collisionWorld,
btAlignedObjectArray<btTypedConstraint*>& constraints, btAlignedObjectArray<btTypedConstraint*>& constraints,
IslandCallback* callback const SolverParams& solverParams
) )
{ {
BT_PROFILE("buildAndProcessIslands");
btCollisionObjectArray& collisionObjects = collisionWorld->getCollisionObjectArray(); btCollisionObjectArray& collisionObjects = collisionWorld->getCollisionObjectArray();
buildIslands(dispatcher,collisionWorld); buildIslands(dispatcher,collisionWorld);
BT_PROFILE("processIslands");
if(!getSplitIslands()) if(!getSplitIslands())
{ {
btPersistentManifold** manifolds = dispatcher->getInternalManifoldPointer(); btPersistentManifold** manifolds = dispatcher->getInternalManifoldPointer();
@@ -683,14 +688,17 @@ void btSimulationIslandManagerMt::buildAndProcessIslands( btDispatcher* dispatch
} }
} }
btTypedConstraint** constraintsPtr = constraints.size() ? &constraints[ 0 ] : NULL; btTypedConstraint** constraintsPtr = constraints.size() ? &constraints[ 0 ] : NULL;
callback->processIsland(&collisionObjects[0], btConstraintSolver* solver = solverParams.m_solverMt ? solverParams.m_solverMt : solverParams.m_solverPool;
collisionObjects.size(), solver->solveGroup(&collisionObjects[0],
manifolds, collisionObjects.size(),
maxNumManifolds, manifolds,
constraintsPtr, maxNumManifolds,
constraints.size(), constraintsPtr,
-1 constraints.size(),
); *solverParams.m_solverInfo,
solverParams.m_debugDrawer,
solverParams.m_dispatcher
);
} }
else else
{ {
@@ -710,6 +718,6 @@ void btSimulationIslandManagerMt::buildAndProcessIslands( btDispatcher* dispatch
mergeIslands(); mergeIslands();
} }
// dispatch islands to solver // dispatch islands to solver
m_islandDispatch( &m_activeIslands, callback ); m_islandDispatch( &m_activeIslands, solverParams );
} }
} }

View File

@@ -19,7 +19,9 @@ subject to the following restrictions:
#include "BulletCollision/CollisionDispatch/btSimulationIslandManager.h" #include "BulletCollision/CollisionDispatch/btSimulationIslandManager.h"
class btTypedConstraint; class btTypedConstraint;
class btConstraintSolver;
struct btContactSolverInfo;
class btIDebugDraw;
/// ///
/// SimulationIslandManagerMt -- Multithread capable version of SimulationIslandManager /// SimulationIslandManagerMt -- Multithread capable version of SimulationIslandManager
@@ -45,22 +47,19 @@ public:
void append( const Island& other ); // add bodies, manifolds, constraints to my own void append( const Island& other ); // add bodies, manifolds, constraints to my own
}; };
struct IslandCallback struct SolverParams
{ {
virtual ~IslandCallback() {}; btConstraintSolver* m_solverPool;
btConstraintSolver* m_solverMt;
virtual void processIsland( btCollisionObject** bodies, btContactSolverInfo* m_solverInfo;
int numBodies, btIDebugDraw* m_debugDrawer;
btPersistentManifold** manifolds, btDispatcher* m_dispatcher;
int numManifolds,
btTypedConstraint** constraints,
int numConstraints,
int islandId
) = 0;
}; };
typedef void( *IslandDispatchFunc ) ( btAlignedObjectArray<Island*>* islands, IslandCallback* callback ); static void solveIsland(btConstraintSolver* solver, Island& island, const SolverParams& solverParams);
static void serialIslandDispatch( btAlignedObjectArray<Island*>* islandsPtr, IslandCallback* callback );
static void parallelIslandDispatch( btAlignedObjectArray<Island*>* islandsPtr, IslandCallback* callback ); typedef void( *IslandDispatchFunc ) ( btAlignedObjectArray<Island*>* islands, const SolverParams& solverParams );
static void serialIslandDispatch( btAlignedObjectArray<Island*>* islandsPtr, const SolverParams& solverParams );
static void parallelIslandDispatch( btAlignedObjectArray<Island*>* islandsPtr, const SolverParams& solverParams );
protected: protected:
btAlignedObjectArray<Island*> m_allocatedIslands; // owner of all Islands btAlignedObjectArray<Island*> m_allocatedIslands; // owner of all Islands
btAlignedObjectArray<Island*> m_activeIslands; // islands actively in use btAlignedObjectArray<Island*> m_activeIslands; // islands actively in use
@@ -83,7 +82,11 @@ public:
btSimulationIslandManagerMt(); btSimulationIslandManagerMt();
virtual ~btSimulationIslandManagerMt(); virtual ~btSimulationIslandManagerMt();
virtual void buildAndProcessIslands( btDispatcher* dispatcher, btCollisionWorld* collisionWorld, btAlignedObjectArray<btTypedConstraint*>& constraints, IslandCallback* callback ); virtual void buildAndProcessIslands( btDispatcher* dispatcher,
btCollisionWorld* collisionWorld,
btAlignedObjectArray<btTypedConstraint*>& constraints,
const SolverParams& solverParams
);
virtual void buildIslands(btDispatcher* dispatcher,btCollisionWorld* colWorld); virtual void buildIslands(btDispatcher* dispatcher,btCollisionWorld* colWorld);
@@ -106,7 +109,6 @@ public:
} }
}; };
extern int gLargeIslandManifoldCount;
#endif //BT_SIMULATION_ISLAND_MANAGER_H #endif //BT_SIMULATION_ISLAND_MANAGER_H