SpuGatheringCollisionDispatcher.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. Bullet Continuous Collision Detection and Physics Library
  3. Copyright (c) 2003-2007 Erwin Coumans http://bulletphysics.com
  4. This software is provided 'as-is', without any express or implied warranty.
  5. In no event will the authors be held liable for any damages arising from the use of this software.
  6. Permission is granted to anyone to use this software for any purpose,
  7. including commercial applications, and to alter it and redistribute it freely,
  8. subject to the following restrictions:
  9. 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.
  10. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
  11. 3. This notice may not be removed or altered from any source distribution.
  12. */
  13. #ifndef BT_SPU_GATHERING_COLLISION__DISPATCHER_H
  14. #define BT_SPU_GATHERING_COLLISION__DISPATCHER_H
  15. #include "bullet/BulletCollision//CollisionDispatch/btCollisionDispatcher.h"
  16. ///Tuning value to optimized SPU utilization
  17. ///Too small value means Task overhead is large compared to computation (too fine granularity)
  18. ///Too big value might render some SPUs are idle, while a few other SPUs are doing all work.
  19. //#define SPU_BATCHSIZE_BROADPHASE_PAIRS 8
  20. //#define SPU_BATCHSIZE_BROADPHASE_PAIRS 16
  21. //#define SPU_BATCHSIZE_BROADPHASE_PAIRS 64
  22. #define SPU_BATCHSIZE_BROADPHASE_PAIRS 128
  23. //#define SPU_BATCHSIZE_BROADPHASE_PAIRS 256
  24. //#define SPU_BATCHSIZE_BROADPHASE_PAIRS 512
  25. //#define SPU_BATCHSIZE_BROADPHASE_PAIRS 1024
  26. class SpuCollisionTaskProcess;
  27. ///SpuGatheringCollisionDispatcher can use SPU to gather and calculate collision detection
  28. ///Time of Impact, Closest Points and Penetration Depth.
  29. class SpuGatheringCollisionDispatcher : public btCollisionDispatcher
  30. {
  31. SpuCollisionTaskProcess* m_spuCollisionTaskProcess;
  32. protected:
  33. class btThreadSupportInterface* m_threadInterface;
  34. unsigned int m_maxNumOutstandingTasks;
  35. public:
  36. //can be used by SPU collision algorithms
  37. SpuCollisionTaskProcess* getSpuCollisionTaskProcess()
  38. {
  39. return m_spuCollisionTaskProcess;
  40. }
  41. SpuGatheringCollisionDispatcher (class btThreadSupportInterface* threadInterface, unsigned int maxNumOutstandingTasks,btCollisionConfiguration* collisionConfiguration);
  42. virtual ~SpuGatheringCollisionDispatcher();
  43. bool supportsDispatchPairOnSpu(int proxyType0,int proxyType1);
  44. virtual void dispatchAllCollisionPairs(btOverlappingPairCache* pairCache,const btDispatcherInfo& dispatchInfo,btDispatcher* dispatcher) ;
  45. };
  46. #endif //BT_SPU_GATHERING_COLLISION__DISPATCHER_H