update bullet so it actually works

Moved the addSourceDirectory for physics/Bullet into the Engine/Source/CMakeLists.txt file that way it can actually appear where we expect it to in the solution explorer.
This commit is contained in:
marauder2k7 2026-06-03 15:08:51 +01:00
parent c7be48130a
commit 13fa178cf6
5986 changed files with 1811270 additions and 453803 deletions

View file

@ -16,108 +16,104 @@ subject to the following restrictions:
#ifndef B3_POSIX_THREAD_SUPPORT_H
#define B3_POSIX_THREAD_SUPPORT_H
#include "Bullet3Common/b3Scalar.h"
#ifndef _XOPEN_SOURCE
#define _XOPEN_SOURCE 600 //for definition of pthread_barrier_t, see http://pages.cs.wisc.edu/~travitch/pthreads_primer.html
#endif //_XOPEN_SOURCE
#define _XOPEN_SOURCE 600 //for definition of pthread_barrier_t, see http://pages.cs.wisc.edu/~travitch/pthreads_primer.html
#endif //_XOPEN_SOURCE
#include <pthread.h>
#include <semaphore.h>
#include "Bullet3Common/b3AlignedObjectArray.h"
#include "b3ThreadSupportInterface.h"
typedef void (*b3PosixThreadFunc)(void* userPtr,void* lsMemory);
typedef void (*b3PosixThreadFunc)(void* userPtr, void* lsMemory);
typedef void* (*b3PosixlsMemorySetupFunc)();
typedef void (*b3PosixlsMemoryReleaseFunc)(void* ptr);
// b3PosixThreadSupport helps to initialize/shutdown libspe2, start/stop SPU tasks and communication
class b3PosixThreadSupport : public b3ThreadSupportInterface
{
public:
typedef enum sStatus {
STATUS_BUSY,
STATUS_READY,
STATUS_FINISHED
} Status;
typedef enum sStatus
{
STATUS_BUSY,
STATUS_READY,
STATUS_FINISHED
} Status;
// placeholder, until libspe2 support is there
struct b3ThreadStatus
struct b3ThreadStatus
{
int m_taskId;
int m_commandId;
int m_status;
int m_taskId;
int m_commandId;
int m_status;
b3PosixThreadFunc m_userThreadFunc;
void* m_userPtr; //for taskDesc etc
void* m_lsMemory; //initialized using PosixLocalStoreMemorySetupFunc
b3PosixThreadFunc m_userThreadFunc;
void* m_userPtr; //for taskDesc etc
b3PosixlsMemoryReleaseFunc m_lsMemoryReleaseFunc;
pthread_t thread;
//each tread will wait until this signal to start its work
sem_t* startSemaphore;
void* m_lsMemory; //initialized using PosixLocalStoreMemorySetupFunc
// this is a copy of m_mainSemaphore,
//each tread will signal once it is finished with its work
sem_t* m_mainSemaphore;
unsigned long threadUsed;
pthread_t thread;
//each tread will wait until this signal to start its work
sem_t* startSemaphore;
// this is a copy of m_mainSemaphore,
//each tread will signal once it is finished with its work
sem_t* m_mainSemaphore;
unsigned long threadUsed;
};
private:
b3AlignedObjectArray<b3ThreadStatus> m_activeThreadStatus;
private:
b3AlignedObjectArray<b3ThreadStatus> m_activeThreadStatus;
// m_mainSemaphoresemaphore will signal, if and how many threads are finished with their work
sem_t* m_mainSemaphore;
public:
///Setup and initialize SPU/CELL/Libspe2
struct ThreadConstructionInfo
struct ThreadConstructionInfo
{
ThreadConstructionInfo(const char* uniqueName,
b3PosixThreadFunc userThreadFunc,
b3PosixlsMemorySetupFunc lsMemoryFunc,
int numThreads=1,
int threadStackSize=65535
)
:m_uniqueName(uniqueName),
m_userThreadFunc(userThreadFunc),
m_lsMemoryFunc(lsMemoryFunc),
m_numThreads(numThreads),
m_threadStackSize(threadStackSize)
b3PosixThreadFunc userThreadFunc,
b3PosixlsMemorySetupFunc lsMemoryFunc,
b3PosixlsMemoryReleaseFunc lsMemoryReleaseFunc,
int numThreads = 1,
int threadStackSize = 65535)
: m_uniqueName(uniqueName),
m_userThreadFunc(userThreadFunc),
m_lsMemoryFunc(lsMemoryFunc),
m_lsMemoryReleaseFunc(lsMemoryReleaseFunc),
m_numThreads(numThreads),
m_threadStackSize(threadStackSize)
{
}
const char* m_uniqueName;
b3PosixThreadFunc m_userThreadFunc;
b3PosixlsMemorySetupFunc m_lsMemoryFunc;
int m_numThreads;
int m_threadStackSize;
const char* m_uniqueName;
b3PosixThreadFunc m_userThreadFunc;
b3PosixlsMemorySetupFunc m_lsMemoryFunc;
b3PosixlsMemoryReleaseFunc m_lsMemoryReleaseFunc;
int m_numThreads;
int m_threadStackSize;
};
b3PosixThreadSupport(ThreadConstructionInfo& threadConstructionInfo);
///cleanup/shutdown Libspe2
virtual ~b3PosixThreadSupport();
///cleanup/shutdown Libspe2
virtual ~b3PosixThreadSupport();
void startThreads(ThreadConstructionInfo& threadInfo);
void startThreads(ThreadConstructionInfo& threadInfo);
virtual void runTask(int uiCommand, void* uiArgument0, int uiArgument1);
virtual void runTask(int uiCommand, void* uiArgument0, int uiArgument1);
virtual void waitForResponse(int* puiArgument0, int* puiArgument1);
virtual void waitForResponse(int *puiArgument0, int *puiArgument1);
///tell the task scheduler we are done with the SPU tasks
virtual void stopThreads();
///tell the task scheduler we are done with the SPU tasks
virtual void stopThreads();
virtual void setNumTasks(int numTasks) {}
@ -127,8 +123,7 @@ public:
}
///non-blocking test if a task is completed. First implement all versions, and then enable this API
virtual bool isTaskCompleted(int *puiArgument0, int *puiArgument1, int timeOutInMilliseconds);
virtual bool isTaskCompleted(int* puiArgument0, int* puiArgument1, int timeOutInMilliseconds);
virtual b3Barrier* createBarrier();
@ -138,15 +133,10 @@ public:
virtual void deleteCriticalSection(b3CriticalSection* criticalSection);
virtual void* getThreadLocalMemory(int taskId)
virtual void* getThreadLocalMemory(int taskId)
{
return m_activeThreadStatus[taskId].m_lsMemory;
}
};
#endif // B3_POSIX_THREAD_SUPPORT_H
#endif // B3_POSIX_THREAD_SUPPORT_H