add Bullet 2.x constraint solver tests for hinge, with large mass ratio

experiment with Midi controls in PairBenchmark to tune variables (will move it into a utility class, so every demo can easier use it in the future)
fix issue with broadphase, not initializing all pairs properly at pair array overflow
This commit is contained in:
Erwin Coumans
2014-01-28 10:25:04 -08:00
parent e3ee9e5b2e
commit 71f0537c6e
20 changed files with 719 additions and 38 deletions

View File

@@ -1246,6 +1246,8 @@ void b3GpuSapBroadphase::calculateOverlappingPairs(int maxPairs)
{
b3Error("Error running out of pairs: numPairs = %d, maxPairs = %d.\n", numPairs, maxPairs);
numPairs = maxPairs;
m_pairCount.resize(0);
m_pairCount.push_back(maxPairs);
}
}

View File

@@ -399,16 +399,16 @@ __kernel void computePairsKernel( __global const btAabbCL* aabbs, volatile __g
if (curNumPairs==64)
{
int curPair = atomic_add(pairCount,curNumPairs);
//avoid a buffer overrun
if ((curPair+curNumPairs)<maxPairs)
for (int p=0;p<curNumPairs;p++)
{
for (int p=0;p<curNumPairs;p++)
if ((curPair+p)<maxPairs)
{
int4 tmpPair;
tmpPair.x = myPairs[p].x;
tmpPair.y = myPairs[p].y;
tmpPair.z = NEW_PAIR_MARKER;
tmpPair.w = NEW_PAIR_MARKER;
pairsOut[curPair+p] = tmpPair; //flush to main memory
}
@@ -436,17 +436,17 @@ __kernel void computePairsKernel( __global const btAabbCL* aabbs, volatile __g
{
//avoid a buffer overrun
int curPair = atomic_add(pairCount,curNumPairs);
if ((curPair+curNumPairs)<maxPairs)
for (int p=0;p<curNumPairs;p++)
{
for (int p=0;p<curNumPairs;p++)
{
if ((curPair+p)<maxPairs)
{
int4 tmpPair;
tmpPair.x = myPairs[p].x;
tmpPair.y = myPairs[p].y;
tmpPair.z = NEW_PAIR_MARKER;
tmpPair.w = NEW_PAIR_MARKER;
pairsOut[curPair+p] = tmpPair; //flush to main memory
}
}
}
curNumPairs = 0;
}

View File

@@ -366,16 +366,16 @@ static const char* sapFastCL= \
" if (curNumPairs==64)\n"
" {\n"
" int curPair = atomic_add(pairCount,curNumPairs);\n"
" //avoid a buffer overrun\n"
" if ((curPair+curNumPairs)<maxPairs)\n"
" for (int p=0;p<curNumPairs;p++)\n"
" {\n"
" for (int p=0;p<curNumPairs;p++)\n"
" if ((curPair+p)<maxPairs)\n"
" {\n"
" int4 tmpPair;\n"
" tmpPair.x = myPairs[p].x;\n"
" tmpPair.y = myPairs[p].y;\n"
" tmpPair.z = NEW_PAIR_MARKER;\n"
" tmpPair.w = NEW_PAIR_MARKER;\n"
" \n"
" pairsOut[curPair+p] = tmpPair; //flush to main memory\n"
" }\n"
" }\n"
@@ -402,17 +402,17 @@ static const char* sapFastCL= \
" {\n"
" //avoid a buffer overrun\n"
" int curPair = atomic_add(pairCount,curNumPairs);\n"
" if ((curPair+curNumPairs)<maxPairs)\n"
" for (int p=0;p<curNumPairs;p++)\n"
" {\n"
" for (int p=0;p<curNumPairs;p++)\n"
" {\n"
" if ((curPair+p)<maxPairs)\n"
" {\n"
" int4 tmpPair;\n"
" tmpPair.x = myPairs[p].x;\n"
" tmpPair.y = myPairs[p].y;\n"
" tmpPair.z = NEW_PAIR_MARKER;\n"
" tmpPair.w = NEW_PAIR_MARKER;\n"
" pairsOut[curPair+p] = tmpPair; //flush to main memory\n"
" }\n"
" }\n"
" }\n"
" curNumPairs = 0;\n"
" }\n"