b3FillCL.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. b3Int4 m_data;
  19. b3UnsignedInt4 m_UnsignedData;
  20. };
  21. int m_offset;
  22. int m_n;
  23. int m_padding[2];
  24. };
  25. protected:
  26. public:
  27. b3FillCL(cl_context ctx, cl_device_id device, cl_command_queue queue);
  28. virtual ~b3FillCL();
  29. void execute(b3OpenCLArray<unsigned int>& src, const unsigned int value, int n, int offset = 0);
  30. void execute(b3OpenCLArray<int>& src, const int value, int n, int offset = 0);
  31. void execute(b3OpenCLArray<float>& src, const float value, int n, int offset = 0);
  32. void execute(b3OpenCLArray<b3Int2>& src, const b3Int2& value, int n, int offset = 0);
  33. void executeHost(b3AlignedObjectArray<b3Int2>& src, const b3Int2& value, int n, int offset);
  34. void executeHost(b3AlignedObjectArray<int>& src, const int value, int n, int offset);
  35. // void execute(b3OpenCLArray<b3Int4>& src, const b3Int4& value, int n, int offset = 0);
  36. };
  37. #endif //B3_FILL_CL_H