Avoid using SSE in API when BT_USE_SSE_IN_API is not defined
Fixes Issue 683.
This commit is contained in:
@@ -397,10 +397,13 @@ void ConvexDecompositionDemo::initPhysics(const char* filename)
|
||||
printf("new numVertices = %d\n", hull->numVertices ());
|
||||
|
||||
btConvexHullShape* convexShape = new btConvexHullShape();
|
||||
bool updateLocalAabb = false;
|
||||
|
||||
for (i=0;i<hull->numVertices();i++)
|
||||
{
|
||||
convexShape->addPoint(hull->getVertexPointer()[i]);
|
||||
convexShape->addPoint(hull->getVertexPointer()[i],updateLocalAabb);
|
||||
}
|
||||
convexShape->recalcLocalAabb();
|
||||
|
||||
if (sEnableSAT)
|
||||
convexShape->initializePolyhedralFeatures();
|
||||
|
||||
@@ -1400,8 +1400,8 @@ void btWorldImporter::convertRigidBodyDouble( btRigidBodyDoubleData* colObjData)
|
||||
}
|
||||
bool isDynamic = mass!=0.f;
|
||||
btRigidBody* body = createRigidBody(isDynamic,mass,startTransform,shape,colObjData->m_collisionObjectData.m_name);
|
||||
body->setFriction(colObjData->m_collisionObjectData.m_friction);
|
||||
body->setRestitution(colObjData->m_collisionObjectData.m_restitution);
|
||||
body->setFriction(btScalar(colObjData->m_collisionObjectData.m_friction));
|
||||
body->setRestitution(btScalar(colObjData->m_collisionObjectData.m_restitution));
|
||||
|
||||
|
||||
#ifdef USE_INTERNAL_EDGE_UTILITY
|
||||
|
||||
@@ -13,6 +13,10 @@ subject to the following restrictions:
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#if defined (_WIN32) || defined (__i386__)
|
||||
#define BT_USE_SSE_IN_API
|
||||
#endif
|
||||
|
||||
#include "btConvexHullShape.h"
|
||||
#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
|
||||
|
||||
@@ -45,9 +49,10 @@ void btConvexHullShape::setLocalScaling(const btVector3& scaling)
|
||||
recalcLocalAabb();
|
||||
}
|
||||
|
||||
void btConvexHullShape::addPoint(const btVector3& point)
|
||||
void btConvexHullShape::addPoint(const btVector3& point, bool recalculateLocalAabb)
|
||||
{
|
||||
m_unscaledPoints.push_back(point);
|
||||
if (recalculateLocalAabb)
|
||||
recalcLocalAabb();
|
||||
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
///btConvexHullShape make an internal copy of the points.
|
||||
btConvexHullShape(const btScalar* points=0,int numPoints=0, int stride=sizeof(btVector3));
|
||||
|
||||
void addPoint(const btVector3& point);
|
||||
void addPoint(const btVector3& point, bool recalculateLocalAabb = true);
|
||||
|
||||
|
||||
btVector3* getUnscaledPoints()
|
||||
|
||||
@@ -13,6 +13,10 @@ subject to the following restrictions:
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
#if defined (_WIN32) || defined (__i386__)
|
||||
#define BT_USE_SSE_IN_API
|
||||
#endif
|
||||
|
||||
#include "btConvexShape.h"
|
||||
#include "btTriangleShape.h"
|
||||
#include "btSphereShape.h"
|
||||
|
||||
@@ -13,7 +13,9 @@ subject to the following restrictions:
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
|
||||
|
||||
#if defined (_WIN32) || defined (__i386__)
|
||||
#define BT_USE_SSE_IN_API
|
||||
#endif
|
||||
|
||||
#include "btMultiSphereShape.h"
|
||||
#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
|
||||
|
||||
@@ -12,6 +12,9 @@ subject to the following restrictions:
|
||||
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#if defined (_WIN32) || defined (__i386__)
|
||||
#define BT_USE_SSE_IN_API
|
||||
#endif
|
||||
|
||||
#include "BulletCollision/CollisionShapes/btPolyhedralConvexShape.h"
|
||||
#include "btConvexPolyhedron.h"
|
||||
|
||||
@@ -229,7 +229,7 @@ public:
|
||||
* @param v The other vector in the dot product */
|
||||
SIMD_FORCE_INLINE btScalar dot(const btVector3& v) const
|
||||
{
|
||||
#if defined BT_USE_SIMD_VECTOR3
|
||||
#if defined BT_USE_SIMD_VECTOR3 && defined (BT_USE_SSE_IN_API) && defined (BT_USE_SSE)
|
||||
__m128 vd = _mm_mul_ps(mVec128, v.mVec128);
|
||||
__m128 z = _mm_movehl_ps(vd, vd);
|
||||
__m128 y = _mm_shuffle_ps(vd, vd, 0x55);
|
||||
@@ -989,7 +989,7 @@ SIMD_FORCE_INLINE btVector3 btVector3::rotate( const btVector3& wAxis, const btS
|
||||
|
||||
SIMD_FORCE_INLINE long btVector3::maxDot( const btVector3 *array, long array_count, btScalar &dotOut ) const
|
||||
{
|
||||
#if defined BT_USE_SIMD_VECTOR3
|
||||
#if (defined BT_USE_SSE && defined BT_USE_SIMD_VECTOR3 && defined BT_USE_SSE_IN_API) || defined (BT_USE_NEON)
|
||||
#if defined _WIN32 || defined (BT_USE_SSE)
|
||||
const long scalar_cutoff = 10;
|
||||
long _maxdot_large( const float *array, const float *vec, unsigned long array_count, float *dotOut );
|
||||
@@ -998,7 +998,7 @@ SIMD_FORCE_INLINE long btVector3::maxDot( const btVector3 *array, long arra
|
||||
extern long (*_maxdot_large)( const float *array, const float *vec, unsigned long array_count, float *dotOut );
|
||||
#endif
|
||||
if( array_count < scalar_cutoff )
|
||||
#endif//BT_USE_SIMD_VECTOR3
|
||||
#endif
|
||||
{
|
||||
btScalar maxDot = -SIMD_INFINITY;
|
||||
int i = 0;
|
||||
@@ -1017,14 +1017,14 @@ SIMD_FORCE_INLINE long btVector3::maxDot( const btVector3 *array, long arra
|
||||
dotOut = maxDot;
|
||||
return ptIndex;
|
||||
}
|
||||
#if defined BT_USE_SIMD_VECTOR3
|
||||
#if (defined BT_USE_SSE && defined BT_USE_SIMD_VECTOR3 && defined BT_USE_SSE_IN_API) || defined (BT_USE_NEON)
|
||||
return _maxdot_large( (float*) array, (float*) &m_floats[0], array_count, &dotOut );
|
||||
#endif//BT_USE_SIMD_VECTOR3
|
||||
#endif
|
||||
}
|
||||
|
||||
SIMD_FORCE_INLINE long btVector3::minDot( const btVector3 *array, long array_count, btScalar &dotOut ) const
|
||||
{
|
||||
#if defined BT_USE_SIMD_VECTOR3
|
||||
#if (defined BT_USE_SSE && defined BT_USE_SIMD_VECTOR3 && defined BT_USE_SSE_IN_API) || defined (BT_USE_NEON)
|
||||
#if defined BT_USE_SSE
|
||||
const long scalar_cutoff = 10;
|
||||
long _mindot_large( const float *array, const float *vec, unsigned long array_count, float *dotOut );
|
||||
@@ -1036,7 +1036,7 @@ SIMD_FORCE_INLINE long btVector3::minDot( const btVector3 *array, long arra
|
||||
#endif
|
||||
|
||||
if( array_count < scalar_cutoff )
|
||||
#endif//BT_USE_SIMD_VECTOR3
|
||||
#endif
|
||||
{
|
||||
btScalar minDot = SIMD_INFINITY;
|
||||
int i = 0;
|
||||
@@ -1057,7 +1057,7 @@ SIMD_FORCE_INLINE long btVector3::minDot( const btVector3 *array, long arra
|
||||
|
||||
return ptIndex;
|
||||
}
|
||||
#if defined BT_USE_SIMD_VECTOR3
|
||||
#if (defined BT_USE_SSE && defined BT_USE_SIMD_VECTOR3 && defined BT_USE_SSE_IN_API) || defined (BT_USE_NEON)
|
||||
return _mindot_large( (float*) array, (float*) &m_floats[0], array_count, &dotOut );
|
||||
#endif//BT_USE_SIMD_VECTOR3
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user