b3GpuPgsContactSolver.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #ifndef B3_GPU_BATCHING_PGS_SOLVER_H
  2. #define B3_GPU_BATCHING_PGS_SOLVER_H
  3. #include "Bullet3OpenCL/Initialize/b3OpenCLInclude.h"
  4. #include "Bullet3OpenCL/ParallelPrimitives/b3OpenCLArray.h"
  5. #include "Bullet3Collision/NarrowPhaseCollision/shared/b3RigidBodyData.h"
  6. #include "Bullet3Collision/NarrowPhaseCollision/b3Contact4.h"
  7. #include "b3GpuConstraint4.h"
  8. class b3GpuPgsContactSolver
  9. {
  10. protected:
  11. int m_debugOutput;
  12. struct b3GpuBatchingPgsSolverInternalData* m_data;
  13. void batchContacts(b3OpenCLArray<b3Contact4>* contacts, int nContacts, b3OpenCLArray<unsigned int>* n, b3OpenCLArray<unsigned int>* offsets, int staticIdx);
  14. inline int sortConstraintByBatch(b3Contact4* cs, int n, int simdWidth, int staticIdx, int numBodies);
  15. inline int sortConstraintByBatch2(b3Contact4* cs, int n, int simdWidth, int staticIdx, int numBodies);
  16. inline int sortConstraintByBatch3(b3Contact4* cs, int n, int simdWidth, int staticIdx, int numBodies, int* batchSizes);
  17. void solveContactConstraintBatchSizes(const b3OpenCLArray<b3RigidBodyData>* bodyBuf, const b3OpenCLArray<b3InertiaData>* shapeBuf,
  18. b3OpenCLArray<b3GpuConstraint4>* constraint, void* additionalData, int n, int maxNumBatches, int numIterations, const b3AlignedObjectArray<int>* batchSizes); //const b3OpenCLArray<int>* gpuBatchSizes);
  19. void solveContactConstraint(const b3OpenCLArray<b3RigidBodyData>* bodyBuf, const b3OpenCLArray<b3InertiaData>* shapeBuf,
  20. b3OpenCLArray<b3GpuConstraint4>* constraint, void* additionalData, int n, int maxNumBatches, int numIterations, const b3AlignedObjectArray<int>* batchSizes); //const b3OpenCLArray<int>* gpuBatchSizes);
  21. public:
  22. b3GpuPgsContactSolver(cl_context ctx, cl_device_id device, cl_command_queue q, int pairCapacity);
  23. virtual ~b3GpuPgsContactSolver();
  24. void solveContacts(int numBodies, cl_mem bodyBuf, cl_mem inertiaBuf, int numContacts, cl_mem contactBuf, const struct b3Config& config, int static0Index);
  25. };
  26. #endif //B3_GPU_BATCHING_PGS_SOLVER_H