Move some code from Branches/OpenCL to trunk, related to threading and OpenCL:
Added Demos/ThreadingDemo showing how to use the cross-platform btThreadSupportInterface under Windows. Added Demos/ParticlesOpenCL showing how to run the NVidia particle demo under OpenCL implementations by AMD, NVidia and MiniCL (CPU)
This commit is contained in:
@@ -17,10 +17,35 @@ subject to the following restrictions:
|
||||
#define THREAD_SUPPORT_INTERFACE_H
|
||||
|
||||
|
||||
//#include <LinearMath/btScalar.h> //for uint32_t etc.
|
||||
#include <LinearMath/btScalar.h> //for ATTRIBUTE_ALIGNED16
|
||||
#include "PlatformDefinitions.h"
|
||||
#include "PpuAddressSpace.h"
|
||||
|
||||
class btBarrier {
|
||||
public:
|
||||
btBarrier() {}
|
||||
virtual ~btBarrier() {}
|
||||
|
||||
virtual void sync() = 0;
|
||||
virtual void setMaxCount(int n) = 0;
|
||||
virtual int getMaxCount() = 0;
|
||||
};
|
||||
|
||||
class btCriticalSection {
|
||||
public:
|
||||
btCriticalSection() {}
|
||||
virtual ~btCriticalSection() {}
|
||||
|
||||
ATTRIBUTE_ALIGNED16(unsigned int mCommonBuff[32]);
|
||||
|
||||
virtual unsigned int getSharedParam(int i) = 0;
|
||||
virtual void setSharedParam(int i,unsigned int p) = 0;
|
||||
|
||||
virtual void lock() = 0;
|
||||
virtual void unlock() = 0;
|
||||
};
|
||||
|
||||
|
||||
class btThreadSupportInterface
|
||||
{
|
||||
public:
|
||||
@@ -33,6 +58,10 @@ public:
|
||||
///check for messages from SPUs
|
||||
virtual void waitForResponse(unsigned int *puiArgument0, unsigned int *puiArgument1) =0;
|
||||
|
||||
|
||||
///non-blocking test if a task is completed. First implement all versions, and then enable this API
|
||||
///virtual bool isTaskCompleted(unsigned int *puiArgument0, unsigned int *puiArgument1, int timeOutInMilliseconds)=0;
|
||||
|
||||
///start the spus (can be called at the beginning of each frame, to make sure that the right SPU program is loaded)
|
||||
virtual void startSPU() =0;
|
||||
|
||||
@@ -44,6 +73,10 @@ public:
|
||||
|
||||
virtual int getNumTasks() const = 0;
|
||||
|
||||
virtual btBarrier* createBarrier() = 0;
|
||||
|
||||
virtual btCriticalSection* createCriticalSection() = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif //THREAD_SUPPORT_INTERFACE_H
|
||||
|
||||
Reference in New Issue
Block a user