b3FillCL.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #ifndef B3_FILL_CL_H
  2. #define B3_FILL_CL_H
  3. #include "b3OpenCLArray.h"
  4. #include "Bullet3Common/b3Scalar.h"
  5. #include "Bullet3Common/shared/b3Int2.h"
  6. #include "Bullet3Common/shared/b3Int4.h"
  7. class b3FillCL
  8. {
  9. cl_command_queue m_commandQueue;
  10. cl_kernel m_fillKernelInt2;
  11. cl_kernel m_fillIntKernel;
  12. cl_kernel m_fillUnsignedIntKernel;
  13. cl_kernel m_fillFloatKernel;
  14. public:
  15. struct b3ConstData
  16. {
  17. union
  18. {
  19. b3Int4 m_data;
  20. b3UnsignedInt4 m_UnsignedData;
  21. };
  22. int m_offset;
  23. int m_n;
  24. int m_padding[2];
  25. };
  26. protected:
  27. public:
  28. b3FillCL(cl_context ctx, cl_device_id device, cl_command_queue queue);
  29. virtual ~b3FillCL();
  30. void execute(b3OpenCLArray<unsigned int>& src, const unsigned int value, int n, int offset = 0);
  31. void execute(b3OpenCLArray<int>& src, const int value, int n, int offset = 0);
  32. void execute(b3OpenCLArray<float>& src, const float value, int n, int offset = 0);
  33. void execute(b3OpenCLArray<b3Int2>& src, const b3Int2& value, int n, int offset = 0);
  34. void executeHost(b3AlignedObjectArray<b3Int2> &src, const b3Int2 &value, int n, int offset);
  35. void executeHost(b3AlignedObjectArray<int> &src, const int value, int n, int offset);
  36. // void execute(b3OpenCLArray<b3Int4>& src, const b3Int4& value, int n, int offset = 0);
  37. };
  38. #endif //B3_FILL_CL_H