Bullet: Remove multithread support that is not available anymore. And was never used by the engine in the first place.
This commit is contained in:
parent
e5747c2faa
commit
7f87a92c72
@ -66,41 +66,41 @@ void jmePhysicsSpace::stepSimulation(jfloat tpf, jint maxSteps, jfloat accuracy)
|
|||||||
dynamicsWorld->stepSimulation(tpf, maxSteps, accuracy);
|
dynamicsWorld->stepSimulation(tpf, maxSteps, accuracy);
|
||||||
}
|
}
|
||||||
|
|
||||||
btThreadSupportInterface* jmePhysicsSpace::createSolverThreadSupport(int maxNumThreads) {
|
// btThreadSupportInterface* jmePhysicsSpace::createSolverThreadSupport(int maxNumThreads) {
|
||||||
#ifdef _WIN32
|
// #ifdef _WIN32
|
||||||
Win32ThreadSupport::Win32ThreadConstructionInfo threadConstructionInfo("solverThreads", SolverThreadFunc, SolverlsMemoryFunc, maxNumThreads);
|
// Win32ThreadSupport::Win32ThreadConstructionInfo threadConstructionInfo("solverThreads", SolverThreadFunc, SolverlsMemoryFunc, maxNumThreads);
|
||||||
Win32ThreadSupport* threadSupport = new Win32ThreadSupport(threadConstructionInfo);
|
// Win32ThreadSupport* threadSupport = new Win32ThreadSupport(threadConstructionInfo);
|
||||||
threadSupport->startSPU();
|
// threadSupport->startSPU();
|
||||||
#elif defined (USE_PTHREADS)
|
// #elif defined (USE_PTHREADS)
|
||||||
PosixThreadSupport::ThreadConstructionInfo constructionInfo("collision", SolverThreadFunc,
|
// PosixThreadSupport::ThreadConstructionInfo constructionInfo("collision", SolverThreadFunc,
|
||||||
SolverlsMemoryFunc, maxNumThreads);
|
// SolverlsMemoryFunc, maxNumThreads);
|
||||||
PosixThreadSupport* threadSupport = new PosixThreadSupport(constructionInfo);
|
// PosixThreadSupport* threadSupport = new PosixThreadSupport(constructionInfo);
|
||||||
threadSupport->startSPU();
|
// threadSupport->startSPU();
|
||||||
#else
|
// #else
|
||||||
SequentialThreadSupport::SequentialThreadConstructionInfo tci("solverThreads", SolverThreadFunc, SolverlsMemoryFunc);
|
// SequentialThreadSupport::SequentialThreadConstructionInfo tci("solverThreads", SolverThreadFunc, SolverlsMemoryFunc);
|
||||||
SequentialThreadSupport* threadSupport = new SequentialThreadSupport(tci);
|
// SequentialThreadSupport* threadSupport = new SequentialThreadSupport(tci);
|
||||||
threadSupport->startSPU();
|
// threadSupport->startSPU();
|
||||||
#endif
|
// #endif
|
||||||
return threadSupport;
|
// return threadSupport;
|
||||||
}
|
// }
|
||||||
|
|
||||||
btThreadSupportInterface* jmePhysicsSpace::createDispatchThreadSupport(int maxNumThreads) {
|
// btThreadSupportInterface* jmePhysicsSpace::createDispatchThreadSupport(int maxNumThreads) {
|
||||||
#ifdef _WIN32
|
// #ifdef _WIN32
|
||||||
Win32ThreadSupport::Win32ThreadConstructionInfo threadConstructionInfo("solverThreads", processCollisionTask, createCollisionLocalStoreMemory, maxNumThreads);
|
// Win32ThreadSupport::Win32ThreadConstructionInfo threadConstructionInfo("solverThreads", processCollisionTask, createCollisionLocalStoreMemory, maxNumThreads);
|
||||||
Win32ThreadSupport* threadSupport = new Win32ThreadSupport(threadConstructionInfo);
|
// Win32ThreadSupport* threadSupport = new Win32ThreadSupport(threadConstructionInfo);
|
||||||
threadSupport->startSPU();
|
// threadSupport->startSPU();
|
||||||
#elif defined (USE_PTHREADS)
|
// #elif defined (USE_PTHREADS)
|
||||||
PosixThreadSupport::ThreadConstructionInfo solverConstructionInfo("solver", processCollisionTask,
|
// PosixThreadSupport::ThreadConstructionInfo solverConstructionInfo("solver", processCollisionTask,
|
||||||
createCollisionLocalStoreMemory, maxNumThreads);
|
// createCollisionLocalStoreMemory, maxNumThreads);
|
||||||
PosixThreadSupport* threadSupport = new PosixThreadSupport(solverConstructionInfo);
|
// PosixThreadSupport* threadSupport = new PosixThreadSupport(solverConstructionInfo);
|
||||||
threadSupport->startSPU();
|
// threadSupport->startSPU();
|
||||||
#else
|
// #else
|
||||||
SequentialThreadSupport::SequentialThreadConstructionInfo tci("solverThreads", processCollisionTask, createCollisionLocalStoreMemory);
|
// SequentialThreadSupport::SequentialThreadConstructionInfo tci("solverThreads", processCollisionTask, createCollisionLocalStoreMemory);
|
||||||
SequentialThreadSupport* threadSupport = new SequentialThreadSupport(tci);
|
// SequentialThreadSupport* threadSupport = new SequentialThreadSupport(tci);
|
||||||
threadSupport->startSPU();
|
// threadSupport->startSPU();
|
||||||
#endif
|
// #endif
|
||||||
return threadSupport;
|
// return threadSupport;
|
||||||
}
|
// }
|
||||||
|
|
||||||
void jmePhysicsSpace::createPhysicsSpace(jfloat minX, jfloat minY, jfloat minZ, jfloat maxX, jfloat maxY, jfloat maxZ, jint broadphaseId, jboolean threading) {
|
void jmePhysicsSpace::createPhysicsSpace(jfloat minX, jfloat minY, jfloat minZ, jfloat maxX, jfloat maxY, jfloat maxZ, jint broadphaseId, jboolean threading) {
|
||||||
// collision configuration contains default setup for memory, collision setup
|
// collision configuration contains default setup for memory, collision setup
|
||||||
@ -140,23 +140,23 @@ void jmePhysicsSpace::createPhysicsSpace(jfloat minX, jfloat minY, jfloat minZ,
|
|||||||
btCollisionDispatcher* dispatcher;
|
btCollisionDispatcher* dispatcher;
|
||||||
btConstraintSolver* solver;
|
btConstraintSolver* solver;
|
||||||
// use the default collision dispatcher. For parallel processing you can use a diffent dispatcher (see Extras/BulletMultiThreaded)
|
// use the default collision dispatcher. For parallel processing you can use a diffent dispatcher (see Extras/BulletMultiThreaded)
|
||||||
if (threading) {
|
// if (threading) {
|
||||||
btThreadSupportInterface* dispatchThreads = createDispatchThreadSupport(4);
|
// btThreadSupportInterface* dispatchThreads = createDispatchThreadSupport(4);
|
||||||
dispatcher = new SpuGatheringCollisionDispatcher(dispatchThreads, 4, collisionConfiguration);
|
// dispatcher = new SpuGatheringCollisionDispatcher(dispatchThreads, 4, collisionConfiguration);
|
||||||
dispatcher->setDispatcherFlags(btCollisionDispatcher::CD_DISABLE_CONTACTPOOL_DYNAMIC_ALLOCATION);
|
// dispatcher->setDispatcherFlags(btCollisionDispatcher::CD_DISABLE_CONTACTPOOL_DYNAMIC_ALLOCATION);
|
||||||
} else {
|
// } else {
|
||||||
dispatcher = new btCollisionDispatcher(collisionConfiguration);
|
dispatcher = new btCollisionDispatcher(collisionConfiguration);
|
||||||
}
|
// }
|
||||||
btGImpactCollisionAlgorithm::registerAlgorithm(dispatcher);
|
btGImpactCollisionAlgorithm::registerAlgorithm(dispatcher);
|
||||||
|
|
||||||
|
|
||||||
// the default constraint solver. For parallel processing you can use a different solver (see Extras/BulletMultiThreaded)
|
// the default constraint solver. For parallel processing you can use a different solver (see Extras/BulletMultiThreaded)
|
||||||
if (threading) {
|
// if (threading) {
|
||||||
btThreadSupportInterface* solverThreads = createSolverThreadSupport(4);
|
// btThreadSupportInterface* solverThreads = createSolverThreadSupport(4);
|
||||||
solver = new btParallelConstraintSolver(solverThreads);
|
// solver = new btParallelConstraintSolver(solverThreads);
|
||||||
} else {
|
// } else {
|
||||||
solver = new btSequentialImpulseConstraintSolver;
|
solver = new btSequentialImpulseConstraintSolver;
|
||||||
}
|
// }
|
||||||
|
|
||||||
//create dynamics world
|
//create dynamics world
|
||||||
btDiscreteDynamicsWorld* world = new btDiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration);
|
btDiscreteDynamicsWorld* world = new btDiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration);
|
||||||
@ -164,12 +164,12 @@ void jmePhysicsSpace::createPhysicsSpace(jfloat minX, jfloat minY, jfloat minZ,
|
|||||||
dynamicsWorld->setWorldUserInfo(this);
|
dynamicsWorld->setWorldUserInfo(this);
|
||||||
|
|
||||||
//parallel solver requires the contacts to be in a contiguous pool, so avoid dynamic allocation
|
//parallel solver requires the contacts to be in a contiguous pool, so avoid dynamic allocation
|
||||||
if (threading) {
|
// if (threading) {
|
||||||
world->getSimulationIslandManager()->setSplitIslands(false);
|
// world->getSimulationIslandManager()->setSplitIslands(false);
|
||||||
world->getSolverInfo().m_numIterations = 4;
|
// world->getSolverInfo().m_numIterations = 4;
|
||||||
world->getSolverInfo().m_solverMode = SOLVER_SIMD + SOLVER_USE_WARMSTARTING; //+SOLVER_RANDMIZE_ORDER;
|
// world->getSolverInfo().m_solverMode = SOLVER_SIMD + SOLVER_USE_WARMSTARTING; //+SOLVER_RANDMIZE_ORDER;
|
||||||
world->getDispatchInfo().m_enableSPU = true;
|
// world->getDispatchInfo().m_enableSPU = true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
broadphase->getOverlappingPairCache()->setInternalGhostPairCallback(new btGhostPairCallback());
|
broadphase->getOverlappingPairCache()->setInternalGhostPairCallback(new btGhostPairCallback());
|
||||||
|
|
||||||
|
@ -36,15 +36,15 @@
|
|||||||
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
|
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
|
||||||
#include "BulletCollision/CollisionDispatch/btGhostObject.h"
|
#include "BulletCollision/CollisionDispatch/btGhostObject.h"
|
||||||
#include "BulletDynamics/Character/btKinematicCharacterController.h"
|
#include "BulletDynamics/Character/btKinematicCharacterController.h"
|
||||||
#ifdef _WIN32
|
// #ifdef _WIN32
|
||||||
#include "BulletMultiThreaded/Win32ThreadSupport.h"
|
// #include "BulletMultiThreaded/Win32ThreadSupport.h"
|
||||||
#else
|
// #else
|
||||||
#include "BulletMultiThreaded/PosixThreadSupport.h"
|
// #include "BulletMultiThreaded/PosixThreadSupport.h"
|
||||||
#endif
|
// #endif
|
||||||
#include "BulletMultiThreaded/btParallelConstraintSolver.h"
|
// #include "BulletMultiThreaded/btParallelConstraintSolver.h"
|
||||||
#include "BulletMultiThreaded/SpuGatheringCollisionDispatcher.h"
|
// #include "BulletMultiThreaded/SpuGatheringCollisionDispatcher.h"
|
||||||
#include "BulletMultiThreaded/SpuCollisionTaskProcess.h"
|
// #include "BulletMultiThreaded/SpuCollisionTaskProcess.h"
|
||||||
#include "BulletMultiThreaded/SequentialThreadSupport.h"
|
// #include "BulletMultiThreaded/SequentialThreadSupport.h"
|
||||||
#include "BulletCollision/CollisionDispatch/btSimulationIslandManager.h"
|
#include "BulletCollision/CollisionDispatch/btSimulationIslandManager.h"
|
||||||
#include "BulletCollision/NarrowPhaseCollision/btManifoldPoint.h"
|
#include "BulletCollision/NarrowPhaseCollision/btManifoldPoint.h"
|
||||||
#include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h"
|
#include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h"
|
||||||
@ -59,8 +59,8 @@ private:
|
|||||||
JavaVM* vm;
|
JavaVM* vm;
|
||||||
btDynamicsWorld* dynamicsWorld;
|
btDynamicsWorld* dynamicsWorld;
|
||||||
jobject javaPhysicsSpace;
|
jobject javaPhysicsSpace;
|
||||||
btThreadSupportInterface* createSolverThreadSupport(int);
|
// btThreadSupportInterface* createSolverThreadSupport(int);
|
||||||
btThreadSupportInterface* createDispatchThreadSupport(int);
|
// btThreadSupportInterface* createDispatchThreadSupport(int);
|
||||||
void attachThread();
|
void attachThread();
|
||||||
public:
|
public:
|
||||||
jmePhysicsSpace(){};
|
jmePhysicsSpace(){};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user