Bullet Collision Detection & Physics Library
btThreadSupportInterface.h
Go to the documentation of this file.
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2007 Erwin Coumans http://bulletphysics.com
4 
5 This software is provided 'as-is', without any express or implied warranty.
6 In no event will the authors be held liable for any damages arising from the use of this software.
7 Permission is granted to anyone to use this software for any purpose,
8 including commercial applications, and to alter it and redistribute it freely,
9 subject to the following restrictions:
10 
11 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
12 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
13 3. This notice may not be removed or altered from any source distribution.
14 */
15 
16 #ifndef BT_THREAD_SUPPORT_INTERFACE_H
17 #define BT_THREAD_SUPPORT_INTERFACE_H
18 
19 
20 #include <LinearMath/btScalar.h> //for ATTRIBUTE_ALIGNED16
21 #include "PlatformDefinitions.h"
22 #include "PpuAddressSpace.h"
23 
24 class btBarrier {
25 public:
26  btBarrier() {}
27  virtual ~btBarrier() {}
28 
29  virtual void sync() = 0;
30  virtual void setMaxCount(int n) = 0;
31  virtual int getMaxCount() = 0;
32 };
33 
35 public:
37  virtual ~btCriticalSection() {}
38 
39  ATTRIBUTE_ALIGNED16(unsigned int mCommonBuff[32]);
40 
41  virtual unsigned int getSharedParam(int i) = 0;
42  virtual void setSharedParam(int i,unsigned int p) = 0;
43 
44  virtual void lock() = 0;
45  virtual void unlock() = 0;
46 };
47 
48 
50 {
51 public:
52 
53  virtual ~btThreadSupportInterface();
54 
56  virtual void sendRequest(uint32_t uiCommand, ppu_address_t uiArgument0, uint32_t uiArgument1) =0;
57 
59  virtual void waitForResponse(unsigned int *puiArgument0, unsigned int *puiArgument1) =0;
60 
61 
64 
66  virtual void startSPU() =0;
67 
69  virtual void stopSPU()=0;
70 
72  virtual void setNumTasks(int numTasks)=0;
73 
74  virtual int getNumTasks() const = 0;
75 
76  virtual btBarrier* createBarrier() = 0;
77 
79 
80  virtual void deleteBarrier(btBarrier* barrier)=0;
81 
82  virtual void deleteCriticalSection(btCriticalSection* criticalSection)=0;
83 
84  virtual void* getThreadLocalMemory(int taskId) { return 0; }
85 
86 };
87 
88 #endif //BT_THREAD_SUPPORT_INTERFACE_H
89 
virtual void setNumTasks(int numTasks)=0
tell the task scheduler to use no more than numTasks tasks
virtual unsigned int getSharedParam(int i)=0
virtual btBarrier * createBarrier()=0
virtual int getNumTasks() const =0
virtual void unlock()=0
virtual int getMaxCount()=0
virtual void sendRequest(uint32_t uiCommand, ppu_address_t uiArgument0, uint32_t uiArgument1)=0
send messages to SPUs
unsigned int mCommonBuff[32]
uint32_t ppu_address_t
virtual void * getThreadLocalMemory(int taskId)
virtual void sync()=0
virtual void lock()=0
virtual void deleteBarrier(btBarrier *barrier)=0
virtual void startSPU()=0
non-blocking test if a task is completed.
virtual void deleteCriticalSection(btCriticalSection *criticalSection)=0
virtual void setMaxCount(int n)=0
virtual void setSharedParam(int i, unsigned int p)=0
unsigned int uint32_t
#define ATTRIBUTE_ALIGNED16(a)
Definition: btScalar.h:59
virtual void stopSPU()=0
tell the task scheduler we are done with the SPU tasks
virtual btCriticalSection * createCriticalSection()=0
static void barrier(unsigned int a)
virtual void waitForResponse(unsigned int *puiArgument0, unsigned int *puiArgument1)=0
check for messages from SPUs