updated BulletMultiThreaded Libspe2 version, it now runs parallel collision detection properly on IBM Cell SDK 2.1, with Playstation 3 Linux on SPUs.

This commit is contained in:
ejcoumans
2007-10-15 05:45:12 +00:00
parent 23921729ea
commit 6797ee41cb
5 changed files with 22 additions and 6 deletions

View File

@@ -43,8 +43,8 @@ PPU_LIBRARIES= -lstdc++ -lsupc++ -lgcc -lgcov -lspe2 -lpthread -L../../lib/ibmsd
PPU_AR=/usr/bin/ar PPU_AR=/usr/bin/ar
MakeOut : MakeOut :
rm -f -R $(OUTDIR) ; mkdir $(OUTDIR) # rm -f -R $(OUTDIR) ; mkdir $(OUTDIR)
@echo "usage: make spu, make ppu, make all, or make clean"
# SPU # SPU
SpuTaskFile : MakeOut SpuTaskFile : MakeOut
$(SPU_GCC) $(SPU_DEFFLAGS) $(SPU_CFLAGS) $(SPU_INCLUDEDIR) -o $(OUTDIR)/SpuTaskFile.o $(SPU_TASKFILE).cpp $(SPU_GCC) $(SPU_DEFFLAGS) $(SPU_CFLAGS) $(SPU_INCLUDEDIR) -o $(OUTDIR)/SpuTaskFile.o $(SPU_TASKFILE).cpp

View File

@@ -39,7 +39,7 @@
#include <spu_mfcio.h> #include <spu_mfcio.h>
//#define DEBUG_DMA #define DEBUG_DMA
#ifdef DEBUG_DMA #ifdef DEBUG_DMA
#define dUASSERT(a,b) if (!(a)) { printf(b);} #define dUASSERT(a,b) if (!(a)) { printf(b);}
#ifdef USE_ADDR64 #ifdef USE_ADDR64

View File

@@ -138,7 +138,8 @@ void SpuContactResult::writeDoubleBufferedManifold(btPersistentManifold* lsManif
memcpy(g_manifoldDmaExport.getFront(),lsManifold,sizeof(btPersistentManifold)); memcpy(g_manifoldDmaExport.getFront(),lsManifold,sizeof(btPersistentManifold));
g_manifoldDmaExport.swapBuffers(); g_manifoldDmaExport.swapBuffers();
g_manifoldDmaExport.backBufferDmaPut((uint64_t)mmManifold, sizeof(btPersistentManifold), DMA_TAG(9)); uint64_t mmAddr = (uint32_t)mmManifold;
g_manifoldDmaExport.backBufferDmaPut(mmAddr, sizeof(btPersistentManifold), DMA_TAG(9));
// Should there be any kind of wait here? What if somebody tries to use this tag again? What if we call this function again really soon? // Should there be any kind of wait here? What if somebody tries to use this tag again? What if we call this function again really soon?
//no, the swapBuffers does the wait //no, the swapBuffers does the wait
} }

View File

@@ -54,6 +54,8 @@ void* createCollisionLocalStoreMemory();
#include <spu_mfcio.h> #include <spu_mfcio.h>
#include <SpuFakeDma.h> #include <SpuFakeDma.h>
//#define DEBUG_LIBSPE2_SPU_TASK
int main(unsigned long long speid, addr64 argp, addr64 envp) int main(unsigned long long speid, addr64 argp, addr64 envp)
@@ -82,7 +84,9 @@ int main(unsigned long long speid, addr64 argp, addr64 envp)
if( btLikely( received_message == Spu_Mailbox_Event_Task )) if( btLikely( received_message == Spu_Mailbox_Event_Task ))
{ {
#ifdef DEBUG_LIBSPE2_SPU_TASK
printf("SPU: received Spu_Mailbox_Event_Task\n"); printf("SPU: received Spu_Mailbox_Event_Task\n");
#endif //DEBUG_LIBSPE2_SPU_TASK
// refresh the status // refresh the status
cellDmaGet(&status, argp.ull, sizeof(btSpuStatus), DMA_TAG(3), 0, 0); cellDmaGet(&status, argp.ull, sizeof(btSpuStatus), DMA_TAG(3), 0, 0);
@@ -92,14 +96,20 @@ int main(unsigned long long speid, addr64 argp, addr64 envp)
cellDmaGet(&taskDesc, status.m_taskDesc.p, sizeof(SpuGatherAndProcessPairsTaskDesc), DMA_TAG(3), 0, 0); cellDmaGet(&taskDesc, status.m_taskDesc.p, sizeof(SpuGatherAndProcessPairsTaskDesc), DMA_TAG(3), 0, 0);
cellDmaWaitTagStatusAll(DMA_MASK(3)); cellDmaWaitTagStatusAll(DMA_MASK(3));
#ifdef DEBUG_LIBSPE2_SPU_TASK
printf("SPU:processCollisionTask\n"); printf("SPU:processCollisionTask\n");
#endif //DEBUG_LIBSPE2_SPU_TASK
processCollisionTask((void*)&taskDesc, taskDesc.m_lsMemory); processCollisionTask((void*)&taskDesc, taskDesc.m_lsMemory);
#ifdef DEBUG_LIBSPE2_SPU_TASK
printf("SPU:finished processCollisionTask\n"); printf("SPU:finished processCollisionTask\n");
#endif //DEBUG_LIBSPE2_SPU_TASK
} }
else else
{ {
#ifdef DEBUG_LIBSPE2_SPU_TASK
printf("SPU: received ShutDown\n"); printf("SPU: received ShutDown\n");
#endif //DEBUG_LIBSPE2_SPU_TASK
if( btLikely( received_message == Spu_Mailbox_Event_Shutdown ) ) if( btLikely( received_message == Spu_Mailbox_Event_Shutdown ) )
{ {
shutdown = true; shutdown = true;
@@ -117,6 +127,7 @@ int main(unsigned long long speid, addr64 argp, addr64 envp)
} }
printf("SPU: shutdown\n"); printf("SPU: shutdown\n");
return 0; return 0;
} }

View File

@@ -93,6 +93,8 @@ public:
void * SamplelsMemoryFunc(); void * SamplelsMemoryFunc();
void SampleThreadFunc(void* userPtr,void* lsMemory); void SampleThreadFunc(void* userPtr,void* lsMemory);
//#define DEBUG_LIBSPE2_MAINLOOP
int main(unsigned long long speid, addr64 argp, addr64 envp) int main(unsigned long long speid, addr64 argp, addr64 envp)
{ {
printf("SPU is up \n"); printf("SPU is up \n");
@@ -125,7 +127,9 @@ int main(unsigned long long speid, addr64 argp, addr64 envp)
break; break;
case Spu_Mailbox_Event_Task: case Spu_Mailbox_Event_Task:
// refresh the status // refresh the status
#ifdef DEBUG_LIBSPE2_MAINLOOP
printf("SPU recieved Task \n"); printf("SPU recieved Task \n");
#endif //DEBUG_LIBSPE2_MAINLOOP
cellDmaGet(&status, argp.ull, sizeof(btSpuStatus), DMA_TAG(3), 0, 0); cellDmaGet(&status, argp.ull, sizeof(btSpuStatus), DMA_TAG(3), 0, 0);
cellDmaWaitTagStatusAll(DMA_MASK(3)); cellDmaWaitTagStatusAll(DMA_MASK(3));