get SequentialThreadSupport to compile on the Mac

This commit is contained in:
ejcoumans
2007-12-14 06:21:51 +00:00
parent 9e25108b06
commit d7354e5387
8 changed files with 72 additions and 41 deletions

View File

@@ -260,7 +260,7 @@ void DemoApplication::keyboardCallback(unsigned char key, int x, int y)
//return from glutMainLoop(), detect memory leaks etc.
glutLeaveMainLoop();
#else
exit();
exit(0);
#endif
break;

View File

@@ -12,7 +12,7 @@ if $(GLUT.AVAILABLE) = "yes"
CFlags bulletopenglsupport :
;
LibDepends bulletopenglsupport : bulletdynamics ;
LibDepends bulletopenglsupport : bulletdynamics ;
ExternalLibs bulletopenglsupport : GLUT ;
}

View File

@@ -4,26 +4,31 @@
//Disabling memcpy sometimes helps debugging DMA
#define USE_MEMCPY 1
#ifdef USE_MEMCPY
#endif
void* cellDmaLargeGetReadOnly(void *ls, uint64_t ea, uint32_t size, uint32_t tag, uint32_t tid, uint32_t rid)
{
#if defined (WIN32) || defined (__PPU__)
return (void*)(uint32_t)ea;
#else
#if defined (__CELLOS_LV2__) || defined (USE_LIBSPE2)
cellDmaLargeGet(ls,ea,size,tag,tid,rid);
return ls;
#endif //WIN32
#else
return (void*)(uint32_t)ea;
#endif
}
void* cellDmaGetReadOnly(void *ls, uint64_t ea, uint32_t size, uint32_t tag, uint32_t tid, uint32_t rid)
{
#if defined (WIN32) || defined (__PPU__)
return (void*)(uint32_t)ea;
#else
#if defined (__CELLOS_LV2__) || defined (USE_LIBSPE2)
cellDmaGet(ls,ea,size,tag,tid,rid);
return ls;
#endif //WIN32
#else
return (void*)(uint32_t)ea;
#endif
}
@@ -43,8 +48,10 @@ int stallingUnalignedDmaSmallGet(void *ls, uint64_t ea, uint32_t size)
///make sure last 4 bits are the same, for cellDmaSmallGet
uint32_t last4BitsOffset = ea & 0x0f;
char* tmpTarget = tmpBuffer + last4BitsOffset;
#ifdef WIN32
#if defined (__CELLOS_LV2__) || defined (USE_LIBSPE2)
mfc_get(tmpTarget,ea,size,DMA_TAG(1),0,0);
#else
//copy into final destination
#ifdef USE_MEMCPY
memcpy(tmpTarget,mainMem,size);
#else
@@ -53,10 +60,8 @@ int stallingUnalignedDmaSmallGet(void *ls, uint64_t ea, uint32_t size)
tmpTarget[i] = mainMem[i];
}
#endif //USE_MEMCPY
#else
mfc_get(tmpTarget,ea,size,DMA_TAG(1),0,0);
//copy into final destination
#endif //WIN32
#endif
cellDmaWaitTagStatusAll(DMA_MASK(1));
@@ -69,8 +74,8 @@ int stallingUnalignedDmaSmallGet(void *ls, uint64_t ea, uint32_t size)
return 0;
}
#ifdef WIN32
#if defined (__CELLOS_LV2__) || defined (USE_LIBSPE2)
#else
int cellDmaLargeGet(void *ls, uint64_t ea, uint32_t size, uint32_t tag, uint32_t tid, uint32_t rid)
{
@@ -126,4 +131,4 @@ void cellDmaWaitTagStatusAll(int ignore)
}
#endif //WIN32
#endif

View File

@@ -15,23 +15,6 @@
#define DMA_TAG(xfer) (xfer + 1)
#define DMA_MASK(xfer) (1 << DMA_TAG(xfer))
#else
#ifdef WIN32
#define DMA_TAG(a) (a)
#define DMA_MASK(a) (a)
/// cellDmaLargeGet Win32 replacements for Cell DMA to allow simulating most of the SPU code (just memcpy)
int cellDmaLargeGet(void *ls, uint64_t ea, uint32_t size, uint32_t tag, uint32_t tid, uint32_t rid);
int cellDmaGet(void *ls, uint64_t ea, uint32_t size, uint32_t tag, uint32_t tid, uint32_t rid);
/// cellDmaLargePut Win32 replacements for Cell DMA to allow simulating most of the SPU code (just memcpy)
int cellDmaLargePut(const void *ls, uint64_t ea, uint32_t size, uint32_t tag, uint32_t tid, uint32_t rid);
/// cellDmaWaitTagStatusAll Win32 replacements for Cell DMA to allow simulating most of the SPU code (just memcpy)
void cellDmaWaitTagStatusAll(int ignore);
#elif defined(USE_LIBSPE2)
#define DMA_TAG(xfer) (xfer + 1)
@@ -109,9 +92,21 @@
#endif // WIN32
#else
//Simulate DMA using memcpy or direct access on non-CELL platforms that don't have DMAs and SPUs (Win32, Mac, Linux etc)
//Potential to add networked simulation using this interface
#define DMA_TAG(a) (a)
#define DMA_MASK(a) (a)
/// cellDmaLargeGet Win32 replacements for Cell DMA to allow simulating most of the SPU code (just memcpy)
int cellDmaLargeGet(void *ls, uint64_t ea, uint32_t size, uint32_t tag, uint32_t tid, uint32_t rid);
int cellDmaGet(void *ls, uint64_t ea, uint32_t size, uint32_t tag, uint32_t tid, uint32_t rid);
/// cellDmaLargePut Win32 replacements for Cell DMA to allow simulating most of the SPU code (just memcpy)
int cellDmaLargePut(const void *ls, uint64_t ea, uint32_t size, uint32_t tag, uint32_t tid, uint32_t rid);
/// cellDmaWaitTagStatusAll Win32 replacements for Cell DMA to allow simulating most of the SPU code (just memcpy)
void cellDmaWaitTagStatusAll(int ignore);
#endif //__CELLOS_LV2__

View File

@@ -85,7 +85,8 @@ int g_CacheHits=0;
#include <LibSN_SPU.h>
#endif //USE_SN_TUNER
#ifdef WIN32
#if defined (__CELLOS_LV2__) || defined (USE_LIBSPE2)
#else
#define IGNORE_ALIGNMENT 1
#define spu_printf printf
#include <stdio.h>

View File

@@ -106,6 +106,34 @@ private:
ATTRIBUTE_ALIGNED128(uint32_t atomic_buf[32]);
};
#else
//create a dummy implementation (without any locking) useful for serial processing
class btSpinlock
{
public:
typedef int SpinVariable;
btSpinlock (SpinVariable* var)
: spinVariable (var)
{}
void Init ()
{
}
void Lock ()
{
}
void Unlock ()
{
}
private:
SpinVariable* spinVariable;
};
#endif

View File

@@ -5,7 +5,7 @@ SubInclude TOP Extras COLLADA_DOM ;
SubInclude TOP Extras glui ;
SubInclude TOP Extras LibXML ;
SubInclude TOP Extras BulletColladaConverter ;
#SubInclude TOP Extras BulletMultiThreaded ;
SubInclude TOP Extras BulletMultiThreaded ;
#SubInclude TOP Extras EPA ;
#SubInclude TOP Extras ExtraSolid35 ;
SubInclude TOP Extras quickstep ;

View File

@@ -111,6 +111,8 @@ inline int btGetVersion()
#define btAssert assert
//btFullAssert is optional, slows down a lot
#define btFullAssert(x)
#define btLikely(_c) _c
#define btUnlikely(_c) _c
#endif // LIBSPE2