Fixes to allow compilation of BulletMultiThreaded under 64bit linux

This commit is contained in:
erwin.coumans
2008-11-14 23:51:49 +00:00
parent 86727242a2
commit cc43193b25
16 changed files with 27 additions and 29 deletions

View File

@@ -170,7 +170,7 @@ ATTRIBUTE_ALIGNED16(struct) btBroadphasePair
m_pProxy0(0),
m_pProxy1(0),
m_algorithm(0),
m_userInfo(0)
m_internalInfo1(0)
{
}
@@ -180,7 +180,7 @@ BT_DECLARE_ALIGNED_ALLOCATOR();
: m_pProxy0(other.m_pProxy0),
m_pProxy1(other.m_pProxy1),
m_algorithm(other.m_algorithm),
m_userInfo(other.m_userInfo)
m_internalInfo1(other.m_internalInfo1)
{
}
btBroadphasePair(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1)
@@ -199,7 +199,7 @@ BT_DECLARE_ALIGNED_ALLOCATOR();
}
m_algorithm = 0;
m_userInfo = 0;
m_internalInfo1 = 0;
}
@@ -207,7 +207,7 @@ BT_DECLARE_ALIGNED_ALLOCATOR();
btBroadphaseProxy* m_pProxy1;
mutable btCollisionAlgorithm* m_algorithm;
mutable void* m_userInfo;
mutable union { void* m_internalInfo1; int m_internalTmpValue;};//don't use this data, it will be removed in future version.
};

View File

@@ -256,7 +256,7 @@ btBroadphasePair* btHashedOverlappingPairCache::internalAddPair(btBroadphaseProx
// pair->m_pProxy0 = proxy0;
// pair->m_pProxy1 = proxy1;
pair->m_algorithm = 0;
pair->m_userInfo = 0;
pair->m_internalTmpValue = 0;
m_next[count] = m_hashTable[hash];
@@ -287,7 +287,7 @@ void* btHashedOverlappingPairCache::removeOverlappingPair(btBroadphaseProxy* pro
cleanOverlappingPair(*pair,dispatcher);
void* userData = pair->m_userInfo;
void* userData = pair->m_internalInfo1;
btAssert(pair->m_pProxy0->getUid() == proxyId1);
btAssert(pair->m_pProxy1->getUid() == proxyId2);
@@ -405,7 +405,7 @@ void* btSortedOverlappingPairCache::removeOverlappingPair(btBroadphaseProxy* pro
{
gOverlappingPairs--;
btBroadphasePair& pair = m_overlappingPairArray[findIndex];
void* userData = pair.m_userInfo;
void* userData = pair.m_internalInfo1;
cleanOverlappingPair(pair,dispatcher);
if (m_ghostPairCallback)
m_ghostPairCallback->removeOverlappingPair(proxy0, proxy1,dispatcher);

View File

@@ -120,7 +120,7 @@ static void *threadFunction(void *argument)
}
///send messages to SPUs
void PosixThreadSupport::sendRequest(uint32_t uiCommand, uint32_t uiArgument0, uint32_t taskId)
void PosixThreadSupport::sendRequest(uint32_t uiCommand, ppu_address_t uiArgument0, uint32_t taskId)
{
/// gMidphaseSPU.sendRequest(CMD_GATHER_AND_PROCESS_PAIRLIST, (uint32_t) &taskDesc);

View File

@@ -100,7 +100,7 @@ public:
///send messages to SPUs
virtual void sendRequest(uint32_t uiCommand, uint32_t uiArgument0, uint32_t uiArgument1);
virtual void sendRequest(uint32_t uiCommand, ppu_address_t uiArgument0, uint32_t uiArgument1);
///check for messages from SPUs
virtual void waitForResponse(unsigned int *puiArgument0, unsigned int *puiArgument1);

View File

@@ -33,7 +33,7 @@ SequentialThreadSupport::~SequentialThreadSupport()
#include <stdio.h>
///send messages to SPUs
void SequentialThreadSupport::sendRequest(uint32_t uiCommand, uint32_t uiArgument0, uint32_t taskId)
void SequentialThreadSupport::sendRequest(uint32_t uiCommand, ppu_address_t uiArgument0, uint32_t taskId)
{
switch (uiCommand)
{

View File

@@ -71,7 +71,7 @@ public:
virtual ~SequentialThreadSupport();
void startThreads(SequentialThreadConstructionInfo& threadInfo);
///send messages to SPUs
virtual void sendRequest(uint32_t uiCommand, uint32_t uiArgument0, uint32_t uiArgument1);
virtual void sendRequest(uint32_t uiCommand, ppu_address_t uiArgument0, uint32_t uiArgument1);
///check for messages from SPUs
virtual void waitForResponse(unsigned int *puiArgument0, unsigned int *puiArgument1);
///start the spus (can be called at the beginning of each frame, to make sure that the right SPU program is loaded)

View File

@@ -128,7 +128,7 @@ void SpuCollisionTaskProcess::issueTask2()
m_threadInterface->sendRequest(CMD_GATHER_AND_PROCESS_PAIRLIST, (uint32_t) &taskDesc,m_currentTask);
m_threadInterface->sendRequest(CMD_GATHER_AND_PROCESS_PAIRLIST, (ppu_address_t) &taskDesc,m_currentTask);
// if all tasks busy, wait for spu event to clear the task.

View File

@@ -106,9 +106,9 @@ public:
//by default, Bullet will use this near callback
{
///userInfo is used to determine if the SPU has to handle this case or not (skip PPU tasks)
if (!collisionPair.m_userInfo)
if (!collisionPair.m_internalTmpValue)
{
collisionPair.m_userInfo = (void*) 1;
collisionPair.m_internalTmpValue = 1;
}
if (!collisionPair.m_algorithm)
{
@@ -132,11 +132,11 @@ public:
void* mem = m_dispatcher->allocateCollisionAlgorithm(so);
#endif
collisionPair.m_algorithm = new(mem) SpuContactManifoldCollisionAlgorithm(ci,colObj0,colObj1);
collisionPair.m_userInfo = (void*) 2;
collisionPair.m_internalTmpValue = 2;
} else
{
collisionPair.m_algorithm = m_dispatcher->findAlgorithm(colObj0,colObj1);
collisionPair.m_userInfo = (void*)3;
collisionPair.m_internalTmpValue = 3;
}
}
}
@@ -179,7 +179,7 @@ void SpuGatheringCollisionDispatcher::dispatchAllCollisionPairs(btOverlappingPai
for (i=0;i<numTotalPairs;i++)
{
btBroadphasePair& collisionPair = pairPtr[i];
if (collisionPair.m_userInfo == (void*)3)
if (collisionPair.m_internalTmpValue == 3)
{
if (collisionPair.m_algorithm)
{

View File

@@ -164,7 +164,7 @@ void SpuContactResult::writeDoubleBufferedManifold(btPersistentManifold* lsManif
memcpy(g_manifoldDmaExport.getFront(),lsManifold,sizeof(btPersistentManifold));
g_manifoldDmaExport.swapBuffers();
uint64_t mmAddr = (uint32_t)mmManifold;
ppu_address_t mmAddr = (ppu_address_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?
//no, the swapBuffers does the wait

View File

@@ -842,7 +842,6 @@ void processCollisionTask(void* userPtr, void* lsMemPtr)
register ppu_address_t dmaPpuAddress;
register ppu_address_t dmaPpuAddress2;
int userInfo;
int numPairs;
register int p;
SpuCollisionPairInput collisionPairInput;
@@ -902,9 +901,7 @@ void processCollisionTask(void* userPtr, void* lsMemPtr)
spu_printf("pair->m_pProxy1 = %d\n",pair.m_pProxy1);
#endif //DEBUG_SPU_COLLISION_DETECTION
userInfo = int(pair.m_userInfo);
if (userInfo == 2 && pair.m_algorithm && pair.m_pProxy0 && pair.m_pProxy1)
if (pair.m_internalTmpValue == 2 && pair.m_algorithm && pair.m_pProxy0 && pair.m_pProxy1)
{
dmaSize = sizeof(SpuContactManifoldCollisionAlgorithm);
dmaPpuAddress2 = (ppu_address_t)pair.m_algorithm;

View File

@@ -578,7 +578,7 @@ void SolverTaskScheduler::issueTask()
SpuSolverTaskDesc& desc = m_taskDescriptors[m_currentTask];
m_threadInterface->sendRequest(1, (uint32_t)&desc, m_currentTask);
m_threadInterface->sendRequest(1, (ppu_address_t)&desc, m_currentTask);
}
void SolverTaskScheduler::flushTasks()

View File

@@ -79,7 +79,7 @@ void SpuRaycastTaskProcess::issueTask2()
SpuRaycastTaskDesc& taskDesc = m_spuRaycastTaskDesc[m_currentTask];
taskDesc.taskId = m_currentTask;
m_threadInterface->sendRequest(1, (uint32_t) &taskDesc,m_currentTask);
m_threadInterface->sendRequest(1, (ppu_address_t) &taskDesc,m_currentTask);
//printf("send thread requested for task %d\n", m_currentTask);
// if all tasks busy, wait for spu event to clear the task.
if (m_numBusyTasks >= m_maxNumOutstandingTasks)

View File

@@ -130,7 +130,7 @@ void SpuSampleTaskProcess::issueTask(void* sampleMainMemPtr,int sampleValue,int
}
m_threadInterface->sendRequest(1, (uint32_t) &taskDesc, m_currentTask);
m_threadInterface->sendRequest(1, (ppu_address_t) &taskDesc, m_currentTask);
// if all tasks busy, wait for spu event to clear the task.

View File

@@ -81,9 +81,9 @@ DWORD WINAPI Thread_no_1( LPVOID lpParam )
}
///send messages to SPUs
void Win32ThreadSupport::sendRequest(uint32_t uiCommand, uint32_t uiArgument0, uint32_t taskId)
void Win32ThreadSupport::sendRequest(uint32_t uiCommand, ppu_address_t uiArgument0, uint32_t taskId)
{
/// gMidphaseSPU.sendRequest(CMD_GATHER_AND_PROCESS_PAIRLIST, (uint32_t) &taskDesc);
/// gMidphaseSPU.sendRequest(CMD_GATHER_AND_PROCESS_PAIRLIST, (ppu_address_t) &taskDesc);
///we should spawn an SPU task here, and in 'waitForResponse' it should wait for response of the (one of) the first tasks that finished

View File

@@ -103,7 +103,7 @@ public:
///send messages to SPUs
virtual void sendRequest(uint32_t uiCommand, uint32_t uiArgument0, uint32_t uiArgument1);
virtual void sendRequest(uint32_t uiCommand, ppu_address_t uiArgument0, uint32_t uiArgument1);
///check for messages from SPUs
virtual void waitForResponse(unsigned int *puiArgument0, unsigned int *puiArgument1);

View File

@@ -19,6 +19,7 @@ subject to the following restrictions:
//#include <LinearMath/btScalar.h> //for uint32_t etc.
#include "PlatformDefinitions.h"
#include "PpuAddressSpace.h"
class btThreadSupportInterface
{
@@ -27,7 +28,7 @@ public:
virtual ~btThreadSupportInterface();
///send messages to SPUs
virtual void sendRequest(uint32_t uiCommand, uint32_t uiArgument0, uint32_t uiArgument1) =0;
virtual void sendRequest(uint32_t uiCommand, ppu_address_t uiArgument0, uint32_t uiArgument1) =0;
///check for messages from SPUs
virtual void waitForResponse(unsigned int *puiArgument0, unsigned int *puiArgument1) =0;