add gjk/epa (host only), possibly improve convex-convex with many edge-edge tests

more preparation towards persistent/incremental contact cache
This commit is contained in:
erwincoumans
2013-07-31 23:22:43 -07:00
parent 7992ff816b
commit 34de49d8a4
24 changed files with 3020 additions and 118 deletions

View File

@@ -962,7 +962,7 @@ static const char* satClipKernelsCL= \
"\n"
"\n"
"\n"
"__kernel void clipHullHullKernel( __global const int4* pairs, \n"
"__kernel void clipHullHullKernel( __global int4* pairs, \n"
" __global const BodyData* rigidBodies, \n"
" __global const btCollidableGpu* collidables,\n"
" __global const ConvexPolyhedronCL* convexShapes, \n"
@@ -974,7 +974,8 @@ static const char* satClipKernelsCL= \
" __global const int* hasSeparatingAxis,\n"
" __global Contact4* restrict globalContactsOut,\n"
" counter32_t nGlobalContactsOut,\n"
" int numPairs)\n"
" int numPairs,\n"
" int contactCapacity)\n"
"{\n"
"\n"
" int i = get_global_id(0);\n"
@@ -1034,8 +1035,10 @@ static const char* satClipKernelsCL= \
" \n"
" int dstIdx;\n"
" AppendInc( nGlobalContactsOut, dstIdx );\n"
" //if ((dstIdx+nReducedContacts) < capacity)\n"
" if (dstIdx<contactCapacity)\n"
" {\n"
" pairs[pairIndex].z = dstIdx;\n"
"\n"
" __global Contact4* c = globalContactsOut+ dstIdx;\n"
" c->m_worldNormal = normal;\n"
" c->m_coeffs = (u32)(0.f*0xffff) | ((u32)(0.7f*0xffff)<<16);\n"
@@ -1742,7 +1745,7 @@ static const char* satClipKernelsCL= \
"\n"
"\n"
"\n"
"__kernel void clipFacesAndContactReductionKernel( __global const int4* pairs,\n"
"__kernel void clipFacesAndContactReductionKernel( __global int4* pairs,\n"
" __global const BodyData* rigidBodies,\n"
" __global const float4* separatingNormals,\n"
" __global const int* hasSeparatingAxis,\n"
@@ -1855,7 +1858,7 @@ static const char* satClipKernelsCL= \
"\n"
"\n"
"\n"
"__kernel void newContactReductionKernel( __global const int4* pairs,\n"
"__kernel void newContactReductionKernel( __global int4* pairs,\n"
" __global const BodyData* rigidBodies,\n"
" __global const float4* separatingNormals,\n"
" __global const int* hasSeparatingAxis,\n"
@@ -1899,12 +1902,16 @@ static const char* satClipKernelsCL= \
" \n"
" if (dstIdx < numPairs)\n"
" {\n"
"\n"
" __global Contact4* c = &globalContactsOut[dstIdx];\n"
" c->m_worldNormal = normal;\n"
" c->m_coeffs = (u32)(0.f*0xffff) | ((u32)(0.7f*0xffff)<<16);\n"
" c->m_batchIdx = pairIndex;\n"
" int bodyA = pairs[pairIndex].x;\n"
" int bodyB = pairs[pairIndex].y;\n"
"\n"
" pairs[pairIndex].w = dstIdx;\n"
"\n"
" c->m_bodyAPtrAndSignBit = rigidBodies[bodyA].m_invMass==0?-bodyA:bodyA;\n"
" c->m_bodyBPtrAndSignBit = rigidBodies[bodyB].m_invMass==0?-bodyB:bodyB;\n"
" c->m_childIndexA =-1;\n"