Added libspe2 parallel Cell SPE support contribution by IBM Germany 'Extreme Blue' project:
Thanks to Benjamin Hoeferlin, Minh Cuong Tran,Martina Huellmann,Frederick Roth.
This commit is contained in:
@@ -6,6 +6,13 @@
|
||||
///This file provides some platform/compiler checks for common definitions
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
typedef union
|
||||
{
|
||||
unsigned int u;
|
||||
void *p;
|
||||
} addr64;
|
||||
|
||||
#if defined(__MINGW32__) || defined(__CYGWIN__) || (defined (_MSC_VER) && _MSC_VER < 1300)
|
||||
#else
|
||||
#endif //__MINGW32__
|
||||
@@ -22,23 +29,44 @@
|
||||
|
||||
#define USE_WIN32_THREADING 1
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#define spu_printf printf
|
||||
|
||||
#else
|
||||
#if defined (__CELLOS_LV2__)
|
||||
///Playstation 3 Cell SDK
|
||||
#include <spu_printf.h>
|
||||
#else
|
||||
//non-windows systems
|
||||
|
||||
#define USE_PTHREADS 1
|
||||
|
||||
|
||||
#endif //__CELLOS_LV2__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h> //for memcpy
|
||||
|
||||
#if defined (__CELLOS_LV2__)
|
||||
// Playstation 3 Cell SDK
|
||||
#include <spu_printf.h>
|
||||
|
||||
#else
|
||||
// posix system
|
||||
|
||||
#define USE_PTHREADS
|
||||
|
||||
#ifdef USE_LIBSPE2
|
||||
#include <stdio.h>
|
||||
#define spu_printf printf
|
||||
#define DWORD unsigned int
|
||||
|
||||
typedef union
|
||||
{
|
||||
unsigned long long ull;
|
||||
unsigned int ui[2];
|
||||
void *p;
|
||||
} addr64;
|
||||
|
||||
|
||||
#endif // USE_LIBSPE2
|
||||
|
||||
#endif //__CELLOS_LV2__
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif //TYPE_DEFINITIONS_H
|
||||
|
||||
|
||||
|
||||
@@ -16,23 +16,10 @@ subject to the following restrictions:
|
||||
|
||||
//#define DEBUG_SPU_TASK_SCHEDULING 1
|
||||
|
||||
#include "btThreadSupportInterface.h"
|
||||
|
||||
//#include "SPUAssert.h"
|
||||
#include <string.h>
|
||||
|
||||
//class OptimizedBvhNode;
|
||||
|
||||
#include "SpuCollisionTaskProcess.h"
|
||||
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
|
||||
#include "BulletCollision/CollisionShapes/btCollisionShape.h"
|
||||
#include "BulletCollision/CollisionShapes/btConvexShape.h"
|
||||
#include "SpuLibspe2Support.h"
|
||||
#include "SpuNarrowPhaseCollisionTask/SpuGatheringCollisionTask.h" // for definitions processCollisionTask and createCollisionLocalStoreMemory
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -44,7 +31,6 @@ SpuCollisionTaskProcess::SpuCollisionTaskProcess(class btThreadSupportInterface*
|
||||
m_maxNumOutstandingTasks(maxNumOutstandingTasks)
|
||||
{
|
||||
m_workUnitTaskBuffers = (unsigned char *)0;
|
||||
|
||||
m_taskBusy.resize(m_maxNumOutstandingTasks);
|
||||
m_spuGatherTaskDesc.resize(m_maxNumOutstandingTasks);
|
||||
|
||||
@@ -70,9 +56,10 @@ m_maxNumOutstandingTasks(maxNumOutstandingTasks)
|
||||
|
||||
SpuCollisionTaskProcess::~SpuCollisionTaskProcess()
|
||||
{
|
||||
|
||||
if (m_workUnitTaskBuffers != 0)
|
||||
{
|
||||
free(m_workUnitTaskBuffers);
|
||||
btAlignedFree(m_workUnitTaskBuffers);
|
||||
m_workUnitTaskBuffers = 0;
|
||||
}
|
||||
|
||||
@@ -84,15 +71,15 @@ SpuCollisionTaskProcess::~SpuCollisionTaskProcess()
|
||||
|
||||
|
||||
|
||||
void
|
||||
SpuCollisionTaskProcess::initialize2()
|
||||
void SpuCollisionTaskProcess::initialize2()
|
||||
{
|
||||
|
||||
#ifdef DEBUG_SPU_TASK_SCHEDULING
|
||||
printf("SpuCollisionTaskProcess::initialize()\n");
|
||||
#endif //DEBUG_SPU_TASK_SCHEDULING
|
||||
if (!m_workUnitTaskBuffers)
|
||||
{
|
||||
m_workUnitTaskBuffers = (unsigned char *)memalign(128, MIDPHASE_WORKUNIT_TASK_SIZE*m_maxNumOutstandingTasks);
|
||||
m_workUnitTaskBuffers = (unsigned char *)btAlignedAlloc(MIDPHASE_WORKUNIT_TASK_SIZE*m_maxNumOutstandingTasks, 128);
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_maxNumOutstandingTasks; i++)
|
||||
@@ -114,10 +101,8 @@ SpuCollisionTaskProcess::initialize2()
|
||||
void SpuCollisionTaskProcess::issueTask2()
|
||||
{
|
||||
|
||||
|
||||
|
||||
#ifdef DEBUG_SPU_TASK_SCHEDULING
|
||||
printf("SpuCollisionTaskProcess::issueTask (m_currentTask= %d\)n", m_currentTask);
|
||||
printf("SpuCollisionTaskProcess::issueTask (m_currentTask= %d\n)", m_currentTask);
|
||||
#endif //DEBUG_SPU_TASK_SCHEDULING
|
||||
|
||||
m_taskBusy[m_currentTask] = true;
|
||||
|
||||
@@ -22,8 +22,25 @@ subject to the following restrictions:
|
||||
|
||||
#include "PlatformDefinitions.h"
|
||||
#include "LinearMath/btAlignedObjectArray.h"
|
||||
#include "SpuNarrowPhaseCollisionTask/SpuGatheringCollisionTask.h" // for definitions processCollisionTask and createCollisionLocalStoreMemory
|
||||
|
||||
//#define DEBUG_SpuCollisionTaskProcess 1
|
||||
#include "btThreadSupportInterface.h"
|
||||
|
||||
|
||||
//#include "SPUAssert.h"
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
|
||||
#include "BulletCollision/CollisionShapes/btCollisionShape.h"
|
||||
#include "BulletCollision/CollisionShapes/btConvexShape.h"
|
||||
|
||||
#include <LinearMath/btAlignedAllocator.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
#define DEBUG_SpuCollisionTaskProcess 1
|
||||
|
||||
|
||||
#define CMD_GATHER_AND_PROCESS_PAIRLIST 1
|
||||
@@ -33,26 +50,27 @@ class btPersistentManifold;
|
||||
class btDispatcher;
|
||||
|
||||
|
||||
///Task Description for SPU collision detection
|
||||
struct SpuGatherAndProcessPairsTaskDesc
|
||||
{
|
||||
uint64_t inPtr;//m_pairArrayPtr;
|
||||
//mutex variable
|
||||
uint32_t m_someMutexVariableInMainMemory;
|
||||
|
||||
uint64_t m_dispatcher;
|
||||
|
||||
uint32_t numOnLastPage;
|
||||
|
||||
uint16_t numPages;
|
||||
uint16_t taskId;
|
||||
|
||||
/////Task Description for SPU collision detection
|
||||
//struct SpuGatherAndProcessPairsTaskDesc
|
||||
//{
|
||||
// uint64_t inPtr;//m_pairArrayPtr;
|
||||
// //mutex variable
|
||||
// uint32_t m_someMutexVariableInMainMemory;
|
||||
//
|
||||
// uint64_t m_dispatcher;
|
||||
//
|
||||
// uint32_t numOnLastPage;
|
||||
//
|
||||
// uint16_t numPages;
|
||||
// uint16_t taskId;
|
||||
//
|
||||
// struct CollisionTask_LocalStoreMemory* m_lsMemory;
|
||||
}
|
||||
#ifdef __CELLOS_LV2__
|
||||
__attribute__ ((aligned (16)))
|
||||
#endif
|
||||
;
|
||||
//}
|
||||
//
|
||||
//#if defined(__CELLOS_LV2__) || defined(USE_LIBSPE2)
|
||||
//__attribute__ ((aligned (16)))
|
||||
//#endif
|
||||
//;
|
||||
|
||||
|
||||
///MidphaseWorkUnitInput stores individual primitive versus mesh collision detection input, to be processed by the SPU.
|
||||
|
||||
Reference in New Issue
Block a user