Get the open source Bullet library more in sync with Playstation SPU version
This commit is contained in:
@@ -31,6 +31,26 @@ void btAlignedFree (void* ptr)
|
||||
|
||||
#else
|
||||
|
||||
#ifdef __CELLOS_LV2__
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
int numAllocs = 0;
|
||||
int numFree = 0;
|
||||
|
||||
void* btAlignedAlloc (int size, int alignment)
|
||||
{
|
||||
numAllocs++;
|
||||
return memalign(alignment, size);
|
||||
}
|
||||
|
||||
void btAlignedFree (void* ptr)
|
||||
{
|
||||
numFree++;
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
#else
|
||||
///todo
|
||||
///will add some multi-platform version that works without _aligned_malloc/_aligned_free
|
||||
|
||||
@@ -43,6 +63,7 @@ void btAlignedFree (void* ptr)
|
||||
{
|
||||
delete [] (char*) ptr;
|
||||
}
|
||||
#endif //
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class btAlignedObjectArray
|
||||
SIMD_FORCE_INLINE void copy(int start,int end, T* dest)
|
||||
{
|
||||
int i;
|
||||
for (i=0;i<m_size;++i)
|
||||
for (i=start;i<end;++i)
|
||||
dest[i] = m_data[i];
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ class btAlignedObjectArray
|
||||
SIMD_FORCE_INLINE void destroy(int first,int last)
|
||||
{
|
||||
int i;
|
||||
for (i=0; i<m_size;i++)
|
||||
for (i=first; i<last;i++)
|
||||
{
|
||||
m_data[i].~T();
|
||||
}
|
||||
|
||||
@@ -21,7 +21,8 @@ subject to the following restrictions:
|
||||
|
||||
|
||||
|
||||
ATTRIBUTE_ALIGNED16 (class btQuadWord)
|
||||
///btQuadWord is base-class for vectors, points
|
||||
class btQuadWord
|
||||
{
|
||||
protected:
|
||||
btScalar m_x;
|
||||
|
||||
@@ -43,6 +43,17 @@ subject to the following restrictions:
|
||||
#define btFullAssert(x)
|
||||
#else
|
||||
|
||||
#if defined (__CELLOS_LV2__)
|
||||
#define SIMD_FORCE_INLINE inline
|
||||
#define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned (16)))
|
||||
#ifndef assert
|
||||
#include <assert.h>
|
||||
#endif
|
||||
#define btAssert assert
|
||||
//btFullAssert is optional, slows down a lot
|
||||
#define btFullAssert(x)
|
||||
#else
|
||||
|
||||
//non-windows systems
|
||||
|
||||
#define SIMD_FORCE_INLINE inline
|
||||
@@ -53,6 +64,7 @@ subject to the following restrictions:
|
||||
#define btAssert assert
|
||||
//btFullAssert is optional, slows down a lot
|
||||
#define btFullAssert(x)
|
||||
#endif //__CELLOS_LV2__
|
||||
#endif
|
||||
|
||||
/// older compilers (gcc 3.x) and Sun needs double version of sqrt etc.
|
||||
|
||||
@@ -19,11 +19,10 @@ subject to the following restrictions:
|
||||
|
||||
#include "btQuadWord.h"
|
||||
|
||||
|
||||
///btVector3 is 16byte aligned, and has an extra unused component m_w
|
||||
///this extra component can be used by derived classes (Quaternion?) or by user
|
||||
class btVector3 : public btQuadWord {
|
||||
|
||||
///btVector3 can be used to represent 3D points and vectors.
|
||||
///It has an un-used w component to suit 16-byte alignment when btVector3 is stored in containers. This extra component can be used by derived classes (Quaternion?) or by user
|
||||
///Ideally, this class should be replaced by a platform optimized SIMD version that keeps the data in registers
|
||||
class btVector3 : public btQuadWord {
|
||||
|
||||
public:
|
||||
SIMD_FORCE_INLINE btVector3() {}
|
||||
|
||||
Reference in New Issue
Block a user