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 | #ifndef SPU_GATHERING_COLLISION__DISPATCHER_H |
---|
16 | #define SPU_GATHERING_COLLISION__DISPATCHER_H |
---|
17 | |
---|
18 | #include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h" |
---|
19 | |
---|
20 | |
---|
21 | ///Tuning value to optimized SPU utilization |
---|
22 | ///Too small value means Task overhead is large compared to computation (too fine granularity) |
---|
23 | ///Too big value might render some SPUs are idle, while a few other SPUs are doing all work. |
---|
24 | #define SPU_BATCHSIZE_BROADPHASE_PAIRS 16 |
---|
25 | //#define SPU_BATCHSIZE_BROADPHASE_PAIRS 256 |
---|
26 | |
---|
27 | |
---|
28 | class SpuCollisionTaskProcess; |
---|
29 | |
---|
30 | ///SpuGatheringCollisionDispatcher can use SPU to gather and calculate collision detection |
---|
31 | ///Time of Impact, Closest Points and Penetration Depth. |
---|
32 | class SpuGatheringCollisionDispatcher : public btCollisionDispatcher |
---|
33 | { |
---|
34 | |
---|
35 | SpuCollisionTaskProcess* m_spuCollisionTaskProcess; |
---|
36 | |
---|
37 | protected: |
---|
38 | |
---|
39 | class btThreadSupportInterface* m_threadInterface; |
---|
40 | |
---|
41 | unsigned int m_maxNumOutstandingTasks; |
---|
42 | |
---|
43 | |
---|
44 | public: |
---|
45 | |
---|
46 | //can be used by SPU collision algorithms |
---|
47 | SpuCollisionTaskProcess* getSpuCollisionTaskProcess() |
---|
48 | { |
---|
49 | return m_spuCollisionTaskProcess; |
---|
50 | } |
---|
51 | |
---|
52 | SpuGatheringCollisionDispatcher (class btThreadSupportInterface* threadInterface, unsigned int maxNumOutstandingTasks,btCollisionConfiguration* collisionConfiguration); |
---|
53 | |
---|
54 | virtual ~SpuGatheringCollisionDispatcher(); |
---|
55 | |
---|
56 | bool supportsDispatchPairOnSpu(int proxyType0,int proxyType1); |
---|
57 | |
---|
58 | virtual void dispatchAllCollisionPairs(btOverlappingPairCache* pairCache,const btDispatcherInfo& dispatchInfo,btDispatcher* dispatcher) ; |
---|
59 | |
---|
60 | }; |
---|
61 | |
---|
62 | |
---|
63 | |
---|
64 | #endif //SPU_GATHERING_COLLISION__DISPATCHER_H |
---|