use int4 for broadphase pair, it allows to store persistent information in the future

(contact cache, applied impulse/warm starting info etc)
This commit is contained in:
erwincoumans
2013-07-31 09:58:15 -07:00
parent 338118b3c6
commit 7992ff816b
19 changed files with 127 additions and 94 deletions

View File

@@ -76,8 +76,8 @@ static const char* sapFastCL= \
" __global const b3SortData* sortedAxisGPU0prev,\n"
" __global const b3SortData* sortedAxisGPU1prev,\n"
" __global const b3SortData* sortedAxisGPU2prev,\n"
" __global int2* addedHostPairsGPU,\n"
" __global int2* removedHostPairsGPU,\n"
" __global int4* addedHostPairsGPU,\n"
" __global int4* removedHostPairsGPU,\n"
" volatile __global int* addedHostPairsCount,\n"
" volatile __global int* removedHostPairsCount,\n"
" int maxCapacity,\n"
@@ -164,7 +164,7 @@ static const char* sapFastCL= \
" if (overlap && !prevOverlap)\n"
" {\n"
" //add a pair\n"
" int2 newPair;\n"
" int4 newPair;\n"
" if (i<=otherIndex)\n"
" {\n"
" newPair.x = i;\n"
@@ -193,7 +193,7 @@ static const char* sapFastCL= \
" {\n"
" \n"
" //remove a pair\n"
" int2 removedPair;\n"
" int4 removedPair;\n"
" if (i<=otherIndex)\n"
" {\n"
" removedPair.x = i;\n"
@@ -258,7 +258,7 @@ static const char* sapFastCL= \
" if (overlap && !prevOverlap)\n"
" {\n"
" //add a pair\n"
" int2 newPair;\n"
" int4 newPair;\n"
" if (i<=otherIndex)\n"
" {\n"
" newPair.x = i;\n"
@@ -286,7 +286,7 @@ static const char* sapFastCL= \
" {\n"
" //if (otherIndex2&1==0) -> min?\n"
" //remove a pair\n"
" int2 removedPair;\n"
" int4 removedPair;\n"
" if (i<=otherIndex)\n"
" {\n"
" removedPair.x = i;\n"
@@ -320,7 +320,7 @@ static const char* sapFastCL= \
"}\n"
"\n"
"//computePairsKernelBatchWrite\n"
"__kernel void computePairsKernel( __global const btAabbCL* aabbs, volatile __global int2* pairsOut,volatile __global int* pairCount, int numObjects, int axis, int maxPairs)\n"
"__kernel void computePairsKernel( __global const btAabbCL* aabbs, volatile __global int4* pairsOut,volatile __global int* pairCount, int numObjects, int axis, int maxPairs)\n"
"{\n"
" int i = get_global_id(0);\n"
" int localId = get_local_id(0);\n"
@@ -395,7 +395,11 @@ static const char* sapFastCL= \
" {\n"
" for (int p=0;p<curNumPairs;p++)\n"
" {\n"
" pairsOut[curPair+p] = myPairs[p]; //flush to main memory\n"
" int4 tmpPair;\n"
" tmpPair.x = myPairs[p].x;\n"
" tmpPair.y = myPairs[p].y;\n"
" \n"
" pairsOut[curPair+p] = tmpPair; //flush to main memory\n"
" }\n"
" }\n"
" curNumPairs = 0;\n"
@@ -425,7 +429,11 @@ static const char* sapFastCL= \
" {\n"
" for (int p=0;p<curNumPairs;p++)\n"
" {\n"
" pairsOut[curPair+p] = myPairs[p]; //flush to main memory\n"
" int4 tmpPair;\n"
" tmpPair.x = myPairs[p].x;\n"
" tmpPair.y = myPairs[p].y;\n"
" \n"
" pairsOut[curPair+p] = tmpPair; //flush to main memory\n"
" }\n"
" }\n"
" curNumPairs = 0;\n"