1 2 #ifndef B3_PREFIX_SCAN_CL_H 3 #define B3_PREFIX_SCAN_CL_H 4 5 #include "b3OpenCLArray.h" 6 #include "b3BufferInfoCL.h" 7 #include "Bullet3Common/b3AlignedObjectArray.h" 8 9 class b3PrefixScanCL 10 { 11 enum 12 { 13 BLOCK_SIZE = 128 14 }; 15 16 // Option m_option; 17 18 cl_command_queue m_commandQueue; 19 20 cl_kernel m_localScanKernel; 21 cl_kernel m_blockSumKernel; 22 cl_kernel m_propagationKernel; 23 24 b3OpenCLArray<unsigned int>* m_workBuffer; 25 26 public: 27 b3PrefixScanCL(cl_context ctx, cl_device_id device, cl_command_queue queue, int size = 0); 28 29 virtual ~b3PrefixScanCL(); 30 31 void execute(b3OpenCLArray<unsigned int>& src, b3OpenCLArray<unsigned int>& dst, int n, unsigned int* sum = 0); 32 void executeHost(b3AlignedObjectArray<unsigned int>& src, b3AlignedObjectArray<unsigned int>& dst, int n, unsigned int* sum = 0); 33 }; 34 35 #endif //B3_PREFIX_SCAN_CL_H 36