Просмотр исходного кода

bullet: fix warnings here and there.

undefined
Sam Hocevar 8 лет назад
Родитель
Сommit
4e6e359d2f
16 измененных файлов: 65 добавлений и 64 удалений
  1. +4
    -3
      src/bullet/Bullet3Dynamics/ConstraintSolver/b3PgsJacobiSolver.cpp
  2. +3
    -3
      src/bullet/Bullet3Dynamics/b3CpuRigidBodyPipeline.cpp
  3. +3
    -3
      src/bullet/Bullet3OpenCL/BroadphaseCollision/b3GpuGridBroadphase.cpp
  4. +15
    -15
      src/bullet/Bullet3OpenCL/BroadphaseCollision/b3GpuSapBroadphase.cpp
  5. +6
    -8
      src/bullet/Bullet3OpenCL/Initialize/b3OpenCLUtils.cpp
  6. +4
    -4
      src/bullet/Bullet3OpenCL/NarrowphaseCollision/b3ConvexHullContact.cpp
  7. +2
    -2
      src/bullet/Bullet3OpenCL/ParallelPrimitives/b3PrefixScanCL.cpp
  8. +2
    -2
      src/bullet/Bullet3OpenCL/ParallelPrimitives/b3PrefixScanFloat4CL.cpp
  9. +2
    -2
      src/bullet/Bullet3OpenCL/Raycast/b3GpuRaycast.cpp
  10. +1
    -1
      src/bullet/Bullet3OpenCL/RigidBody/b3GpuJacobiContactSolver.cpp
  11. +11
    -7
      src/bullet/Bullet3OpenCL/RigidBody/b3Solver.cpp
  12. +5
    -5
      src/bullet/BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.cpp
  13. +2
    -2
      src/bullet/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp
  14. +2
    -2
      src/bullet/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp
  15. +2
    -2
      src/bullet/BulletInverseDynamics/details/IDLinearMathInterface.hpp
  16. +1
    -3
      src/bullet/Makefile.am

+ 4
- 3
src/bullet/Bullet3Dynamics/ConstraintSolver/b3PgsJacobiSolver.cpp Просмотреть файл

@@ -142,8 +142,9 @@ int getNumContacts(b3Contact4* contact)
}

b3PgsJacobiSolver::b3PgsJacobiSolver(bool usePgs)
:m_btSeed2(0),m_usePgs(usePgs),
m_numSplitImpulseRecoveries(0)
: m_usePgs(usePgs),
m_numSplitImpulseRecoveries(0),
m_btSeed2(0)
{

}
@@ -1811,4 +1812,4 @@ b3Scalar b3PgsJacobiSolver::solveGroupCacheFriendlyFinish(b3RigidBodyData* bodie
void b3PgsJacobiSolver::reset()
{
m_btSeed2 = 0;
}
}

+ 3
- 3
src/bullet/Bullet3Dynamics/b3CpuRigidBodyPipeline.cpp Просмотреть файл

@@ -254,9 +254,9 @@ struct b3SolveTask// : public ThreadPool::Task
int maxNumBatches,
b3AlignedObjectArray<int>* wgUsedBodies, int curWgidx
)
: m_bodies( bodies ), m_shapes( shapes ), m_constraints( constraints ), m_start( start ), m_nConstraints( nConstraints ),
m_solveFriction( true ),m_maxNumBatches(maxNumBatches),
m_wgUsedBodies(wgUsedBodies),m_curWgidx(curWgidx)
: m_bodies( bodies ), m_shapes( shapes ), m_constraints( constraints ),
m_wgUsedBodies(wgUsedBodies), m_curWgidx(curWgidx), m_start( start ),
m_nConstraints( nConstraints ), m_solveFriction( true ), m_maxNumBatches(maxNumBatches)
{}

unsigned short int getType(){ return 0; }


+ 3
- 3
src/bullet/Bullet3OpenCL/BroadphaseCollision/b3GpuGridBroadphase.cpp Просмотреть файл

@@ -38,8 +38,8 @@ m_largeAabbsMappingGPU(ctx,q),
m_gpuPairs(ctx,q),

m_hashGpu(ctx,q),
m_paramsGPU(ctx,q),
m_cellStartGpu(ctx,q)
m_cellStartGpu(ctx,q),
m_paramsGPU(ctx,q)
{

@@ -279,7 +279,7 @@ void b3GpuGridBroadphase::calculateOverlappingPairs(int maxPairs)

int sz = m_gpuPairs.size();
printf("m_gpuPairs.size()=%d\n",sz);
for (int i=0;i<m_gpuPairs.size();i++)
for (unsigned int i=0;i<m_gpuPairs.size();i++)
{
printf("pair %d = %d,%d\n",i,pairsCpu[i].x,pairsCpu[i].y);
}


+ 15
- 15
src/bullet/Bullet3OpenCL/BroadphaseCollision/b3GpuSapBroadphase.cpp Просмотреть файл

@@ -19,17 +19,6 @@ b3GpuSapBroadphase::b3GpuSapBroadphase(cl_context ctx,cl_device_id device, cl_co
:m_context(ctx),
m_device(device),
m_queue(q),
m_allAabbsGPU(ctx,q),
m_smallAabbsMappingGPU(ctx,q),
m_largeAabbsMappingGPU(ctx,q),
m_pairCount(ctx,q),
m_overlappingPairs(ctx,q),
m_gpuSmallSortData(ctx,q),
m_gpuSmallSortedAabbs(ctx,q),
m_sum(ctx,q),
m_sum2(ctx,q),
m_dst(ctx,q),
m_currentBuffer(-1),
m_objectMinMaxIndexGPUaxis0(ctx,q),
m_objectMinMaxIndexGPUaxis1(ctx,q),
m_objectMinMaxIndexGPUaxis2(ctx,q),
@@ -45,7 +34,18 @@ m_sortedAxisGPU2prev(ctx,q),
m_addedHostPairsGPU(ctx,q),
m_removedHostPairsGPU(ctx,q),
m_addedCountGPU(ctx,q),
m_removedCountGPU(ctx,q)
m_removedCountGPU(ctx,q),
m_currentBuffer(-1),
m_pairCount(ctx,q),
m_allAabbsGPU(ctx,q),
m_sum(ctx,q),
m_sum2(ctx,q),
m_dst(ctx,q),
m_smallAabbsMappingGPU(ctx,q),
m_largeAabbsMappingGPU(ctx,q),
m_overlappingPairs(ctx,q),
m_gpuSmallSortData(ctx,q),
m_gpuSmallSortedAabbs(ctx,q)
{
const char* sapSrc = sapCL;
@@ -565,7 +565,7 @@ void b3GpuSapBroadphase::calculateOverlappingPairsHostIncremental3Sap()
if (dmin!=0)
{
int stepMin = dmin<0 ? -1 : 1;
for (int j=prevMinIndex;j!=curMinIndex;j+=stepMin)
for (unsigned int j=prevMinIndex;j!=curMinIndex;j+=stepMin)
{
int otherIndex2 = m_sortedAxisCPU[axis][otherbuffer][j].y;
int otherIndex = otherIndex2/2;
@@ -648,7 +648,7 @@ void b3GpuSapBroadphase::calculateOverlappingPairsHostIncremental3Sap()
if (dmax!=0)
{
int stepMax = dmax<0 ? -1 : 1;
for (int j=prevMaxIndex;j!=curMaxIndex;j+=stepMax)
for (unsigned int j=prevMaxIndex;j!=curMaxIndex;j+=stepMax)
{
int otherIndex2 = m_sortedAxisCPU[axis][otherbuffer][j].y;
int otherIndex = otherIndex2/2;
@@ -1024,7 +1024,7 @@ void b3GpuSapBroadphase::calculateOverlappingPairs(int maxPairs)

bool syncOnHost = false;

int numSmallAabbs = m_smallAabbsMappingCPU.size();
unsigned int numSmallAabbs = m_smallAabbsMappingCPU.size();
if (m_prefixScanFloat4 && numSmallAabbs)
{
B3_PROFILE("GPU compute best variance axis");


+ 6
- 8
src/bullet/Bullet3OpenCL/Initialize/b3OpenCLUtils.cpp Просмотреть файл

@@ -168,11 +168,10 @@ cl_platform_id b3OpenCLUtils_getPlatform(int platformIndex0, cl_int* pErrNum)
#endif

cl_platform_id platform = 0;
unsigned int platformIndex = (unsigned int )platformIndex0;
cl_uint numPlatforms;
cl_int ciErrNum = clGetPlatformIDs(0, NULL, &numPlatforms);

if (platformIndex>=0 && platformIndex<numPlatforms)
if (platformIndex0>=0 && (cl_uint)platformIndex0<numPlatforms)
{
cl_platform_id* platforms = (cl_platform_id*) malloc (sizeof(cl_platform_id)*numPlatforms);
ciErrNum = clGetPlatformIDs(numPlatforms, platforms, NULL);
@@ -183,7 +182,7 @@ cl_platform_id b3OpenCLUtils_getPlatform(int platformIndex0, cl_int* pErrNum)
return platform;
}

platform = platforms[platformIndex];
platform = platforms[platformIndex0];

free (platforms);
}
@@ -310,7 +309,6 @@ cl_context b3OpenCLUtils_createContextFromType(cl_device_type deviceType, cl_int

cl_uint numPlatforms;
cl_context retContext = 0;
unsigned int i;

cl_int ciErrNum = clGetPlatformIDs(0, NULL, &numPlatforms);
if(ciErrNum != CL_SUCCESS)
@@ -332,7 +330,7 @@ cl_context b3OpenCLUtils_createContextFromType(cl_device_type deviceType, cl_int



for ( i = 0; i < numPlatforms; ++i)
for (int i = 0; (cl_uint)i < numPlatforms; ++i)
{
char pbuf[128];
ciErrNum = clGetPlatformInfo( platforms[i],
@@ -346,7 +344,7 @@ cl_context b3OpenCLUtils_createContextFromType(cl_device_type deviceType, cl_int
return NULL;
}

if (preferredPlatformIndex>=0 && i==preferredPlatformIndex)
if (i==preferredPlatformIndex)
{
cl_platform_id tmpPlatform = platforms[0];
platforms[0] = platforms[i];
@@ -363,7 +361,7 @@ cl_context b3OpenCLUtils_createContextFromType(cl_device_type deviceType, cl_int
}
}

for (i = 0; i < numPlatforms; ++i)
for (int i = 0; (cl_uint)i < numPlatforms; ++i)
{
cl_platform_id platform = platforms[i];
assert(platform);
@@ -583,7 +581,7 @@ static const char* strip2(const char* name, const char* pattern)
const char * oriptr;
const char * patloc;
// find how many times the pattern occurs in the original string
for (oriptr = name; patloc = strstr(oriptr, pattern); oriptr = patloc + patlen)
for (oriptr = name; (patloc = strstr(oriptr, pattern)); oriptr = patloc + patlen)
{
patcnt++;
}


+ 4
- 4
src/bullet/Bullet3OpenCL/NarrowphaseCollision/b3ConvexHullContact.cpp Просмотреть файл

@@ -108,8 +108,10 @@ m_queue(q),
m_findSeparatingAxisKernel(0),
m_findSeparatingAxisVertexFaceKernel(0),
m_findSeparatingAxisEdgeEdgeKernel(0),
m_unitSphereDirections(m_context,m_queue),
m_totalContactsOut(m_context, m_queue),
m_sepNormals(m_context, m_queue),
m_dmins(m_context,m_queue),
m_hasSeparatingNormals(m_context, m_queue),
m_concaveSepNormals(m_context, m_queue),
m_concaveHasSeparatingNormals(m_context,m_queue),
@@ -117,9 +119,7 @@ m_numConcavePairsOut(m_context, m_queue),
m_gpuCompoundPairs(m_context, m_queue),
m_gpuCompoundSepNormals(m_context, m_queue),
m_gpuHasCompoundSepNormals(m_context, m_queue),
m_numCompoundPairsOut(m_context, m_queue),
m_dmins(m_context,m_queue),
m_unitSphereDirections(m_context,m_queue)
m_numCompoundPairsOut(m_context, m_queue)
{
m_totalContactsOut.push_back(0);
@@ -404,7 +404,7 @@ inline bool IsPointInPolygon(const float4& p,
float4 v0 = baseVertex[convexIndices[face->m_indexOffset + face->m_numIndices-1]];
b = v0;

for(unsigned i=0; i != face->m_numIndices; ++i)
for(int i=0; i != face->m_numIndices; ++i)
{
a = b;
float4 vi = baseVertex[convexIndices[face->m_indexOffset + i]];


+ 2
- 2
src/bullet/Bullet3OpenCL/ParallelPrimitives/b3PrefixScanCL.cpp Просмотреть файл

@@ -38,7 +38,7 @@ template<class T>
T b3NextPowerOf2(T n)
{
n -= 1;
for(int i=0; i<sizeof(T)*8; i++)
for(unsigned int i=0; i<sizeof(T)*8; i++)
n = n | (n>>i);
return n+1;
}
@@ -123,4 +123,4 @@ void b3PrefixScanCL::executeHost(b3AlignedObjectArray<unsigned int>& src, b3Alig
{
*sum = dst[n-1];
}
}
}

+ 2
- 2
src/bullet/Bullet3OpenCL/ParallelPrimitives/b3PrefixScanFloat4CL.cpp Просмотреть файл

@@ -38,7 +38,7 @@ template<class T>
T b3NextPowerOf2(T n)
{
n -= 1;
for(int i=0; i<sizeof(T)*8; i++)
for(unsigned int i=0; i<sizeof(T)*8; i++)
n = n | (n>>i);
return n+1;
}
@@ -123,4 +123,4 @@ void b3PrefixScanFloat4CL::executeHost(b3AlignedObjectArray<b3Vector3>& src, b3A
{
*sum = dst[n-1];
}
}
}

+ 2
- 2
src/bullet/Bullet3OpenCL/Raycast/b3GpuRaycast.cpp Просмотреть файл

@@ -311,7 +311,7 @@ void b3GpuRaycast::castRays(const b3AlignedObjectArray<b3RayInfo>& rays, b3Align
int numRayRigidPairs = -1;
m_data->m_gpuNumRayRigidPairs->copyToHostPointer(&numRayRigidPairs, 1);
if( numRayRigidPairs > m_data->m_gpuRayRigidPairs->size() )
if( numRayRigidPairs > (int)m_data->m_gpuRayRigidPairs->size() )
{
numRayRigidPairs = m_data->m_gpuRayRigidPairs->size();
m_data->m_gpuNumRayRigidPairs->copyFromHostPointer(&numRayRigidPairs, 1);
@@ -388,4 +388,4 @@ void b3GpuRaycast::castRays(const b3AlignedObjectArray<b3RayInfo>& rays, b3Align
m_data->m_gpuHitResults->copyToHost(hitResults);
}

}
}

+ 1
- 1
src/bullet/Bullet3OpenCL/RigidBody/b3GpuJacobiContactSolver.cpp Просмотреть файл

@@ -562,7 +562,7 @@ void b3GpuJacobiContactSolver::solveGroupHost(b3RigidBodyData* bodies,b3InertiaD
b3AlignedObjectArray<b3Vector3> deltaAngularVelocities;
deltaLinearVelocities.resize(totalNumSplitBodies);
deltaAngularVelocities.resize(totalNumSplitBodies);
for (int i=0;i<totalNumSplitBodies;i++)
for (unsigned int i=0;i<totalNumSplitBodies;i++)
{
deltaLinearVelocities[i].setZero();
deltaAngularVelocities[i].setZero();


+ 11
- 7
src/bullet/Bullet3OpenCL/RigidBody/b3Solver.cpp Просмотреть файл

@@ -87,11 +87,11 @@ public:


b3Solver::b3Solver(cl_context ctx, cl_device_id device, cl_command_queue queue, int pairCapacity)
:m_nIterations(4),
m_context(ctx),
: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);
@@ -362,11 +362,15 @@ 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; }


+ 5
- 5
src/bullet/BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.cpp Просмотреть файл

@@ -151,8 +151,8 @@ static btScalar EdgeSeparation(const btBox2dShape* poly1, const btTransform& xf1
int index = 0;
btScalar minDot = BT_LARGE_FLOAT;

if( count2 > 0 )
index = (int) normal1.minDot( vertices2, count2, minDot);
if( count2 > 0 )
index = (int) normal1.minDot( vertices2, count2, minDot);

btVector3 v1 = b2Mul(xf1, vertices1[edge1]);
btVector3 v2 = b2Mul(xf2, vertices2[index]);
@@ -174,9 +174,9 @@ static btScalar FindMaxSeparation(int* edgeIndex,

// Find edge normal on poly1 that has the largest projection onto d.
int edge = 0;
btScalar maxDot;
if( count1 > 0 )
edge = (int) dLocal1.maxDot( normals1, count1, maxDot);
btScalar maxDot;
if( count1 > 0 )
edge = (int) dLocal1.maxDot( normals1, count1, maxDot);

// Get the separation for the edge normal.
btScalar s = EdgeSeparation(poly1, xf1, edge, poly2, xf2);


+ 2
- 2
src/bullet/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp Просмотреть файл

@@ -232,8 +232,8 @@ void btCompoundCollisionAlgorithm::processCollision (const btCollisionObjectWrap
m_compoundShapeRevision = compoundShape->getUpdateRevision();
}

if (m_childCollisionAlgorithms.size()==0)
return;
if (m_childCollisionAlgorithms.size()==0)
return;
const btDbvt* tree = compoundShape->getDynamicAabbTree();
//use a dynamic aabb tree to cull potential child-overlaps


+ 2
- 2
src/bullet/BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp Просмотреть файл

@@ -29,8 +29,8 @@ subject to the following restrictions:

btConvexConcaveCollisionAlgorithm::btConvexConcaveCollisionAlgorithm( const btCollisionAlgorithmConstructionInfo& ci, const btCollisionObjectWrapper* body0Wrap,const btCollisionObjectWrapper* body1Wrap,bool isSwapped)
: btActivatingCollisionAlgorithm(ci,body0Wrap,body1Wrap),
m_isSwapped(isSwapped),
m_btConvexTriangleCallback(ci.m_dispatcher1,body0Wrap,body1Wrap,isSwapped)
m_btConvexTriangleCallback(ci.m_dispatcher1, body0Wrap, body1Wrap, isSwapped),
m_isSwapped(isSwapped)
{
}



+ 2
- 2
src/bullet/BulletInverseDynamics/details/IDLinearMathInterface.hpp Просмотреть файл

@@ -22,7 +22,7 @@ public:
vec3(const btVector3& btv) { *this = btv; }
idScalar& operator()(int i) { return (*this)[i]; }
const idScalar& operator()(int i) const { return (*this)[i]; }
const int size() const { return 3; }
int size() const { return 3; }
const vec3& operator=(const btVector3& rhs) {
*static_cast<btVector3*>(this) = rhs;
return *this;
@@ -113,7 +113,7 @@ inline vecx operator/(const vecx& a, const idScalar& s) {
class mat3x : public matxx {
public:
mat3x(){}
mat3x(const mat3x&rhs) {
mat3x(const mat3x&rhs): matxx() {
matxx::resize(rhs.rows(), rhs.cols());
*this = rhs;
}


+ 1
- 3
src/bullet/Makefile.am Просмотреть файл

@@ -6,9 +6,7 @@ noinst_LIBRARIES = liblol-bullet.a
# Only remove flags that were actually set, because we don't know
# what the compiler actually accepts.
disable_cflags = $(filter $(AM_CPPFLAGS:-W%=-Wno-%), \
-Wno-shadow -Wno-unused -Wno-cast-qual -Wno-strict-aliasing \
-Wno-reorder -Wno-maybe-uninitialized -Wno-narrowing \
-Wno-parentheses)
-Wno-shadow -Wno-unused -Wno-cast-qual -Wno-strict-aliasing)

liblol_bullet_a_SOURCES = $(bullet_sources)
liblol_bullet_a_CPPFLAGS = -DB3_USE_CLEW $(AM_CPPFLAGS) -I$(srcdir) $(disable_cflags)


Загрузка…
Отмена
Сохранить