better host check code, to determine failing OpenCL kernels on certain (Apple) platforms

This commit is contained in:
erwin coumans
2013-12-13 13:27:00 -08:00
parent 571b14787a
commit d24b1eaae9

View File

@@ -2915,7 +2915,7 @@ void GpuSatCollision::computeConvexConvexContactsGPUSAT( b3OpenCLArray<b3Int4>*
hostCollidables[collidableIndexB].m_shapeType == SHAPE_CONVEX_HULL) hostCollidables[collidableIndexB].m_shapeType == SHAPE_CONVEX_HULL)
{ {
//printf("hostPairs[i].z=%d\n",hostPairs[i].z); //printf("hostPairs[i].z=%d\n",hostPairs[i].z);
int contactIndex = 0;//computeContactConvexConvex2(i,bodyIndexA,bodyIndexB,collidableIndexA,collidableIndexB,hostBodyBuf, hostCollidables,hostConvexData,hostVertices,hostUniqueEdges,hostIndices,hostFaces,hostContacts,nContacts,maxContactCapacity,oldHostContacts); int contactIndex = computeContactConvexConvex2(i,bodyIndexA,bodyIndexB,collidableIndexA,collidableIndexB,hostBodyBuf, hostCollidables,hostConvexData,hostVertices,hostUniqueEdges,hostIndices,hostFaces,hostContacts,nContacts,maxContactCapacity,oldHostContacts);
//int contactIndex = computeContactConvexConvex(hostPairs,i,bodyIndexA,bodyIndexB,collidableIndexA,collidableIndexB,hostBodyBuf,hostCollidables,hostConvexData,hostVertices,hostUniqueEdges,hostIndices,hostFaces,hostContacts,nContacts,maxContactCapacity,oldHostContacts); //int contactIndex = computeContactConvexConvex(hostPairs,i,bodyIndexA,bodyIndexB,collidableIndexA,collidableIndexB,hostBodyBuf,hostCollidables,hostConvexData,hostVertices,hostUniqueEdges,hostIndices,hostFaces,hostContacts,nContacts,maxContactCapacity,oldHostContacts);
@@ -3018,7 +3018,7 @@ void GpuSatCollision::computeConvexConvexContactsGPUSAT( b3OpenCLArray<b3Int4>*
clFinish(m_queue); clFinish(m_queue);
if (findSeparatingAxisOnGpu) if (findSeparatingAxisOnGpu)
{ {
#ifndef CHECK_ON_HOST
{ {
B3_PROFILE("findSeparatingAxisKernel"); B3_PROFILE("findSeparatingAxisKernel");
b3BufferInfoCL bInfo[] = { b3BufferInfoCL bInfo[] = {
@@ -3043,11 +3043,12 @@ void GpuSatCollision::computeConvexConvexContactsGPUSAT( b3OpenCLArray<b3Int4>*
launcher.launch1D( num); launcher.launch1D( num);
clFinish(m_queue); clFinish(m_queue);
} }
#endif
numCompoundPairs = m_numCompoundPairsOut.at(0); numCompoundPairs = m_numCompoundPairsOut.at(0);
bool useGpuFindCompoundPairs=true; bool useGpuFindCompoundPairs=true;
#ifndef CHECK_ON_HOST
if (useGpuFindCompoundPairs) if (useGpuFindCompoundPairs)
{ {
B3_PROFILE("findCompoundPairsKernel"); B3_PROFILE("findCompoundPairsKernel");
@@ -3165,14 +3166,13 @@ void GpuSatCollision::computeConvexConvexContactsGPUSAT( b3OpenCLArray<b3Int4>*
printf("numCompoundPairsOut=%d\n",numCompoundPairsOut); printf("numCompoundPairsOut=%d\n",numCompoundPairsOut);
} }
} }
if (numCompoundPairs > compoundPairCapacity) if (numCompoundPairs > compoundPairCapacity)
{ {
b3Error("Exceeded compound pair capacity (%d/%d)\n", numCompoundPairs, compoundPairCapacity); b3Error("Exceeded compound pair capacity (%d/%d)\n", numCompoundPairs, compoundPairCapacity);
numCompoundPairs = compoundPairCapacity; numCompoundPairs = compoundPairCapacity;
} }
#endif //CHECK_ON_HOST
@@ -3222,7 +3222,7 @@ void GpuSatCollision::computeConvexConvexContactsGPUSAT( b3OpenCLArray<b3Int4>*
if (numCompoundPairs) if (numCompoundPairs)
{ {
#ifndef CHECK_ON_HOST
B3_PROFILE("processCompoundPairsKernel"); B3_PROFILE("processCompoundPairsKernel");
b3BufferInfoCL bInfo[] = b3BufferInfoCL bInfo[] =
{ {
@@ -3247,7 +3247,7 @@ void GpuSatCollision::computeConvexConvexContactsGPUSAT( b3OpenCLArray<b3Int4>*
int num = numCompoundPairs; int num = numCompoundPairs;
launcher.launch1D( num); launcher.launch1D( num);
clFinish(m_queue); clFinish(m_queue);
#endif
} }
@@ -3572,7 +3572,7 @@ void GpuSatCollision::computeConvexConvexContactsGPUSAT( b3OpenCLArray<b3Int4>*
//concave-convex contact clipping //concave-convex contact clipping
if (numConcavePairs) if (numConcavePairs)
{ {
// printf("numConcavePairs = %d\n", numConcavePairs); // printf("numConcavePairs = %d\n", numConcavePairs);
// nContacts = m_totalContactsOut.at(0); // nContacts = m_totalContactsOut.at(0);
// printf("nContacts before = %d\n", nContacts); // printf("nContacts before = %d\n", nContacts);
@@ -3723,14 +3723,12 @@ void GpuSatCollision::computeConvexConvexContactsGPUSAT( b3OpenCLArray<b3Int4>*
b3AlignedObjectArray<b3Contact4> cpuContacts; b3AlignedObjectArray<b3Contact4> cpuContacts;
contactOut->copyToHost(cpuContacts); contactOut->copyToHost(cpuContacts);
} }
// printf("nContacts after = %d\n", nContacts); // printf("nContacts after = %d\n", nContacts);
} }//numConcavePairs
//convex-convex contact clipping //convex-convex contact clipping
if (1)
{
B3_PROFILE("clipHullHullKernel"); B3_PROFILE("clipHullHullKernel");
bool breakupKernel = false; bool breakupKernel = false;
@@ -3738,6 +3736,8 @@ void GpuSatCollision::computeConvexConvexContactsGPUSAT( b3OpenCLArray<b3Int4>*
breakupKernel = true; breakupKernel = true;
#endif #endif
#ifndef CHECK_ON_HOST
if (breakupKernel) if (breakupKernel)
{ {
@@ -3812,7 +3812,7 @@ void GpuSatCollision::computeConvexConvexContactsGPUSAT( b3OpenCLArray<b3Int4>*
clFinish(m_queue); clFinish(m_queue);
{ {
// nContacts = m_totalContactsOut.at(0); // nContacts = m_totalContactsOut.at(0);
// printf("nContacts = %d\n",nContacts); // printf("nContacts = %d\n",nContacts);
contactOut->reserve(nContacts+nPairs); contactOut->reserve(nContacts+nPairs);
@@ -3842,7 +3842,7 @@ void GpuSatCollision::computeConvexConvexContactsGPUSAT( b3OpenCLArray<b3Int4>*
nContacts = m_totalContactsOut.at(0); nContacts = m_totalContactsOut.at(0);
contactOut->resize(nContacts); contactOut->resize(nContacts);
// b3Contact4 pt = contactOut->at(0); // b3Contact4 pt = contactOut->at(0);
// printf("nContacts = %d\n",nContacts); // printf("nContacts = %d\n",nContacts);
} }
@@ -3884,6 +3884,10 @@ void GpuSatCollision::computeConvexConvexContactsGPUSAT( b3OpenCLArray<b3Int4>*
} }
contactOut->resize(nContacts); contactOut->resize(nContacts);
} }
}
#endif //#endif //CHECK_ON_HOST
#ifndef CHECK_ON_HOST
int nCompoundsPairs = m_gpuCompoundPairs.size(); int nCompoundsPairs = m_gpuCompoundPairs.size();
@@ -3921,9 +3925,8 @@ void GpuSatCollision::computeConvexConvexContactsGPUSAT( b3OpenCLArray<b3Int4>*
nContacts = maxContactCapacity; nContacts = maxContactCapacity;
} }
contactOut->resize(nContacts); contactOut->resize(nContacts);
} }//if nCompoundsPairs
} #endif //CHECK_ON_HOST
}
} }//contactClippingOnGpu
} }