BulletMultiThreeded SpuGatheringCollisionDispatcher: minor change in batch size of scheduled pairs: use 128 by default, unless the number of pairs is less then (total amount of tasks * batch size)

This commit is contained in:
erwin.coumans
2010-02-12 23:14:16 +00:00
parent e68a13f185
commit e71051e931
2 changed files with 10 additions and 3 deletions

View File

@@ -178,14 +178,21 @@ void SpuGatheringCollisionDispatcher::dispatchAllCollisionPairs(btOverlappingPai
//send one big batch
int numTotalPairs = pairCache->getNumOverlappingPairs();
btBroadphasePair* pairPtr = pairCache->getOverlappingPairArrayPtr();
int i;
{
int pairRange = SPU_BATCHSIZE_BROADPHASE_PAIRS;
if (numTotalPairs < (m_spuCollisionTaskProcess->getNumTasks()*SPU_BATCHSIZE_BROADPHASE_PAIRS))
{
pairRange = (numTotalPairs/m_spuCollisionTaskProcess->getNumTasks())+1;
}
BT_PROFILE("addWorkToTask");
for (i=0;i<numTotalPairs;)
{
//Performance Hint: tweak this number during benchmarking
static const int pairRange = SPU_BATCHSIZE_BROADPHASE_PAIRS;
int endIndex = (i+pairRange) < numTotalPairs ? i+pairRange : numTotalPairs;
m_spuCollisionTaskProcess->addWorkToTask(pairPtr,i,endIndex);
i = endIndex;