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. //return from glutMainLoop(), detect memory leaks etc.
glutLeaveMainLoop(); glutLeaveMainLoop();
#else #else
exit(); exit(0);
#endif #endif
break; break;

View File

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

View File

@@ -4,26 +4,31 @@
//Disabling memcpy sometimes helps debugging DMA //Disabling memcpy sometimes helps debugging DMA
#define USE_MEMCPY 1 #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) 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; #if defined (__CELLOS_LV2__) || defined (USE_LIBSPE2)
#else
cellDmaLargeGet(ls,ea,size,tag,tid,rid); cellDmaLargeGet(ls,ea,size,tag,tid,rid);
return ls; 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) void* cellDmaGetReadOnly(void *ls, uint64_t ea, uint32_t size, uint32_t tag, uint32_t tid, uint32_t rid)
{ {
#if defined (WIN32) || defined (__PPU__) #if defined (__CELLOS_LV2__) || defined (USE_LIBSPE2)
return (void*)(uint32_t)ea;
#else
cellDmaGet(ls,ea,size,tag,tid,rid); cellDmaGet(ls,ea,size,tag,tid,rid);
return ls; 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 ///make sure last 4 bits are the same, for cellDmaSmallGet
uint32_t last4BitsOffset = ea & 0x0f; uint32_t last4BitsOffset = ea & 0x0f;
char* tmpTarget = tmpBuffer + last4BitsOffset; 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 #ifdef USE_MEMCPY
memcpy(tmpTarget,mainMem,size); memcpy(tmpTarget,mainMem,size);
#else #else
@@ -53,10 +60,8 @@ int stallingUnalignedDmaSmallGet(void *ls, uint64_t ea, uint32_t size)
tmpTarget[i] = mainMem[i]; tmpTarget[i] = mainMem[i];
} }
#endif //USE_MEMCPY #endif //USE_MEMCPY
#else
mfc_get(tmpTarget,ea,size,DMA_TAG(1),0,0); #endif
//copy into final destination
#endif //WIN32
cellDmaWaitTagStatusAll(DMA_MASK(1)); cellDmaWaitTagStatusAll(DMA_MASK(1));
@@ -69,8 +74,8 @@ int stallingUnalignedDmaSmallGet(void *ls, uint64_t ea, uint32_t size)
return 0; return 0;
} }
#if defined (__CELLOS_LV2__) || defined (USE_LIBSPE2)
#ifdef WIN32 #else
int cellDmaLargeGet(void *ls, uint64_t ea, uint32_t size, uint32_t tag, uint32_t tid, uint32_t rid) 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_TAG(xfer) (xfer + 1)
#define DMA_MASK(xfer) (1 << DMA_TAG(xfer)) #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) #elif defined(USE_LIBSPE2)
#define DMA_TAG(xfer) (xfer + 1) #define DMA_TAG(xfer) (xfer + 1)
@@ -109,9 +92,21 @@
#else
//Simulate DMA using memcpy or direct access on non-CELL platforms that don't have DMAs and SPUs (Win32, Mac, Linux etc)
#endif // WIN32 //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__ #endif //__CELLOS_LV2__

View File

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

View File

@@ -106,6 +106,34 @@ private:
ATTRIBUTE_ALIGNED128(uint32_t atomic_buf[32]); 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 #endif

View File

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

View File

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