fix many warnings
remove btMultiSapBroadphase.* make collisionFilterGroup/collisionFilterMark int (instead of short int)
This commit is contained in:
@@ -55,7 +55,7 @@ void getInfo2Point2Point(b3GpuGenericConstraint* constraint, b3GpuConstraintInfo
|
||||
info->m_J1linearAxis[2*info->rowskip+2] = 1;
|
||||
|
||||
b3Vector3 a1 = trA.getBasis()*constraint->getPivotInA();
|
||||
b3Vector3 a1a = b3QuatRotate(trA.getRotation(),constraint->getPivotInA());
|
||||
//b3Vector3 a1a = b3QuatRotate(trA.getRotation(),constraint->getPivotInA());
|
||||
|
||||
{
|
||||
b3Vector3* angular0 = (b3Vector3*)(info->m_J1angularAxis);
|
||||
|
||||
@@ -576,7 +576,7 @@ void b3GpuJacobiContactSolver::solveGroupHost(b3RigidBodyData* bodies,b3InertiaD
|
||||
for( i=0; i<numManifolds; i++)
|
||||
{
|
||||
|
||||
float frictionCoeff = contactConstraints[i].getFrictionCoeff();
|
||||
//float frictionCoeff = contactConstraints[i].getFrictionCoeff();
|
||||
int aIdx = (int)contactConstraints[i].m_bodyA;
|
||||
int bIdx = (int)contactConstraints[i].m_bodyB;
|
||||
b3RigidBodyData& bodyA = bodies[aIdx];
|
||||
@@ -650,7 +650,7 @@ void b3GpuJacobiContactSolver::solveGroupHost(b3RigidBodyData* bodies,b3InertiaD
|
||||
}
|
||||
for (int iter = 0;iter<maxIter;iter++)
|
||||
{
|
||||
int i=0;
|
||||
//int i=0;
|
||||
|
||||
//solve friction
|
||||
|
||||
|
||||
@@ -445,7 +445,7 @@ int b3GpuNarrowPhase::registerCompoundShape(b3AlignedObjectArray<b3GpuChildShap
|
||||
for (int i=0;i<childShapes->size();i++)
|
||||
{
|
||||
int childColIndex = childShapes->at(i).m_shapeIndex;
|
||||
b3Collidable& childCol = getCollidableCpu(childColIndex);
|
||||
//b3Collidable& childCol = getCollidableCpu(childColIndex);
|
||||
b3SapAabb aabbLoc =m_data->m_localShapeAABBCPU->at(childColIndex);
|
||||
|
||||
b3Vector3 childLocalAabbMin=b3MakeVector3(aabbLoc.m_min[0],aabbLoc.m_min[1],aabbLoc.m_min[2]);
|
||||
@@ -832,7 +832,7 @@ void b3GpuNarrowPhase::computeContacts(cl_mem broadphasePairs, int numBroadphase
|
||||
//swap buffer
|
||||
m_data->m_currentContactBuffer=1-m_data->m_currentContactBuffer;
|
||||
|
||||
int curSize = m_data->m_pBufContactBuffersGPU[m_data->m_currentContactBuffer]->size();
|
||||
//int curSize = m_data->m_pBufContactBuffersGPU[m_data->m_currentContactBuffer]->size();
|
||||
|
||||
int maxTriConvexPairCapacity = m_data->m_config.m_maxTriConvexPairCapacity;
|
||||
int numTriConvexPairsOut=0;
|
||||
|
||||
@@ -84,7 +84,7 @@ struct b3GpuPgsJacobiSolverInternalData
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
static b3Transform getWorldTransform(b3RigidBodyData* rb)
|
||||
{
|
||||
b3Transform newTrans;
|
||||
@@ -98,7 +98,7 @@ static const b3Matrix3x3& getInvInertiaTensorWorld(b3InertiaData* inertia)
|
||||
return inertia->m_invInertiaWorld;
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
|
||||
static const b3Vector3& getLinearVelocity(b3RigidBodyData* rb)
|
||||
{
|
||||
@@ -254,7 +254,7 @@ b3Scalar b3GpuPgsConstraintSolver::solveGroupCacheFriendlySetup(b3OpenCLArray<b3
|
||||
}
|
||||
}
|
||||
|
||||
int totalBodies = 0;
|
||||
// int totalBodies = 0;
|
||||
int totalNumRows = 0;
|
||||
//b3RigidBody* rb0=0,*rb1=0;
|
||||
//if (1)
|
||||
@@ -604,9 +604,9 @@ b3Scalar b3GpuPgsConstraintSolver::solveGroupCacheFriendlySetup(b3OpenCLArray<b3
|
||||
// b3ContactSolverInfo info = infoGlobal;
|
||||
|
||||
|
||||
int numNonContactPool = m_tmpSolverNonContactConstraintPool.size();
|
||||
int numConstraintPool = m_tmpSolverContactConstraintPool.size();
|
||||
int numFrictionPool = m_tmpSolverContactFrictionConstraintPool.size();
|
||||
// int numNonContactPool = m_tmpSolverNonContactConstraintPool.size();
|
||||
// int numConstraintPool = m_tmpSolverContactConstraintPool.size();
|
||||
// int numFrictionPool = m_tmpSolverContactFrictionConstraintPool.size();
|
||||
|
||||
|
||||
return 0.f;
|
||||
@@ -858,7 +858,7 @@ static b3AlignedObjectArray<int> curUsed;
|
||||
|
||||
inline int b3GpuPgsConstraintSolver::sortConstraintByBatch3( b3BatchConstraint* cs, int numConstraints, int simdWidth , int staticIdx, int numBodies)
|
||||
{
|
||||
int sz = sizeof(b3BatchConstraint);
|
||||
//int sz = sizeof(b3BatchConstraint);
|
||||
|
||||
B3_PROFILE("sortConstraintByBatch3");
|
||||
|
||||
@@ -892,7 +892,7 @@ inline int b3GpuPgsConstraintSolver::sortConstraintByBatch3( b3BatchConstraint*
|
||||
#endif
|
||||
|
||||
int numValidConstraints = 0;
|
||||
int unprocessedConstraintIndex = 0;
|
||||
// int unprocessedConstraintIndex = 0;
|
||||
|
||||
int batchIdx = 0;
|
||||
|
||||
@@ -1032,7 +1032,7 @@ void b3GpuPgsConstraintSolver::solveJoints(int numBodies, b3OpenCLArray<b3RigidB
|
||||
b3Scalar b3GpuPgsConstraintSolver::solveGroupCacheFriendlyFinish(b3OpenCLArray<b3RigidBodyData>* gpuBodies,b3OpenCLArray<b3InertiaData>* gpuInertias,int numBodies,b3OpenCLArray<b3GpuGenericConstraint>* gpuConstraints,int numConstraints,const b3ContactSolverInfo& infoGlobal)
|
||||
{
|
||||
B3_PROFILE("solveGroupCacheFriendlyFinish");
|
||||
int numPoolConstraints = m_tmpSolverContactConstraintPool.size();
|
||||
// int numPoolConstraints = m_tmpSolverContactConstraintPool.size();
|
||||
// int i,j;
|
||||
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ b3GpuPgsContactSolver::b3GpuPgsContactSolver(cl_context ctx,cl_device_id device,
|
||||
m_data->m_offsets = new b3OpenCLArray<unsigned int>( ctx,m_data->m_queue,B3_SOLVER_N_CELLS);
|
||||
m_data->m_offsets->resize(B3_SOLVER_N_CELLS);
|
||||
const char* additionalMacros = "";
|
||||
const char* srcFileNameForCaching="";
|
||||
//const char* srcFileNameForCaching="";
|
||||
|
||||
|
||||
|
||||
@@ -556,26 +556,8 @@ static bool b3ContactCmp(const b3Contact4& p, const b3Contact4& q)
|
||||
|
||||
|
||||
|
||||
static const int gridTable4x4[] =
|
||||
{
|
||||
0,1,17,16,
|
||||
1,2,18,19,
|
||||
17,18,32,3,
|
||||
16,19,3,34
|
||||
};
|
||||
|
||||
static const int gridTable8x8[] =
|
||||
{
|
||||
0, 2, 3, 16, 17, 18, 19, 1,
|
||||
66, 64, 80, 67, 82, 81, 65, 83,
|
||||
131,144,128,130,147,129,145,146,
|
||||
208,195,194,192,193,211,210,209,
|
||||
21, 22, 23, 5, 4, 6, 7, 20,
|
||||
86, 85, 69, 87, 70, 68, 84, 71,
|
||||
151,133,149,150,135,148,132,134,
|
||||
197,27,214,213,212,199,198,196
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -583,6 +565,30 @@ static const int gridTable8x8[] =
|
||||
#define USE_SPATIAL_BATCHING 1
|
||||
#define USE_4x4_GRID 1
|
||||
|
||||
#ifndef USE_SPATIAL_BATCHING
|
||||
static const int gridTable4x4[] =
|
||||
{
|
||||
0,1,17,16,
|
||||
1,2,18,19,
|
||||
17,18,32,3,
|
||||
16,19,3,34
|
||||
};
|
||||
static const int gridTable8x8[] =
|
||||
{
|
||||
0, 2, 3, 16, 17, 18, 19, 1,
|
||||
66, 64, 80, 67, 82, 81, 65, 83,
|
||||
131,144,128,130,147,129,145,146,
|
||||
208,195,194,192,193,211,210,209,
|
||||
21, 22, 23, 5, 4, 6, 7, 20,
|
||||
86, 85, 69, 87, 70, 68, 84, 71,
|
||||
151,133,149,150,135,148,132,134,
|
||||
197,27,214,213,212,199,198,196
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
void SetSortDataCPU(b3Contact4* gContact, b3RigidBodyData* gBodies, b3SortData* gSortDataOut, int nContacts,float scale,const b3Int4& nSplit,int staticIdx)
|
||||
{
|
||||
@@ -597,7 +603,6 @@ void SetSortDataCPU(b3Contact4* gContact, b3RigidBodyData* gBodies, b3SortData*
|
||||
int bIdx = abs(bPtrAndSignBit);
|
||||
|
||||
bool aStatic = (aPtrAndSignBit<0) ||(aPtrAndSignBit==staticIdx);
|
||||
bool bStatic = (bPtrAndSignBit<0) ||(bPtrAndSignBit==staticIdx);
|
||||
|
||||
#if USE_SPATIAL_BATCHING
|
||||
int idx = (aStatic)? bIdx: aIdx;
|
||||
@@ -609,6 +614,8 @@ void SetSortDataCPU(b3Contact4* gContact, b3RigidBodyData* gBodies, b3SortData*
|
||||
int newIndex = (xIdx+yIdx*nSplit.x+zIdx*nSplit.x*nSplit.y);
|
||||
|
||||
#else//USE_SPATIAL_BATCHING
|
||||
bool bStatic = (bPtrAndSignBit<0) ||(bPtrAndSignBit==staticIdx);
|
||||
|
||||
#if USE_4x4_GRID
|
||||
int aa = aIdx&3;
|
||||
int bb = bIdx&3;
|
||||
@@ -797,7 +804,7 @@ void b3GpuPgsContactSolver::solveContacts(int numBodies, cl_mem bodyBuf, cl_mem
|
||||
|
||||
|
||||
|
||||
const b3OpenCLArray<b3RigidBodyData>* bodyNative = bodyBuf;
|
||||
//const b3OpenCLArray<b3RigidBodyData>* bodyNative = bodyBuf;
|
||||
|
||||
|
||||
{
|
||||
@@ -1033,7 +1040,7 @@ void b3GpuPgsContactSolver::solveContacts(int numBodies, cl_mem bodyBuf, cl_mem
|
||||
}
|
||||
|
||||
|
||||
bool compareGPU = false;
|
||||
// bool compareGPU = false;
|
||||
if (nContacts)
|
||||
{
|
||||
if (!gCpuBatchContacts)
|
||||
@@ -1070,7 +1077,7 @@ void b3GpuPgsContactSolver::solveContacts(int numBodies, cl_mem bodyBuf, cl_mem
|
||||
{
|
||||
m_data->m_batchSizes.resize(B3_MAX_NUM_BATCHES);
|
||||
int totalNumConstraints = cpuContacts.size();
|
||||
int simdWidth =numBodies+1;//-1;//64;//-1;//32;
|
||||
//int simdWidth =numBodies+1;//-1;//64;//-1;//32;
|
||||
int numBatches = sortConstraintByBatch3( &cpuContacts[0], totalNumConstraints, totalNumConstraints+1,csCfg.m_staticIdx ,numBodies,&m_data->m_batchSizes[0]); // on GPU
|
||||
maxNumBatches = b3Max(numBatches,maxNumBatches);
|
||||
static int globalMaxBatch = 0;
|
||||
@@ -1138,17 +1145,17 @@ void b3GpuPgsContactSolver::solveContacts(int numBodies, cl_mem bodyBuf, cl_mem
|
||||
B3_PROFILE("copyToHost");
|
||||
m_data->m_pBufContactOutGPU->copyToHost(cpuContacts);
|
||||
}
|
||||
b3OpenCLArray<unsigned int>* countsNative = m_data->m_solverGPU->m_numConstraints;
|
||||
b3OpenCLArray<unsigned int>* offsetsNative = m_data->m_solverGPU->m_offsets;
|
||||
// b3OpenCLArray<unsigned int>* countsNative = m_data->m_solverGPU->m_numConstraints;
|
||||
// b3OpenCLArray<unsigned int>* offsetsNative = m_data->m_solverGPU->m_offsets;
|
||||
|
||||
|
||||
|
||||
int numNonzeroGrid=0;
|
||||
// int numNonzeroGrid=0;
|
||||
|
||||
{
|
||||
m_data->m_batchSizes.resize(B3_MAX_NUM_BATCHES);
|
||||
int totalNumConstraints = cpuContacts.size();
|
||||
int simdWidth =numBodies+1;//-1;//64;//-1;//32;
|
||||
// int simdWidth =numBodies+1;//-1;//64;//-1;//32;
|
||||
int numBatches = sortConstraintByBatch3( &cpuContacts[0], totalNumConstraints, totalNumConstraints+1,csCfg.m_staticIdx ,numBodies,&m_data->m_batchSizes[0]); // on GPU
|
||||
maxNumBatches = b3Max(numBatches,maxNumBatches);
|
||||
static int globalMaxBatch = 0;
|
||||
@@ -1420,7 +1427,7 @@ inline int b3GpuPgsContactSolver::sortConstraintByBatch2( b3Contact4* cs, int nu
|
||||
idxSrc[i] = i;
|
||||
|
||||
int numValidConstraints = 0;
|
||||
int unprocessedConstraintIndex = 0;
|
||||
// int unprocessedConstraintIndex = 0;
|
||||
|
||||
int batchIdx = 0;
|
||||
|
||||
@@ -1588,7 +1595,7 @@ inline int b3GpuPgsContactSolver::sortConstraintByBatch3( b3Contact4* cs, int nu
|
||||
#endif
|
||||
|
||||
int numValidConstraints = 0;
|
||||
int unprocessedConstraintIndex = 0;
|
||||
// int unprocessedConstraintIndex = 0;
|
||||
|
||||
int batchIdx = 0;
|
||||
|
||||
|
||||
@@ -87,11 +87,12 @@ public:
|
||||
|
||||
|
||||
b3Solver::b3Solver(cl_context ctx, cl_device_id device, cl_command_queue queue, int pairCapacity)
|
||||
:m_nIterations(4),
|
||||
:
|
||||
m_context(ctx),
|
||||
m_device(device),
|
||||
m_queue(queue),
|
||||
m_batchSizes(ctx,queue)
|
||||
m_batchSizes(ctx,queue),
|
||||
m_nIterations(4)
|
||||
{
|
||||
m_sort32 = new b3RadixSort32CL(ctx,device,queue);
|
||||
m_scan = new b3PrefixScanCL(ctx,device,queue,B3_SOLVER_N_CELLS);
|
||||
@@ -108,7 +109,7 @@ b3Solver::b3Solver(cl_context ctx, cl_device_id device, cl_command_queue queue,
|
||||
m_offsets = new b3OpenCLArray<unsigned int>( ctx,queue,B3_SOLVER_N_CELLS);
|
||||
m_offsets->resize(B3_SOLVER_N_CELLS);
|
||||
const char* additionalMacros = "";
|
||||
const char* srcFileNameForCaching="";
|
||||
// const char* srcFileNameForCaching="";
|
||||
|
||||
|
||||
|
||||
@@ -356,17 +357,32 @@ void solveContact(b3GpuConstraint4& cs,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
b3AlignedObjectArray<b3RigidBodyData>& m_bodies;
|
||||
b3AlignedObjectArray<b3InertiaData>& m_shapes;
|
||||
b3AlignedObjectArray<b3GpuConstraint4>& m_constraints;
|
||||
b3AlignedObjectArray<int>* m_batchSizes;
|
||||
int m_cellIndex;
|
||||
int m_curWgidx;
|
||||
int m_start;
|
||||
int m_nConstraints;
|
||||
bool m_solveFriction;
|
||||
int m_maxNumBatches;
|
||||
*/
|
||||
|
||||
struct SolveTask// : public ThreadPool::Task
|
||||
{
|
||||
SolveTask(b3AlignedObjectArray<b3RigidBodyData>& bodies, b3AlignedObjectArray<b3InertiaData>& shapes, b3AlignedObjectArray<b3GpuConstraint4>& constraints,
|
||||
int start, int nConstraints,int maxNumBatches,b3AlignedObjectArray<int>* wgUsedBodies, int curWgidx, b3AlignedObjectArray<int>* batchSizes, int cellIndex)
|
||||
: m_bodies( bodies ), m_shapes( shapes ), m_constraints( constraints ), m_start( start ), m_nConstraints( nConstraints ),
|
||||
m_solveFriction( true ),m_maxNumBatches(maxNumBatches),
|
||||
m_curWgidx(curWgidx),
|
||||
: m_bodies( bodies ), m_shapes( shapes ),
|
||||
m_constraints( constraints ),
|
||||
m_batchSizes(batchSizes),
|
||||
m_cellIndex(cellIndex)
|
||||
m_cellIndex(cellIndex),
|
||||
m_curWgidx(curWgidx),
|
||||
m_start( start ),
|
||||
m_nConstraints( nConstraints ),
|
||||
m_solveFriction( true ),
|
||||
m_maxNumBatches(maxNumBatches)
|
||||
{}
|
||||
|
||||
unsigned short int getType(){ return 0; }
|
||||
@@ -388,7 +404,7 @@ struct SolveTask// : public ThreadPool::Task
|
||||
float frictionCoeff = m_constraints[i].getFrictionCoeff();
|
||||
int aIdx = (int)m_constraints[i].m_bodyA;
|
||||
int bIdx = (int)m_constraints[i].m_bodyB;
|
||||
int localBatch = m_constraints[i].m_batchIdx;
|
||||
// int localBatch = m_constraints[i].m_batchIdx;
|
||||
b3RigidBodyData& bodyA = m_bodies[aIdx];
|
||||
b3RigidBodyData& bodyB = m_bodies[bIdx];
|
||||
|
||||
@@ -604,7 +620,7 @@ void b3Solver::solveContactConstraintHost( b3OpenCLArray<b3RigidBodyData>* body
|
||||
}
|
||||
const int start = offsetsHost[cellIdx];
|
||||
int numConstraintsInCell = numConstraintsHost[cellIdx];
|
||||
const int end = start + numConstraintsInCell;
|
||||
// const int end = start + numConstraintsInCell;
|
||||
|
||||
SolveTask task( bodyNative, shapeNative, constraintNative, start, numConstraintsInCell ,maxNumBatches,usedBodies,wgIdx,batchSizes,cellIdx);
|
||||
task.m_solveFriction = false;
|
||||
@@ -640,7 +656,7 @@ void b3Solver::solveContactConstraintHost( b3OpenCLArray<b3RigidBodyData>* body
|
||||
|
||||
const int start = offsetsHost[cellIdx];
|
||||
int numConstraintsInCell = numConstraintsHost[cellIdx];
|
||||
const int end = start + numConstraintsInCell;
|
||||
// const int end = start + numConstraintsInCell;
|
||||
|
||||
SolveTask task( bodyNative, shapeNative, constraintNative, start, numConstraintsInCell,maxNumBatches, 0,0,batchSizes,cellIdx);
|
||||
task.m_solveFriction = true;
|
||||
@@ -688,7 +704,7 @@ void checkConstraintBatch(const b3OpenCLArray<b3RigidBodyData>* bodyBuf,
|
||||
|
||||
int cellBatch = batchId;
|
||||
const int nn = B3_SOLVER_N_CELLS;
|
||||
int numWorkItems = 64*nn/B3_SOLVER_N_BATCHES;
|
||||
// int numWorkItems = 64*nn/B3_SOLVER_N_BATCHES;
|
||||
|
||||
b3AlignedObjectArray<unsigned int> gN;
|
||||
m_numConstraints->copyToHost(gN);
|
||||
@@ -697,7 +713,7 @@ void checkConstraintBatch(const b3OpenCLArray<b3RigidBodyData>* bodyBuf,
|
||||
int nSplitX = B3_SOLVER_N_SPLIT_X;
|
||||
int nSplitY = B3_SOLVER_N_SPLIT_Y;
|
||||
|
||||
int bIdx = batchId;
|
||||
// int bIdx = batchId;
|
||||
|
||||
b3AlignedObjectArray<b3GpuConstraint4> cpuConstraints;
|
||||
constraint->copyToHost(cpuConstraints);
|
||||
@@ -932,7 +948,7 @@ void b3Solver::convertToConstraints( const b3OpenCLArray<b3RigidBodyData>* bodyB
|
||||
b3OpenCLArray<b3Contact4>* contactsIn, b3OpenCLArray<b3GpuConstraint4>* contactCOut, void* additionalData,
|
||||
int nContacts, const ConstraintCfg& cfg )
|
||||
{
|
||||
b3OpenCLArray<b3GpuConstraint4>* constraintNative =0;
|
||||
// b3OpenCLArray<b3GpuConstraint4>* constraintNative =0;
|
||||
contactCOut->resize(nContacts);
|
||||
struct CB
|
||||
{
|
||||
@@ -1099,7 +1115,6 @@ void b3Solver::sortContacts( const b3OpenCLArray<b3RigidBodyData>* bodyBuf,
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
void b3Solver::batchContacts( b3OpenCLArray<b3Contact4>* contacts, int nContacts, b3OpenCLArray<unsigned int>* nNative, b3OpenCLArray<unsigned int>* offsetsNative, int staticIdx )
|
||||
{
|
||||
|
||||
@@ -1122,7 +1137,7 @@ void b3Solver::batchContacts( b3OpenCLArray<b3Contact4>* contacts, int nContact
|
||||
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
b3BufferInfoCL bInfo[] = {
|
||||
b3BufferInfoCL( contacts->getBufferCL() ),
|
||||
b3BufferInfoCL( m_contactBuffer2->getBufferCL()),
|
||||
@@ -1132,7 +1147,7 @@ void b3Solver::batchContacts( b3OpenCLArray<b3Contact4>* contacts, int nContact
|
||||
, b3BufferInfoCL(&gpuDebugInfo)
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user