Avoid breaking up the clipHullHull kernel, it ruins performance. Unfortunately, Mac OSX still requires it.
Use indices instead of copies for small/large aabbs in broadphase (grid / sap)
This commit is contained in:
@@ -3171,6 +3171,8 @@ void GpuSatCollision::computeConvexConvexContactsGPUSAT( b3OpenCLArray<b3Int4>*
|
||||
if (1)
|
||||
{
|
||||
|
||||
if (1)
|
||||
{
|
||||
{
|
||||
B3_PROFILE("findSeparatingAxisVertexFaceKernel");
|
||||
b3BufferInfoCL bInfo[] = {
|
||||
@@ -3228,7 +3230,8 @@ void GpuSatCollision::computeConvexConvexContactsGPUSAT( b3OpenCLArray<b3Int4>*
|
||||
clFinish(m_queue);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (1)
|
||||
{
|
||||
B3_PROFILE("findSeparatingAxisUnitSphereKernel");
|
||||
b3BufferInfoCL bInfo[] = {
|
||||
@@ -4466,8 +4469,8 @@ void GpuSatCollision::computeConvexConvexContactsGPUSAT( b3OpenCLArray<b3Int4>*
|
||||
|
||||
|
||||
//convex-convex contact clipping
|
||||
B3_PROFILE("clipHullHullKernel");
|
||||
bool breakupKernel = true;
|
||||
|
||||
bool breakupKernel = false;
|
||||
|
||||
#ifdef __APPLE__
|
||||
breakupKernel = true;
|
||||
@@ -4480,6 +4483,7 @@ void GpuSatCollision::computeConvexConvexContactsGPUSAT( b3OpenCLArray<b3Int4>*
|
||||
#endif//CHECK_ON_HOST
|
||||
if (computeConvexConvex)
|
||||
{
|
||||
B3_PROFILE("clipHullHullKernel");
|
||||
if (breakupKernel)
|
||||
{
|
||||
|
||||
|
||||
@@ -958,8 +958,15 @@ __kernel void clipHullHullKernel( __global int4* pairs,
|
||||
|
||||
int nReducedContacts = extractManifoldSequential(pointsIn, nPoints, normal, contactIdx);
|
||||
|
||||
int dstIdx;
|
||||
AppendInc( nGlobalContactsOut, dstIdx );
|
||||
|
||||
int mprContactIndex = pairs[pairIndex].z;
|
||||
|
||||
int dstIdx = mprContactIndex;
|
||||
if (dstIdx<0)
|
||||
{
|
||||
AppendInc( nGlobalContactsOut, dstIdx );
|
||||
}
|
||||
|
||||
if (dstIdx<contactCapacity)
|
||||
{
|
||||
pairs[pairIndex].z = dstIdx;
|
||||
@@ -977,7 +984,11 @@ __kernel void clipHullHullKernel( __global int4* pairs,
|
||||
|
||||
for (int i=0;i<nReducedContacts;i++)
|
||||
{
|
||||
c->m_worldPosB[i] = pointsIn[contactIdx[i]];
|
||||
//this condition means: overwrite contact point, unless at index i==0 we have a valid 'mpr' contact
|
||||
if (i>0||(mprContactIndex<0))
|
||||
{
|
||||
c->m_worldPosB[i] = pointsIn[contactIdx[i]];
|
||||
}
|
||||
}
|
||||
GET_NPOINTS(*c) = nReducedContacts;
|
||||
}
|
||||
|
||||
@@ -1245,8 +1245,13 @@ static const char* satClipKernelsCL= \
|
||||
" \n"
|
||||
" int nReducedContacts = extractManifoldSequential(pointsIn, nPoints, normal, contactIdx);\n"
|
||||
" \n"
|
||||
" int dstIdx;\n"
|
||||
" AppendInc( nGlobalContactsOut, dstIdx );\n"
|
||||
" \n"
|
||||
" int mprContactIndex = pairs[pairIndex].z;\n"
|
||||
" int dstIdx = mprContactIndex;\n"
|
||||
" if (dstIdx<0)\n"
|
||||
" {\n"
|
||||
" AppendInc( nGlobalContactsOut, dstIdx );\n"
|
||||
" }\n"
|
||||
" if (dstIdx<contactCapacity)\n"
|
||||
" {\n"
|
||||
" pairs[pairIndex].z = dstIdx;\n"
|
||||
@@ -1262,7 +1267,11 @@ static const char* satClipKernelsCL= \
|
||||
" c->m_childIndexB = -1;\n"
|
||||
" for (int i=0;i<nReducedContacts;i++)\n"
|
||||
" {\n"
|
||||
" c->m_worldPosB[i] = pointsIn[contactIdx[i]];\n"
|
||||
" //this condition means: overwrite contact point, unless at index i==0 we have a valid 'mpr' contact\n"
|
||||
" if (i>0||(mprContactIndex<0))\n"
|
||||
" {\n"
|
||||
" c->m_worldPosB[i] = pointsIn[contactIdx[i]];\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" GET_NPOINTS(*c) = nReducedContacts;\n"
|
||||
" }\n"
|
||||
|
||||
Reference in New Issue
Block a user