Fixes to allow compilation of BulletMultiThreaded under 64bit linux
This commit is contained in:
@@ -170,7 +170,7 @@ ATTRIBUTE_ALIGNED16(struct) btBroadphasePair
|
|||||||
m_pProxy0(0),
|
m_pProxy0(0),
|
||||||
m_pProxy1(0),
|
m_pProxy1(0),
|
||||||
m_algorithm(0),
|
m_algorithm(0),
|
||||||
m_userInfo(0)
|
m_internalInfo1(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,7 +180,7 @@ BT_DECLARE_ALIGNED_ALLOCATOR();
|
|||||||
: m_pProxy0(other.m_pProxy0),
|
: m_pProxy0(other.m_pProxy0),
|
||||||
m_pProxy1(other.m_pProxy1),
|
m_pProxy1(other.m_pProxy1),
|
||||||
m_algorithm(other.m_algorithm),
|
m_algorithm(other.m_algorithm),
|
||||||
m_userInfo(other.m_userInfo)
|
m_internalInfo1(other.m_internalInfo1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
btBroadphasePair(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1)
|
btBroadphasePair(btBroadphaseProxy& proxy0,btBroadphaseProxy& proxy1)
|
||||||
@@ -199,7 +199,7 @@ BT_DECLARE_ALIGNED_ALLOCATOR();
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_algorithm = 0;
|
m_algorithm = 0;
|
||||||
m_userInfo = 0;
|
m_internalInfo1 = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,7 +207,7 @@ BT_DECLARE_ALIGNED_ALLOCATOR();
|
|||||||
btBroadphaseProxy* m_pProxy1;
|
btBroadphaseProxy* m_pProxy1;
|
||||||
|
|
||||||
mutable btCollisionAlgorithm* m_algorithm;
|
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.
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ btBroadphasePair* btHashedOverlappingPairCache::internalAddPair(btBroadphaseProx
|
|||||||
// pair->m_pProxy0 = proxy0;
|
// pair->m_pProxy0 = proxy0;
|
||||||
// pair->m_pProxy1 = proxy1;
|
// pair->m_pProxy1 = proxy1;
|
||||||
pair->m_algorithm = 0;
|
pair->m_algorithm = 0;
|
||||||
pair->m_userInfo = 0;
|
pair->m_internalTmpValue = 0;
|
||||||
|
|
||||||
|
|
||||||
m_next[count] = m_hashTable[hash];
|
m_next[count] = m_hashTable[hash];
|
||||||
@@ -287,7 +287,7 @@ void* btHashedOverlappingPairCache::removeOverlappingPair(btBroadphaseProxy* pro
|
|||||||
|
|
||||||
cleanOverlappingPair(*pair,dispatcher);
|
cleanOverlappingPair(*pair,dispatcher);
|
||||||
|
|
||||||
void* userData = pair->m_userInfo;
|
void* userData = pair->m_internalInfo1;
|
||||||
|
|
||||||
btAssert(pair->m_pProxy0->getUid() == proxyId1);
|
btAssert(pair->m_pProxy0->getUid() == proxyId1);
|
||||||
btAssert(pair->m_pProxy1->getUid() == proxyId2);
|
btAssert(pair->m_pProxy1->getUid() == proxyId2);
|
||||||
@@ -405,7 +405,7 @@ void* btSortedOverlappingPairCache::removeOverlappingPair(btBroadphaseProxy* pro
|
|||||||
{
|
{
|
||||||
gOverlappingPairs--;
|
gOverlappingPairs--;
|
||||||
btBroadphasePair& pair = m_overlappingPairArray[findIndex];
|
btBroadphasePair& pair = m_overlappingPairArray[findIndex];
|
||||||
void* userData = pair.m_userInfo;
|
void* userData = pair.m_internalInfo1;
|
||||||
cleanOverlappingPair(pair,dispatcher);
|
cleanOverlappingPair(pair,dispatcher);
|
||||||
if (m_ghostPairCallback)
|
if (m_ghostPairCallback)
|
||||||
m_ghostPairCallback->removeOverlappingPair(proxy0, proxy1,dispatcher);
|
m_ghostPairCallback->removeOverlappingPair(proxy0, proxy1,dispatcher);
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ static void *threadFunction(void *argument)
|
|||||||
}
|
}
|
||||||
|
|
||||||
///send messages to SPUs
|
///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);
|
/// gMidphaseSPU.sendRequest(CMD_GATHER_AND_PROCESS_PAIRLIST, (uint32_t) &taskDesc);
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
///send messages to SPUs
|
///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
|
///check for messages from SPUs
|
||||||
virtual void waitForResponse(unsigned int *puiArgument0, unsigned int *puiArgument1);
|
virtual void waitForResponse(unsigned int *puiArgument0, unsigned int *puiArgument1);
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ SequentialThreadSupport::~SequentialThreadSupport()
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
///send messages to SPUs
|
///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)
|
switch (uiCommand)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public:
|
|||||||
virtual ~SequentialThreadSupport();
|
virtual ~SequentialThreadSupport();
|
||||||
void startThreads(SequentialThreadConstructionInfo& threadInfo);
|
void startThreads(SequentialThreadConstructionInfo& threadInfo);
|
||||||
///send messages to SPUs
|
///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
|
///check for messages from SPUs
|
||||||
virtual void waitForResponse(unsigned int *puiArgument0, unsigned int *puiArgument1);
|
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)
|
///start the spus (can be called at the beginning of each frame, to make sure that the right SPU program is loaded)
|
||||||
|
|||||||
@@ -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.
|
// if all tasks busy, wait for spu event to clear the task.
|
||||||
|
|
||||||
|
|||||||
@@ -106,9 +106,9 @@ public:
|
|||||||
//by default, Bullet will use this near callback
|
//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)
|
///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)
|
if (!collisionPair.m_algorithm)
|
||||||
{
|
{
|
||||||
@@ -132,11 +132,11 @@ public:
|
|||||||
void* mem = m_dispatcher->allocateCollisionAlgorithm(so);
|
void* mem = m_dispatcher->allocateCollisionAlgorithm(so);
|
||||||
#endif
|
#endif
|
||||||
collisionPair.m_algorithm = new(mem) SpuContactManifoldCollisionAlgorithm(ci,colObj0,colObj1);
|
collisionPair.m_algorithm = new(mem) SpuContactManifoldCollisionAlgorithm(ci,colObj0,colObj1);
|
||||||
collisionPair.m_userInfo = (void*) 2;
|
collisionPair.m_internalTmpValue = 2;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
collisionPair.m_algorithm = m_dispatcher->findAlgorithm(colObj0,colObj1);
|
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++)
|
for (i=0;i<numTotalPairs;i++)
|
||||||
{
|
{
|
||||||
btBroadphasePair& collisionPair = pairPtr[i];
|
btBroadphasePair& collisionPair = pairPtr[i];
|
||||||
if (collisionPair.m_userInfo == (void*)3)
|
if (collisionPair.m_internalTmpValue == 3)
|
||||||
{
|
{
|
||||||
if (collisionPair.m_algorithm)
|
if (collisionPair.m_algorithm)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ 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();
|
||||||
uint64_t mmAddr = (uint32_t)mmManifold;
|
ppu_address_t mmAddr = (ppu_address_t)mmManifold;
|
||||||
g_manifoldDmaExport.backBufferDmaPut(mmAddr, sizeof(btPersistentManifold), DMA_TAG(9));
|
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
|
||||||
|
|||||||
@@ -842,7 +842,6 @@ void processCollisionTask(void* userPtr, void* lsMemPtr)
|
|||||||
register ppu_address_t dmaPpuAddress;
|
register ppu_address_t dmaPpuAddress;
|
||||||
register ppu_address_t dmaPpuAddress2;
|
register ppu_address_t dmaPpuAddress2;
|
||||||
|
|
||||||
int userInfo;
|
|
||||||
int numPairs;
|
int numPairs;
|
||||||
register int p;
|
register int p;
|
||||||
SpuCollisionPairInput collisionPairInput;
|
SpuCollisionPairInput collisionPairInput;
|
||||||
@@ -902,9 +901,7 @@ void processCollisionTask(void* userPtr, void* lsMemPtr)
|
|||||||
spu_printf("pair->m_pProxy1 = %d\n",pair.m_pProxy1);
|
spu_printf("pair->m_pProxy1 = %d\n",pair.m_pProxy1);
|
||||||
#endif //DEBUG_SPU_COLLISION_DETECTION
|
#endif //DEBUG_SPU_COLLISION_DETECTION
|
||||||
|
|
||||||
userInfo = int(pair.m_userInfo);
|
if (pair.m_internalTmpValue == 2 && pair.m_algorithm && pair.m_pProxy0 && pair.m_pProxy1)
|
||||||
|
|
||||||
if (userInfo == 2 && pair.m_algorithm && pair.m_pProxy0 && pair.m_pProxy1)
|
|
||||||
{
|
{
|
||||||
dmaSize = sizeof(SpuContactManifoldCollisionAlgorithm);
|
dmaSize = sizeof(SpuContactManifoldCollisionAlgorithm);
|
||||||
dmaPpuAddress2 = (ppu_address_t)pair.m_algorithm;
|
dmaPpuAddress2 = (ppu_address_t)pair.m_algorithm;
|
||||||
|
|||||||
@@ -578,7 +578,7 @@ void SolverTaskScheduler::issueTask()
|
|||||||
|
|
||||||
SpuSolverTaskDesc& desc = m_taskDescriptors[m_currentTask];
|
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()
|
void SolverTaskScheduler::flushTasks()
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ void SpuRaycastTaskProcess::issueTask2()
|
|||||||
SpuRaycastTaskDesc& taskDesc = m_spuRaycastTaskDesc[m_currentTask];
|
SpuRaycastTaskDesc& taskDesc = m_spuRaycastTaskDesc[m_currentTask];
|
||||||
|
|
||||||
taskDesc.taskId = 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);
|
//printf("send thread requested for task %d\n", m_currentTask);
|
||||||
// if all tasks busy, wait for spu event to clear the task.
|
// if all tasks busy, wait for spu event to clear the task.
|
||||||
if (m_numBusyTasks >= m_maxNumOutstandingTasks)
|
if (m_numBusyTasks >= m_maxNumOutstandingTasks)
|
||||||
|
|||||||
@@ -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.
|
// if all tasks busy, wait for spu event to clear the task.
|
||||||
|
|
||||||
|
|||||||
@@ -81,9 +81,9 @@ DWORD WINAPI Thread_no_1( LPVOID lpParam )
|
|||||||
}
|
}
|
||||||
|
|
||||||
///send messages to SPUs
|
///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
|
///we should spawn an SPU task here, and in 'waitForResponse' it should wait for response of the (one of) the first tasks that finished
|
||||||
|
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
///send messages to SPUs
|
///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
|
///check for messages from SPUs
|
||||||
virtual void waitForResponse(unsigned int *puiArgument0, unsigned int *puiArgument1);
|
virtual void waitForResponse(unsigned int *puiArgument0, unsigned int *puiArgument1);
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ subject to the following restrictions:
|
|||||||
|
|
||||||
//#include <LinearMath/btScalar.h> //for uint32_t etc.
|
//#include <LinearMath/btScalar.h> //for uint32_t etc.
|
||||||
#include "PlatformDefinitions.h"
|
#include "PlatformDefinitions.h"
|
||||||
|
#include "PpuAddressSpace.h"
|
||||||
|
|
||||||
class btThreadSupportInterface
|
class btThreadSupportInterface
|
||||||
{
|
{
|
||||||
@@ -27,7 +28,7 @@ public:
|
|||||||
virtual ~btThreadSupportInterface();
|
virtual ~btThreadSupportInterface();
|
||||||
|
|
||||||
///send messages to SPUs
|
///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
|
///check for messages from SPUs
|
||||||
virtual void waitForResponse(unsigned int *puiArgument0, unsigned int *puiArgument1) =0;
|
virtual void waitForResponse(unsigned int *puiArgument0, unsigned int *puiArgument1) =0;
|
||||||
|
|||||||
Reference in New Issue
Block a user