ASL  0.1.7
Advanced Simulation Library
cl.hpp
Go to the documentation of this file.
1 // Supply "cl.hpp" with ASL, since it is not present in OpenCL 2.0
2 // Remove the file after switching to OpenCL 2.1
3 
4 
5 /*******************************************************************************
6  * Copyright (c) 2008-2015 The Khronos Group Inc.
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining a
9  * copy of this software and/or associated documentation files (the
10  * "Materials"), to deal in the Materials without restriction, including
11  * without limitation the rights to use, copy, modify, merge, publish,
12  * distribute, sublicense, and/or sell copies of the Materials, and to
13  * permit persons to whom the Materials are furnished to do so, subject to
14  * the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be included
17  * in all copies or substantial portions of the Materials.
18  *
19  * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
23  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25  * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
26  ******************************************************************************/
27 
50 #ifndef CL_HPP_
51 #define CL_HPP_
52 
53 #ifdef _WIN32
54 
55 #include <malloc.h>
56 
57 #if defined(USE_DX_INTEROP)
58 #include <CL/cl_d3d10.h>
59 #include <CL/cl_dx9_media_sharing.h>
60 #endif
61 #endif // _WIN32
62 
63 #if defined(_MSC_VER)
64 #include <intrin.h>
65 #endif // _MSC_VER
66 
67 //
68 #if defined(USE_CL_DEVICE_FISSION)
69 #include <CL/cl_ext.h>
70 #endif
71 
72 #if defined(__APPLE__) || defined(__MACOSX)
73 #include <OpenCL/opencl.h>
74 #else
75 #include <CL/opencl.h>
76 #endif // !__APPLE__
77 
78 #if (_MSC_VER >= 1700) || (__cplusplus >= 201103L)
79 #define CL_HPP_RVALUE_REFERENCES_SUPPORTED
80 #define CL_HPP_CPP11_ATOMICS_SUPPORTED
81 #include <atomic>
82 #endif
83 
84 #if (__cplusplus >= 201103L)
85 #define CL_HPP_NOEXCEPT noexcept
86 #else
87 #define CL_HPP_NOEXCEPT
88 #endif
89 
90 
91 // To avoid accidentally taking ownership of core OpenCL types
92 // such as cl_kernel constructors are made explicit
93 // under OpenCL 1.2
94 #if defined(CL_VERSION_1_2) && !defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
95 #define __CL_EXPLICIT_CONSTRUCTORS explicit
96 #else // #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
97 #define __CL_EXPLICIT_CONSTRUCTORS
98 #endif // #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
99 
100 // Define deprecated prefixes and suffixes to ensure compilation
101 // in case they are not pre-defined
102 #if !defined(CL_EXT_PREFIX__VERSION_1_1_DEPRECATED)
103 #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
104 #endif // #if !defined(CL_EXT_PREFIX__VERSION_1_1_DEPRECATED)
105 #if !defined(CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED)
106 #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
107 #endif // #if !defined(CL_EXT_PREFIX__VERSION_1_1_DEPRECATED)
108 
109 #if !defined(CL_CALLBACK)
110 #define CL_CALLBACK
111 #endif //CL_CALLBACK
112 
113 #include <utility>
114 #include <limits>
115 #include <iterator>
116 
117 #if defined(__CL_ENABLE_EXCEPTIONS)
118 #include <exception>
119 #endif // #if defined(__CL_ENABLE_EXCEPTIONS)
120 
121 #if !defined(__NO_STD_VECTOR)
122 #include <vector>
123 #endif
124 
125 #if !defined(__NO_STD_STRING)
126 #include <string>
127 #endif
128 
129 #if defined(__ANDROID__) || defined(linux) || defined(__APPLE__) || defined(__MACOSX)
130 #include <alloca.h>
131 #endif // linux
132 
133 #include <cstring>
134 
135 
141 namespace cl {
142 
143 class Memory;
144 
148 #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS) || (defined(CL_VERSION_1_1) && !defined(CL_VERSION_1_2))
149 #define __INIT_CL_EXT_FCN_PTR(name) \
150  if(!pfn_##name) { \
151  pfn_##name = (PFN_##name) \
152  clGetExtensionFunctionAddress(#name); \
153  if(!pfn_##name) { \
154  } \
155  }
156 #endif // #if defined(CL_VERSION_1_1)
157 
158 #if defined(CL_VERSION_1_2)
159 #define __INIT_CL_EXT_FCN_PTR_PLATFORM(platform, name) \
160  if(!pfn_##name) { \
161  pfn_##name = (PFN_##name) \
162  clGetExtensionFunctionAddressForPlatform(platform, #name); \
163  if(!pfn_##name) { \
164  } \
165  }
166 #endif // #if defined(CL_VERSION_1_1)
167 
168 class Program;
169 class Device;
170 class Context;
171 class CommandQueue;
172 class Memory;
173 class Buffer;
174 
175 #if defined(__CL_ENABLE_EXCEPTIONS)
176 
180 class Error : public std::exception
181 {
182 private:
183  cl_int err_;
184  const char * errStr_;
185 public:
195  Error(cl_int err, const char * errStr = NULL) : err_(err), errStr_(errStr)
196  {}
197 
198  ~Error() throw() {}
199 
204  virtual const char * what() const throw ()
205  {
206  if (errStr_ == NULL) {
207  return "empty";
208  }
209  else {
210  return errStr_;
211  }
212  }
213 
218  cl_int err(void) const { return err_; }
219 };
220 
221 #define __ERR_STR(x) #x
222 #else
223 #define __ERR_STR(x) NULL
224 #endif // __CL_ENABLE_EXCEPTIONS
225 
226 
227 namespace detail
228 {
229 #if defined(__CL_ENABLE_EXCEPTIONS)
230 static inline cl_int errHandler (
231  cl_int err,
232  const char * errStr = NULL)
233 {
234  if (err != CL_SUCCESS) {
235  throw Error(err, errStr);
236  }
237  return err;
238 }
239 #else
240 static inline cl_int errHandler (cl_int err, const char * errStr = NULL)
241 {
242  (void) errStr; // suppress unused variable warning
243  return err;
244 }
245 #endif // __CL_ENABLE_EXCEPTIONS
246 }
247 
248 
249 
251 #if !defined(__CL_USER_OVERRIDE_ERROR_STRINGS)
252 #define __GET_DEVICE_INFO_ERR __ERR_STR(clGetDeviceInfo)
253 #define __GET_PLATFORM_INFO_ERR __ERR_STR(clGetPlatformInfo)
254 #define __GET_DEVICE_IDS_ERR __ERR_STR(clGetDeviceIDs)
255 #define __GET_PLATFORM_IDS_ERR __ERR_STR(clGetPlatformIDs)
256 #define __GET_CONTEXT_INFO_ERR __ERR_STR(clGetContextInfo)
257 #define __GET_EVENT_INFO_ERR __ERR_STR(clGetEventInfo)
258 #define __GET_EVENT_PROFILE_INFO_ERR __ERR_STR(clGetEventProfileInfo)
259 #define __GET_MEM_OBJECT_INFO_ERR __ERR_STR(clGetMemObjectInfo)
260 #define __GET_IMAGE_INFO_ERR __ERR_STR(clGetImageInfo)
261 #define __GET_SAMPLER_INFO_ERR __ERR_STR(clGetSamplerInfo)
262 #define __GET_KERNEL_INFO_ERR __ERR_STR(clGetKernelInfo)
263 #if defined(CL_VERSION_1_2)
264 #define __GET_KERNEL_ARG_INFO_ERR __ERR_STR(clGetKernelArgInfo)
265 #endif // #if defined(CL_VERSION_1_2)
266 #define __GET_KERNEL_WORK_GROUP_INFO_ERR __ERR_STR(clGetKernelWorkGroupInfo)
267 #define __GET_PROGRAM_INFO_ERR __ERR_STR(clGetProgramInfo)
268 #define __GET_PROGRAM_BUILD_INFO_ERR __ERR_STR(clGetProgramBuildInfo)
269 #define __GET_COMMAND_QUEUE_INFO_ERR __ERR_STR(clGetCommandQueueInfo)
270 
271 #define __CREATE_CONTEXT_ERR __ERR_STR(clCreateContext)
272 #define __CREATE_CONTEXT_FROM_TYPE_ERR __ERR_STR(clCreateContextFromType)
273 #define __GET_SUPPORTED_IMAGE_FORMATS_ERR __ERR_STR(clGetSupportedImageFormats)
274 
275 #define __CREATE_BUFFER_ERR __ERR_STR(clCreateBuffer)
276 #define __COPY_ERR __ERR_STR(cl::copy)
277 #define __CREATE_SUBBUFFER_ERR __ERR_STR(clCreateSubBuffer)
278 #define __CREATE_GL_BUFFER_ERR __ERR_STR(clCreateFromGLBuffer)
279 #define __CREATE_GL_RENDER_BUFFER_ERR __ERR_STR(clCreateFromGLBuffer)
280 #define __GET_GL_OBJECT_INFO_ERR __ERR_STR(clGetGLObjectInfo)
281 #if defined(CL_VERSION_1_2)
282 #define __CREATE_IMAGE_ERR __ERR_STR(clCreateImage)
283 #define __CREATE_GL_TEXTURE_ERR __ERR_STR(clCreateFromGLTexture)
284 #define __IMAGE_DIMENSION_ERR __ERR_STR(Incorrect image dimensions)
285 #endif // #if defined(CL_VERSION_1_2)
286 #define __CREATE_SAMPLER_ERR __ERR_STR(clCreateSampler)
287 #define __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR __ERR_STR(clSetMemObjectDestructorCallback)
288 
289 #define __CREATE_USER_EVENT_ERR __ERR_STR(clCreateUserEvent)
290 #define __SET_USER_EVENT_STATUS_ERR __ERR_STR(clSetUserEventStatus)
291 #define __SET_EVENT_CALLBACK_ERR __ERR_STR(clSetEventCallback)
292 #define __WAIT_FOR_EVENTS_ERR __ERR_STR(clWaitForEvents)
293 
294 #define __CREATE_KERNEL_ERR __ERR_STR(clCreateKernel)
295 #define __SET_KERNEL_ARGS_ERR __ERR_STR(clSetKernelArg)
296 #define __CREATE_PROGRAM_WITH_SOURCE_ERR __ERR_STR(clCreateProgramWithSource)
297 #define __CREATE_PROGRAM_WITH_BINARY_ERR __ERR_STR(clCreateProgramWithBinary)
298 #if defined(CL_VERSION_1_2)
299 #define __CREATE_PROGRAM_WITH_BUILT_IN_KERNELS_ERR __ERR_STR(clCreateProgramWithBuiltInKernels)
300 #endif // #if defined(CL_VERSION_1_2)
301 #define __BUILD_PROGRAM_ERR __ERR_STR(clBuildProgram)
302 #if defined(CL_VERSION_1_2)
303 #define __COMPILE_PROGRAM_ERR __ERR_STR(clCompileProgram)
304 #define __LINK_PROGRAM_ERR __ERR_STR(clLinkProgram)
305 #endif // #if defined(CL_VERSION_1_2)
306 #define __CREATE_KERNELS_IN_PROGRAM_ERR __ERR_STR(clCreateKernelsInProgram)
307 
308 #define __CREATE_COMMAND_QUEUE_ERR __ERR_STR(clCreateCommandQueue)
309 #define __SET_COMMAND_QUEUE_PROPERTY_ERR __ERR_STR(clSetCommandQueueProperty)
310 #define __ENQUEUE_READ_BUFFER_ERR __ERR_STR(clEnqueueReadBuffer)
311 #define __ENQUEUE_READ_BUFFER_RECT_ERR __ERR_STR(clEnqueueReadBufferRect)
312 #define __ENQUEUE_WRITE_BUFFER_ERR __ERR_STR(clEnqueueWriteBuffer)
313 #define __ENQUEUE_WRITE_BUFFER_RECT_ERR __ERR_STR(clEnqueueWriteBufferRect)
314 #define __ENQEUE_COPY_BUFFER_ERR __ERR_STR(clEnqueueCopyBuffer)
315 #define __ENQEUE_COPY_BUFFER_RECT_ERR __ERR_STR(clEnqueueCopyBufferRect)
316 #define __ENQUEUE_FILL_BUFFER_ERR __ERR_STR(clEnqueueFillBuffer)
317 #define __ENQUEUE_READ_IMAGE_ERR __ERR_STR(clEnqueueReadImage)
318 #define __ENQUEUE_WRITE_IMAGE_ERR __ERR_STR(clEnqueueWriteImage)
319 #define __ENQUEUE_COPY_IMAGE_ERR __ERR_STR(clEnqueueCopyImage)
320 #define __ENQUEUE_FILL_IMAGE_ERR __ERR_STR(clEnqueueFillImage)
321 #define __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR __ERR_STR(clEnqueueCopyImageToBuffer)
322 #define __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR __ERR_STR(clEnqueueCopyBufferToImage)
323 #define __ENQUEUE_MAP_BUFFER_ERR __ERR_STR(clEnqueueMapBuffer)
324 #define __ENQUEUE_MAP_IMAGE_ERR __ERR_STR(clEnqueueMapImage)
325 #define __ENQUEUE_UNMAP_MEM_OBJECT_ERR __ERR_STR(clEnqueueUnMapMemObject)
326 #define __ENQUEUE_NDRANGE_KERNEL_ERR __ERR_STR(clEnqueueNDRangeKernel)
327 #define __ENQUEUE_TASK_ERR __ERR_STR(clEnqueueTask)
328 #define __ENQUEUE_NATIVE_KERNEL __ERR_STR(clEnqueueNativeKernel)
329 #if defined(CL_VERSION_1_2)
330 #define __ENQUEUE_MIGRATE_MEM_OBJECTS_ERR __ERR_STR(clEnqueueMigrateMemObjects)
331 #endif // #if defined(CL_VERSION_1_2)
332 
333 #define __ENQUEUE_ACQUIRE_GL_ERR __ERR_STR(clEnqueueAcquireGLObjects)
334 #define __ENQUEUE_RELEASE_GL_ERR __ERR_STR(clEnqueueReleaseGLObjects)
335 
336 
337 #define __RETAIN_ERR __ERR_STR(Retain Object)
338 #define __RELEASE_ERR __ERR_STR(Release Object)
339 #define __FLUSH_ERR __ERR_STR(clFlush)
340 #define __FINISH_ERR __ERR_STR(clFinish)
341 #define __VECTOR_CAPACITY_ERR __ERR_STR(Vector capacity error)
342 
346 #if defined(CL_VERSION_1_2)
347 #define __CREATE_SUB_DEVICES __ERR_STR(clCreateSubDevices)
348 #else
349 #define __CREATE_SUB_DEVICES __ERR_STR(clCreateSubDevicesEXT)
350 #endif // #if defined(CL_VERSION_1_2)
351 
355 #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS) || (defined(CL_VERSION_1_1) && !defined(CL_VERSION_1_2))
356 #define __ENQUEUE_MARKER_ERR __ERR_STR(clEnqueueMarker)
357 #define __ENQUEUE_WAIT_FOR_EVENTS_ERR __ERR_STR(clEnqueueWaitForEvents)
358 #define __ENQUEUE_BARRIER_ERR __ERR_STR(clEnqueueBarrier)
359 #define __UNLOAD_COMPILER_ERR __ERR_STR(clUnloadCompiler)
360 #define __CREATE_GL_TEXTURE_2D_ERR __ERR_STR(clCreateFromGLTexture2D)
361 #define __CREATE_GL_TEXTURE_3D_ERR __ERR_STR(clCreateFromGLTexture3D)
362 #define __CREATE_IMAGE2D_ERR __ERR_STR(clCreateImage2D)
363 #define __CREATE_IMAGE3D_ERR __ERR_STR(clCreateImage3D)
364 #endif // #if defined(CL_VERSION_1_1)
365 
366 #endif // __CL_USER_OVERRIDE_ERROR_STRINGS
367 
372 #if defined(CL_VERSION_1_2)
373 #define __ENQUEUE_MARKER_WAIT_LIST_ERR __ERR_STR(clEnqueueMarkerWithWaitList)
374 #define __ENQUEUE_BARRIER_WAIT_LIST_ERR __ERR_STR(clEnqueueBarrierWithWaitList)
375 #endif // #if defined(CL_VERSION_1_2)
376 
377 #if !defined(__USE_DEV_STRING) && !defined(__NO_STD_STRING)
378 typedef std::string STRING_CLASS;
379 #elif !defined(__USE_DEV_STRING)
380 
390 {
391 private:
392  ::size_t size_;
393  char * str_;
394 public:
396  string(void) : size_(0), str_(NULL)
397  {
398  }
399 
411  string(const char * str, ::size_t size) :
412  size_(size),
413  str_(NULL)
414  {
415  if( size > 0 ) {
416  str_ = new char[size_+1];
417  if (str_ != NULL) {
418  memcpy(str_, str, size_ * sizeof(char));
419  str_[size_] = '\0';
420  }
421  else {
422  size_ = 0;
423  }
424  }
425  }
426 
432  string(const char * str) :
433  size_(0),
434  str_(NULL)
435  {
436  if( str ) {
437  size_= ::strlen(str);
438  }
439  if( size_ > 0 ) {
440  str_ = new char[size_ + 1];
441  if (str_ != NULL) {
442  memcpy(str_, str, (size_ + 1) * sizeof(char));
443  }
444  }
445  }
446 
447  void resize( ::size_t n )
448  {
449  if( size_ == n ) {
450  return;
451  }
452  if (n == 0) {
453  if( str_ ) {
454  delete [] str_;
455  }
456  str_ = NULL;
457  size_ = 0;
458  }
459  else {
460  char *newString = new char[n + 1];
461  ::size_t copySize = n;
462  if( size_ < n ) {
463  copySize = size_;
464  }
465  size_ = n;
466 
467  if(str_) {
468  memcpy(newString, str_, (copySize + 1) * sizeof(char));
469  }
470  if( copySize < size_ ) {
471  memset(newString + copySize, 0, size_ - copySize);
472  }
473  newString[size_] = '\0';
474 
475  delete [] str_;
476  str_ = newString;
477  }
478  }
479 
480  const char& operator[] ( ::size_t pos ) const
481  {
482  return str_[pos];
483  }
484 
485  char& operator[] ( ::size_t pos )
486  {
487  return str_[pos];
488  }
489 
496  string& operator=(const string& rhs)
497  {
498  if (this == &rhs) {
499  return *this;
500  }
501 
502  if( str_ != NULL ) {
503  delete [] str_;
504  str_ = NULL;
505  size_ = 0;
506  }
507 
508  if (rhs.size_ == 0 || rhs.str_ == NULL) {
509  str_ = NULL;
510  size_ = 0;
511  }
512  else {
513  str_ = new char[rhs.size_ + 1];
514  size_ = rhs.size_;
515 
516  if (str_ != NULL) {
517  memcpy(str_, rhs.str_, (size_ + 1) * sizeof(char));
518  }
519  else {
520  size_ = 0;
521  }
522  }
523 
524  return *this;
525  }
526 
531  string(const string& rhs) :
532  size_(0),
533  str_(NULL)
534  {
535  *this = rhs;
536  }
537 
539  ~string()
540  {
541  delete[] str_;
542  str_ = NULL;
543  }
544 
546  ::size_t size(void) const { return size_; }
547 
549  ::size_t length(void) const { return size(); }
550 
554  const char * c_str(void) const { return (str_) ? str_ : "";}
555 };
556 typedef cl::string STRING_CLASS;
557 #endif // #elif !defined(__USE_DEV_STRING)
558 
559 #if !defined(__USE_DEV_VECTOR) && !defined(__NO_STD_VECTOR)
560 #define VECTOR_CLASS std::vector
561 #elif !defined(__USE_DEV_VECTOR)
562 #define VECTOR_CLASS cl::vector
563 
564 #if !defined(__MAX_DEFAULT_VECTOR_SIZE)
565 #define __MAX_DEFAULT_VECTOR_SIZE 10
566 #endif
567 
590 template <typename T, unsigned int N = __MAX_DEFAULT_VECTOR_SIZE>
592 {
593 private:
594  T data_[N];
595  unsigned int size_;
596 
597 public:
599  vector() :
600  size_(static_cast<unsigned int>(0))
601  {}
602 
604  ~vector()
605  {
606  clear();
607  }
608 
610  unsigned int size(void) const
611  {
612  return size_;
613  }
614 
620  void clear()
621  {
622  while(!empty()) {
623  pop_back();
624  }
625  }
626 
631  void push_back (const T& x)
632  {
633  if (size() < N) {
634  new (&data_[size_]) T(x);
635  size_++;
636  } else {
637  detail::errHandler(CL_MEM_OBJECT_ALLOCATION_FAILURE, __VECTOR_CAPACITY_ERR);
638  }
639  }
640 
645  void pop_back(void)
646  {
647  if (size_ != 0) {
648  --size_;
649  data_[size_].~T();
650  } else {
651  detail::errHandler(CL_MEM_OBJECT_ALLOCATION_FAILURE, __VECTOR_CAPACITY_ERR);
652  }
653  }
654 
659  vector(const vector<T, N>& vec) :
660  size_(vec.size_)
661  {
662  if (size_ != 0) {
663  assign(vec.begin(), vec.end());
664  }
665  }
666 
673  vector(unsigned int size, const T& val = T()) :
674  size_(0)
675  {
676  for (unsigned int i = 0; i < size; i++) {
677  push_back(val);
678  }
679  }
680 
688  vector<T, N>& operator=(const vector<T, N>& rhs)
689  {
690  if (this == &rhs) {
691  return *this;
692  }
693 
694  if (rhs.size_ != 0) {
695  assign(rhs.begin(), rhs.end());
696  } else {
697  clear();
698  }
699 
700  return *this;
701  }
702 
707  bool operator==(vector<T,N> &vec)
708  {
709  if (size() != vec.size()) {
710  return false;
711  }
712 
713  for( unsigned int i = 0; i < size(); ++i ) {
714  if( operator[](i) != vec[i] ) {
715  return false;
716  }
717  }
718  return true;
719  }
720 
722  operator T* () { return data_; }
723 
725  operator const T* () const { return data_; }
726 
728  bool empty (void) const
729  {
730  return size_==0;
731  }
732 
734  unsigned int max_size (void) const
735  {
736  return N;
737  }
738 
740  unsigned int capacity () const
741  {
742  return N;
743  }
744 
746  void resize(unsigned int newSize, T fill = T())
747  {
748  if (newSize > N)
749  {
750  detail::errHandler(CL_MEM_OBJECT_ALLOCATION_FAILURE, __VECTOR_CAPACITY_ERR);
751  }
752  else
753  {
754  while (size_ < newSize)
755  {
756  new (&data_[size_]) T(fill);
757  size_++;
758  }
759  while (size_ > newSize)
760  {
761  --size_;
762  data_[size_].~T();
763  }
764  }
765  }
766 
773  T& operator[](int index)
774  {
775  return data_[index];
776  }
777 
785  const T& operator[](int index) const
786  {
787  return data_[index];
788  }
789 
798  template<class I>
799  void assign(I start, I end)
800  {
801  clear();
802  while(start != end) {
803  push_back(*start);
804  start++;
805  }
806  }
807 
811  class iterator
812  {
813  private:
814  const vector<T,N> *vec_;
815  int index_;
816 
822  iterator (const vector<T,N> &vec, int index) :
823  vec_(&vec)
824  {
825  if( !vec.empty() ) {
826  index_ = index;
827  } else {
828  index_ = -1;
829  }
830  }
831 
832  public:
833  iterator(void) :
834  index_(-1),
835  vec_(NULL)
836  {
837  }
838 
839  iterator(const iterator& rhs) :
840  vec_(rhs.vec_),
841  index_(rhs.index_)
842  {
843  }
844 
845  ~iterator(void) {}
846 
847  static iterator begin(const cl::vector<T,N> &vec)
848  {
849  iterator i(vec, 0);
850 
851  return i;
852  }
853 
854  static iterator end(const cl::vector<T,N> &vec)
855  {
856  iterator i(vec, vec.size());
857 
858  return i;
859  }
860 
861  bool operator==(iterator i)
862  {
863  return ((vec_ == i.vec_) &&
864  (index_ == i.index_));
865  }
866 
867  bool operator!=(iterator i)
868  {
869  return (!(*this==i));
870  }
871 
872  iterator& operator++()
873  {
874  ++index_;
875  return *this;
876  }
877 
878  iterator operator++(int)
879  {
880  iterator retVal(*this);
881  ++index_;
882  return retVal;
883  }
884 
885  iterator& operator--()
886  {
887  --index_;
888  return *this;
889  }
890 
891  iterator operator--(int)
892  {
893  iterator retVal(*this);
894  --index_;
895  return retVal;
896  }
897 
898  const T& operator *() const
899  {
900  return (*vec_)[index_];
901  }
902  };
903 
904  iterator begin(void)
905  {
906  return iterator::begin(*this);
907  }
908 
909  iterator begin(void) const
910  {
911  return iterator::begin(*this);
912  }
913 
914  iterator end(void)
915  {
916  return iterator::end(*this);
917  }
918 
919  iterator end(void) const
920  {
921  return iterator::end(*this);
922  }
923 
924  T& front(void)
925  {
926  return data_[0];
927  }
928 
929  T& back(void)
930  {
931  return data_[size_];
932  }
933 
934  const T& front(void) const
935  {
936  return data_[0];
937  }
938 
939  const T& back(void) const
940  {
941  return data_[size_-1];
942  }
944 #endif // #if !defined(__USE_DEV_VECTOR) && !defined(__NO_STD_VECTOR)
945 
946 
947 
948 
949 
950 namespace detail {
951 #define __DEFAULT_NOT_INITIALIZED 1
952 #define __DEFAULT_BEING_INITIALIZED 2
953 #define __DEFAULT_INITIALIZED 4
954 
955  /*
956  * Compare and exchange primitives are needed for handling of defaults
957  */
958 
959 #ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED
960  inline int compare_exchange(std::atomic<int> * dest, int exchange, int comparand)
961 #else // !CL_HPP_CPP11_ATOMICS_SUPPORTED
962  inline int compare_exchange(volatile int * dest, int exchange, int comparand)
963 #endif // !CL_HPP_CPP11_ATOMICS_SUPPORTED
964  {
965 #ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED
966  std::atomic_compare_exchange_strong(dest, &comparand, exchange);
967  return comparand;
968 #elif _MSC_VER
969  return (int)(_InterlockedCompareExchange(
970  (volatile long*)dest,
971  (long)exchange,
972  (long)comparand));
973 #else // !_MSC_VER && !CL_HPP_CPP11_ATOMICS_SUPPORTED
974  return (__sync_val_compare_and_swap(
975  dest,
976  comparand,
977  exchange));
978 #endif // !CL_HPP_CPP11_ATOMICS_SUPPORTED
979  }
980 
981  inline void fence() {
982 #ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED
983  std::atomic_thread_fence(std::memory_order_seq_cst);
984 #elif _MSC_VER // !CL_HPP_CPP11_ATOMICS_SUPPORTED
985  _ReadWriteBarrier();
986 #else // !_MSC_VER && !CL_HPP_CPP11_ATOMICS_SUPPORTED
987  __sync_synchronize();
988 #endif // !CL_HPP_CPP11_ATOMICS_SUPPORTED
989  }
990 } // namespace detail
991 
992 
997 template <int N>
998 class size_t
999 {
1000 private:
1001  ::size_t data_[N];
1002 
1003 public:
1006  {
1007  for( int i = 0; i < N; ++i ) {
1008  data_[i] = 0;
1009  }
1010  }
1011 
1012  ::size_t& operator[](int index)
1013  {
1014  return data_[index];
1015  }
1016 
1017  const ::size_t& operator[](int index) const
1018  {
1019  return data_[index];
1020  }
1021 
1023  operator ::size_t* () { return data_; }
1024 
1026  operator const ::size_t* () const { return data_; }
1027 };
1028 
1029 namespace detail {
1030 
1031 // Generic getInfoHelper. The final parameter is used to guide overload
1032 // resolution: the actual parameter passed is an int, which makes this
1033 // a worse conversion sequence than a specialization that declares the
1034 // parameter as an int.
1035 template<typename Functor, typename T>
1036 inline cl_int getInfoHelper(Functor f, cl_uint name, T* param, long)
1037 {
1038  return f(name, sizeof(T), param, NULL);
1039 }
1040 
1041 // Specialized getInfoHelper for VECTOR_CLASS params
1042 template <typename Func, typename T>
1043 inline cl_int getInfoHelper(Func f, cl_uint name, VECTOR_CLASS<T>* param, long)
1044 {
1045  ::size_t required;
1046  cl_int err = f(name, 0, NULL, &required);
1047  if (err != CL_SUCCESS) {
1048  return err;
1049  }
1050 
1051  T* value = (T*) alloca(required);
1052  err = f(name, required, value, NULL);
1053  if (err != CL_SUCCESS) {
1054  return err;
1055  }
1056 
1057  param->assign(&value[0], &value[required/sizeof(T)]);
1058  return CL_SUCCESS;
1059 }
1060 
1061 /* Specialization for reference-counted types. This depends on the
1062  * existence of Wrapper<T>::cl_type, and none of the other types having the
1063  * cl_type member. Note that simplify specifying the parameter as Wrapper<T>
1064  * does not work, because when using a derived type (e.g. Context) the generic
1065  * template will provide a better match.
1066  */
1067 template <typename Func, typename T>
1068 inline cl_int getInfoHelper(Func f, cl_uint name, VECTOR_CLASS<T>* param, int, typename T::cl_type = 0)
1069 {
1070  ::size_t required;
1071  cl_int err = f(name, 0, NULL, &required);
1072  if (err != CL_SUCCESS) {
1073  return err;
1074  }
1075 
1076  typename T::cl_type * value = (typename T::cl_type *) alloca(required);
1077  err = f(name, required, value, NULL);
1078  if (err != CL_SUCCESS) {
1079  return err;
1080  }
1081 
1082  ::size_t elements = required / sizeof(typename T::cl_type);
1083  param->assign(&value[0], &value[elements]);
1084  for (::size_t i = 0; i < elements; i++)
1085  {
1086  if (value[i] != NULL)
1087  {
1088  err = (*param)[i].retain();
1089  if (err != CL_SUCCESS) {
1090  return err;
1091  }
1092  }
1093  }
1094  return CL_SUCCESS;
1095 }
1096 
1097 // Specialized for getInfo<CL_PROGRAM_BINARIES>
1098 template <typename Func>
1099 inline cl_int getInfoHelper(Func f, cl_uint name, VECTOR_CLASS<char *>* param, int)
1100 {
1101  cl_int err = f(name, param->size() * sizeof(char *), &(*param)[0], NULL);
1102 
1103  if (err != CL_SUCCESS) {
1104  return err;
1105  }
1106 
1107  return CL_SUCCESS;
1108 }
1109 
1110 // Specialized GetInfoHelper for STRING_CLASS params
1111 template <typename Func>
1112 inline cl_int getInfoHelper(Func f, cl_uint name, STRING_CLASS* param, long)
1113 {
1114  ::size_t required;
1115  cl_int err = f(name, 0, NULL, &required);
1116  if (err != CL_SUCCESS) {
1117  return err;
1118  }
1119 
1120  // std::string has a constant data member
1121  // a char vector does not
1122  VECTOR_CLASS<char> value(required);
1123  err = f(name, required, value.data(), NULL);
1124  if (err != CL_SUCCESS) {
1125  return err;
1126  }
1127  if (param) {
1128  param->assign(value.begin(), value.end());
1129  }
1130  return CL_SUCCESS;
1131 }
1132 
1133 // Specialized GetInfoHelper for cl::size_t params
1134 template <typename Func, ::size_t N>
1135 inline cl_int getInfoHelper(Func f, cl_uint name, size_t<N>* param, long)
1136 {
1137  ::size_t required;
1138  cl_int err = f(name, 0, NULL, &required);
1139  if (err != CL_SUCCESS) {
1140  return err;
1141  }
1142 
1143  ::size_t* value = (::size_t*) alloca(required);
1144  err = f(name, required, value, NULL);
1145  if (err != CL_SUCCESS) {
1146  return err;
1147  }
1148 
1149  for(int i = 0; i < N; ++i) {
1150  (*param)[i] = value[i];
1151  }
1152 
1153  return CL_SUCCESS;
1154 }
1155 
1156 template<typename T> struct ReferenceHandler;
1157 
1158 /* Specialization for reference-counted types. This depends on the
1159  * existence of Wrapper<T>::cl_type, and none of the other types having the
1160  * cl_type member. Note that simplify specifying the parameter as Wrapper<T>
1161  * does not work, because when using a derived type (e.g. Context) the generic
1162  * template will provide a better match.
1163  */
1164 template<typename Func, typename T>
1165 inline cl_int getInfoHelper(Func f, cl_uint name, T* param, int, typename T::cl_type = 0)
1166 {
1167  typename T::cl_type value;
1168  cl_int err = f(name, sizeof(value), &value, NULL);
1169  if (err != CL_SUCCESS) {
1170  return err;
1171  }
1172  *param = value;
1173  if (value != NULL)
1174  {
1175  err = param->retain();
1176  if (err != CL_SUCCESS) {
1177  return err;
1178  }
1179  }
1180  return CL_SUCCESS;
1181 }
1182 
1183 #define __PARAM_NAME_INFO_1_0(F) \
1184  F(cl_platform_info, CL_PLATFORM_PROFILE, STRING_CLASS) \
1185  F(cl_platform_info, CL_PLATFORM_VERSION, STRING_CLASS) \
1186  F(cl_platform_info, CL_PLATFORM_NAME, STRING_CLASS) \
1187  F(cl_platform_info, CL_PLATFORM_VENDOR, STRING_CLASS) \
1188  F(cl_platform_info, CL_PLATFORM_EXTENSIONS, STRING_CLASS) \
1189  \
1190  F(cl_device_info, CL_DEVICE_TYPE, cl_device_type) \
1191  F(cl_device_info, CL_DEVICE_VENDOR_ID, cl_uint) \
1192  F(cl_device_info, CL_DEVICE_MAX_COMPUTE_UNITS, cl_uint) \
1193  F(cl_device_info, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, cl_uint) \
1194  F(cl_device_info, CL_DEVICE_MAX_WORK_GROUP_SIZE, ::size_t) \
1195  F(cl_device_info, CL_DEVICE_MAX_WORK_ITEM_SIZES, VECTOR_CLASS< ::size_t>) \
1196  F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR, cl_uint) \
1197  F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT, cl_uint) \
1198  F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT, cl_uint) \
1199  F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG, cl_uint) \
1200  F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT, cl_uint) \
1201  F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE, cl_uint) \
1202  F(cl_device_info, CL_DEVICE_MAX_CLOCK_FREQUENCY, cl_uint) \
1203  F(cl_device_info, CL_DEVICE_ADDRESS_BITS, cl_uint) \
1204  F(cl_device_info, CL_DEVICE_MAX_READ_IMAGE_ARGS, cl_uint) \
1205  F(cl_device_info, CL_DEVICE_MAX_WRITE_IMAGE_ARGS, cl_uint) \
1206  F(cl_device_info, CL_DEVICE_MAX_MEM_ALLOC_SIZE, cl_ulong) \
1207  F(cl_device_info, CL_DEVICE_IMAGE2D_MAX_WIDTH, ::size_t) \
1208  F(cl_device_info, CL_DEVICE_IMAGE2D_MAX_HEIGHT, ::size_t) \
1209  F(cl_device_info, CL_DEVICE_IMAGE3D_MAX_WIDTH, ::size_t) \
1210  F(cl_device_info, CL_DEVICE_IMAGE3D_MAX_HEIGHT, ::size_t) \
1211  F(cl_device_info, CL_DEVICE_IMAGE3D_MAX_DEPTH, ::size_t) \
1212  F(cl_device_info, CL_DEVICE_IMAGE_SUPPORT, cl_bool) \
1213  F(cl_device_info, CL_DEVICE_MAX_PARAMETER_SIZE, ::size_t) \
1214  F(cl_device_info, CL_DEVICE_MAX_SAMPLERS, cl_uint) \
1215  F(cl_device_info, CL_DEVICE_MEM_BASE_ADDR_ALIGN, cl_uint) \
1216  F(cl_device_info, CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE, cl_uint) \
1217  F(cl_device_info, CL_DEVICE_SINGLE_FP_CONFIG, cl_device_fp_config) \
1218  F(cl_device_info, CL_DEVICE_GLOBAL_MEM_CACHE_TYPE, cl_device_mem_cache_type) \
1219  F(cl_device_info, CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE, cl_uint)\
1220  F(cl_device_info, CL_DEVICE_GLOBAL_MEM_CACHE_SIZE, cl_ulong) \
1221  F(cl_device_info, CL_DEVICE_GLOBAL_MEM_SIZE, cl_ulong) \
1222  F(cl_device_info, CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE, cl_ulong) \
1223  F(cl_device_info, CL_DEVICE_MAX_CONSTANT_ARGS, cl_uint) \
1224  F(cl_device_info, CL_DEVICE_LOCAL_MEM_TYPE, cl_device_local_mem_type) \
1225  F(cl_device_info, CL_DEVICE_LOCAL_MEM_SIZE, cl_ulong) \
1226  F(cl_device_info, CL_DEVICE_ERROR_CORRECTION_SUPPORT, cl_bool) \
1227  F(cl_device_info, CL_DEVICE_PROFILING_TIMER_RESOLUTION, ::size_t) \
1228  F(cl_device_info, CL_DEVICE_ENDIAN_LITTLE, cl_bool) \
1229  F(cl_device_info, CL_DEVICE_AVAILABLE, cl_bool) \
1230  F(cl_device_info, CL_DEVICE_COMPILER_AVAILABLE, cl_bool) \
1231  F(cl_device_info, CL_DEVICE_EXECUTION_CAPABILITIES, cl_device_exec_capabilities) \
1232  F(cl_device_info, CL_DEVICE_QUEUE_PROPERTIES, cl_command_queue_properties) \
1233  F(cl_device_info, CL_DEVICE_PLATFORM, cl_platform_id) \
1234  F(cl_device_info, CL_DEVICE_NAME, STRING_CLASS) \
1235  F(cl_device_info, CL_DEVICE_VENDOR, STRING_CLASS) \
1236  F(cl_device_info, CL_DRIVER_VERSION, STRING_CLASS) \
1237  F(cl_device_info, CL_DEVICE_PROFILE, STRING_CLASS) \
1238  F(cl_device_info, CL_DEVICE_VERSION, STRING_CLASS) \
1239  F(cl_device_info, CL_DEVICE_EXTENSIONS, STRING_CLASS) \
1240  \
1241  F(cl_context_info, CL_CONTEXT_REFERENCE_COUNT, cl_uint) \
1242  F(cl_context_info, CL_CONTEXT_DEVICES, VECTOR_CLASS<Device>) \
1243  F(cl_context_info, CL_CONTEXT_PROPERTIES, VECTOR_CLASS<cl_context_properties>) \
1244  \
1245  F(cl_event_info, CL_EVENT_COMMAND_QUEUE, cl::CommandQueue) \
1246  F(cl_event_info, CL_EVENT_COMMAND_TYPE, cl_command_type) \
1247  F(cl_event_info, CL_EVENT_REFERENCE_COUNT, cl_uint) \
1248  F(cl_event_info, CL_EVENT_COMMAND_EXECUTION_STATUS, cl_int) \
1249  \
1250  F(cl_profiling_info, CL_PROFILING_COMMAND_QUEUED, cl_ulong) \
1251  F(cl_profiling_info, CL_PROFILING_COMMAND_SUBMIT, cl_ulong) \
1252  F(cl_profiling_info, CL_PROFILING_COMMAND_START, cl_ulong) \
1253  F(cl_profiling_info, CL_PROFILING_COMMAND_END, cl_ulong) \
1254  \
1255  F(cl_mem_info, CL_MEM_TYPE, cl_mem_object_type) \
1256  F(cl_mem_info, CL_MEM_FLAGS, cl_mem_flags) \
1257  F(cl_mem_info, CL_MEM_SIZE, ::size_t) \
1258  F(cl_mem_info, CL_MEM_HOST_PTR, void*) \
1259  F(cl_mem_info, CL_MEM_MAP_COUNT, cl_uint) \
1260  F(cl_mem_info, CL_MEM_REFERENCE_COUNT, cl_uint) \
1261  F(cl_mem_info, CL_MEM_CONTEXT, cl::Context) \
1262  \
1263  F(cl_image_info, CL_IMAGE_FORMAT, cl_image_format) \
1264  F(cl_image_info, CL_IMAGE_ELEMENT_SIZE, ::size_t) \
1265  F(cl_image_info, CL_IMAGE_ROW_PITCH, ::size_t) \
1266  F(cl_image_info, CL_IMAGE_SLICE_PITCH, ::size_t) \
1267  F(cl_image_info, CL_IMAGE_WIDTH, ::size_t) \
1268  F(cl_image_info, CL_IMAGE_HEIGHT, ::size_t) \
1269  F(cl_image_info, CL_IMAGE_DEPTH, ::size_t) \
1270  \
1271  F(cl_sampler_info, CL_SAMPLER_REFERENCE_COUNT, cl_uint) \
1272  F(cl_sampler_info, CL_SAMPLER_CONTEXT, cl::Context) \
1273  F(cl_sampler_info, CL_SAMPLER_NORMALIZED_COORDS, cl_addressing_mode) \
1274  F(cl_sampler_info, CL_SAMPLER_ADDRESSING_MODE, cl_filter_mode) \
1275  F(cl_sampler_info, CL_SAMPLER_FILTER_MODE, cl_bool) \
1276  \
1277  F(cl_program_info, CL_PROGRAM_REFERENCE_COUNT, cl_uint) \
1278  F(cl_program_info, CL_PROGRAM_CONTEXT, cl::Context) \
1279  F(cl_program_info, CL_PROGRAM_NUM_DEVICES, cl_uint) \
1280  F(cl_program_info, CL_PROGRAM_DEVICES, VECTOR_CLASS<Device>) \
1281  F(cl_program_info, CL_PROGRAM_SOURCE, STRING_CLASS) \
1282  F(cl_program_info, CL_PROGRAM_BINARY_SIZES, VECTOR_CLASS< ::size_t>) \
1283  F(cl_program_info, CL_PROGRAM_BINARIES, VECTOR_CLASS<char *>) \
1284  \
1285  F(cl_program_build_info, CL_PROGRAM_BUILD_STATUS, cl_build_status) \
1286  F(cl_program_build_info, CL_PROGRAM_BUILD_OPTIONS, STRING_CLASS) \
1287  F(cl_program_build_info, CL_PROGRAM_BUILD_LOG, STRING_CLASS) \
1288  \
1289  F(cl_kernel_info, CL_KERNEL_FUNCTION_NAME, STRING_CLASS) \
1290  F(cl_kernel_info, CL_KERNEL_NUM_ARGS, cl_uint) \
1291  F(cl_kernel_info, CL_KERNEL_REFERENCE_COUNT, cl_uint) \
1292  F(cl_kernel_info, CL_KERNEL_CONTEXT, cl::Context) \
1293  F(cl_kernel_info, CL_KERNEL_PROGRAM, cl::Program) \
1294  \
1295  F(cl_kernel_work_group_info, CL_KERNEL_WORK_GROUP_SIZE, ::size_t) \
1296  F(cl_kernel_work_group_info, CL_KERNEL_COMPILE_WORK_GROUP_SIZE, cl::size_t<3>) \
1297  F(cl_kernel_work_group_info, CL_KERNEL_LOCAL_MEM_SIZE, cl_ulong) \
1298  \
1299  F(cl_command_queue_info, CL_QUEUE_CONTEXT, cl::Context) \
1300  F(cl_command_queue_info, CL_QUEUE_DEVICE, cl::Device) \
1301  F(cl_command_queue_info, CL_QUEUE_REFERENCE_COUNT, cl_uint) \
1302  F(cl_command_queue_info, CL_QUEUE_PROPERTIES, cl_command_queue_properties)
1303 
1304 #if defined(CL_VERSION_1_1)
1305 #define __PARAM_NAME_INFO_1_1(F) \
1306  F(cl_context_info, CL_CONTEXT_NUM_DEVICES, cl_uint)\
1307  F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF, cl_uint) \
1308  F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR, cl_uint) \
1309  F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT, cl_uint) \
1310  F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_INT, cl_uint) \
1311  F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG, cl_uint) \
1312  F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT, cl_uint) \
1313  F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE, cl_uint) \
1314  F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF, cl_uint) \
1315  F(cl_device_info, CL_DEVICE_DOUBLE_FP_CONFIG, cl_device_fp_config) \
1316  F(cl_device_info, CL_DEVICE_HALF_FP_CONFIG, cl_device_fp_config) \
1317  F(cl_device_info, CL_DEVICE_HOST_UNIFIED_MEMORY, cl_bool) \
1318  F(cl_device_info, CL_DEVICE_OPENCL_C_VERSION, STRING_CLASS) \
1319  \
1320  F(cl_mem_info, CL_MEM_ASSOCIATED_MEMOBJECT, cl::Memory) \
1321  F(cl_mem_info, CL_MEM_OFFSET, ::size_t) \
1322  \
1323  F(cl_kernel_work_group_info, CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE, ::size_t) \
1324  F(cl_kernel_work_group_info, CL_KERNEL_PRIVATE_MEM_SIZE, cl_ulong) \
1325  \
1326  F(cl_event_info, CL_EVENT_CONTEXT, cl::Context)
1327 #endif // CL_VERSION_1_1
1328 
1329 
1330 #if defined(CL_VERSION_1_2)
1331 #define __PARAM_NAME_INFO_1_2(F) \
1332  F(cl_image_info, CL_IMAGE_BUFFER, cl::Buffer) \
1333  \
1334  F(cl_program_info, CL_PROGRAM_NUM_KERNELS, ::size_t) \
1335  F(cl_program_info, CL_PROGRAM_KERNEL_NAMES, STRING_CLASS) \
1336  \
1337  F(cl_program_build_info, CL_PROGRAM_BINARY_TYPE, cl_program_binary_type) \
1338  \
1339  F(cl_kernel_info, CL_KERNEL_ATTRIBUTES, STRING_CLASS) \
1340  \
1341  F(cl_kernel_arg_info, CL_KERNEL_ARG_ADDRESS_QUALIFIER, cl_kernel_arg_address_qualifier) \
1342  F(cl_kernel_arg_info, CL_KERNEL_ARG_ACCESS_QUALIFIER, cl_kernel_arg_access_qualifier) \
1343  F(cl_kernel_arg_info, CL_KERNEL_ARG_TYPE_NAME, STRING_CLASS) \
1344  F(cl_kernel_arg_info, CL_KERNEL_ARG_NAME, STRING_CLASS) \
1345  \
1346  F(cl_device_info, CL_DEVICE_PARENT_DEVICE, cl_device_id) \
1347  F(cl_device_info, CL_DEVICE_PARTITION_PROPERTIES, VECTOR_CLASS<cl_device_partition_property>) \
1348  F(cl_device_info, CL_DEVICE_PARTITION_TYPE, VECTOR_CLASS<cl_device_partition_property>) \
1349  F(cl_device_info, CL_DEVICE_REFERENCE_COUNT, cl_uint) \
1350  F(cl_device_info, CL_DEVICE_PREFERRED_INTEROP_USER_SYNC, ::size_t) \
1351  F(cl_device_info, CL_DEVICE_PARTITION_AFFINITY_DOMAIN, cl_device_affinity_domain) \
1352  F(cl_device_info, CL_DEVICE_BUILT_IN_KERNELS, STRING_CLASS)
1353 #endif // #if defined(CL_VERSION_1_2)
1354 
1355 #if defined(USE_CL_DEVICE_FISSION)
1356 #define __PARAM_NAME_DEVICE_FISSION(F) \
1357  F(cl_device_info, CL_DEVICE_PARENT_DEVICE_EXT, cl_device_id) \
1358  F(cl_device_info, CL_DEVICE_PARTITION_TYPES_EXT, VECTOR_CLASS<cl_device_partition_property_ext>) \
1359  F(cl_device_info, CL_DEVICE_AFFINITY_DOMAINS_EXT, VECTOR_CLASS<cl_device_partition_property_ext>) \
1360  F(cl_device_info, CL_DEVICE_REFERENCE_COUNT_EXT , cl_uint) \
1361  F(cl_device_info, CL_DEVICE_PARTITION_STYLE_EXT, VECTOR_CLASS<cl_device_partition_property_ext>)
1362 #endif // USE_CL_DEVICE_FISSION
1363 
1364 template <typename enum_type, cl_int Name>
1365 struct param_traits {};
1366 
1367 #define __CL_DECLARE_PARAM_TRAITS(token, param_name, T) \
1368 struct token; \
1369 template<> \
1370 struct param_traits<detail:: token,param_name> \
1371 { \
1372  enum { value = param_name }; \
1373  typedef T param_type; \
1374 };
1375 
1377 #if defined(CL_VERSION_1_1)
1378 __PARAM_NAME_INFO_1_1(__CL_DECLARE_PARAM_TRAITS)
1379 #endif // CL_VERSION_1_1
1380 #if defined(CL_VERSION_1_2)
1381 __PARAM_NAME_INFO_1_2(__CL_DECLARE_PARAM_TRAITS)
1382 #endif // CL_VERSION_1_1
1383 
1384 #if defined(USE_CL_DEVICE_FISSION)
1385 __PARAM_NAME_DEVICE_FISSION(__CL_DECLARE_PARAM_TRAITS);
1386 #endif // USE_CL_DEVICE_FISSION
1387 
1388 #ifdef CL_PLATFORM_ICD_SUFFIX_KHR
1389 __CL_DECLARE_PARAM_TRAITS(cl_platform_info, CL_PLATFORM_ICD_SUFFIX_KHR, STRING_CLASS)
1390 #endif
1391 
1392 #ifdef CL_DEVICE_PROFILING_TIMER_OFFSET_AMD
1393 __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_PROFILING_TIMER_OFFSET_AMD, cl_ulong)
1394 #endif
1395 
1396 #ifdef CL_DEVICE_GLOBAL_FREE_MEMORY_AMD
1397 __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_GLOBAL_FREE_MEMORY_AMD, VECTOR_CLASS< ::size_t>)
1398 #endif
1399 #ifdef CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD
1400 __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD, cl_uint)
1401 #endif
1402 #ifdef CL_DEVICE_SIMD_WIDTH_AMD
1403 __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_SIMD_WIDTH_AMD, cl_uint)
1404 #endif
1405 #ifdef CL_DEVICE_SIMD_INSTRUCTION_WIDTH_AMD
1406 __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_SIMD_INSTRUCTION_WIDTH_AMD, cl_uint)
1407 #endif
1408 #ifdef CL_DEVICE_WAVEFRONT_WIDTH_AMD
1409 __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_WAVEFRONT_WIDTH_AMD, cl_uint)
1410 #endif
1411 #ifdef CL_DEVICE_GLOBAL_MEM_CHANNELS_AMD
1412 __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_GLOBAL_MEM_CHANNELS_AMD, cl_uint)
1413 #endif
1414 #ifdef CL_DEVICE_GLOBAL_MEM_CHANNEL_BANKS_AMD
1415 __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_GLOBAL_MEM_CHANNEL_BANKS_AMD, cl_uint)
1416 #endif
1417 #ifdef CL_DEVICE_GLOBAL_MEM_CHANNEL_BANK_WIDTH_AMD
1418 __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_GLOBAL_MEM_CHANNEL_BANK_WIDTH_AMD, cl_uint)
1419 #endif
1420 #ifdef CL_DEVICE_LOCAL_MEM_SIZE_PER_COMPUTE_UNIT_AMD
1421 __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_LOCAL_MEM_SIZE_PER_COMPUTE_UNIT_AMD, cl_uint)
1422 #endif
1423 #ifdef CL_DEVICE_LOCAL_MEM_BANKS_AMD
1424 __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_LOCAL_MEM_BANKS_AMD, cl_uint)
1425 #endif
1426 
1427 #ifdef CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
1428 __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV, cl_uint)
1429 #endif
1430 #ifdef CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
1431 __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV, cl_uint)
1432 #endif
1433 #ifdef CL_DEVICE_REGISTERS_PER_BLOCK_NV
1434 __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_REGISTERS_PER_BLOCK_NV, cl_uint)
1435 #endif
1436 #ifdef CL_DEVICE_WARP_SIZE_NV
1437 __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_WARP_SIZE_NV, cl_uint)
1438 #endif
1439 #ifdef CL_DEVICE_GPU_OVERLAP_NV
1440 __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_GPU_OVERLAP_NV, cl_bool)
1441 #endif
1442 #ifdef CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV
1443 __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV, cl_bool)
1444 #endif
1445 #ifdef CL_DEVICE_INTEGRATED_MEMORY_NV
1446 __CL_DECLARE_PARAM_TRAITS(cl_device_info, CL_DEVICE_INTEGRATED_MEMORY_NV, cl_bool)
1447 #endif
1448 
1449 // Convenience functions
1450 
1451 template <typename Func, typename T>
1452 inline cl_int
1453 getInfo(Func f, cl_uint name, T* param)
1454 {
1455  return getInfoHelper(f, name, param, 0);
1456 }
1457 
1458 template <typename Func, typename Arg0>
1460 {
1461  Func f_; const Arg0& arg0_;
1462  cl_int operator ()(
1463  cl_uint param, ::size_t size, void* value, ::size_t* size_ret)
1464  { return f_(arg0_, param, size, value, size_ret); }
1465 };
1466 
1467 template <typename Func, typename Arg0, typename Arg1>
1469 {
1470  Func f_; const Arg0& arg0_; const Arg1& arg1_;
1471  cl_int operator ()(
1472  cl_uint param, ::size_t size, void* value, ::size_t* size_ret)
1473  { return f_(arg0_, arg1_, param, size, value, size_ret); }
1474 };
1475 
1476 template <typename Func, typename Arg0, typename T>
1477 inline cl_int
1478 getInfo(Func f, const Arg0& arg0, cl_uint name, T* param)
1479 {
1480  GetInfoFunctor0<Func, Arg0> f0 = { f, arg0 };
1481  return getInfoHelper(f0, name, param, 0);
1482 }
1483 
1484 template <typename Func, typename Arg0, typename Arg1, typename T>
1485 inline cl_int
1486 getInfo(Func f, const Arg0& arg0, const Arg1& arg1, cl_uint name, T* param)
1487 {
1488  GetInfoFunctor1<Func, Arg0, Arg1> f0 = { f, arg0, arg1 };
1489  return getInfoHelper(f0, name, param, 0);
1490 }
1491 
1492 template<typename T>
1493 struct ReferenceHandler
1494 { };
1495 
1496 #if defined(CL_VERSION_1_2)
1497 
1500 template <>
1501 struct ReferenceHandler<cl_device_id>
1502 {
1512  static cl_int retain(cl_device_id device)
1513  { return ::clRetainDevice(device); }
1523  static cl_int release(cl_device_id device)
1524  { return ::clReleaseDevice(device); }
1525 };
1526 #else // #if defined(CL_VERSION_1_2)
1527 
1530 template <>
1531 struct ReferenceHandler<cl_device_id>
1532 {
1533  // cl_device_id does not have retain().
1534  static cl_int retain(cl_device_id)
1535  { return CL_SUCCESS; }
1536  // cl_device_id does not have release().
1537  static cl_int release(cl_device_id)
1538  { return CL_SUCCESS; }
1539 };
1540 #endif // #if defined(CL_VERSION_1_2)
1541 
1542 template <>
1543 struct ReferenceHandler<cl_platform_id>
1544 {
1545  // cl_platform_id does not have retain().
1546  static cl_int retain(cl_platform_id)
1547  { return CL_SUCCESS; }
1548  // cl_platform_id does not have release().
1549  static cl_int release(cl_platform_id)
1550  { return CL_SUCCESS; }
1551 };
1552 
1553 template <>
1554 struct ReferenceHandler<cl_context>
1555 {
1556  static cl_int retain(cl_context context)
1557  { return ::clRetainContext(context); }
1558  static cl_int release(cl_context context)
1559  { return ::clReleaseContext(context); }
1560 };
1561 
1562 template <>
1563 struct ReferenceHandler<cl_command_queue>
1564 {
1565  static cl_int retain(cl_command_queue queue)
1566  { return ::clRetainCommandQueue(queue); }
1567  static cl_int release(cl_command_queue queue)
1568  { return ::clReleaseCommandQueue(queue); }
1569 };
1570 
1571 template <>
1572 struct ReferenceHandler<cl_mem>
1573 {
1574  static cl_int retain(cl_mem memory)
1575  { return ::clRetainMemObject(memory); }
1576  static cl_int release(cl_mem memory)
1577  { return ::clReleaseMemObject(memory); }
1578 };
1579 
1580 template <>
1581 struct ReferenceHandler<cl_sampler>
1582 {
1583  static cl_int retain(cl_sampler sampler)
1584  { return ::clRetainSampler(sampler); }
1585  static cl_int release(cl_sampler sampler)
1586  { return ::clReleaseSampler(sampler); }
1587 };
1588 
1589 template <>
1590 struct ReferenceHandler<cl_program>
1591 {
1592  static cl_int retain(cl_program program)
1593  { return ::clRetainProgram(program); }
1594  static cl_int release(cl_program program)
1595  { return ::clReleaseProgram(program); }
1596 };
1597 
1598 template <>
1599 struct ReferenceHandler<cl_kernel>
1600 {
1601  static cl_int retain(cl_kernel kernel)
1602  { return ::clRetainKernel(kernel); }
1603  static cl_int release(cl_kernel kernel)
1604  { return ::clReleaseKernel(kernel); }
1605 };
1606 
1607 template <>
1608 struct ReferenceHandler<cl_event>
1609 {
1610  static cl_int retain(cl_event event)
1611  { return ::clRetainEvent(event); }
1612  static cl_int release(cl_event event)
1613  { return ::clReleaseEvent(event); }
1614 };
1615 
1616 
1617 // Extracts version number with major in the upper 16 bits, minor in the lower 16
1618 static cl_uint getVersion(const char *versionInfo)
1619 {
1620  int highVersion = 0;
1621  int lowVersion = 0;
1622  int index = 7;
1623  while(versionInfo[index] != '.' ) {
1624  highVersion *= 10;
1625  highVersion += versionInfo[index]-'0';
1626  ++index;
1627  }
1628  ++index;
1629  while(versionInfo[index] != ' ' && versionInfo[index] != '\0') {
1630  lowVersion *= 10;
1631  lowVersion += versionInfo[index]-'0';
1632  ++index;
1633  }
1634  return (highVersion << 16) | lowVersion;
1635 }
1636 
1637 static cl_uint getPlatformVersion(cl_platform_id platform)
1638 {
1639  ::size_t size = 0;
1640  clGetPlatformInfo(platform, CL_PLATFORM_VERSION, 0, NULL, &size);
1641  char *versionInfo = (char *) alloca(size);
1642  clGetPlatformInfo(platform, CL_PLATFORM_VERSION, size, &versionInfo[0], &size);
1643  return getVersion(versionInfo);
1644 }
1645 
1646 static cl_uint getDevicePlatformVersion(cl_device_id device)
1647 {
1648  cl_platform_id platform;
1649  clGetDeviceInfo(device, CL_DEVICE_PLATFORM, sizeof(platform), &platform, NULL);
1650  return getPlatformVersion(platform);
1651 }
1652 
1653 #if defined(CL_VERSION_1_2) && defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
1654 static cl_uint getContextPlatformVersion(cl_context context)
1655 {
1656  // The platform cannot be queried directly, so we first have to grab a
1657  // device and obtain its context
1658  ::size_t size = 0;
1659  clGetContextInfo(context, CL_CONTEXT_DEVICES, 0, NULL, &size);
1660  if (size == 0)
1661  return 0;
1662  cl_device_id *devices = (cl_device_id *) alloca(size);
1663  clGetContextInfo(context, CL_CONTEXT_DEVICES, size, devices, NULL);
1664  return getDevicePlatformVersion(devices[0]);
1665 }
1666 #endif // #if defined(CL_VERSION_1_2) && defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
1667 
1668 template <typename T>
1669 class Wrapper
1670 {
1671 public:
1672  typedef T cl_type;
1673 
1674 protected:
1676 
1677 public:
1678  Wrapper() : object_(NULL) { }
1679 
1680  Wrapper(const cl_type &obj) : object_(obj) { }
1681 
1683  {
1684  if (object_ != NULL) { release(); }
1685  }
1686 
1688  {
1689  object_ = rhs.object_;
1690  if (object_ != NULL) { detail::errHandler(retain(), __RETAIN_ERR); }
1691  }
1692 
1693 #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
1695  {
1696  object_ = rhs.object_;
1697  rhs.object_ = NULL;
1698  }
1699 #endif
1700 
1702  {
1703  if (this != &rhs) {
1704  if (object_ != NULL) { detail::errHandler(release(), __RELEASE_ERR); }
1705  object_ = rhs.object_;
1706  if (object_ != NULL) { detail::errHandler(retain(), __RETAIN_ERR); }
1707  }
1708  return *this;
1709  }
1710 
1711 #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
1713  {
1714  if (this != &rhs) {
1715  if (object_ != NULL) { detail::errHandler(release(), __RELEASE_ERR); }
1716  object_ = rhs.object_;
1717  rhs.object_ = NULL;
1718  }
1719  return *this;
1720  }
1721 #endif
1722 
1724  {
1725  if (object_ != NULL) { detail::errHandler(release(), __RELEASE_ERR); }
1726  object_ = rhs;
1727  return *this;
1728  }
1729 
1730  cl_type operator ()() const { return object_; }
1731 
1732  cl_type& operator ()() { return object_; }
1733 
1734 protected:
1735  template<typename Func, typename U>
1736  friend inline cl_int getInfoHelper(Func, cl_uint, U*, int, typename U::cl_type);
1737 
1738  cl_int retain() const
1739  {
1741  }
1742 
1743  cl_int release() const
1744  {
1746  }
1747 };
1748 
1749 template <>
1750 class Wrapper<cl_device_id>
1751 {
1752 public:
1753  typedef cl_device_id cl_type;
1754 
1755 protected:
1758 
1759  static bool isReferenceCountable(cl_device_id device)
1760  {
1761  bool retVal = false;
1762  if (device != NULL) {
1763  int version = getDevicePlatformVersion(device);
1764  if(version > ((1 << 16) + 1)) {
1765  retVal = true;
1766  }
1767  }
1768  return retVal;
1769  }
1770 
1771 public:
1772  Wrapper() : object_(NULL), referenceCountable_(false)
1773  {
1774  }
1775 
1776  Wrapper(const cl_type &obj) : object_(obj), referenceCountable_(false)
1777  {
1778  referenceCountable_ = isReferenceCountable(obj);
1779  }
1780 
1782  {
1783  if (object_ != NULL) { release(); }
1784  }
1785 
1787  {
1788  object_ = rhs.object_;
1789  referenceCountable_ = isReferenceCountable(object_);
1790  if (object_ != NULL) { detail::errHandler(retain(), __RETAIN_ERR); }
1791  }
1792 
1793 #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
1795  {
1796  object_ = rhs.object_;
1797  referenceCountable_ = rhs.referenceCountable_;
1798  rhs.object_ = NULL;
1799  rhs.referenceCountable_ = false;
1800  }
1801 #endif
1802 
1804  {
1805  if (this != &rhs) {
1806  if (object_ != NULL) { detail::errHandler(release(), __RELEASE_ERR); }
1807  object_ = rhs.object_;
1808  referenceCountable_ = rhs.referenceCountable_;
1809  if (object_ != NULL) { detail::errHandler(retain(), __RETAIN_ERR); }
1810  }
1811  return *this;
1812  }
1813 
1814 #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
1816  {
1817  if (this != &rhs) {
1818  if (object_ != NULL) { detail::errHandler(release(), __RELEASE_ERR); }
1819  object_ = rhs.object_;
1820  referenceCountable_ = rhs.referenceCountable_;
1821  rhs.object_ = NULL;
1822  rhs.referenceCountable_ = false;
1823  }
1824  return *this;
1825  }
1826 #endif
1827 
1829  {
1830  if (object_ != NULL) { detail::errHandler(release(), __RELEASE_ERR); }
1831  object_ = rhs;
1832  referenceCountable_ = isReferenceCountable(object_);
1833  return *this;
1834  }
1835 
1836  cl_type operator ()() const { return object_; }
1837 
1838  cl_type& operator ()() { return object_; }
1839 
1840 protected:
1841  template<typename Func, typename U>
1842  friend inline cl_int getInfoHelper(Func, cl_uint, U*, int, typename U::cl_type);
1843 
1844  template<typename Func, typename U>
1845  friend inline cl_int getInfoHelper(Func, cl_uint, VECTOR_CLASS<U>*, int, typename U::cl_type);
1846 
1847  cl_int retain() const
1848  {
1849  if( referenceCountable_ ) {
1851  }
1852  else {
1853  return CL_SUCCESS;
1854  }
1855  }
1856 
1857  cl_int release() const
1858  {
1859  if( referenceCountable_ ) {
1861  }
1862  else {
1863  return CL_SUCCESS;
1864  }
1865  }
1866 };
1867 
1868 } // namespace detail
1870 
1876 struct ImageFormat : public cl_image_format
1877 {
1880 
1882  ImageFormat(cl_channel_order order, cl_channel_type type)
1883  {
1884  image_channel_order = order;
1885  image_channel_data_type = type;
1886  }
1887 
1890  {
1891  if (this != &rhs) {
1892  this->image_channel_data_type = rhs.image_channel_data_type;
1893  this->image_channel_order = rhs.image_channel_order;
1894  }
1895  return *this;
1896  }
1897 };
1898 
1906 class Device : public detail::Wrapper<cl_device_id>
1907 {
1908 public:
1910  Device() : detail::Wrapper<cl_type>() { }
1911 
1916  __CL_EXPLICIT_CONSTRUCTORS Device(const cl_device_id &device) : detail::Wrapper<cl_type>(device) { }
1917 
1922  static Device getDefault(cl_int * err = NULL);
1923 
1928  Device& operator = (const cl_device_id& rhs)
1929  {
1931  return *this;
1932  }
1933 
1937  Device(const Device& dev) : detail::Wrapper<cl_type>(dev) {}
1938 
1943  {
1945  return *this;
1946  }
1947 
1948 #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
1949 
1952  Device(Device&& dev) CL_HPP_NOEXCEPT : detail::Wrapper<cl_type>(std::move(dev)) {}
1953 
1957  Device& operator = (Device &&dev)
1958  {
1959  detail::Wrapper<cl_type>::operator=(std::move(dev));
1960  return *this;
1961  }
1962 #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
1963 
1965  template <typename T>
1966  cl_int getInfo(cl_device_info name, T* param) const
1967  {
1968  return detail::errHandler(
1969  detail::getInfo(&::clGetDeviceInfo, object_, name, param),
1970  __GET_DEVICE_INFO_ERR);
1971  }
1972 
1974  template <cl_int name> typename
1976  getInfo(cl_int* err = NULL) const
1977  {
1978  typename detail::param_traits<
1979  detail::cl_device_info, name>::param_type param;
1980  cl_int result = getInfo(name, &param);
1981  if (err != NULL) {
1982  *err = result;
1983  }
1984  return param;
1985  }
1986 
1990 #if defined(CL_VERSION_1_2)
1991  cl_int createSubDevices(
1993  const cl_device_partition_property * properties,
1994  VECTOR_CLASS<Device>* devices)
1995  {
1996  cl_uint n = 0;
1997  cl_int err = clCreateSubDevices(object_, properties, 0, NULL, &n);
1998  if (err != CL_SUCCESS) {
1999  return detail::errHandler(err, __CREATE_SUB_DEVICES);
2000  }
2001 
2002  cl_device_id* ids = (cl_device_id*) alloca(n * sizeof(cl_device_id));
2003  err = clCreateSubDevices(object_, properties, n, ids, NULL);
2004  if (err != CL_SUCCESS) {
2005  return detail::errHandler(err, __CREATE_SUB_DEVICES);
2006  }
2007 
2008  devices->assign(&ids[0], &ids[n]);
2009  return CL_SUCCESS;
2010  }
2011 #endif // #if defined(CL_VERSION_1_2)
2012 
2016 #if defined(CL_VERSION_1_1)
2017 #if defined(USE_CL_DEVICE_FISSION)
2018  cl_int createSubDevices(
2019  const cl_device_partition_property_ext * properties,
2020  VECTOR_CLASS<Device>* devices)
2021  {
2022  typedef CL_API_ENTRY cl_int
2023  ( CL_API_CALL * PFN_clCreateSubDevicesEXT)(
2024  cl_device_id /*in_device*/,
2025  const cl_device_partition_property_ext * /* properties */,
2026  cl_uint /*num_entries*/,
2027  cl_device_id * /*out_devices*/,
2028  cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1;
2029 
2030  static PFN_clCreateSubDevicesEXT pfn_clCreateSubDevicesEXT = NULL;
2031  __INIT_CL_EXT_FCN_PTR(clCreateSubDevicesEXT);
2032 
2033  cl_uint n = 0;
2034  cl_int err = pfn_clCreateSubDevicesEXT(object_, properties, 0, NULL, &n);
2035  if (err != CL_SUCCESS) {
2036  return detail::errHandler(err, __CREATE_SUB_DEVICES);
2037  }
2038 
2039  cl_device_id* ids = (cl_device_id*) alloca(n * sizeof(cl_device_id));
2040  err = pfn_clCreateSubDevicesEXT(object_, properties, n, ids, NULL);
2041  if (err != CL_SUCCESS) {
2042  return detail::errHandler(err, __CREATE_SUB_DEVICES);
2043  }
2044 
2045  devices->assign(&ids[0], &ids[n]);
2046  return CL_SUCCESS;
2047  }
2048 #endif // #if defined(USE_CL_DEVICE_FISSION)
2049 #endif // #if defined(CL_VERSION_1_1)
2050 };
2051 
2059 class Platform : public detail::Wrapper<cl_platform_id>
2060 {
2061 public:
2063  Platform() : detail::Wrapper<cl_type>() { }
2064 
2069  __CL_EXPLICIT_CONSTRUCTORS Platform(const cl_platform_id &platform) : detail::Wrapper<cl_type>(platform) { }
2070 
2075  Platform& operator = (const cl_platform_id& rhs)
2076  {
2078  return *this;
2079  }
2080 
2082  cl_int getInfo(cl_platform_info name, STRING_CLASS* param) const
2083  {
2084  return detail::errHandler(
2085  detail::getInfo(&::clGetPlatformInfo, object_, name, param),
2086  __GET_PLATFORM_INFO_ERR);
2087  }
2088 
2090  template <cl_int name> typename
2092  getInfo(cl_int* err = NULL) const
2093  {
2094  typename detail::param_traits<
2095  detail::cl_platform_info, name>::param_type param;
2096  cl_int result = getInfo(name, &param);
2097  if (err != NULL) {
2098  *err = result;
2099  }
2100  return param;
2101  }
2102 
2107  cl_int getDevices(
2108  cl_device_type type,
2109  VECTOR_CLASS<Device>* devices) const
2110  {
2111  cl_uint n = 0;
2112  if( devices == NULL ) {
2113  return detail::errHandler(CL_INVALID_ARG_VALUE, __GET_DEVICE_IDS_ERR);
2114  }
2115  cl_int err = ::clGetDeviceIDs(object_, type, 0, NULL, &n);
2116  if (err != CL_SUCCESS) {
2117  return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
2118  }
2119 
2120  cl_device_id* ids = (cl_device_id*) alloca(n * sizeof(cl_device_id));
2121  err = ::clGetDeviceIDs(object_, type, n, ids, NULL);
2122  if (err != CL_SUCCESS) {
2123  return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
2124  }
2125 
2126  devices->assign(&ids[0], &ids[n]);
2127  return CL_SUCCESS;
2128  }
2129 
2130 #if defined(USE_DX_INTEROP)
2131 
2154  cl_int getDevices(
2155  cl_d3d10_device_source_khr d3d_device_source,
2156  void * d3d_object,
2157  cl_d3d10_device_set_khr d3d_device_set,
2158  VECTOR_CLASS<Device>* devices) const
2159  {
2160  typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clGetDeviceIDsFromD3D10KHR)(
2161  cl_platform_id platform,
2162  cl_d3d10_device_source_khr d3d_device_source,
2163  void * d3d_object,
2164  cl_d3d10_device_set_khr d3d_device_set,
2165  cl_uint num_entries,
2166  cl_device_id * devices,
2167  cl_uint* num_devices);
2168 
2169  if( devices == NULL ) {
2170  return detail::errHandler(CL_INVALID_ARG_VALUE, __GET_DEVICE_IDS_ERR);
2171  }
2172 
2173  static PFN_clGetDeviceIDsFromD3D10KHR pfn_clGetDeviceIDsFromD3D10KHR = NULL;
2174  __INIT_CL_EXT_FCN_PTR_PLATFORM(object_, clGetDeviceIDsFromD3D10KHR);
2175 
2176  cl_uint n = 0;
2177  cl_int err = pfn_clGetDeviceIDsFromD3D10KHR(
2178  object_,
2179  d3d_device_source,
2180  d3d_object,
2181  d3d_device_set,
2182  0,
2183  NULL,
2184  &n);
2185  if (err != CL_SUCCESS) {
2186  return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
2187  }
2188 
2189  cl_device_id* ids = (cl_device_id*) alloca(n * sizeof(cl_device_id));
2190  err = pfn_clGetDeviceIDsFromD3D10KHR(
2191  object_,
2192  d3d_device_source,
2193  d3d_object,
2194  d3d_device_set,
2195  n,
2196  ids,
2197  NULL);
2198  if (err != CL_SUCCESS) {
2199  return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
2200  }
2201 
2202  devices->assign(&ids[0], &ids[n]);
2203  return CL_SUCCESS;
2204  }
2205 #endif
2206 
2211  static cl_int get(
2212  VECTOR_CLASS<Platform>* platforms)
2213  {
2214  cl_uint n = 0;
2215 
2216  if( platforms == NULL ) {
2217  return detail::errHandler(CL_INVALID_ARG_VALUE, __GET_PLATFORM_IDS_ERR);
2218  }
2219 
2220  cl_int err = ::clGetPlatformIDs(0, NULL, &n);
2221  if (err != CL_SUCCESS) {
2222  return detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
2223  }
2224 
2225  cl_platform_id* ids = (cl_platform_id*) alloca(
2226  n * sizeof(cl_platform_id));
2227  err = ::clGetPlatformIDs(n, ids, NULL);
2228  if (err != CL_SUCCESS) {
2229  return detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
2230  }
2231 
2232  platforms->assign(&ids[0], &ids[n]);
2233  return CL_SUCCESS;
2234  }
2235 
2240  static cl_int get(
2241  Platform * platform)
2242  {
2243  cl_uint n = 0;
2244 
2245  if( platform == NULL ) {
2246  return detail::errHandler(CL_INVALID_ARG_VALUE, __GET_PLATFORM_IDS_ERR);
2247  }
2248 
2249  cl_int err = ::clGetPlatformIDs(0, NULL, &n);
2250  if (err != CL_SUCCESS) {
2251  return detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
2252  }
2253 
2254  cl_platform_id* ids = (cl_platform_id*) alloca(
2255  n * sizeof(cl_platform_id));
2256  err = ::clGetPlatformIDs(n, ids, NULL);
2257  if (err != CL_SUCCESS) {
2258  return detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
2259  }
2260 
2261  *platform = ids[0];
2262  return CL_SUCCESS;
2263  }
2264 
2269  static Platform get(
2270  cl_int * errResult = NULL)
2271  {
2272  Platform platform;
2273  cl_uint n = 0;
2274  cl_int err = ::clGetPlatformIDs(0, NULL, &n);
2275  if (err != CL_SUCCESS) {
2276  detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
2277  if (errResult != NULL) {
2278  *errResult = err;
2279  }
2280  return Platform();
2281  }
2282 
2283  cl_platform_id* ids = (cl_platform_id*) alloca(
2284  n * sizeof(cl_platform_id));
2285  err = ::clGetPlatformIDs(n, ids, NULL);
2286 
2287  if (err != CL_SUCCESS) {
2288  detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
2289  if (errResult != NULL) {
2290  *errResult = err;
2291  }
2292  return Platform();
2293  }
2294 
2295 
2296  return Platform(ids[0]);
2297  }
2298 
2300  cl_int *errResult = NULL )
2301  {
2302  return get(errResult);
2303  }
2304 
2305 
2306 #if defined(CL_VERSION_1_2)
2307  cl_int
2309  unloadCompiler()
2310  {
2311  return ::clUnloadPlatformCompiler(object_);
2312  }
2313 #endif // #if defined(CL_VERSION_1_2)
2314 }; // class Platform
2315 
2319 #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS) || (defined(CL_VERSION_1_1) && !defined(CL_VERSION_1_2))
2320 
2325 UnloadCompiler() CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
2326 inline cl_int
2327 UnloadCompiler()
2328 {
2329  return ::clUnloadCompiler();
2330 }
2331 #endif // #if defined(CL_VERSION_1_1)
2332 
2341 class Context
2342  : public detail::Wrapper<cl_context>
2343 {
2344 private:
2345 
2346 #ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED
2347  static std::atomic<int> default_initialized_;
2348 #else // !CL_HPP_CPP11_ATOMICS_SUPPORTED
2349  static volatile int default_initialized_;
2350 #endif // !CL_HPP_CPP11_ATOMICS_SUPPORTED
2351  static Context default_;
2352  static volatile cl_int default_error_;
2353 public:
2359  const VECTOR_CLASS<Device>& devices,
2360  cl_context_properties* properties = NULL,
2361  void (CL_CALLBACK * notifyFptr)(
2362  const char *,
2363  const void *,
2364  ::size_t,
2365  void *) = NULL,
2366  void* data = NULL,
2367  cl_int* err = NULL)
2368  {
2369  cl_int error;
2370 
2371  ::size_t numDevices = devices.size();
2372  cl_device_id* deviceIDs = (cl_device_id*) alloca(numDevices * sizeof(cl_device_id));
2373  for( ::size_t deviceIndex = 0; deviceIndex < numDevices; ++deviceIndex ) {
2374  deviceIDs[deviceIndex] = (devices[deviceIndex])();
2375  }
2376 
2377  object_ = ::clCreateContext(
2378  properties, (cl_uint) numDevices,
2379  deviceIDs,
2380  notifyFptr, data, &error);
2381 
2382  detail::errHandler(error, __CREATE_CONTEXT_ERR);
2383  if (err != NULL) {
2384  *err = error;
2385  }
2386  }
2387 
2389  const Device& device,
2390  cl_context_properties* properties = NULL,
2391  void (CL_CALLBACK * notifyFptr)(
2392  const char *,
2393  const void *,
2394  ::size_t,
2395  void *) = NULL,
2396  void* data = NULL,
2397  cl_int* err = NULL)
2398  {
2399  cl_int error;
2400 
2401  cl_device_id deviceID = device();
2402 
2403  object_ = ::clCreateContext(
2404  properties, 1,
2405  &deviceID,
2406  notifyFptr, data, &error);
2407 
2408  detail::errHandler(error, __CREATE_CONTEXT_ERR);
2409  if (err != NULL) {
2410  *err = error;
2411  }
2412  }
2413 
2419  cl_device_type type,
2420  cl_context_properties* properties = NULL,
2421  void (CL_CALLBACK * notifyFptr)(
2422  const char *,
2423  const void *,
2424  ::size_t,
2425  void *) = NULL,
2426  void* data = NULL,
2427  cl_int* err = NULL)
2428  {
2429  cl_int error;
2430 
2431 #if !defined(__APPLE__) && !defined(__MACOS)
2432  cl_context_properties prop[4] = {CL_CONTEXT_PLATFORM, 0, 0, 0 };
2433 
2434  if (properties == NULL) {
2435  // Get a valid platform ID as we cannot send in a blank one
2436  VECTOR_CLASS<Platform> platforms;
2437  error = Platform::get(&platforms);
2438  if (error != CL_SUCCESS) {
2439  detail::errHandler(error, __CREATE_CONTEXT_FROM_TYPE_ERR);
2440  if (err != NULL) {
2441  *err = error;
2442  }
2443  return;
2444  }
2445 
2446  // Check the platforms we found for a device of our specified type
2447  cl_context_properties platform_id = 0;
2448  for (unsigned int i = 0; i < platforms.size(); i++) {
2449 
2450  VECTOR_CLASS<Device> devices;
2451 
2452 #if defined(__CL_ENABLE_EXCEPTIONS)
2453  try {
2454 #endif
2455 
2456  error = platforms[i].getDevices(type, &devices);
2457 
2458 #if defined(__CL_ENABLE_EXCEPTIONS)
2459  } catch (Error) {}
2460  // Catch if exceptions are enabled as we don't want to exit if first platform has no devices of type
2461  // We do error checking next anyway, and can throw there if needed
2462 #endif
2463 
2464  // Only squash CL_SUCCESS and CL_DEVICE_NOT_FOUND
2465  if (error != CL_SUCCESS && error != CL_DEVICE_NOT_FOUND) {
2466  detail::errHandler(error, __CREATE_CONTEXT_FROM_TYPE_ERR);
2467  if (err != NULL) {
2468  *err = error;
2469  }
2470  }
2471 
2472  if (devices.size() > 0) {
2473  platform_id = (cl_context_properties)platforms[i]();
2474  break;
2475  }
2476  }
2477 
2478  if (platform_id == 0) {
2479  detail::errHandler(CL_DEVICE_NOT_FOUND, __CREATE_CONTEXT_FROM_TYPE_ERR);
2480  if (err != NULL) {
2481  *err = CL_DEVICE_NOT_FOUND;
2482  }
2483  return;
2484  }
2485 
2486  prop[1] = platform_id;
2487  properties = &prop[0];
2488  }
2489 #endif
2490  object_ = ::clCreateContextFromType(
2491  properties, type, notifyFptr, data, &error);
2492 
2493  detail::errHandler(error, __CREATE_CONTEXT_FROM_TYPE_ERR);
2494  if (err != NULL) {
2495  *err = error;
2496  }
2497  }
2498 
2502  Context(const Context& ctx) : detail::Wrapper<cl_type>(ctx) {}
2503 
2508  {
2510  return *this;
2511  }
2512 
2513 #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
2514 
2517  Context(Context&& ctx) CL_HPP_NOEXCEPT : detail::Wrapper<cl_type>(std::move(ctx)) {}
2518 
2522  Context& operator = (Context &&ctx)
2523  {
2524  detail::Wrapper<cl_type>::operator=(std::move(ctx));
2525  return *this;
2526  }
2527 #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
2528 
2533  static Context getDefault(cl_int * err = NULL)
2534  {
2535  int state = detail::compare_exchange(
2536  &default_initialized_,
2538 
2539  if (state & __DEFAULT_INITIALIZED) {
2540  if (err != NULL) {
2541  *err = default_error_;
2542  }
2543  return default_;
2544  }
2545 
2546  if (state & __DEFAULT_BEING_INITIALIZED) {
2547  // Assume writes will propagate eventually...
2548  while(default_initialized_ != __DEFAULT_INITIALIZED) {
2549  detail::fence();
2550  }
2551 
2552  if (err != NULL) {
2553  *err = default_error_;
2554  }
2555  return default_;
2556  }
2557 
2558  cl_int error;
2559  default_ = Context(
2560  CL_DEVICE_TYPE_DEFAULT,
2561  NULL,
2562  NULL,
2563  NULL,
2564  &error);
2565 
2566  detail::fence();
2567 
2568  default_error_ = error;
2569  // Assume writes will propagate eventually...
2570  default_initialized_ = __DEFAULT_INITIALIZED;
2571 
2572  detail::fence();
2573 
2574  if (err != NULL) {
2575  *err = default_error_;
2576  }
2577  return default_;
2578 
2579  }
2580 
2582  Context() : detail::Wrapper<cl_type>() { }
2583 
2589  __CL_EXPLICIT_CONSTRUCTORS Context(const cl_context& context) : detail::Wrapper<cl_type>(context) { }
2590 
2596  Context& operator = (const cl_context& rhs)
2597  {
2599  return *this;
2600  }
2601 
2603  template <typename T>
2604  cl_int getInfo(cl_context_info name, T* param) const
2605  {
2606  return detail::errHandler(
2607  detail::getInfo(&::clGetContextInfo, object_, name, param),
2608  __GET_CONTEXT_INFO_ERR);
2609  }
2610 
2612  template <cl_int name> typename
2614  getInfo(cl_int* err = NULL) const
2615  {
2616  typename detail::param_traits<
2617  detail::cl_context_info, name>::param_type param;
2618  cl_int result = getInfo(name, &param);
2619  if (err != NULL) {
2620  *err = result;
2621  }
2622  return param;
2623  }
2624 
2630  cl_mem_flags flags,
2631  cl_mem_object_type type,
2632  VECTOR_CLASS<ImageFormat>* formats) const
2633  {
2634  cl_uint numEntries;
2635  cl_int err = ::clGetSupportedImageFormats(
2636  object_,
2637  flags,
2638  type,
2639  0,
2640  NULL,
2641  &numEntries);
2642  if (err != CL_SUCCESS) {
2643  return detail::errHandler(err, __GET_SUPPORTED_IMAGE_FORMATS_ERR);
2644  }
2645 
2646  ImageFormat* value = (ImageFormat*)
2647  alloca(numEntries * sizeof(ImageFormat));
2648  err = ::clGetSupportedImageFormats(
2649  object_,
2650  flags,
2651  type,
2652  numEntries,
2653  (cl_image_format*) value,
2654  NULL);
2655  if (err != CL_SUCCESS) {
2656  return detail::errHandler(err, __GET_SUPPORTED_IMAGE_FORMATS_ERR);
2657  }
2658 
2659  formats->assign(&value[0], &value[numEntries]);
2660  return CL_SUCCESS;
2661  }
2662 };
2663 
2664 inline Device Device::getDefault(cl_int * err)
2665 {
2666  cl_int error;
2667  Device device;
2668 
2669  Context context = Context::getDefault(&error);
2670  detail::errHandler(error, __CREATE_CONTEXT_ERR);
2671 
2672  if (error != CL_SUCCESS) {
2673  if (err != NULL) {
2674  *err = error;
2675  }
2676  }
2677  else {
2678  device = context.getInfo<CL_CONTEXT_DEVICES>()[0];
2679  if (err != NULL) {
2680  *err = CL_SUCCESS;
2681  }
2682  }
2683 
2684  return device;
2685 }
2686 
2687 
2688 #ifdef _WIN32
2689 #ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED
2690 __declspec(selectany) std::atomic<int> Context::default_initialized_;
2691 #else // !CL_HPP_CPP11_ATOMICS_SUPPORTED
2692 __declspec(selectany) volatile int Context::default_initialized_ = __DEFAULT_NOT_INITIALIZED;
2693 #endif // !CL_HPP_CPP11_ATOMICS_SUPPORTED
2694 __declspec(selectany) Context Context::default_;
2695 __declspec(selectany) volatile cl_int Context::default_error_ = CL_SUCCESS;
2696 #else // !_WIN32
2697 #ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED
2698 __attribute__((weak)) std::atomic<int> Context::default_initialized_;
2699 #else // !CL_HPP_CPP11_ATOMICS_SUPPORTED
2700 __attribute__((weak)) volatile int Context::default_initialized_ = __DEFAULT_NOT_INITIALIZED;
2701 #endif // !CL_HPP_CPP11_ATOMICS_SUPPORTED
2702 __attribute__((weak)) Context Context::default_;
2703 __attribute__((weak)) volatile cl_int Context::default_error_ = CL_SUCCESS;
2704 #endif // !_WIN32
2705 
2714 class Event : public detail::Wrapper<cl_event>
2715 {
2716 public:
2718  Event() : detail::Wrapper<cl_type>() { }
2719 
2725  __CL_EXPLICIT_CONSTRUCTORS Event(const cl_event& event) : detail::Wrapper<cl_type>(event) { }
2726 
2732  Event& operator = (const cl_event& rhs)
2733  {
2735  return *this;
2736  }
2737 
2739  template <typename T>
2740  cl_int getInfo(cl_event_info name, T* param) const
2741  {
2742  return detail::errHandler(
2743  detail::getInfo(&::clGetEventInfo, object_, name, param),
2744  __GET_EVENT_INFO_ERR);
2745  }
2746 
2748  template <cl_int name> typename
2750  getInfo(cl_int* err = NULL) const
2751  {
2752  typename detail::param_traits<
2753  detail::cl_event_info, name>::param_type param;
2754  cl_int result = getInfo(name, &param);
2755  if (err != NULL) {
2756  *err = result;
2757  }
2758  return param;
2759  }
2760 
2762  template <typename T>
2763  cl_int getProfilingInfo(cl_profiling_info name, T* param) const
2764  {
2765  return detail::errHandler(detail::getInfo(
2766  &::clGetEventProfilingInfo, object_, name, param),
2767  __GET_EVENT_PROFILE_INFO_ERR);
2768  }
2769 
2771  template <cl_int name> typename
2773  getProfilingInfo(cl_int* err = NULL) const
2774  {
2775  typename detail::param_traits<
2776  detail::cl_profiling_info, name>::param_type param;
2777  cl_int result = getProfilingInfo(name, &param);
2778  if (err != NULL) {
2779  *err = result;
2780  }
2781  return param;
2782  }
2783 
2788  cl_int wait() const
2789  {
2790  return detail::errHandler(
2791  ::clWaitForEvents(1, &object_),
2792  __WAIT_FOR_EVENTS_ERR);
2793  }
2794 
2795 #if defined(CL_VERSION_1_1)
2796 
2800  cl_int setCallback(
2801  cl_int type,
2802  void (CL_CALLBACK * pfn_notify)(cl_event, cl_int, void *),
2803  void * user_data = NULL)
2804  {
2805  return detail::errHandler(
2806  ::clSetEventCallback(
2807  object_,
2808  type,
2809  pfn_notify,
2810  user_data),
2811  __SET_EVENT_CALLBACK_ERR);
2812  }
2813 #endif
2814 
2819  static cl_int
2820  waitForEvents(const VECTOR_CLASS<Event>& events)
2821  {
2822  return detail::errHandler(
2823  ::clWaitForEvents(
2824  (cl_uint) events.size(), (events.size() > 0) ? (cl_event*)&events.front() : NULL),
2825  __WAIT_FOR_EVENTS_ERR);
2826  }
2827 };
2828 
2829 #if defined(CL_VERSION_1_1)
2830 
2834 class UserEvent : public Event
2835 {
2836 public:
2841  UserEvent(
2842  const Context& context,
2843  cl_int * err = NULL)
2844  {
2845  cl_int error;
2846  object_ = ::clCreateUserEvent(
2847  context(),
2848  &error);
2849 
2850  detail::errHandler(error, __CREATE_USER_EVENT_ERR);
2851  if (err != NULL) {
2852  *err = error;
2853  }
2854  }
2855 
2857  UserEvent() : Event() { }
2858 
2863  cl_int setStatus(cl_int status)
2864  {
2865  return detail::errHandler(
2866  ::clSetUserEventStatus(object_,status),
2867  __SET_USER_EVENT_STATUS_ERR);
2868  }
2869 };
2870 #endif
2871 
2876 inline static cl_int
2877 WaitForEvents(const VECTOR_CLASS<Event>& events)
2878 {
2879  return detail::errHandler(
2880  ::clWaitForEvents(
2881  (cl_uint) events.size(), (events.size() > 0) ? (cl_event*)&events.front() : NULL),
2882  __WAIT_FOR_EVENTS_ERR);
2883 }
2884 
2893 class Memory : public detail::Wrapper<cl_mem>
2894 {
2895 public:
2897  Memory() : detail::Wrapper<cl_type>() { }
2898 
2904  __CL_EXPLICIT_CONSTRUCTORS Memory(const cl_mem& memory) : detail::Wrapper<cl_type>(memory) { }
2905 
2911  Memory& operator = (const cl_mem& rhs)
2912  {
2914  return *this;
2915  }
2916 
2920  Memory(const Memory& mem) : detail::Wrapper<cl_type>(mem) {}
2921 
2926  {
2928  return *this;
2929  }
2930 
2931 #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
2932 
2935  Memory(Memory&& mem) CL_HPP_NOEXCEPT : detail::Wrapper<cl_type>(std::move(mem)) {}
2936 
2940  Memory& operator = (Memory &&mem)
2941  {
2942  detail::Wrapper<cl_type>::operator=(std::move(mem));
2943  return *this;
2944  }
2945 #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
2946 
2948  template <typename T>
2949  cl_int getInfo(cl_mem_info name, T* param) const
2950  {
2951  return detail::errHandler(
2952  detail::getInfo(&::clGetMemObjectInfo, object_, name, param),
2953  __GET_MEM_OBJECT_INFO_ERR);
2954  }
2955 
2957  template <cl_int name> typename
2959  getInfo(cl_int* err = NULL) const
2960  {
2961  typename detail::param_traits<
2962  detail::cl_mem_info, name>::param_type param;
2963  cl_int result = getInfo(name, &param);
2964  if (err != NULL) {
2965  *err = result;
2966  }
2967  return param;
2968  }
2969 
2970 #if defined(CL_VERSION_1_1)
2971 
2984  cl_int setDestructorCallback(
2985  void (CL_CALLBACK * pfn_notify)(cl_mem, void *),
2986  void * user_data = NULL)
2987  {
2988  return detail::errHandler(
2989  ::clSetMemObjectDestructorCallback(
2990  object_,
2991  pfn_notify,
2992  user_data),
2993  __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR);
2994  }
2995 #endif
2996 
2997 };
2998 
2999 // Pre-declare copy functions
3000 class Buffer;
3001 template< typename IteratorType >
3002 cl_int copy( IteratorType startIterator, IteratorType endIterator, cl::Buffer &buffer );
3003 template< typename IteratorType >
3004 cl_int copy( const cl::Buffer &buffer, IteratorType startIterator, IteratorType endIterator );
3005 template< typename IteratorType >
3006 cl_int copy( const CommandQueue &queue, IteratorType startIterator, IteratorType endIterator, cl::Buffer &buffer );
3007 template< typename IteratorType >
3008 cl_int copy( const CommandQueue &queue, const cl::Buffer &buffer, IteratorType startIterator, IteratorType endIterator );
3009 
3010 
3017 class Buffer : public Memory
3018 {
3019 public:
3020 
3029  const Context& context,
3030  cl_mem_flags flags,
3031  ::size_t size,
3032  void* host_ptr = NULL,
3033  cl_int* err = NULL)
3034  {
3035  cl_int error;
3036  object_ = ::clCreateBuffer(context(), flags, size, host_ptr, &error);
3037 
3038  detail::errHandler(error, __CREATE_BUFFER_ERR);
3039  if (err != NULL) {
3040  *err = error;
3041  }
3042  }
3043 
3054  cl_mem_flags flags,
3055  ::size_t size,
3056  void* host_ptr = NULL,
3057  cl_int* err = NULL)
3058  {
3059  cl_int error;
3060 
3061  Context context = Context::getDefault(err);
3062 
3063  object_ = ::clCreateBuffer(context(), flags, size, host_ptr, &error);
3064 
3065  detail::errHandler(error, __CREATE_BUFFER_ERR);
3066  if (err != NULL) {
3067  *err = error;
3068  }
3069  }
3070 
3076  template< typename IteratorType >
3078  IteratorType startIterator,
3079  IteratorType endIterator,
3080  bool readOnly,
3081  bool useHostPtr = false,
3082  cl_int* err = NULL)
3083  {
3084  typedef typename std::iterator_traits<IteratorType>::value_type DataType;
3085  cl_int error;
3086 
3087  cl_mem_flags flags = 0;
3088  if( readOnly ) {
3089  flags |= CL_MEM_READ_ONLY;
3090  }
3091  else {
3092  flags |= CL_MEM_READ_WRITE;
3093  }
3094  if( useHostPtr ) {
3095  flags |= CL_MEM_USE_HOST_PTR;
3096  }
3097 
3098  ::size_t size = sizeof(DataType)*(endIterator - startIterator);
3099 
3100  Context context = Context::getDefault(err);
3101 
3102  if( useHostPtr ) {
3103  object_ = ::clCreateBuffer(context(), flags, size, static_cast<DataType*>(&*startIterator), &error);
3104  } else {
3105  object_ = ::clCreateBuffer(context(), flags, size, 0, &error);
3106  }
3107 
3108  detail::errHandler(error, __CREATE_BUFFER_ERR);
3109  if (err != NULL) {
3110  *err = error;
3111  }
3112 
3113  if( !useHostPtr ) {
3114  error = cl::copy(startIterator, endIterator, *this);
3115  detail::errHandler(error, __CREATE_BUFFER_ERR);
3116  if (err != NULL) {
3117  *err = error;
3118  }
3119  }
3120  }
3121 
3127  template< typename IteratorType >
3128  Buffer(const Context &context, IteratorType startIterator, IteratorType endIterator,
3129  bool readOnly, bool useHostPtr = false, cl_int* err = NULL);
3130 
3135  template< typename IteratorType >
3136  Buffer(const CommandQueue &queue, IteratorType startIterator, IteratorType endIterator,
3137  bool readOnly, bool useHostPtr = false, cl_int* err = NULL);
3138 
3140  Buffer() : Memory() { }
3141 
3146  __CL_EXPLICIT_CONSTRUCTORS Buffer(const cl_mem& buffer) : Memory(buffer) { }
3147 
3152  Buffer& operator = (const cl_mem& rhs)
3153  {
3154  Memory::operator=(rhs);
3155  return *this;
3156  }
3157 
3161  Buffer(const Buffer& buf) : Memory(buf) {}
3162 
3167  {
3168  Memory::operator=(buf);
3169  return *this;
3170  }
3171 
3172 #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
3173 
3176  Buffer(Buffer&& buf) CL_HPP_NOEXCEPT : Memory(std::move(buf)) {}
3177 
3181  Buffer& operator = (Buffer &&buf)
3182  {
3183  Memory::operator=(std::move(buf));
3184  return *this;
3185  }
3186 #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
3187 
3188 #if defined(CL_VERSION_1_1)
3189 
3193  Buffer createSubBuffer(
3194  cl_mem_flags flags,
3195  cl_buffer_create_type buffer_create_type,
3196  const void * buffer_create_info,
3197  cl_int * err = NULL)
3198  {
3199  Buffer result;
3200  cl_int error;
3201  result.object_ = ::clCreateSubBuffer(
3202  object_,
3203  flags,
3204  buffer_create_type,
3205  buffer_create_info,
3206  &error);
3207 
3208  detail::errHandler(error, __CREATE_SUBBUFFER_ERR);
3209  if (err != NULL) {
3210  *err = error;
3211  }
3212 
3213  return result;
3214  }
3215 #endif
3216 };
3217 
3218 #if defined (USE_DX_INTEROP)
3219 
3227 class BufferD3D10 : public Buffer
3228 {
3229 public:
3230  typedef CL_API_ENTRY cl_mem (CL_API_CALL *PFN_clCreateFromD3D10BufferKHR)(
3231  cl_context context, cl_mem_flags flags, ID3D10Buffer* buffer,
3232  cl_int* errcode_ret);
3233 
3239  BufferD3D10(
3240  const Context& context,
3241  cl_mem_flags flags,
3242  ID3D10Buffer* bufobj,
3243  cl_int * err = NULL)
3244  {
3245  static PFN_clCreateFromD3D10BufferKHR pfn_clCreateFromD3D10BufferKHR = NULL;
3246 
3247 #if defined(CL_VERSION_1_2)
3248  vector<cl_context_properties> props = context.getInfo<CL_CONTEXT_PROPERTIES>();
3249  cl_platform platform = -1;
3250  for( int i = 0; i < props.size(); ++i ) {
3251  if( props[i] == CL_CONTEXT_PLATFORM ) {
3252  platform = props[i+1];
3253  }
3254  }
3255  __INIT_CL_EXT_FCN_PTR_PLATFORM(platform, clCreateFromD3D10BufferKHR);
3256 #endif
3257 #if defined(CL_VERSION_1_1)
3258  __INIT_CL_EXT_FCN_PTR(clCreateFromD3D10BufferKHR);
3259 #endif
3260 
3261  cl_int error;
3262  object_ = pfn_clCreateFromD3D10BufferKHR(
3263  context(),
3264  flags,
3265  bufobj,
3266  &error);
3267 
3268  detail::errHandler(error, __CREATE_GL_BUFFER_ERR);
3269  if (err != NULL) {
3270  *err = error;
3271  }
3272  }
3273 
3275  BufferD3D10() : Buffer() { }
3276 
3281  __CL_EXPLICIT_CONSTRUCTORS BufferD3D10(const cl_mem& buffer) : Buffer(buffer) { }
3282 
3287  BufferD3D10& operator = (const cl_mem& rhs)
3288  {
3289  Buffer::operator=(rhs);
3290  return *this;
3291  }
3292 
3296  BufferD3D10(const BufferD3D10& buf) : Buffer(buf) {}
3297 
3301  BufferD3D10& operator = (const BufferD3D10 &buf)
3302  {
3303  Buffer::operator=(buf);
3304  return *this;
3305  }
3306 
3307 #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
3308 
3311  BufferD3D10(BufferD3D10&& buf) CL_HPP_NOEXCEPT : Buffer(std::move(buf)) {}
3312 
3316  BufferD3D10& operator = (BufferD3D10 &&buf)
3317  {
3318  Buffer::operator=(std::move(buf));
3319  return *this;
3320  }
3321 #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
3322 };
3323 #endif
3324 
3333 class BufferGL : public Buffer
3334 {
3335 public:
3342  const Context& context,
3343  cl_mem_flags flags,
3344  cl_GLuint bufobj,
3345  cl_int * err = NULL)
3346  {
3347  cl_int error;
3348  object_ = ::clCreateFromGLBuffer(
3349  context(),
3350  flags,
3351  bufobj,
3352  &error);
3353 
3354  detail::errHandler(error, __CREATE_GL_BUFFER_ERR);
3355  if (err != NULL) {
3356  *err = error;
3357  }
3358  }
3359 
3361  BufferGL() : Buffer() { }
3362 
3367  __CL_EXPLICIT_CONSTRUCTORS BufferGL(const cl_mem& buffer) : Buffer(buffer) { }
3368 
3373  BufferGL& operator = (const cl_mem& rhs)
3374  {
3375  Buffer::operator=(rhs);
3376  return *this;
3377  }
3378 
3382  BufferGL(const BufferGL& buf) : Buffer(buf) {}
3383 
3388  {
3389  Buffer::operator=(buf);
3390  return *this;
3391  }
3392 
3393 #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
3394 
3397  BufferGL(BufferGL&& buf) CL_HPP_NOEXCEPT : Buffer(std::move(buf)) {}
3398 
3402  BufferGL& operator = (BufferGL &&buf)
3403  {
3404  Buffer::operator=(std::move(buf));
3405  return *this;
3406  }
3407 #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
3408 
3411  cl_gl_object_type *type,
3412  cl_GLuint * gl_object_name)
3413  {
3414  return detail::errHandler(
3415  ::clGetGLObjectInfo(object_,type,gl_object_name),
3416  __GET_GL_OBJECT_INFO_ERR);
3417  }
3418 };
3419 
3426 class Image : public Memory
3427 {
3428 protected:
3430  Image() : Memory() { }
3431 
3436  __CL_EXPLICIT_CONSTRUCTORS Image(const cl_mem& image) : Memory(image) { }
3437 
3442  Image& operator = (const cl_mem& rhs)
3443  {
3444  Memory::operator=(rhs);
3445  return *this;
3446  }
3447 
3451  Image(const Image& img) : Memory(img) {}
3452 
3456  Image& operator = (const Image &img)
3457  {
3458  Memory::operator=(img);
3459  return *this;
3460  }
3461 
3462 #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
3463 
3466  Image(Image&& img) CL_HPP_NOEXCEPT : Memory(std::move(img)) {}
3467 
3471  Image& operator = (Image &&img)
3472  {
3473  Memory::operator=(std::move(img));
3474  return *this;
3475  }
3476 #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
3477 
3478 public:
3480  template <typename T>
3481  cl_int getImageInfo(cl_image_info name, T* param) const
3482  {
3483  return detail::errHandler(
3484  detail::getInfo(&::clGetImageInfo, object_, name, param),
3485  __GET_IMAGE_INFO_ERR);
3486  }
3487 
3489  template <cl_int name> typename
3491  getImageInfo(cl_int* err = NULL) const
3492  {
3493  typename detail::param_traits<
3494  detail::cl_image_info, name>::param_type param;
3495  cl_int result = getImageInfo(name, &param);
3496  if (err != NULL) {
3497  *err = result;
3498  }
3499  return param;
3500  }
3501 };
3502 
3503 #if defined(CL_VERSION_1_2)
3504 
3510 class Image1D : public Image
3511 {
3512 public:
3517  Image1D(
3518  const Context& context,
3519  cl_mem_flags flags,
3520  ImageFormat format,
3521  ::size_t width,
3522  void* host_ptr = NULL,
3523  cl_int* err = NULL)
3524  {
3525  cl_int error;
3526  cl_image_desc desc =
3527  {
3528  CL_MEM_OBJECT_IMAGE1D,
3529  width,
3530  0, 0, 0, 0, 0, 0, 0, 0
3531  };
3532  object_ = ::clCreateImage(
3533  context(),
3534  flags,
3535  &format,
3536  &desc,
3537  host_ptr,
3538  &error);
3539 
3540  detail::errHandler(error, __CREATE_IMAGE_ERR);
3541  if (err != NULL) {
3542  *err = error;
3543  }
3544  }
3545 
3547  Image1D() { }
3548 
3553  __CL_EXPLICIT_CONSTRUCTORS Image1D(const cl_mem& image1D) : Image(image1D) { }
3554 
3559  Image1D& operator = (const cl_mem& rhs)
3560  {
3561  Image::operator=(rhs);
3562  return *this;
3563  }
3564 
3568  Image1D(const Image1D& img) : Image(img) {}
3569 
3573  Image1D& operator = (const Image1D &img)
3574  {
3575  Image::operator=(img);
3576  return *this;
3577  }
3578 
3579 #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
3580 
3583  Image1D(Image1D&& img) CL_HPP_NOEXCEPT : Image(std::move(img)) {}
3584 
3588  Image1D& operator = (Image1D &&img)
3589  {
3590  Image::operator=(std::move(img));
3591  return *this;
3592  }
3593 #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
3594 };
3595 
3599 class Image1DBuffer : public Image
3600 {
3601 public:
3602  Image1DBuffer(
3603  const Context& context,
3604  cl_mem_flags flags,
3605  ImageFormat format,
3606  ::size_t width,
3607  const Buffer &buffer,
3608  cl_int* err = NULL)
3609  {
3610  cl_int error;
3611  cl_image_desc desc =
3612  {
3613  CL_MEM_OBJECT_IMAGE1D_BUFFER,
3614  width,
3615  0, 0, 0, 0, 0, 0, 0,
3616  buffer()
3617  };
3618  object_ = ::clCreateImage(
3619  context(),
3620  flags,
3621  &format,
3622  &desc,
3623  NULL,
3624  &error);
3625 
3626  detail::errHandler(error, __CREATE_IMAGE_ERR);
3627  if (err != NULL) {
3628  *err = error;
3629  }
3630  }
3631 
3632  Image1DBuffer() { }
3633 
3634  __CL_EXPLICIT_CONSTRUCTORS Image1DBuffer(const cl_mem& image1D) : Image(image1D) { }
3635 
3636  Image1DBuffer& operator = (const cl_mem& rhs)
3637  {
3638  Image::operator=(rhs);
3639  return *this;
3640  }
3641 
3645  Image1DBuffer(const Image1DBuffer& img) : Image(img) {}
3646 
3650  Image1DBuffer& operator = (const Image1DBuffer &img)
3651  {
3652  Image::operator=(img);
3653  return *this;
3654  }
3655 
3656 #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
3657 
3660  Image1DBuffer(Image1DBuffer&& img) CL_HPP_NOEXCEPT : Image(std::move(img)) {}
3661 
3665  Image1DBuffer& operator = (Image1DBuffer &&img)
3666  {
3667  Image::operator=(std::move(img));
3668  return *this;
3669  }
3670 #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
3671 };
3672 
3676 class Image1DArray : public Image
3677 {
3678 public:
3679  Image1DArray(
3680  const Context& context,
3681  cl_mem_flags flags,
3682  ImageFormat format,
3683  ::size_t arraySize,
3684  ::size_t width,
3685  ::size_t rowPitch,
3686  void* host_ptr = NULL,
3687  cl_int* err = NULL)
3688  {
3689  cl_int error;
3690  cl_image_desc desc =
3691  {
3692  CL_MEM_OBJECT_IMAGE1D_ARRAY,
3693  width,
3694  0, 0, // height, depth (unused)
3695  arraySize,
3696  rowPitch,
3697  0, 0, 0, 0
3698  };
3699  object_ = ::clCreateImage(
3700  context(),
3701  flags,
3702  &format,
3703  &desc,
3704  host_ptr,
3705  &error);
3706 
3707  detail::errHandler(error, __CREATE_IMAGE_ERR);
3708  if (err != NULL) {
3709  *err = error;
3710  }
3711  }
3712 
3713  Image1DArray() { }
3714 
3715  __CL_EXPLICIT_CONSTRUCTORS Image1DArray(const cl_mem& imageArray) : Image(imageArray) { }
3716 
3717  Image1DArray& operator = (const cl_mem& rhs)
3718  {
3719  Image::operator=(rhs);
3720  return *this;
3721  }
3722 
3726  Image1DArray(const Image1DArray& img) : Image(img) {}
3727 
3731  Image1DArray& operator = (const Image1DArray &img)
3732  {
3733  Image::operator=(img);
3734  return *this;
3735  }
3736 
3737 #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
3738 
3741  Image1DArray(Image1DArray&& img) CL_HPP_NOEXCEPT : Image(std::move(img)) {}
3742 
3746  Image1DArray& operator = (Image1DArray &&img)
3747  {
3748  Image::operator=(std::move(img));
3749  return *this;
3750  }
3751 #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
3752 };
3753 #endif // #if defined(CL_VERSION_1_2)
3754 
3755 
3762 class Image2D : public Image
3763 {
3764 public:
3770  const Context& context,
3771  cl_mem_flags flags,
3772  ImageFormat format,
3773  ::size_t width,
3774  ::size_t height,
3775  ::size_t row_pitch = 0,
3776  void* host_ptr = NULL,
3777  cl_int* err = NULL)
3778  {
3779  cl_int error;
3780  bool useCreateImage;
3781 
3782 #if defined(CL_VERSION_1_2) && defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
3783  // Run-time decision based on the actual platform
3784  {
3785  cl_uint version = detail::getContextPlatformVersion(context());
3786  useCreateImage = (version >= 0x10002); // OpenCL 1.2 or above
3787  }
3788 #elif defined(CL_VERSION_1_2)
3789  useCreateImage = true;
3790 #else
3791  useCreateImage = false;
3792 #endif
3793 
3794 #if defined(CL_VERSION_1_2)
3795  if (useCreateImage)
3796  {
3797  cl_image_desc desc =
3798  {
3799  CL_MEM_OBJECT_IMAGE2D,
3800  width,
3801  height,
3802  0, 0, // depth, array size (unused)
3803  row_pitch,
3804  0, 0, 0, 0
3805  };
3806  object_ = ::clCreateImage(
3807  context(),
3808  flags,
3809  &format,
3810  &desc,
3811  host_ptr,
3812  &error);
3813 
3814  detail::errHandler(error, __CREATE_IMAGE_ERR);
3815  if (err != NULL) {
3816  *err = error;
3817  }
3818  }
3819 #endif // #if defined(CL_VERSION_1_2)
3820 #if !defined(CL_VERSION_1_2) || defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
3821  if (!useCreateImage)
3822  {
3823  object_ = ::clCreateImage2D(
3824  context(), flags,&format, width, height, row_pitch, host_ptr, &error);
3825 
3826  detail::errHandler(error, __CREATE_IMAGE2D_ERR);
3827  if (err != NULL) {
3828  *err = error;
3829  }
3830  }
3831 #endif // #if !defined(CL_VERSION_1_2) || defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
3832  }
3833 
3835  Image2D() { }
3836 
3841  __CL_EXPLICIT_CONSTRUCTORS Image2D(const cl_mem& image2D) : Image(image2D) { }
3842 
3847  Image2D& operator = (const cl_mem& rhs)
3848  {
3849  Image::operator=(rhs);
3850  return *this;
3851  }
3852 
3856  Image2D(const Image2D& img) : Image(img) {}
3857 
3862  {
3863  Image::operator=(img);
3864  return *this;
3865  }
3866 
3867 #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
3868 
3871  Image2D(Image2D&& img) CL_HPP_NOEXCEPT : Image(std::move(img)) {}
3872 
3876  Image2D& operator = (Image2D &&img)
3877  {
3878  Image::operator=(std::move(img));
3879  return *this;
3880  }
3881 #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
3882 };
3883 
3884 
3885 #if !defined(CL_VERSION_1_2)
3886 
3896 {
3897 public:
3904  const Context& context,
3905  cl_mem_flags flags,
3906  cl_GLenum target,
3907  cl_GLint miplevel,
3908  cl_GLuint texobj,
3909  cl_int * err = NULL)
3910  {
3911  cl_int error;
3912  object_ = ::clCreateFromGLTexture2D(
3913  context(),
3914  flags,
3915  target,
3916  miplevel,
3917  texobj,
3918  &error);
3919 
3920  detail::errHandler(error, __CREATE_GL_TEXTURE_2D_ERR);
3921  if (err != NULL) {
3922  *err = error;
3923  }
3924 
3925  }
3926 
3928  Image2DGL() : Image2D() { }
3929 
3934  __CL_EXPLICIT_CONSTRUCTORS Image2DGL(const cl_mem& image) : Image2D(image) { }
3935 
3940  Image2DGL& operator = (const cl_mem& rhs)
3941  {
3942  Image2D::operator=(rhs);
3943  return *this;
3944  }
3945 
3949  Image2DGL(const Image2DGL& img) : Image2D(img) {}
3950 
3954  Image2DGL& operator = (const Image2DGL &img)
3955  {
3956  Image2D::operator=(img);
3957  return *this;
3958  }
3959 
3960 #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
3961 
3964  Image2DGL(Image2DGL&& img) CL_HPP_NOEXCEPT : Image2D(std::move(img)) {}
3965 
3969  Image2DGL& operator = (Image2DGL &&img)
3970  {
3971  Image2D::operator=(std::move(img));
3972  return *this;
3973  }
3974 #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
3975 };
3976 #endif // #if !defined(CL_VERSION_1_2)
3977 
3978 #if defined(CL_VERSION_1_2)
3979 
3982 class Image2DArray : public Image
3983 {
3984 public:
3985  Image2DArray(
3986  const Context& context,
3987  cl_mem_flags flags,
3988  ImageFormat format,
3989  ::size_t arraySize,
3990  ::size_t width,
3991  ::size_t height,
3992  ::size_t rowPitch,
3993  ::size_t slicePitch,
3994  void* host_ptr = NULL,
3995  cl_int* err = NULL)
3996  {
3997  cl_int error;
3998  cl_image_desc desc =
3999  {
4000  CL_MEM_OBJECT_IMAGE2D_ARRAY,
4001  width,
4002  height,
4003  0, // depth (unused)
4004  arraySize,
4005  rowPitch,
4006  slicePitch,
4007  0, 0, 0
4008  };
4009  object_ = ::clCreateImage(
4010  context(),
4011  flags,
4012  &format,
4013  &desc,
4014  host_ptr,
4015  &error);
4016 
4017  detail::errHandler(error, __CREATE_IMAGE_ERR);
4018  if (err != NULL) {
4019  *err = error;
4020  }
4021  }
4022 
4023  Image2DArray() { }
4024 
4025  __CL_EXPLICIT_CONSTRUCTORS Image2DArray(const cl_mem& imageArray) : Image(imageArray) { }
4026 
4027  Image2DArray& operator = (const cl_mem& rhs)
4028  {
4029  Image::operator=(rhs);
4030  return *this;
4031  }
4032 
4036  Image2DArray(const Image2DArray& img) : Image(img) {}
4037 
4041  Image2DArray& operator = (const Image2DArray &img)
4042  {
4043  Image::operator=(img);
4044  return *this;
4045  }
4046 
4047 #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
4048 
4051  Image2DArray(Image2DArray&& img) CL_HPP_NOEXCEPT : Image(std::move(img)) {}
4052 
4056  Image2DArray& operator = (Image2DArray &&img)
4057  {
4058  Image::operator=(std::move(img));
4059  return *this;
4060  }
4061 #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
4062 };
4063 #endif // #if defined(CL_VERSION_1_2)
4064 
4071 class Image3D : public Image
4072 {
4073 public:
4079  const Context& context,
4080  cl_mem_flags flags,
4081  ImageFormat format,
4082  ::size_t width,
4083  ::size_t height,
4084  ::size_t depth,
4085  ::size_t row_pitch = 0,
4086  ::size_t slice_pitch = 0,
4087  void* host_ptr = NULL,
4088  cl_int* err = NULL)
4089  {
4090  cl_int error;
4091  bool useCreateImage;
4092 
4093 #if defined(CL_VERSION_1_2) && defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
4094  // Run-time decision based on the actual platform
4095  {
4096  cl_uint version = detail::getContextPlatformVersion(context());
4097  useCreateImage = (version >= 0x10002); // OpenCL 1.2 or above
4098  }
4099 #elif defined(CL_VERSION_1_2)
4100  useCreateImage = true;
4101 #else
4102  useCreateImage = false;
4103 #endif
4104 
4105 #if defined(CL_VERSION_1_2)
4106  if (useCreateImage)
4107  {
4108  cl_image_desc desc =
4109  {
4110  CL_MEM_OBJECT_IMAGE3D,
4111  width,
4112  height,
4113  depth,
4114  0, // array size (unused)
4115  row_pitch,
4116  slice_pitch,
4117  0, 0, 0
4118  };
4119  object_ = ::clCreateImage(
4120  context(),
4121  flags,
4122  &format,
4123  &desc,
4124  host_ptr,
4125  &error);
4126 
4127  detail::errHandler(error, __CREATE_IMAGE_ERR);
4128  if (err != NULL) {
4129  *err = error;
4130  }
4131  }
4132 #endif // #if defined(CL_VERSION_1_2)
4133 #if !defined(CL_VERSION_1_2) || defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
4134  if (!useCreateImage)
4135  {
4136  object_ = ::clCreateImage3D(
4137  context(), flags, &format, width, height, depth, row_pitch,
4138  slice_pitch, host_ptr, &error);
4139 
4140  detail::errHandler(error, __CREATE_IMAGE3D_ERR);
4141  if (err != NULL) {
4142  *err = error;
4143  }
4144  }
4145 #endif // #if !defined(CL_VERSION_1_2) || defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS)
4146  }
4147 
4149  Image3D() : Image() { }
4150 
4155  __CL_EXPLICIT_CONSTRUCTORS Image3D(const cl_mem& image3D) : Image(image3D) { }
4156 
4161  Image3D& operator = (const cl_mem& rhs)
4162  {
4163  Image::operator=(rhs);
4164  return *this;
4165  }
4166 
4170  Image3D(const Image3D& img) : Image(img) {}
4171 
4176  {
4177  Image::operator=(img);
4178  return *this;
4179  }
4180 
4181 #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
4182 
4185  Image3D(Image3D&& img) CL_HPP_NOEXCEPT : Image(std::move(img)) {}
4186 
4190  Image3D& operator = (Image3D &&img)
4191  {
4192  Image::operator=(std::move(img));
4193  return *this;
4194  }
4195 #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
4196 };
4197 
4198 #if !defined(CL_VERSION_1_2)
4199 
4207 class Image3DGL : public Image3D
4208 {
4209 public:
4216  const Context& context,
4217  cl_mem_flags flags,
4218  cl_GLenum target,
4219  cl_GLint miplevel,
4220  cl_GLuint texobj,
4221  cl_int * err = NULL)
4222  {
4223  cl_int error;
4224  object_ = ::clCreateFromGLTexture3D(
4225  context(),
4226  flags,
4227  target,
4228  miplevel,
4229  texobj,
4230  &error);
4231 
4232  detail::errHandler(error, __CREATE_GL_TEXTURE_3D_ERR);
4233  if (err != NULL) {
4234  *err = error;
4235  }
4236  }
4237 
4239  Image3DGL() : Image3D() { }
4240 
4245  __CL_EXPLICIT_CONSTRUCTORS Image3DGL(const cl_mem& image) : Image3D(image) { }
4246 
4251  Image3DGL& operator = (const cl_mem& rhs)
4252  {
4253  Image3D::operator=(rhs);
4254  return *this;
4255  }
4256 
4260  Image3DGL(const Image3DGL& img) : Image3D(img) {}
4261 
4266  {
4267  Image3D::operator=(img);
4268  return *this;
4269  }
4270 
4271 #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
4272 
4275  Image3DGL(Image3DGL&& img) CL_HPP_NOEXCEPT : Image3D(std::move(img)) {}
4276 
4281  {
4282  Image3D::operator=(std::move(img));
4283  return *this;
4284  }
4285 #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
4286 };
4287 #endif // #if !defined(CL_VERSION_1_2)
4288 
4289 #if defined(CL_VERSION_1_2)
4290 
4296 class ImageGL : public Image
4297 {
4298 public:
4299  ImageGL(
4300  const Context& context,
4301  cl_mem_flags flags,
4302  cl_GLenum target,
4303  cl_GLint miplevel,
4304  cl_GLuint texobj,
4305  cl_int * err = NULL)
4306  {
4307  cl_int error;
4308  object_ = ::clCreateFromGLTexture(
4309  context(),
4310  flags,
4311  target,
4312  miplevel,
4313  texobj,
4314  &error);
4315 
4316  detail::errHandler(error, __CREATE_GL_TEXTURE_ERR);
4317  if (err != NULL) {
4318  *err = error;
4319  }
4320  }
4321 
4322  ImageGL() : Image() { }
4323 
4324  __CL_EXPLICIT_CONSTRUCTORS ImageGL(const cl_mem& image) : Image(image) { }
4325 
4326  ImageGL& operator = (const cl_mem& rhs)
4327  {
4328  Image::operator=(rhs);
4329  return *this;
4330  }
4331 
4335  ImageGL(const ImageGL& img) : Image(img) {}
4336 
4340  ImageGL& operator = (const ImageGL &img)
4341  {
4342  Image::operator=(img);
4343  return *this;
4344  }
4345 
4346 #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
4347 
4350  ImageGL(ImageGL&& img) CL_HPP_NOEXCEPT : Image(std::move(img)) {}
4351 
4355  ImageGL& operator = (ImageGL &&img)
4356  {
4357  Image::operator=(std::move(img));
4358  return *this;
4359  }
4360 #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
4361 };
4362 #endif // #if defined(CL_VERSION_1_2)
4363 
4373 #if defined(CL_VERSION_1_2)
4374  public ImageGL
4375 #else // #if defined(CL_VERSION_1_2)
4376  public Image2DGL
4377 #endif //#if defined(CL_VERSION_1_2)
4378 {
4379 public:
4386  const Context& context,
4387  cl_mem_flags flags,
4388  cl_GLuint bufobj,
4389  cl_int * err = NULL)
4390  {
4391  cl_int error;
4392  object_ = ::clCreateFromGLRenderbuffer(
4393  context(),
4394  flags,
4395  bufobj,
4396  &error);
4397 
4398  detail::errHandler(error, __CREATE_GL_RENDER_BUFFER_ERR);
4399  if (err != NULL) {
4400  *err = error;
4401  }
4402  }
4403 
4405 #if defined(CL_VERSION_1_2)
4406  BufferRenderGL() : ImageGL() {};
4407 #else // #if defined(CL_VERSION_1_2)
4408  BufferRenderGL() : Image2DGL() {};
4409 #endif //#if defined(CL_VERSION_1_2)
4410 
4415 #if defined(CL_VERSION_1_2)
4416  __CL_EXPLICIT_CONSTRUCTORS BufferRenderGL(const cl_mem& buffer) : ImageGL(buffer) { }
4417 #else // #if defined(CL_VERSION_1_2)
4418  __CL_EXPLICIT_CONSTRUCTORS BufferRenderGL(const cl_mem& buffer) : Image2DGL(buffer) { }
4419 #endif //#if defined(CL_VERSION_1_2)
4420 
4421 
4426  BufferRenderGL& operator = (const cl_mem& rhs)
4427  {
4428 #if defined(CL_VERSION_1_2)
4429  ImageGL::operator=(rhs);
4430 #else // #if defined(CL_VERSION_1_2)
4431  Image2DGL::operator=(rhs);
4432 #endif //#if defined(CL_VERSION_1_2)
4433 
4434  return *this;
4435  }
4436 
4440 #if defined(CL_VERSION_1_2)
4441  BufferRenderGL(const BufferRenderGL& buf) : ImageGL(buf) {}
4442 #else // #if defined(CL_VERSION_1_2)
4443  BufferRenderGL(const BufferRenderGL& buf) : Image2DGL(buf) {}
4444 #endif //#if defined(CL_VERSION_1_2)
4445 
4450  {
4451 #if defined(CL_VERSION_1_2)
4452  ImageGL::operator=(rhs);
4453 #else // #if defined(CL_VERSION_1_2)
4454  Image2DGL::operator=(rhs);
4455 #endif //#if defined(CL_VERSION_1_2)
4456  return *this;
4457  }
4458 
4459 #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
4460 
4463 #if defined(CL_VERSION_1_2)
4464  BufferRenderGL(BufferRenderGL&& buf) CL_HPP_NOEXCEPT : ImageGL(std::move(buf)) {}
4465 #else // #if defined(CL_VERSION_1_2)
4466  BufferRenderGL(BufferRenderGL&& buf) CL_HPP_NOEXCEPT : Image2DGL(std::move(buf)) {}
4467 #endif //#if defined(CL_VERSION_1_2)
4468 
4469 
4474  {
4475 #if defined(CL_VERSION_1_2)
4476  ImageGL::operator=(std::move(buf));
4477 #else // #if defined(CL_VERSION_1_2)
4478  Image2DGL::operator=(std::move(buf));
4479 #endif //#if defined(CL_VERSION_1_2)
4480 
4481  return *this;
4482  }
4483 #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
4484 
4487  cl_gl_object_type *type,
4488  cl_GLuint * gl_object_name)
4489  {
4490  return detail::errHandler(
4491  ::clGetGLObjectInfo(object_, type, gl_object_name),
4492  __GET_GL_OBJECT_INFO_ERR);
4493  }
4494 };
4495 
4504 class Sampler : public detail::Wrapper<cl_sampler>
4505 {
4506 public:
4508  Sampler() { }
4509 
4515  const Context& context,
4516  cl_bool normalized_coords,
4517  cl_addressing_mode addressing_mode,
4518  cl_filter_mode filter_mode,
4519  cl_int* err = NULL)
4520  {
4521  cl_int error;
4522  object_ = ::clCreateSampler(
4523  context(),
4524  normalized_coords,
4525  addressing_mode,
4526  filter_mode,
4527  &error);
4528 
4529  detail::errHandler(error, __CREATE_SAMPLER_ERR);
4530  if (err != NULL) {
4531  *err = error;
4532  }
4533  }
4534 
4540  __CL_EXPLICIT_CONSTRUCTORS Sampler(const cl_sampler& sampler) : detail::Wrapper<cl_type>(sampler) { }
4541 
4547  Sampler& operator = (const cl_sampler& rhs)
4548  {
4550  return *this;
4551  }
4552 
4556  Sampler(const Sampler& sam) : detail::Wrapper<cl_type>(sam) {}
4557 
4562  {
4564  return *this;
4565  }
4566 
4567 #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
4568 
4571  Sampler(Sampler&& sam) CL_HPP_NOEXCEPT : detail::Wrapper<cl_type>(std::move(sam)) {}
4572 
4576  Sampler& operator = (Sampler &&sam)
4577  {
4578  detail::Wrapper<cl_type>::operator=(std::move(sam));
4579  return *this;
4580  }
4581 #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
4582 
4584  template <typename T>
4585  cl_int getInfo(cl_sampler_info name, T* param) const
4586  {
4587  return detail::errHandler(
4588  detail::getInfo(&::clGetSamplerInfo, object_, name, param),
4589  __GET_SAMPLER_INFO_ERR);
4590  }
4591 
4593  template <cl_int name> typename
4595  getInfo(cl_int* err = NULL) const
4596  {
4597  typename detail::param_traits<
4598  detail::cl_sampler_info, name>::param_type param;
4599  cl_int result = getInfo(name, &param);
4600  if (err != NULL) {
4601  *err = result;
4602  }
4603  return param;
4604  }
4605 };
4606 
4607 class Program;
4608 class CommandQueue;
4609 class Kernel;
4610 
4612 class NDRange
4613 {
4614 private:
4615  size_t<3> sizes_;
4616  cl_uint dimensions_;
4617 
4618 public:
4621  : dimensions_(0)
4622  { }
4623 
4625  NDRange(::size_t size0)
4626  : dimensions_(1)
4627  {
4628  sizes_[0] = size0;
4629  }
4630 
4632  NDRange(::size_t size0, ::size_t size1)
4633  : dimensions_(2)
4634  {
4635  sizes_[0] = size0;
4636  sizes_[1] = size1;
4637  }
4638 
4640  NDRange(::size_t size0, ::size_t size1, ::size_t size2)
4641  : dimensions_(3)
4642  {
4643  sizes_[0] = size0;
4644  sizes_[1] = size1;
4645  sizes_[2] = size2;
4646  }
4647 
4652  operator const ::size_t*() const {
4653  return (const ::size_t*) sizes_;
4654  }
4655 
4657  ::size_t dimensions() const { return dimensions_; }
4658 };
4659 
4661 static const NDRange NullRange;
4662 
4665 {
4667 };
4668 
4669 namespace detail {
4670 
4671 template <typename T>
4673 {
4674  static ::size_t size(const T&) { return sizeof(T); }
4675  static const T* ptr(const T& value) { return &value; }
4676 };
4677 
4678 template <>
4680 {
4681  static ::size_t size(const LocalSpaceArg& value) { return value.size_; }
4682  static const void* ptr(const LocalSpaceArg&) { return NULL; }
4683 };
4684 
4685 }
4687 
4692 inline CL_EXT_PREFIX__VERSION_1_1_DEPRECATED LocalSpaceArg
4694 inline LocalSpaceArg
4695 __local(::size_t size)
4696 {
4697  LocalSpaceArg ret = { size };
4698  return ret;
4699 }
4700 
4704 inline LocalSpaceArg
4705 Local(::size_t size)
4706 {
4707  LocalSpaceArg ret = { size };
4708  return ret;
4709 }
4710 
4711 //class KernelFunctor;
4712 
4721 class Kernel : public detail::Wrapper<cl_kernel>
4722 {
4723 public:
4724  inline Kernel(const Program& program, const char* name, cl_int* err = NULL);
4725 
4727  Kernel() { }
4728 
4734  __CL_EXPLICIT_CONSTRUCTORS Kernel(const cl_kernel& kernel) : detail::Wrapper<cl_type>(kernel) { }
4735 
4741  Kernel& operator = (const cl_kernel& rhs)
4742  {
4744  return *this;
4745  }
4746 
4750  Kernel(const Kernel& kernel) : detail::Wrapper<cl_type>(kernel) {}
4751 
4755  Kernel& operator = (const Kernel &kernel)
4756  {
4758  return *this;
4759  }
4760 
4761 #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
4762 
4765  Kernel(Kernel&& kernel) CL_HPP_NOEXCEPT : detail::Wrapper<cl_type>(std::move(kernel)) {}
4766 
4770  Kernel& operator = (Kernel &&kernel)
4771  {
4772  detail::Wrapper<cl_type>::operator=(std::move(kernel));
4773  return *this;
4774  }
4775 #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
4776 
4777  template <typename T>
4778  cl_int getInfo(cl_kernel_info name, T* param) const
4779  {
4780  return detail::errHandler(
4781  detail::getInfo(&::clGetKernelInfo, object_, name, param),
4782  __GET_KERNEL_INFO_ERR);
4783  }
4784 
4785  template <cl_int name> typename
4787  getInfo(cl_int* err = NULL) const
4788  {
4789  typename detail::param_traits<
4790  detail::cl_kernel_info, name>::param_type param;
4791  cl_int result = getInfo(name, &param);
4792  if (err != NULL) {
4793  *err = result;
4794  }
4795  return param;
4796  }
4797 
4798 #if defined(CL_VERSION_1_2)
4799  template <typename T>
4800  cl_int getArgInfo(cl_uint argIndex, cl_kernel_arg_info name, T* param) const
4801  {
4802  return detail::errHandler(
4803  detail::getInfo(&::clGetKernelArgInfo, object_, argIndex, name, param),
4804  __GET_KERNEL_ARG_INFO_ERR);
4805  }
4806 
4807  template <cl_int name> typename
4808  detail::param_traits<detail::cl_kernel_arg_info, name>::param_type
4809  getArgInfo(cl_uint argIndex, cl_int* err = NULL) const
4810  {
4811  typename detail::param_traits<
4812  detail::cl_kernel_arg_info, name>::param_type param;
4813  cl_int result = getArgInfo(argIndex, name, &param);
4814  if (err != NULL) {
4815  *err = result;
4816  }
4817  return param;
4818  }
4819 #endif // #if defined(CL_VERSION_1_2)
4820 
4821  template <typename T>
4823  const Device& device, cl_kernel_work_group_info name, T* param) const
4824  {
4825  return detail::errHandler(
4827  &::clGetKernelWorkGroupInfo, object_, device(), name, param),
4828  __GET_KERNEL_WORK_GROUP_INFO_ERR);
4829  }
4830 
4831  template <cl_int name> typename
4833  getWorkGroupInfo(const Device& device, cl_int* err = NULL) const
4834  {
4835  typename detail::param_traits<
4836  detail::cl_kernel_work_group_info, name>::param_type param;
4837  cl_int result = getWorkGroupInfo(device, name, &param);
4838  if (err != NULL) {
4839  *err = result;
4840  }
4841  return param;
4842  }
4843 
4844  template <typename T>
4845  cl_int setArg(cl_uint index, const T &value)
4846  {
4847  return detail::errHandler(
4848  ::clSetKernelArg(
4849  object_,
4850  index,
4853  __SET_KERNEL_ARGS_ERR);
4854  }
4855 
4856  cl_int setArg(cl_uint index, ::size_t size, const void* argPtr)
4857  {
4858  return detail::errHandler(
4859  ::clSetKernelArg(object_, index, size, argPtr),
4860  __SET_KERNEL_ARGS_ERR);
4861  }
4862 };
4863 
4867 class Program : public detail::Wrapper<cl_program>
4868 {
4869 public:
4870  typedef VECTOR_CLASS<std::pair<const void*, ::size_t> > Binaries;
4871  typedef VECTOR_CLASS<std::pair<const char*, ::size_t> > Sources;
4872 
4874  const STRING_CLASS& source,
4875  bool build = false,
4876  cl_int* err = NULL)
4877  {
4878  cl_int error;
4879 
4880  const char * strings = source.c_str();
4881  const ::size_t length = source.size();
4882 
4883  Context context = Context::getDefault(err);
4884 
4885  object_ = ::clCreateProgramWithSource(
4886  context(), (cl_uint)1, &strings, &length, &error);
4887 
4888  detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR);
4889 
4890  if (error == CL_SUCCESS && build) {
4891 
4892  error = ::clBuildProgram(
4893  object_,
4894  0,
4895  NULL,
4896  "",
4897  NULL,
4898  NULL);
4899 
4900  detail::errHandler(error, __BUILD_PROGRAM_ERR);
4901  }
4902 
4903  if (err != NULL) {
4904  *err = error;
4905  }
4906  }
4907 
4909  const Context& context,
4910  const STRING_CLASS& source,
4911  bool build = false,
4912  cl_int* err = NULL)
4913  {
4914  cl_int error;
4915 
4916  const char * strings = source.c_str();
4917  const ::size_t length = source.size();
4918 
4919  object_ = ::clCreateProgramWithSource(
4920  context(), (cl_uint)1, &strings, &length, &error);
4921 
4922  detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR);
4923 
4924  if (error == CL_SUCCESS && build) {
4925 
4926  error = ::clBuildProgram(
4927  object_,
4928  0,
4929  NULL,
4930  "",
4931  NULL,
4932  NULL);
4933 
4934  detail::errHandler(error, __BUILD_PROGRAM_ERR);
4935  }
4936 
4937  if (err != NULL) {
4938  *err = error;
4939  }
4940  }
4941 
4943  const Context& context,
4944  const Sources& sources,
4945  cl_int* err = NULL)
4946  {
4947  cl_int error;
4948 
4949  const ::size_t n = (::size_t)sources.size();
4950  ::size_t* lengths = (::size_t*) alloca(n * sizeof(::size_t));
4951  const char** strings = (const char**) alloca(n * sizeof(const char*));
4952 
4953  for (::size_t i = 0; i < n; ++i) {
4954  strings[i] = sources[(int)i].first;
4955  lengths[i] = sources[(int)i].second;
4956  }
4957 
4958  object_ = ::clCreateProgramWithSource(
4959  context(), (cl_uint)n, strings, lengths, &error);
4960 
4961  detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR);
4962  if (err != NULL) {
4963  *err = error;
4964  }
4965  }
4966 
4987  const Context& context,
4988  const VECTOR_CLASS<Device>& devices,
4989  const Binaries& binaries,
4990  VECTOR_CLASS<cl_int>* binaryStatus = NULL,
4991  cl_int* err = NULL)
4992  {
4993  cl_int error;
4994 
4995  const ::size_t numDevices = devices.size();
4996 
4997  // Catch size mismatch early and return
4998  if(binaries.size() != numDevices) {
4999  error = CL_INVALID_VALUE;
5000  detail::errHandler(error, __CREATE_PROGRAM_WITH_BINARY_ERR);
5001  if (err != NULL) {
5002  *err = error;
5003  }
5004  return;
5005  }
5006 
5007  ::size_t* lengths = (::size_t*) alloca(numDevices * sizeof(::size_t));
5008  const unsigned char** images = (const unsigned char**) alloca(numDevices * sizeof(const unsigned char**));
5009 
5010  for (::size_t i = 0; i < numDevices; ++i) {
5011  images[i] = (const unsigned char*)binaries[i].first;
5012  lengths[i] = binaries[(int)i].second;
5013  }
5014 
5015  cl_device_id* deviceIDs = (cl_device_id*) alloca(numDevices * sizeof(cl_device_id));
5016  for( ::size_t deviceIndex = 0; deviceIndex < numDevices; ++deviceIndex ) {
5017  deviceIDs[deviceIndex] = (devices[deviceIndex])();
5018  }
5019 
5020  if(binaryStatus) {
5021  binaryStatus->resize(numDevices);
5022  }
5023 
5024  object_ = ::clCreateProgramWithBinary(
5025  context(), (cl_uint) devices.size(),
5026  deviceIDs,
5027  lengths, images, (binaryStatus != NULL && numDevices > 0)
5028  ? &binaryStatus->front()
5029  : NULL, &error);
5030 
5031  detail::errHandler(error, __CREATE_PROGRAM_WITH_BINARY_ERR);
5032  if (err != NULL) {
5033  *err = error;
5034  }
5035  }
5036 
5037 
5038 #if defined(CL_VERSION_1_2)
5039 
5043  Program(
5044  const Context& context,
5045  const VECTOR_CLASS<Device>& devices,
5046  const STRING_CLASS& kernelNames,
5047  cl_int* err = NULL)
5048  {
5049  cl_int error;
5050 
5051 
5052  ::size_t numDevices = devices.size();
5053  cl_device_id* deviceIDs = (cl_device_id*) alloca(numDevices * sizeof(cl_device_id));
5054  for( ::size_t deviceIndex = 0; deviceIndex < numDevices; ++deviceIndex ) {
5055  deviceIDs[deviceIndex] = (devices[deviceIndex])();
5056  }
5057 
5058  object_ = ::clCreateProgramWithBuiltInKernels(
5059  context(),
5060  (cl_uint) devices.size(),
5061  deviceIDs,
5062  kernelNames.c_str(),
5063  &error);
5064 
5065  detail::errHandler(error, __CREATE_PROGRAM_WITH_BUILT_IN_KERNELS_ERR);
5066  if (err != NULL) {
5067  *err = error;
5068  }
5069  }
5070 #endif // #if defined(CL_VERSION_1_2)
5071 
5072  Program() { }
5073 
5074  __CL_EXPLICIT_CONSTRUCTORS Program(const cl_program& program) : detail::Wrapper<cl_type>(program) { }
5075 
5076  Program& operator = (const cl_program& rhs)
5077  {
5079  return *this;
5080  }
5081 
5085  Program(const Program& program) : detail::Wrapper<cl_type>(program) {}
5086 
5090  Program& operator = (const Program &program)
5091  {
5093  return *this;
5094  }
5095 
5096 #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
5097 
5100  Program(Program&& program) CL_HPP_NOEXCEPT : detail::Wrapper<cl_type>(std::move(program)) {}
5101 
5105  Program& operator = (Program &&program)
5106  {
5107  detail::Wrapper<cl_type>::operator=(std::move(program));
5108  return *this;
5109  }
5110 #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
5111 
5112  cl_int build(
5113  const VECTOR_CLASS<Device>& devices,
5114  const char* options = NULL,
5115  void (CL_CALLBACK * notifyFptr)(cl_program, void *) = NULL,
5116  void* data = NULL) const
5117  {
5118  ::size_t numDevices = devices.size();
5119  cl_device_id* deviceIDs = (cl_device_id*) alloca(numDevices * sizeof(cl_device_id));
5120  for( ::size_t deviceIndex = 0; deviceIndex < numDevices; ++deviceIndex ) {
5121  deviceIDs[deviceIndex] = (devices[deviceIndex])();
5122  }
5123 
5124  return detail::errHandler(
5125  ::clBuildProgram(
5126  object_,
5127  (cl_uint)
5128  devices.size(),
5129  deviceIDs,
5130  options,
5131  notifyFptr,
5132  data),
5133  __BUILD_PROGRAM_ERR);
5134  }
5135 
5136  cl_int build(
5137  const char* options = NULL,
5138  void (CL_CALLBACK * notifyFptr)(cl_program, void *) = NULL,
5139  void* data = NULL) const
5140  {
5141  return detail::errHandler(
5142  ::clBuildProgram(
5143  object_,
5144  0,
5145  NULL,
5146  options,
5147  notifyFptr,
5148  data),
5149  __BUILD_PROGRAM_ERR);
5150  }
5151 
5152 #if defined(CL_VERSION_1_2)
5153  cl_int compile(
5154  const char* options = NULL,
5155  void (CL_CALLBACK * notifyFptr)(cl_program, void *) = NULL,
5156  void* data = NULL) const
5157  {
5158  return detail::errHandler(
5159  ::clCompileProgram(
5160  object_,
5161  0,
5162  NULL,
5163  options,
5164  0,
5165  NULL,
5166  NULL,
5167  notifyFptr,
5168  data),
5169  __COMPILE_PROGRAM_ERR);
5170  }
5171 #endif
5172 
5173  template <typename T>
5174  cl_int getInfo(cl_program_info name, T* param) const
5175  {
5176  return detail::errHandler(
5177  detail::getInfo(&::clGetProgramInfo, object_, name, param),
5178  __GET_PROGRAM_INFO_ERR);
5179  }
5180 
5181  template <cl_int name> typename
5183  getInfo(cl_int* err = NULL) const
5184  {
5185  typename detail::param_traits<
5186  detail::cl_program_info, name>::param_type param;
5187  cl_int result = getInfo(name, &param);
5188  if (err != NULL) {
5189  *err = result;
5190  }
5191  return param;
5192  }
5193 
5194  template <typename T>
5196  const Device& device, cl_program_build_info name, T* param) const
5197  {
5198  return detail::errHandler(
5200  &::clGetProgramBuildInfo, object_, device(), name, param),
5201  __GET_PROGRAM_BUILD_INFO_ERR);
5202  }
5203 
5204  template <cl_int name> typename
5206  getBuildInfo(const Device& device, cl_int* err = NULL) const
5207  {
5208  typename detail::param_traits<
5209  detail::cl_program_build_info, name>::param_type param;
5210  cl_int result = getBuildInfo(device, name, &param);
5211  if (err != NULL) {
5212  *err = result;
5213  }
5214  return param;
5215  }
5216 
5217  cl_int createKernels(VECTOR_CLASS<Kernel>* kernels)
5218  {
5219  cl_uint numKernels;
5220  cl_int err = ::clCreateKernelsInProgram(object_, 0, NULL, &numKernels);
5221  if (err != CL_SUCCESS) {
5222  return detail::errHandler(err, __CREATE_KERNELS_IN_PROGRAM_ERR);
5223  }
5224 
5225  Kernel* value = (Kernel*) alloca(numKernels * sizeof(Kernel));
5226  err = ::clCreateKernelsInProgram(
5227  object_, numKernels, (cl_kernel*) value, NULL);
5228  if (err != CL_SUCCESS) {
5229  return detail::errHandler(err, __CREATE_KERNELS_IN_PROGRAM_ERR);
5230  }
5231 
5232  kernels->assign(&value[0], &value[numKernels]);
5233  return CL_SUCCESS;
5234  }
5235 };
5236 
5237 #if defined(CL_VERSION_1_2)
5238 inline Program linkProgram(
5239  Program input1,
5240  Program input2,
5241  const char* options = NULL,
5242  void (CL_CALLBACK * notifyFptr)(cl_program, void *) = NULL,
5243  void* data = NULL,
5244  cl_int* err = NULL)
5245 {
5246  cl_int error_local = CL_SUCCESS;
5247 
5248  cl_program programs[2] = { input1(), input2() };
5249 
5250  Context ctx = input1.getInfo<CL_PROGRAM_CONTEXT>(&error_local);
5251  if(error_local!=CL_SUCCESS) {
5252  detail::errHandler(error_local, __LINK_PROGRAM_ERR);
5253  }
5254 
5255  cl_program prog = ::clLinkProgram(
5256  ctx(),
5257  0,
5258  NULL,
5259  options,
5260  2,
5261  programs,
5262  notifyFptr,
5263  data,
5264  &error_local);
5265 
5266  detail::errHandler(error_local,__COMPILE_PROGRAM_ERR);
5267  if (err != NULL) {
5268  *err = error_local;
5269  }
5270 
5271  return Program(prog);
5272 }
5273 
5274 inline Program linkProgram(
5275  VECTOR_CLASS<Program> inputPrograms,
5276  const char* options = NULL,
5277  void (CL_CALLBACK * notifyFptr)(cl_program, void *) = NULL,
5278  void* data = NULL,
5279  cl_int* err = NULL)
5280 {
5281  cl_int error_local = CL_SUCCESS;
5282 
5283  cl_program * programs = (cl_program*) alloca(inputPrograms.size() * sizeof(cl_program));
5284 
5285  if (programs != NULL) {
5286  for (unsigned int i = 0; i < inputPrograms.size(); i++) {
5287  programs[i] = inputPrograms[i]();
5288  }
5289  }
5290 
5291  Context ctx;
5292  if(inputPrograms.size() > 0) {
5293  ctx = inputPrograms[0].getInfo<CL_PROGRAM_CONTEXT>(&error_local);
5294  if(error_local!=CL_SUCCESS) {
5295  detail::errHandler(error_local, __LINK_PROGRAM_ERR);
5296  }
5297  }
5298  cl_program prog = ::clLinkProgram(
5299  ctx(),
5300  0,
5301  NULL,
5302  options,
5303  (cl_uint)inputPrograms.size(),
5304  programs,
5305  notifyFptr,
5306  data,
5307  &error_local);
5308 
5309  detail::errHandler(error_local,__COMPILE_PROGRAM_ERR);
5310  if (err != NULL) {
5311  *err = error_local;
5312  }
5313 
5314  return Program(prog);
5315 }
5316 #endif
5317 
5318 template<>
5319 inline VECTOR_CLASS<char *> cl::Program::getInfo<CL_PROGRAM_BINARIES>(cl_int* err) const
5320 {
5321  VECTOR_CLASS< ::size_t> sizes = getInfo<CL_PROGRAM_BINARY_SIZES>();
5322  VECTOR_CLASS<char *> binaries;
5323  for (VECTOR_CLASS< ::size_t>::iterator s = sizes.begin(); s != sizes.end(); ++s)
5324  {
5325  char *ptr = NULL;
5326  if (*s != 0)
5327  ptr = new char[*s];
5328  binaries.push_back(ptr);
5329  }
5330 
5331  cl_int result = getInfo(CL_PROGRAM_BINARIES, &binaries);
5332  if (err != NULL) {
5333  *err = result;
5334  }
5335  return binaries;
5336 }
5337 
5338 inline Kernel::Kernel(const Program& program, const char* name, cl_int* err)
5339 {
5340  cl_int error;
5341 
5342  object_ = ::clCreateKernel(program(), name, &error);
5343  detail::errHandler(error, __CREATE_KERNEL_ERR);
5344 
5345  if (err != NULL) {
5346  *err = error;
5347  }
5348 
5349 }
5350 
5354 class CommandQueue : public detail::Wrapper<cl_command_queue>
5355 {
5356 private:
5357 #ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED
5358  static std::atomic<int> default_initialized_;
5359 #else // !CL_HPP_CPP11_ATOMICS_SUPPORTED
5360  static volatile int default_initialized_;
5361 #endif // !CL_HPP_CPP11_ATOMICS_SUPPORTED
5362  static CommandQueue default_;
5363  static volatile cl_int default_error_;
5364 public:
5366  cl_command_queue_properties properties,
5367  cl_int* err = NULL)
5368  {
5369  cl_int error;
5370 
5371  Context context = Context::getDefault(&error);
5372  detail::errHandler(error, __CREATE_CONTEXT_ERR);
5373 
5374  if (error != CL_SUCCESS) {
5375  if (err != NULL) {
5376  *err = error;
5377  }
5378  }
5379  else {
5380  Device device = context.getInfo<CL_CONTEXT_DEVICES>()[0];
5381 
5382  object_ = ::clCreateCommandQueue(
5383  context(), device(), properties, &error);
5384 
5385  detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
5386  if (err != NULL) {
5387  *err = error;
5388  }
5389  }
5390  }
5394  explicit CommandQueue(
5395  const Context& context,
5396  cl_command_queue_properties properties = 0,
5397  cl_int* err = NULL)
5398  {
5399  cl_int error;
5400  VECTOR_CLASS<cl::Device> devices;
5401  error = context.getInfo(CL_CONTEXT_DEVICES, &devices);
5402 
5403  detail::errHandler(error, __CREATE_CONTEXT_ERR);
5404 
5405  if (error != CL_SUCCESS)
5406  {
5407  if (err != NULL) {
5408  *err = error;
5409  }
5410  return;
5411  }
5412 
5413  object_ = ::clCreateCommandQueue(context(), devices[0](), properties, &error);
5414 
5415  detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
5416 
5417  if (err != NULL) {
5418  *err = error;
5419  }
5420 
5421  }
5422 
5424  const Context& context,
5425  const Device& device,
5426  cl_command_queue_properties properties = 0,
5427  cl_int* err = NULL)
5428  {
5429  cl_int error;
5430  object_ = ::clCreateCommandQueue(
5431  context(), device(), properties, &error);
5432 
5433  detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
5434  if (err != NULL) {
5435  *err = error;
5436  }
5437  }
5438 
5442  CommandQueue(const CommandQueue& queue) : detail::Wrapper<cl_type>(queue) {}
5443 
5448  {
5450  return *this;
5451  }
5452 
5453 #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
5454 
5457  CommandQueue(CommandQueue&& queue) CL_HPP_NOEXCEPT : detail::Wrapper<cl_type>(std::move(queue)) {}
5458 
5463  {
5464  detail::Wrapper<cl_type>::operator=(std::move(queue));
5465  return *this;
5466  }
5467 #endif // #if defined(CL_HPP_RVALUE_REFERENCES_SUPPORTED)
5468 
5469  static CommandQueue getDefault(cl_int * err = NULL)
5470  {
5471  int state = detail::compare_exchange(
5472  &default_initialized_,
5474 
5475  if (state & __DEFAULT_INITIALIZED) {
5476  if (err != NULL) {
5477  *err = default_error_;
5478  }
5479  return default_;
5480  }
5481 
5482  if (state & __DEFAULT_BEING_INITIALIZED) {
5483  // Assume writes will propagate eventually...
5484  while(default_initialized_ != __DEFAULT_INITIALIZED) {
5485  detail::fence();
5486  }
5487 
5488  if (err != NULL) {
5489  *err = default_error_;
5490  }
5491  return default_;
5492  }
5493 
5494  cl_int error;
5495 
5496  Context context = Context::getDefault(&error);
5497  detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
5498 
5499  if (error != CL_SUCCESS) {
5500  if (err != NULL) {
5501  *err = error;
5502  }
5503  }
5504  else {
5505  Device device = context.getInfo<CL_CONTEXT_DEVICES>()[0];
5506 
5507  default_ = CommandQueue(context, device, 0, &error);
5508 
5509  detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
5510  if (err != NULL) {
5511  *err = error;
5512  }
5513  }
5514 
5515  detail::fence();
5516 
5517  default_error_ = error;
5518  // Assume writes will propagate eventually...
5519  default_initialized_ = __DEFAULT_INITIALIZED;
5520 
5521  detail::fence();
5522 
5523  if (err != NULL) {
5524  *err = default_error_;
5525  }
5526  return default_;
5527 
5528  }
5529 
5531 
5532  __CL_EXPLICIT_CONSTRUCTORS CommandQueue(const cl_command_queue& commandQueue) : detail::Wrapper<cl_type>(commandQueue) { }
5533 
5534  CommandQueue& operator = (const cl_command_queue& rhs)
5535  {
5537  return *this;
5538  }
5539 
5540  template <typename T>
5541  cl_int getInfo(cl_command_queue_info name, T* param) const
5542  {
5543  return detail::errHandler(
5545  &::clGetCommandQueueInfo, object_, name, param),
5546  __GET_COMMAND_QUEUE_INFO_ERR);
5547  }
5548 
5549  template <cl_int name> typename
5551  getInfo(cl_int* err = NULL) const
5552  {
5553  typename detail::param_traits<
5554  detail::cl_command_queue_info, name>::param_type param;
5555  cl_int result = getInfo(name, &param);
5556  if (err != NULL) {
5557  *err = result;
5558  }
5559  return param;
5560  }
5561 
5563  const Buffer& buffer,
5564  cl_bool blocking,
5565  ::size_t offset,
5566  ::size_t size,
5567  void* ptr,
5568  const VECTOR_CLASS<Event>* events = NULL,
5569  Event* event = NULL) const
5570  {
5571  cl_event tmp;
5572  cl_int err = detail::errHandler(
5573  ::clEnqueueReadBuffer(
5574  object_, buffer(), blocking, offset, size,
5575  ptr,
5576  (events != NULL) ? (cl_uint) events->size() : 0,
5577  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
5578  (event != NULL) ? &tmp : NULL),
5579  __ENQUEUE_READ_BUFFER_ERR);
5580 
5581  if (event != NULL && err == CL_SUCCESS)
5582  *event = tmp;
5583 
5584  return err;
5585  }
5586 
5588  const Buffer& buffer,
5589  cl_bool blocking,
5590  ::size_t offset,
5591  ::size_t size,
5592  const void* ptr,
5593  const VECTOR_CLASS<Event>* events = NULL,
5594  Event* event = NULL) const
5595  {
5596  cl_event tmp;
5597  cl_int err = detail::errHandler(
5598  ::clEnqueueWriteBuffer(
5599  object_, buffer(), blocking, offset, size,
5600  ptr,
5601  (events != NULL) ? (cl_uint) events->size() : 0,
5602  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
5603  (event != NULL) ? &tmp : NULL),
5604  __ENQUEUE_WRITE_BUFFER_ERR);
5605 
5606  if (event != NULL && err == CL_SUCCESS)
5607  *event = tmp;
5608 
5609  return err;
5610  }
5611 
5613  const Buffer& src,
5614  const Buffer& dst,
5615  ::size_t src_offset,
5616  ::size_t dst_offset,
5617  ::size_t size,
5618  const VECTOR_CLASS<Event>* events = NULL,
5619  Event* event = NULL) const
5620  {
5621  cl_event tmp;
5622  cl_int err = detail::errHandler(
5623  ::clEnqueueCopyBuffer(
5624  object_, src(), dst(), src_offset, dst_offset, size,
5625  (events != NULL) ? (cl_uint) events->size() : 0,
5626  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
5627  (event != NULL) ? &tmp : NULL),
5628  __ENQEUE_COPY_BUFFER_ERR);
5629 
5630  if (event != NULL && err == CL_SUCCESS)
5631  *event = tmp;
5632 
5633  return err;
5634  }
5635 
5637  const Buffer& buffer,
5638  cl_bool blocking,
5639  const size_t<3>& buffer_offset,
5640  const size_t<3>& host_offset,
5641  const size_t<3>& region,
5642  ::size_t buffer_row_pitch,
5643  ::size_t buffer_slice_pitch,
5644  ::size_t host_row_pitch,
5645  ::size_t host_slice_pitch,
5646  void *ptr,
5647  const VECTOR_CLASS<Event>* events = NULL,
5648  Event* event = NULL) const
5649  {
5650  cl_event tmp;
5651  cl_int err = detail::errHandler(
5652  ::clEnqueueReadBufferRect(
5653  object_,
5654  buffer(),
5655  blocking,
5656  (const ::size_t *)buffer_offset,
5657  (const ::size_t *)host_offset,
5658  (const ::size_t *)region,
5659  buffer_row_pitch,
5660  buffer_slice_pitch,
5661  host_row_pitch,
5662  host_slice_pitch,
5663  ptr,
5664  (events != NULL) ? (cl_uint) events->size() : 0,
5665  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
5666  (event != NULL) ? &tmp : NULL),
5667  __ENQUEUE_READ_BUFFER_RECT_ERR);
5668 
5669  if (event != NULL && err == CL_SUCCESS)
5670  *event = tmp;
5671 
5672  return err;
5673  }
5674 
5676  const Buffer& buffer,
5677  cl_bool blocking,
5678  const size_t<3>& buffer_offset,
5679  const size_t<3>& host_offset,
5680  const size_t<3>& region,
5681  ::size_t buffer_row_pitch,
5682  ::size_t buffer_slice_pitch,
5683  ::size_t host_row_pitch,
5684  ::size_t host_slice_pitch,
5685  void *ptr,
5686  const VECTOR_CLASS<Event>* events = NULL,
5687  Event* event = NULL) const
5688  {
5689  cl_event tmp;
5690  cl_int err = detail::errHandler(
5691  ::clEnqueueWriteBufferRect(
5692  object_,
5693  buffer(),
5694  blocking,
5695  (const ::size_t *)buffer_offset,
5696  (const ::size_t *)host_offset,
5697  (const ::size_t *)region,
5698  buffer_row_pitch,
5699  buffer_slice_pitch,
5700  host_row_pitch,
5701  host_slice_pitch,
5702  ptr,
5703  (events != NULL) ? (cl_uint) events->size() : 0,
5704  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
5705  (event != NULL) ? &tmp : NULL),
5706  __ENQUEUE_WRITE_BUFFER_RECT_ERR);
5707 
5708  if (event != NULL && err == CL_SUCCESS)
5709  *event = tmp;
5710 
5711  return err;
5712  }
5713 
5715  const Buffer& src,
5716  const Buffer& dst,
5717  const size_t<3>& src_origin,
5718  const size_t<3>& dst_origin,
5719  const size_t<3>& region,
5720  ::size_t src_row_pitch,
5721  ::size_t src_slice_pitch,
5722  ::size_t dst_row_pitch,
5723  ::size_t dst_slice_pitch,
5724  const VECTOR_CLASS<Event>* events = NULL,
5725  Event* event = NULL) const
5726  {
5727  cl_event tmp;
5728  cl_int err = detail::errHandler(
5729  ::clEnqueueCopyBufferRect(
5730  object_,
5731  src(),
5732  dst(),
5733  (const ::size_t *)src_origin,
5734  (const ::size_t *)dst_origin,
5735  (const ::size_t *)region,
5736  src_row_pitch,
5737  src_slice_pitch,
5738  dst_row_pitch,
5739  dst_slice_pitch,
5740  (events != NULL) ? (cl_uint) events->size() : 0,
5741  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
5742  (event != NULL) ? &tmp : NULL),
5743  __ENQEUE_COPY_BUFFER_RECT_ERR);
5744 
5745  if (event != NULL && err == CL_SUCCESS)
5746  *event = tmp;
5747 
5748  return err;
5749  }
5750 
5751 #if defined(CL_VERSION_1_2)
5752 
5758  template<typename PatternType>
5759  cl_int enqueueFillBuffer(
5760  const Buffer& buffer,
5761  PatternType pattern,
5762  ::size_t offset,
5763  ::size_t size,
5764  const VECTOR_CLASS<Event>* events = NULL,
5765  Event* event = NULL) const
5766  {
5767  cl_event tmp;
5768  cl_int err = detail::errHandler(
5769  ::clEnqueueFillBuffer(
5770  object_,
5771  buffer(),
5772  static_cast<void*>(&pattern),
5773  sizeof(PatternType),
5774  offset,
5775  size,
5776  (events != NULL) ? (cl_uint) events->size() : 0,
5777  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
5778  (event != NULL) ? &tmp : NULL),
5779  __ENQUEUE_FILL_BUFFER_ERR);
5780 
5781  if (event != NULL && err == CL_SUCCESS)
5782  *event = tmp;
5783 
5784  return err;
5785  }
5786 #endif // #if defined(CL_VERSION_1_2)
5787 
5789  const Image& image,
5790  cl_bool blocking,
5791  const size_t<3>& origin,
5792  const size_t<3>& region,
5793  ::size_t row_pitch,
5794  ::size_t slice_pitch,
5795  void* ptr,
5796  const VECTOR_CLASS<Event>* events = NULL,
5797  Event* event = NULL) const
5798  {
5799  cl_event tmp;
5800  cl_int err = detail::errHandler(
5801  ::clEnqueueReadImage(
5802  object_, image(), blocking, (const ::size_t *) origin,
5803  (const ::size_t *) region, row_pitch, slice_pitch, ptr,
5804  (events != NULL) ? (cl_uint) events->size() : 0,
5805  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
5806  (event != NULL) ? &tmp : NULL),
5807  __ENQUEUE_READ_IMAGE_ERR);
5808 
5809  if (event != NULL && err == CL_SUCCESS)
5810  *event = tmp;
5811 
5812  return err;
5813  }
5814 
5816  const Image& image,
5817  cl_bool blocking,
5818  const size_t<3>& origin,
5819  const size_t<3>& region,
5820  ::size_t row_pitch,
5821  ::size_t slice_pitch,
5822  void* ptr,
5823  const VECTOR_CLASS<Event>* events = NULL,
5824  Event* event = NULL) const
5825  {
5826  cl_event tmp;
5827  cl_int err = detail::errHandler(
5828  ::clEnqueueWriteImage(
5829  object_, image(), blocking, (const ::size_t *) origin,
5830  (const ::size_t *) region, row_pitch, slice_pitch, ptr,
5831  (events != NULL) ? (cl_uint) events->size() : 0,
5832  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
5833  (event != NULL) ? &tmp : NULL),
5834  __ENQUEUE_WRITE_IMAGE_ERR);
5835 
5836  if (event != NULL && err == CL_SUCCESS)
5837  *event = tmp;
5838 
5839  return err;
5840  }
5841 
5843  const Image& src,
5844  const Image& dst,
5845  const size_t<3>& src_origin,
5846  const size_t<3>& dst_origin,
5847  const size_t<3>& region,
5848  const VECTOR_CLASS<Event>* events = NULL,
5849  Event* event = NULL) const
5850  {
5851  cl_event tmp;
5852  cl_int err = detail::errHandler(
5853  ::clEnqueueCopyImage(
5854  object_, src(), dst(), (const ::size_t *) src_origin,
5855  (const ::size_t *)dst_origin, (const ::size_t *) region,
5856  (events != NULL) ? (cl_uint) events->size() : 0,
5857  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
5858  (event != NULL) ? &tmp : NULL),
5859  __ENQUEUE_COPY_IMAGE_ERR);
5860 
5861  if (event != NULL && err == CL_SUCCESS)
5862  *event = tmp;
5863 
5864  return err;
5865  }
5866 
5867 #if defined(CL_VERSION_1_2)
5868 
5875  cl_int enqueueFillImage(
5876  const Image& image,
5877  cl_float4 fillColor,
5878  const size_t<3>& origin,
5879  const size_t<3>& region,
5880  const VECTOR_CLASS<Event>* events = NULL,
5881  Event* event = NULL) const
5882  {
5883  cl_event tmp;
5884  cl_int err = detail::errHandler(
5885  ::clEnqueueFillImage(
5886  object_,
5887  image(),
5888  static_cast<void*>(&fillColor),
5889  (const ::size_t *) origin,
5890  (const ::size_t *) region,
5891  (events != NULL) ? (cl_uint) events->size() : 0,
5892  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
5893  (event != NULL) ? &tmp : NULL),
5894  __ENQUEUE_FILL_IMAGE_ERR);
5895 
5896  if (event != NULL && err == CL_SUCCESS)
5897  *event = tmp;
5898 
5899  return err;
5900  }
5901 
5909  cl_int enqueueFillImage(
5910  const Image& image,
5911  cl_int4 fillColor,
5912  const size_t<3>& origin,
5913  const size_t<3>& region,
5914  const VECTOR_CLASS<Event>* events = NULL,
5915  Event* event = NULL) const
5916  {
5917  cl_event tmp;
5918  cl_int err = detail::errHandler(
5919  ::clEnqueueFillImage(
5920  object_,
5921  image(),
5922  static_cast<void*>(&fillColor),
5923  (const ::size_t *) origin,
5924  (const ::size_t *) region,
5925  (events != NULL) ? (cl_uint) events->size() : 0,
5926  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
5927  (event != NULL) ? &tmp : NULL),
5928  __ENQUEUE_FILL_IMAGE_ERR);
5929 
5930  if (event != NULL && err == CL_SUCCESS)
5931  *event = tmp;
5932 
5933  return err;
5934  }
5935 
5943  cl_int enqueueFillImage(
5944  const Image& image,
5945  cl_uint4 fillColor,
5946  const size_t<3>& origin,
5947  const size_t<3>& region,
5948  const VECTOR_CLASS<Event>* events = NULL,
5949  Event* event = NULL) const
5950  {
5951  cl_event tmp;
5952  cl_int err = detail::errHandler(
5953  ::clEnqueueFillImage(
5954  object_,
5955  image(),
5956  static_cast<void*>(&fillColor),
5957  (const ::size_t *) origin,
5958  (const ::size_t *) region,
5959  (events != NULL) ? (cl_uint) events->size() : 0,
5960  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
5961  (event != NULL) ? &tmp : NULL),
5962  __ENQUEUE_FILL_IMAGE_ERR);
5963 
5964  if (event != NULL && err == CL_SUCCESS)
5965  *event = tmp;
5966 
5967  return err;
5968  }
5969 #endif // #if defined(CL_VERSION_1_2)
5970 
5972  const Image& src,
5973  const Buffer& dst,
5974  const size_t<3>& src_origin,
5975  const size_t<3>& region,
5976  ::size_t dst_offset,
5977  const VECTOR_CLASS<Event>* events = NULL,
5978  Event* event = NULL) const
5979  {
5980  cl_event tmp;
5981  cl_int err = detail::errHandler(
5982  ::clEnqueueCopyImageToBuffer(
5983  object_, src(), dst(), (const ::size_t *) src_origin,
5984  (const ::size_t *) region, dst_offset,
5985  (events != NULL) ? (cl_uint) events->size() : 0,
5986  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
5987  (event != NULL) ? &tmp : NULL),
5988  __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR);
5989 
5990  if (event != NULL && err == CL_SUCCESS)
5991  *event = tmp;
5992 
5993  return err;
5994  }
5995 
5997  const Buffer& src,
5998  const Image& dst,
5999  ::size_t src_offset,
6000  const size_t<3>& dst_origin,
6001  const size_t<3>& region,
6002  const VECTOR_CLASS<Event>* events = NULL,
6003  Event* event = NULL) const
6004  {
6005  cl_event tmp;
6006  cl_int err = detail::errHandler(
6007  ::clEnqueueCopyBufferToImage(
6008  object_, src(), dst(), src_offset,
6009  (const ::size_t *) dst_origin, (const ::size_t *) region,
6010  (events != NULL) ? (cl_uint) events->size() : 0,
6011  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
6012  (event != NULL) ? &tmp : NULL),
6013  __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR);
6014 
6015  if (event != NULL && err == CL_SUCCESS)
6016  *event = tmp;
6017 
6018  return err;
6019  }
6020 
6022  const Buffer& buffer,
6023  cl_bool blocking,
6024  cl_map_flags flags,
6025  ::size_t offset,
6026  ::size_t size,
6027  const VECTOR_CLASS<Event>* events = NULL,
6028  Event* event = NULL,
6029  cl_int* err = NULL) const
6030  {
6031  cl_event tmp;
6032  cl_int error;
6033  void * result = ::clEnqueueMapBuffer(
6034  object_, buffer(), blocking, flags, offset, size,
6035  (events != NULL) ? (cl_uint) events->size() : 0,
6036  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
6037  (event != NULL) ? &tmp : NULL,
6038  &error);
6039 
6040  detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
6041  if (err != NULL) {
6042  *err = error;
6043  }
6044  if (event != NULL && error == CL_SUCCESS)
6045  *event = tmp;
6046 
6047  return result;
6048  }
6049 
6051  const Image& buffer,
6052  cl_bool blocking,
6053  cl_map_flags flags,
6054  const size_t<3>& origin,
6055  const size_t<3>& region,
6056  ::size_t * row_pitch,
6057  ::size_t * slice_pitch,
6058  const VECTOR_CLASS<Event>* events = NULL,
6059  Event* event = NULL,
6060  cl_int* err = NULL) const
6061  {
6062  cl_event tmp;
6063  cl_int error;
6064  void * result = ::clEnqueueMapImage(
6065  object_, buffer(), blocking, flags,
6066  (const ::size_t *) origin, (const ::size_t *) region,
6067  row_pitch, slice_pitch,
6068  (events != NULL) ? (cl_uint) events->size() : 0,
6069  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
6070  (event != NULL) ? &tmp : NULL,
6071  &error);
6072 
6073  detail::errHandler(error, __ENQUEUE_MAP_IMAGE_ERR);
6074  if (err != NULL) {
6075  *err = error;
6076  }
6077  if (event != NULL && error == CL_SUCCESS)
6078  *event = tmp;
6079  return result;
6080  }
6081 
6083  const Memory& memory,
6084  void* mapped_ptr,
6085  const VECTOR_CLASS<Event>* events = NULL,
6086  Event* event = NULL) const
6087  {
6088  cl_event tmp;
6089  cl_int err = detail::errHandler(
6090  ::clEnqueueUnmapMemObject(
6091  object_, memory(), mapped_ptr,
6092  (events != NULL) ? (cl_uint) events->size() : 0,
6093  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
6094  (event != NULL) ? &tmp : NULL),
6095  __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
6096 
6097  if (event != NULL && err == CL_SUCCESS)
6098  *event = tmp;
6099 
6100  return err;
6101  }
6102 
6103 #if defined(CL_VERSION_1_2)
6104 
6115  cl_int enqueueMarkerWithWaitList(
6116  const VECTOR_CLASS<Event> *events = 0,
6117  Event *event = 0)
6118  {
6119  cl_event tmp;
6120  cl_int err = detail::errHandler(
6121  ::clEnqueueMarkerWithWaitList(
6122  object_,
6123  (events != NULL) ? (cl_uint) events->size() : 0,
6124  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
6125  (event != NULL) ? &tmp : NULL),
6126  __ENQUEUE_MARKER_WAIT_LIST_ERR);
6127 
6128  if (event != NULL && err == CL_SUCCESS)
6129  *event = tmp;
6130 
6131  return err;
6132  }
6133 
6145  cl_int enqueueBarrierWithWaitList(
6146  const VECTOR_CLASS<Event> *events = 0,
6147  Event *event = 0)
6148  {
6149  cl_event tmp;
6150  cl_int err = detail::errHandler(
6151  ::clEnqueueBarrierWithWaitList(
6152  object_,
6153  (events != NULL) ? (cl_uint) events->size() : 0,
6154  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
6155  (event != NULL) ? &tmp : NULL),
6156  __ENQUEUE_BARRIER_WAIT_LIST_ERR);
6157 
6158  if (event != NULL && err == CL_SUCCESS)
6159  *event = tmp;
6160 
6161  return err;
6162  }
6163 
6168  cl_int enqueueMigrateMemObjects(
6169  const VECTOR_CLASS<Memory> &memObjects,
6170  cl_mem_migration_flags flags,
6171  const VECTOR_CLASS<Event>* events = NULL,
6172  Event* event = NULL
6173  )
6174  {
6175  cl_event tmp;
6176 
6177  cl_mem* localMemObjects = static_cast<cl_mem*>(alloca(memObjects.size() * sizeof(cl_mem)));
6178  for( int i = 0; i < (int)memObjects.size(); ++i ) {
6179  localMemObjects[i] = memObjects[i]();
6180  }
6181 
6182 
6183  cl_int err = detail::errHandler(
6184  ::clEnqueueMigrateMemObjects(
6185  object_,
6186  (cl_uint)memObjects.size(),
6187  static_cast<const cl_mem*>(localMemObjects),
6188  flags,
6189  (events != NULL) ? (cl_uint) events->size() : 0,
6190  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
6191  (event != NULL) ? &tmp : NULL),
6192  __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
6193 
6194  if (event != NULL && err == CL_SUCCESS)
6195  *event = tmp;
6196 
6197  return err;
6198  }
6199 #endif // #if defined(CL_VERSION_1_2)
6200 
6202  const Kernel& kernel,
6203  const NDRange& offset,
6204  const NDRange& global,
6205  const NDRange& local = NullRange,
6206  const VECTOR_CLASS<Event>* events = NULL,
6207  Event* event = NULL) const
6208  {
6209  cl_event tmp;
6210  cl_int err = detail::errHandler(
6211  ::clEnqueueNDRangeKernel(
6212  object_, kernel(), (cl_uint) global.dimensions(),
6213  offset.dimensions() != 0 ? (const ::size_t*) offset : NULL,
6214  (const ::size_t*) global,
6215  local.dimensions() != 0 ? (const ::size_t*) local : NULL,
6216  (events != NULL) ? (cl_uint) events->size() : 0,
6217  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
6218  (event != NULL) ? &tmp : NULL),
6219  __ENQUEUE_NDRANGE_KERNEL_ERR);
6220 
6221  if (event != NULL && err == CL_SUCCESS)
6222  *event = tmp;
6223 
6224  return err;
6225  }
6226 
6227  cl_int enqueueTask(
6228  const Kernel& kernel,
6229  const VECTOR_CLASS<Event>* events = NULL,
6230  Event* event = NULL) const
6231  {
6232  cl_event tmp;
6233  cl_int err = detail::errHandler(
6234  ::clEnqueueTask(
6235  object_, kernel(),
6236  (events != NULL) ? (cl_uint) events->size() : 0,
6237  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
6238  (event != NULL) ? &tmp : NULL),
6239  __ENQUEUE_TASK_ERR);
6240 
6241  if (event != NULL && err == CL_SUCCESS)
6242  *event = tmp;
6243 
6244  return err;
6245  }
6246 
6248  void (CL_CALLBACK *userFptr)(void *),
6249  std::pair<void*, ::size_t> args,
6250  const VECTOR_CLASS<Memory>* mem_objects = NULL,
6251  const VECTOR_CLASS<const void*>* mem_locs = NULL,
6252  const VECTOR_CLASS<Event>* events = NULL,
6253  Event* event = NULL) const
6254  {
6255  cl_mem * mems = (mem_objects != NULL && mem_objects->size() > 0)
6256  ? (cl_mem*) alloca(mem_objects->size() * sizeof(cl_mem))
6257  : NULL;
6258 
6259  if (mems != NULL) {
6260  for (unsigned int i = 0; i < mem_objects->size(); i++) {
6261  mems[i] = ((*mem_objects)[i])();
6262  }
6263  }
6264 
6265  cl_event tmp;
6266  cl_int err = detail::errHandler(
6267  ::clEnqueueNativeKernel(
6268  object_, userFptr, args.first, args.second,
6269  (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
6270  mems,
6271  (mem_locs != NULL && mem_locs->size() > 0) ? (const void **) &mem_locs->front() : NULL,
6272  (events != NULL) ? (cl_uint) events->size() : 0,
6273  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
6274  (event != NULL) ? &tmp : NULL),
6275  __ENQUEUE_NATIVE_KERNEL);
6276 
6277  if (event != NULL && err == CL_SUCCESS)
6278  *event = tmp;
6279 
6280  return err;
6281  }
6282 
6286 #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS) || (defined(CL_VERSION_1_1) && !defined(CL_VERSION_1_2))
6288  cl_int enqueueMarker(Event* event = NULL) const CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
6289  {
6290  cl_event tmp;
6291  cl_int err = detail::errHandler(
6292  ::clEnqueueMarker(
6293  object_,
6294  (event != NULL) ? &tmp : NULL),
6295  __ENQUEUE_MARKER_ERR);
6296 
6297  if (event != NULL && err == CL_SUCCESS)
6298  *event = tmp;
6299 
6300  return err;
6301  }
6302 
6304  cl_int enqueueWaitForEvents(const VECTOR_CLASS<Event>& events) const CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
6305  {
6306  return detail::errHandler(
6307  ::clEnqueueWaitForEvents(
6308  object_,
6309  (cl_uint) events.size(),
6310  events.size() > 0 ? (const cl_event*) &events.front() : NULL),
6311  __ENQUEUE_WAIT_FOR_EVENTS_ERR);
6312  }
6313 #endif // #if defined(CL_VERSION_1_1)
6314 
6316  const VECTOR_CLASS<Memory>* mem_objects = NULL,
6317  const VECTOR_CLASS<Event>* events = NULL,
6318  Event* event = NULL) const
6319  {
6320  cl_event tmp;
6321  cl_int err = detail::errHandler(
6322  ::clEnqueueAcquireGLObjects(
6323  object_,
6324  (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
6325  (mem_objects != NULL && mem_objects->size() > 0) ? (const cl_mem *) &mem_objects->front(): NULL,
6326  (events != NULL) ? (cl_uint) events->size() : 0,
6327  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
6328  (event != NULL) ? &tmp : NULL),
6329  __ENQUEUE_ACQUIRE_GL_ERR);
6330 
6331  if (event != NULL && err == CL_SUCCESS)
6332  *event = tmp;
6333 
6334  return err;
6335  }
6336 
6338  const VECTOR_CLASS<Memory>* mem_objects = NULL,
6339  const VECTOR_CLASS<Event>* events = NULL,
6340  Event* event = NULL) const
6341  {
6342  cl_event tmp;
6343  cl_int err = detail::errHandler(
6344  ::clEnqueueReleaseGLObjects(
6345  object_,
6346  (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
6347  (mem_objects != NULL && mem_objects->size() > 0) ? (const cl_mem *) &mem_objects->front(): NULL,
6348  (events != NULL) ? (cl_uint) events->size() : 0,
6349  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
6350  (event != NULL) ? &tmp : NULL),
6351  __ENQUEUE_RELEASE_GL_ERR);
6352 
6353  if (event != NULL && err == CL_SUCCESS)
6354  *event = tmp;
6355 
6356  return err;
6357  }
6358 
6359 #if defined (USE_DX_INTEROP)
6360 typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clEnqueueAcquireD3D10ObjectsKHR)(
6361  cl_command_queue command_queue, cl_uint num_objects,
6362  const cl_mem* mem_objects, cl_uint num_events_in_wait_list,
6363  const cl_event* event_wait_list, cl_event* event);
6364 typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clEnqueueReleaseD3D10ObjectsKHR)(
6365  cl_command_queue command_queue, cl_uint num_objects,
6366  const cl_mem* mem_objects, cl_uint num_events_in_wait_list,
6367  const cl_event* event_wait_list, cl_event* event);
6368 
6369  cl_int enqueueAcquireD3D10Objects(
6370  const VECTOR_CLASS<Memory>* mem_objects = NULL,
6371  const VECTOR_CLASS<Event>* events = NULL,
6372  Event* event = NULL) const
6373  {
6374  static PFN_clEnqueueAcquireD3D10ObjectsKHR pfn_clEnqueueAcquireD3D10ObjectsKHR = NULL;
6375 #if defined(CL_VERSION_1_2)
6376  cl_context context = getInfo<CL_QUEUE_CONTEXT>();
6377  cl::Device device(getInfo<CL_QUEUE_DEVICE>());
6378  cl_platform_id platform = device.getInfo<CL_DEVICE_PLATFORM>();
6379  __INIT_CL_EXT_FCN_PTR_PLATFORM(platform, clEnqueueAcquireD3D10ObjectsKHR);
6380 #endif
6381 #if defined(CL_VERSION_1_1)
6382  __INIT_CL_EXT_FCN_PTR(clEnqueueAcquireD3D10ObjectsKHR);
6383 #endif
6384 
6385  cl_event tmp;
6386  cl_int err = detail::errHandler(
6387  pfn_clEnqueueAcquireD3D10ObjectsKHR(
6388  object_,
6389  (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
6390  (mem_objects != NULL && mem_objects->size() > 0) ? (const cl_mem *) &mem_objects->front(): NULL,
6391  (events != NULL) ? (cl_uint) events->size() : 0,
6392  (events != NULL) ? (cl_event*) &events->front() : NULL,
6393  (event != NULL) ? &tmp : NULL),
6394  __ENQUEUE_ACQUIRE_GL_ERR);
6395 
6396  if (event != NULL && err == CL_SUCCESS)
6397  *event = tmp;
6398 
6399  return err;
6400  }
6401 
6402  cl_int enqueueReleaseD3D10Objects(
6403  const VECTOR_CLASS<Memory>* mem_objects = NULL,
6404  const VECTOR_CLASS<Event>* events = NULL,
6405  Event* event = NULL) const
6406  {
6407  static PFN_clEnqueueReleaseD3D10ObjectsKHR pfn_clEnqueueReleaseD3D10ObjectsKHR = NULL;
6408 #if defined(CL_VERSION_1_2)
6409  cl_context context = getInfo<CL_QUEUE_CONTEXT>();
6410  cl::Device device(getInfo<CL_QUEUE_DEVICE>());
6411  cl_platform_id platform = device.getInfo<CL_DEVICE_PLATFORM>();
6412  __INIT_CL_EXT_FCN_PTR_PLATFORM(platform, clEnqueueReleaseD3D10ObjectsKHR);
6413 #endif // #if defined(CL_VERSION_1_2)
6414 #if defined(CL_VERSION_1_1)
6415  __INIT_CL_EXT_FCN_PTR(clEnqueueReleaseD3D10ObjectsKHR);
6416 #endif // #if defined(CL_VERSION_1_1)
6417 
6418  cl_event tmp;
6419  cl_int err = detail::errHandler(
6420  pfn_clEnqueueReleaseD3D10ObjectsKHR(
6421  object_,
6422  (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
6423  (mem_objects != NULL && mem_objects->size() > 0) ? (const cl_mem *) &mem_objects->front(): NULL,
6424  (events != NULL) ? (cl_uint) events->size() : 0,
6425  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
6426  (event != NULL) ? &tmp : NULL),
6427  __ENQUEUE_RELEASE_GL_ERR);
6428 
6429  if (event != NULL && err == CL_SUCCESS)
6430  *event = tmp;
6431 
6432  return err;
6433  }
6434 #endif
6435 
6439 #if defined(CL_USE_DEPRECATED_OPENCL_1_1_APIS) || (defined(CL_VERSION_1_1) && !defined(CL_VERSION_1_2))
6441  cl_int enqueueBarrier() const CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
6442  {
6443  return detail::errHandler(
6444  ::clEnqueueBarrier(object_),
6445  __ENQUEUE_BARRIER_ERR);
6446  }
6447 #endif // #if defined(CL_VERSION_1_1)
6448 
6449  cl_int flush() const
6450  {
6451  return detail::errHandler(::clFlush(object_), __FLUSH_ERR);
6452  }
6453 
6454  cl_int finish() const
6455  {
6456  return detail::errHandler(::clFinish(object_), __FINISH_ERR);
6457  }
6458 };
6459 
6460 #ifdef _WIN32
6461 #ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED
6462 __declspec(selectany) std::atomic<int> CommandQueue::default_initialized_;
6463 #else // !CL_HPP_CPP11_ATOMICS_SUPPORTED
6464 __declspec(selectany) volatile int CommandQueue::default_initialized_ = __DEFAULT_NOT_INITIALIZED;
6465 #endif // !CL_HPP_CPP11_ATOMICS_SUPPORTED
6466 __declspec(selectany) CommandQueue CommandQueue::default_;
6467 __declspec(selectany) volatile cl_int CommandQueue::default_error_ = CL_SUCCESS;
6468 #else // !_WIN32
6469 #ifdef CL_HPP_CPP11_ATOMICS_SUPPORTED
6470 __attribute__((weak)) std::atomic<int> CommandQueue::default_initialized_;
6471 #else // !CL_HPP_CPP11_ATOMICS_SUPPORTED
6472 __attribute__((weak)) volatile int CommandQueue::default_initialized_ = __DEFAULT_NOT_INITIALIZED;
6473 #endif // !CL_HPP_CPP11_ATOMICS_SUPPORTED
6474 __attribute__((weak)) CommandQueue CommandQueue::default_;
6475 __attribute__((weak)) volatile cl_int CommandQueue::default_error_ = CL_SUCCESS;
6476 #endif // !_WIN32
6477 
6478 template< typename IteratorType >
6480  const Context &context,
6481  IteratorType startIterator,
6482  IteratorType endIterator,
6483  bool readOnly,
6484  bool useHostPtr,
6485  cl_int* err)
6486 {
6487  typedef typename std::iterator_traits<IteratorType>::value_type DataType;
6488  cl_int error;
6489 
6490  cl_mem_flags flags = 0;
6491  if( readOnly ) {
6492  flags |= CL_MEM_READ_ONLY;
6493  }
6494  else {
6495  flags |= CL_MEM_READ_WRITE;
6496  }
6497  if( useHostPtr ) {
6498  flags |= CL_MEM_USE_HOST_PTR;
6499  }
6500 
6501  ::size_t size = sizeof(DataType)*(endIterator - startIterator);
6502 
6503  if( useHostPtr ) {
6504  object_ = ::clCreateBuffer(context(), flags, size, static_cast<DataType*>(&*startIterator), &error);
6505  } else {
6506  object_ = ::clCreateBuffer(context(), flags, size, 0, &error);
6507  }
6508 
6509  detail::errHandler(error, __CREATE_BUFFER_ERR);
6510  if (err != NULL) {
6511  *err = error;
6512  }
6513 
6514  if( !useHostPtr ) {
6515  CommandQueue queue(context, 0, &error);
6516  detail::errHandler(error, __CREATE_BUFFER_ERR);
6517  if (err != NULL) {
6518  *err = error;
6519  }
6520 
6521  error = cl::copy(queue, startIterator, endIterator, *this);
6522  detail::errHandler(error, __CREATE_BUFFER_ERR);
6523  if (err != NULL) {
6524  *err = error;
6525  }
6526  }
6527 }
6528 
6529 template< typename IteratorType >
6531  const CommandQueue &queue,
6532  IteratorType startIterator,
6533  IteratorType endIterator,
6534  bool readOnly,
6535  bool useHostPtr,
6536  cl_int* err)
6537 {
6538  typedef typename std::iterator_traits<IteratorType>::value_type DataType;
6539  cl_int error;
6540 
6541  cl_mem_flags flags = 0;
6542  if (readOnly) {
6543  flags |= CL_MEM_READ_ONLY;
6544  }
6545  else {
6546  flags |= CL_MEM_READ_WRITE;
6547  }
6548  if (useHostPtr) {
6549  flags |= CL_MEM_USE_HOST_PTR;
6550  }
6551 
6552  ::size_t size = sizeof(DataType)*(endIterator - startIterator);
6553 
6554  Context context = queue.getInfo<CL_QUEUE_CONTEXT>();
6555 
6556  if (useHostPtr) {
6557  object_ = ::clCreateBuffer(context(), flags, size, static_cast<DataType*>(&*startIterator), &error);
6558  }
6559  else {
6560  object_ = ::clCreateBuffer(context(), flags, size, 0, &error);
6561  }
6562 
6563  detail::errHandler(error, __CREATE_BUFFER_ERR);
6564  if (err != NULL) {
6565  *err = error;
6566  }
6567 
6568  if (!useHostPtr) {
6569  error = cl::copy(queue, startIterator, endIterator, *this);
6570  detail::errHandler(error, __CREATE_BUFFER_ERR);
6571  if (err != NULL) {
6572  *err = error;
6573  }
6574  }
6575 }
6576 
6577 inline cl_int enqueueReadBuffer(
6578  const Buffer& buffer,
6579  cl_bool blocking,
6580  ::size_t offset,
6581  ::size_t size,
6582  void* ptr,
6583  const VECTOR_CLASS<Event>* events = NULL,
6584  Event* event = NULL)
6585 {
6586  cl_int error;
6587  CommandQueue queue = CommandQueue::getDefault(&error);
6588 
6589  if (error != CL_SUCCESS) {
6590  return error;
6591  }
6592 
6593  return queue.enqueueReadBuffer(buffer, blocking, offset, size, ptr, events, event);
6594 }
6595 
6596 inline cl_int enqueueWriteBuffer(
6597  const Buffer& buffer,
6598  cl_bool blocking,
6599  ::size_t offset,
6600  ::size_t size,
6601  const void* ptr,
6602  const VECTOR_CLASS<Event>* events = NULL,
6603  Event* event = NULL)
6604 {
6605  cl_int error;
6606  CommandQueue queue = CommandQueue::getDefault(&error);
6607 
6608  if (error != CL_SUCCESS) {
6609  return error;
6610  }
6611 
6612  return queue.enqueueWriteBuffer(buffer, blocking, offset, size, ptr, events, event);
6613 }
6614 
6615 inline void* enqueueMapBuffer(
6616  const Buffer& buffer,
6617  cl_bool blocking,
6618  cl_map_flags flags,
6619  ::size_t offset,
6620  ::size_t size,
6621  const VECTOR_CLASS<Event>* events = NULL,
6622  Event* event = NULL,
6623  cl_int* err = NULL)
6624 {
6625  cl_int error;
6626  CommandQueue queue = CommandQueue::getDefault(&error);
6627  detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
6628  if (err != NULL) {
6629  *err = error;
6630  }
6631 
6632  void * result = ::clEnqueueMapBuffer(
6633  queue(), buffer(), blocking, flags, offset, size,
6634  (events != NULL) ? (cl_uint) events->size() : 0,
6635  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
6636  (cl_event*) event,
6637  &error);
6638 
6639  detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
6640  if (err != NULL) {
6641  *err = error;
6642  }
6643  return result;
6644 }
6645 
6647  const Memory& memory,
6648  void* mapped_ptr,
6649  const VECTOR_CLASS<Event>* events = NULL,
6650  Event* event = NULL)
6651 {
6652  cl_int error;
6653  CommandQueue queue = CommandQueue::getDefault(&error);
6654  detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
6655  if (error != CL_SUCCESS) {
6656  return error;
6657  }
6658 
6659  cl_event tmp;
6660  cl_int err = detail::errHandler(
6661  ::clEnqueueUnmapMemObject(
6662  queue(), memory(), mapped_ptr,
6663  (events != NULL) ? (cl_uint) events->size() : 0,
6664  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
6665  (event != NULL) ? &tmp : NULL),
6666  __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
6667 
6668  if (event != NULL && err == CL_SUCCESS)
6669  *event = tmp;
6670 
6671  return err;
6672 }
6673 
6674 inline cl_int enqueueCopyBuffer(
6675  const Buffer& src,
6676  const Buffer& dst,
6677  ::size_t src_offset,
6678  ::size_t dst_offset,
6679  ::size_t size,
6680  const VECTOR_CLASS<Event>* events = NULL,
6681  Event* event = NULL)
6682 {
6683  cl_int error;
6684  CommandQueue queue = CommandQueue::getDefault(&error);
6685 
6686  if (error != CL_SUCCESS) {
6687  return error;
6688  }
6689 
6690  return queue.enqueueCopyBuffer(src, dst, src_offset, dst_offset, size, events, event);
6691 }
6692 
6698 template< typename IteratorType >
6699 inline cl_int copy( IteratorType startIterator, IteratorType endIterator, cl::Buffer &buffer )
6700 {
6701  cl_int error;
6702  CommandQueue queue = CommandQueue::getDefault(&error);
6703  if (error != CL_SUCCESS)
6704  return error;
6705 
6706  return cl::copy(queue, startIterator, endIterator, buffer);
6707 }
6708 
6714 template< typename IteratorType >
6715 inline cl_int copy( const cl::Buffer &buffer, IteratorType startIterator, IteratorType endIterator )
6716 {
6717  cl_int error;
6718  CommandQueue queue = CommandQueue::getDefault(&error);
6719  if (error != CL_SUCCESS)
6720  return error;
6721 
6722  return cl::copy(queue, buffer, startIterator, endIterator);
6723 }
6724 
6730 template< typename IteratorType >
6731 inline cl_int copy( const CommandQueue &queue, IteratorType startIterator, IteratorType endIterator, cl::Buffer &buffer )
6732 {
6733  typedef typename std::iterator_traits<IteratorType>::value_type DataType;
6734  cl_int error;
6735 
6736  ::size_t length = endIterator-startIterator;
6737  ::size_t byteLength = length*sizeof(DataType);
6738 
6739  DataType *pointer =
6740  static_cast<DataType*>(queue.enqueueMapBuffer(buffer, CL_TRUE, CL_MAP_WRITE, 0, byteLength, 0, 0, &error));
6741  // if exceptions enabled, enqueueMapBuffer will throw
6742  if( error != CL_SUCCESS ) {
6743  return error;
6744  }
6745 #if defined(_MSC_VER)
6746  std::copy(
6747  startIterator,
6748  endIterator,
6749  stdext::checked_array_iterator<DataType*>(
6750  pointer, length));
6751 #else
6752  std::copy(startIterator, endIterator, pointer);
6753 #endif
6754  Event endEvent;
6755  error = queue.enqueueUnmapMemObject(buffer, pointer, 0, &endEvent);
6756  // if exceptions enabled, enqueueUnmapMemObject will throw
6757  if( error != CL_SUCCESS ) {
6758  return error;
6759  }
6760  endEvent.wait();
6761  return CL_SUCCESS;
6762 }
6763 
6769 template< typename IteratorType >
6770 inline cl_int copy( const CommandQueue &queue, const cl::Buffer &buffer, IteratorType startIterator, IteratorType endIterator )
6771 {
6772  typedef typename std::iterator_traits<IteratorType>::value_type DataType;
6773  cl_int error;
6774 
6775  ::size_t length = endIterator-startIterator;
6776  ::size_t byteLength = length*sizeof(DataType);
6777 
6778  DataType *pointer =
6779  static_cast<DataType*>(queue.enqueueMapBuffer(buffer, CL_TRUE, CL_MAP_READ, 0, byteLength, 0, 0, &error));
6780  // if exceptions enabled, enqueueMapBuffer will throw
6781  if( error != CL_SUCCESS ) {
6782  return error;
6783  }
6784  std::copy(pointer, pointer + length, startIterator);
6785  Event endEvent;
6786  error = queue.enqueueUnmapMemObject(buffer, pointer, 0, &endEvent);
6787  // if exceptions enabled, enqueueUnmapMemObject will throw
6788  if( error != CL_SUCCESS ) {
6789  return error;
6790  }
6791  endEvent.wait();
6792  return CL_SUCCESS;
6793 }
6794 
6795 #if defined(CL_VERSION_1_1)
6796 inline cl_int enqueueReadBufferRect(
6797  const Buffer& buffer,
6798  cl_bool blocking,
6799  const size_t<3>& buffer_offset,
6800  const size_t<3>& host_offset,
6801  const size_t<3>& region,
6802  ::size_t buffer_row_pitch,
6803  ::size_t buffer_slice_pitch,
6804  ::size_t host_row_pitch,
6805  ::size_t host_slice_pitch,
6806  void *ptr,
6807  const VECTOR_CLASS<Event>* events = NULL,
6808  Event* event = NULL)
6809 {
6810  cl_int error;
6811  CommandQueue queue = CommandQueue::getDefault(&error);
6812 
6813  if (error != CL_SUCCESS) {
6814  return error;
6815  }
6816 
6817  return queue.enqueueReadBufferRect(
6818  buffer,
6819  blocking,
6820  buffer_offset,
6821  host_offset,
6822  region,
6823  buffer_row_pitch,
6824  buffer_slice_pitch,
6825  host_row_pitch,
6826  host_slice_pitch,
6827  ptr,
6828  events,
6829  event);
6830 }
6831 
6832 inline cl_int enqueueWriteBufferRect(
6833  const Buffer& buffer,
6834  cl_bool blocking,
6835  const size_t<3>& buffer_offset,
6836  const size_t<3>& host_offset,
6837  const size_t<3>& region,
6838  ::size_t buffer_row_pitch,
6839  ::size_t buffer_slice_pitch,
6840  ::size_t host_row_pitch,
6841  ::size_t host_slice_pitch,
6842  void *ptr,
6843  const VECTOR_CLASS<Event>* events = NULL,
6844  Event* event = NULL)
6845 {
6846  cl_int error;
6847  CommandQueue queue = CommandQueue::getDefault(&error);
6848 
6849  if (error != CL_SUCCESS) {
6850  return error;
6851  }
6852 
6853  return queue.enqueueWriteBufferRect(
6854  buffer,
6855  blocking,
6856  buffer_offset,
6857  host_offset,
6858  region,
6859  buffer_row_pitch,
6860  buffer_slice_pitch,
6861  host_row_pitch,
6862  host_slice_pitch,
6863  ptr,
6864  events,
6865  event);
6866 }
6867 
6868 inline cl_int enqueueCopyBufferRect(
6869  const Buffer& src,
6870  const Buffer& dst,
6871  const size_t<3>& src_origin,
6872  const size_t<3>& dst_origin,
6873  const size_t<3>& region,
6874  ::size_t src_row_pitch,
6875  ::size_t src_slice_pitch,
6876  ::size_t dst_row_pitch,
6877  ::size_t dst_slice_pitch,
6878  const VECTOR_CLASS<Event>* events = NULL,
6879  Event* event = NULL)
6880 {
6881  cl_int error;
6882  CommandQueue queue = CommandQueue::getDefault(&error);
6883 
6884  if (error != CL_SUCCESS) {
6885  return error;
6886  }
6887 
6888  return queue.enqueueCopyBufferRect(
6889  src,
6890  dst,
6891  src_origin,
6892  dst_origin,
6893  region,
6894  src_row_pitch,
6895  src_slice_pitch,
6896  dst_row_pitch,
6897  dst_slice_pitch,
6898  events,
6899  event);
6900 }
6901 #endif
6902 
6903 inline cl_int enqueueReadImage(
6904  const Image& image,
6905  cl_bool blocking,
6906  const size_t<3>& origin,
6907  const size_t<3>& region,
6908  ::size_t row_pitch,
6909  ::size_t slice_pitch,
6910  void* ptr,
6911  const VECTOR_CLASS<Event>* events = NULL,
6912  Event* event = NULL)
6913 {
6914  cl_int error;
6915  CommandQueue queue = CommandQueue::getDefault(&error);
6916 
6917  if (error != CL_SUCCESS) {
6918  return error;
6919  }
6920 
6921  return queue.enqueueReadImage(
6922  image,
6923  blocking,
6924  origin,
6925  region,
6926  row_pitch,
6927  slice_pitch,
6928  ptr,
6929  events,
6930  event);
6931 }
6932 
6933 inline cl_int enqueueWriteImage(
6934  const Image& image,
6935  cl_bool blocking,
6936  const size_t<3>& origin,
6937  const size_t<3>& region,
6938  ::size_t row_pitch,
6939  ::size_t slice_pitch,
6940  void* ptr,
6941  const VECTOR_CLASS<Event>* events = NULL,
6942  Event* event = NULL)
6943 {
6944  cl_int error;
6945  CommandQueue queue = CommandQueue::getDefault(&error);
6946 
6947  if (error != CL_SUCCESS) {
6948  return error;
6949  }
6950 
6951  return queue.enqueueWriteImage(
6952  image,
6953  blocking,
6954  origin,
6955  region,
6956  row_pitch,
6957  slice_pitch,
6958  ptr,
6959  events,
6960  event);
6961 }
6962 
6963 inline cl_int enqueueCopyImage(
6964  const Image& src,
6965  const Image& dst,
6966  const size_t<3>& src_origin,
6967  const size_t<3>& dst_origin,
6968  const size_t<3>& region,
6969  const VECTOR_CLASS<Event>* events = NULL,
6970  Event* event = NULL)
6971 {
6972  cl_int error;
6973  CommandQueue queue = CommandQueue::getDefault(&error);
6974 
6975  if (error != CL_SUCCESS) {
6976  return error;
6977  }
6978 
6979  return queue.enqueueCopyImage(
6980  src,
6981  dst,
6982  src_origin,
6983  dst_origin,
6984  region,
6985  events,
6986  event);
6987 }
6988 
6990  const Image& src,
6991  const Buffer& dst,
6992  const size_t<3>& src_origin,
6993  const size_t<3>& region,
6994  ::size_t dst_offset,
6995  const VECTOR_CLASS<Event>* events = NULL,
6996  Event* event = NULL)
6997 {
6998  cl_int error;
6999  CommandQueue queue = CommandQueue::getDefault(&error);
7000 
7001  if (error != CL_SUCCESS) {
7002  return error;
7003  }
7004 
7005  return queue.enqueueCopyImageToBuffer(
7006  src,
7007  dst,
7008  src_origin,
7009  region,
7010  dst_offset,
7011  events,
7012  event);
7013 }
7014 
7016  const Buffer& src,
7017  const Image& dst,
7018  ::size_t src_offset,
7019  const size_t<3>& dst_origin,
7020  const size_t<3>& region,
7021  const VECTOR_CLASS<Event>* events = NULL,
7022  Event* event = NULL)
7023 {
7024  cl_int error;
7025  CommandQueue queue = CommandQueue::getDefault(&error);
7026 
7027  if (error != CL_SUCCESS) {
7028  return error;
7029  }
7030 
7031  return queue.enqueueCopyBufferToImage(
7032  src,
7033  dst,
7034  src_offset,
7035  dst_origin,
7036  region,
7037  events,
7038  event);
7039 }
7040 
7041 
7042 inline cl_int flush(void)
7043 {
7044  cl_int error;
7045  CommandQueue queue = CommandQueue::getDefault(&error);
7046 
7047  if (error != CL_SUCCESS) {
7048  return error;
7049  }
7050 
7051  return queue.flush();
7052 }
7053 
7054 inline cl_int finish(void)
7055 {
7056  cl_int error;
7057  CommandQueue queue = CommandQueue::getDefault(&error);
7058 
7059  if (error != CL_SUCCESS) {
7060  return error;
7061  }
7062 
7063 
7064  return queue.finish();
7065 }
7066 
7067 // Kernel Functor support
7068 // New interface as of September 2011
7069 // Requires the C++11 std::tr1::function (note do not support TR1)
7070 // Visual Studio 2010 and GCC 4.2
7071 
7073 {
7078  VECTOR_CLASS<Event> events_;
7079 
7081  queue_(CommandQueue::getDefault()),
7082  offset_(NullRange),
7083  global_(global),
7084  local_(NullRange)
7085  {
7086 
7087  }
7088 
7089  EnqueueArgs(NDRange global, NDRange local) :
7090  queue_(CommandQueue::getDefault()),
7091  offset_(NullRange),
7092  global_(global),
7093  local_(local)
7094  {
7095 
7096  }
7097 
7099  queue_(CommandQueue::getDefault()),
7100  offset_(offset),
7101  global_(global),
7102  local_(local)
7103  {
7104 
7105  }
7106 
7107  EnqueueArgs(Event e, NDRange global) :
7108  queue_(CommandQueue::getDefault()),
7109  offset_(NullRange),
7110  global_(global),
7111  local_(NullRange)
7112  {
7113  events_.push_back(e);
7114  }
7115 
7116  EnqueueArgs(Event e, NDRange global, NDRange local) :
7117  queue_(CommandQueue::getDefault()),
7118  offset_(NullRange),
7119  global_(global),
7120  local_(local)
7121  {
7122  events_.push_back(e);
7123  }
7124 
7126  queue_(CommandQueue::getDefault()),
7127  offset_(offset),
7128  global_(global),
7129  local_(local)
7130  {
7131  events_.push_back(e);
7132  }
7133 
7134  EnqueueArgs(const VECTOR_CLASS<Event> &events, NDRange global) :
7135  queue_(CommandQueue::getDefault()),
7136  offset_(NullRange),
7137  global_(global),
7138  local_(NullRange),
7139  events_(events)
7140  {
7141 
7142  }
7143 
7144  EnqueueArgs(const VECTOR_CLASS<Event> &events, NDRange global, NDRange local) :
7145  queue_(CommandQueue::getDefault()),
7146  offset_(NullRange),
7147  global_(global),
7148  local_(local),
7149  events_(events)
7150  {
7151 
7152  }
7153 
7154  EnqueueArgs(const VECTOR_CLASS<Event> &events, NDRange offset, NDRange global, NDRange local) :
7155  queue_(CommandQueue::getDefault()),
7156  offset_(offset),
7157  global_(global),
7158  local_(local),
7159  events_(events)
7160  {
7161 
7162  }
7163 
7164  EnqueueArgs(CommandQueue &queue, NDRange global) :
7165  queue_(queue),
7166  offset_(NullRange),
7167  global_(global),
7168  local_(NullRange)
7169  {
7170 
7171  }
7172 
7173  EnqueueArgs(CommandQueue &queue, NDRange global, NDRange local) :
7174  queue_(queue),
7175  offset_(NullRange),
7176  global_(global),
7177  local_(local)
7178  {
7179 
7180  }
7181 
7183  queue_(queue),
7184  offset_(offset),
7185  global_(global),
7186  local_(local)
7187  {
7188 
7189  }
7190 
7191  EnqueueArgs(CommandQueue &queue, Event e, NDRange global) :
7192  queue_(queue),
7193  offset_(NullRange),
7194  global_(global),
7195  local_(NullRange)
7196  {
7197  events_.push_back(e);
7198  }
7199 
7200  EnqueueArgs(CommandQueue &queue, Event e, NDRange global, NDRange local) :
7201  queue_(queue),
7202  offset_(NullRange),
7203  global_(global),
7204  local_(local)
7205  {
7206  events_.push_back(e);
7207  }
7208 
7210  queue_(queue),
7211  offset_(offset),
7212  global_(global),
7213  local_(local)
7214  {
7215  events_.push_back(e);
7216  }
7217 
7218  EnqueueArgs(CommandQueue &queue, const VECTOR_CLASS<Event> &events, NDRange global) :
7219  queue_(queue),
7220  offset_(NullRange),
7221  global_(global),
7222  local_(NullRange),
7223  events_(events)
7224  {
7225 
7226  }
7227 
7228  EnqueueArgs(CommandQueue &queue, const VECTOR_CLASS<Event> &events, NDRange global, NDRange local) :
7229  queue_(queue),
7230  offset_(NullRange),
7231  global_(global),
7232  local_(local),
7233  events_(events)
7234  {
7235 
7236  }
7237 
7238  EnqueueArgs(CommandQueue &queue, const VECTOR_CLASS<Event> &events, NDRange offset, NDRange global, NDRange local) :
7239  queue_(queue),
7240  offset_(offset),
7241  global_(global),
7242  local_(local),
7243  events_(events)
7244  {
7245 
7246  }
7247 };
7248 
7249 namespace detail {
7250 
7251 class NullType {};
7252 
7253 template<int index, typename T0>
7254 struct SetArg
7255 {
7256  static void set (Kernel kernel, T0 arg)
7257  {
7258  kernel.setArg(index, arg);
7259  }
7260 };
7261 
7262 template<int index>
7263 struct SetArg<index, NullType>
7264 {
7265  static void set (Kernel, NullType)
7266  {
7267  }
7268 };
7269 
7270 template <
7271  typename T0, typename T1, typename T2, typename T3,
7272  typename T4, typename T5, typename T6, typename T7,
7273  typename T8, typename T9, typename T10, typename T11,
7274  typename T12, typename T13, typename T14, typename T15,
7275  typename T16, typename T17, typename T18, typename T19,
7276  typename T20, typename T21, typename T22, typename T23,
7277  typename T24, typename T25, typename T26, typename T27,
7278  typename T28, typename T29, typename T30, typename T31
7279 >
7281 {
7282 private:
7283  Kernel kernel_;
7284 
7285 public:
7287  Kernel kernel) :
7288  kernel_(kernel)
7289  {}
7290 
7292  const Program& program,
7293  const STRING_CLASS name,
7294  cl_int * err = NULL) :
7295  kernel_(program, name.c_str(), err)
7296  {}
7297 
7299  const EnqueueArgs& args,
7300  T0 t0,
7301  T1 t1 = NullType(),
7302  T2 t2 = NullType(),
7303  T3 t3 = NullType(),
7304  T4 t4 = NullType(),
7305  T5 t5 = NullType(),
7306  T6 t6 = NullType(),
7307  T7 t7 = NullType(),
7308  T8 t8 = NullType(),
7309  T9 t9 = NullType(),
7310  T10 t10 = NullType(),
7311  T11 t11 = NullType(),
7312  T12 t12 = NullType(),
7313  T13 t13 = NullType(),
7314  T14 t14 = NullType(),
7315  T15 t15 = NullType(),
7316  T16 t16 = NullType(),
7317  T17 t17 = NullType(),
7318  T18 t18 = NullType(),
7319  T19 t19 = NullType(),
7320  T20 t20 = NullType(),
7321  T21 t21 = NullType(),
7322  T22 t22 = NullType(),
7323  T23 t23 = NullType(),
7324  T24 t24 = NullType(),
7325  T25 t25 = NullType(),
7326  T26 t26 = NullType(),
7327  T27 t27 = NullType(),
7328  T28 t28 = NullType(),
7329  T29 t29 = NullType(),
7330  T30 t30 = NullType(),
7331  T31 t31 = NullType()
7332  )
7333  {
7334  Event event;
7335  SetArg<0, T0>::set(kernel_, t0);
7336  SetArg<1, T1>::set(kernel_, t1);
7337  SetArg<2, T2>::set(kernel_, t2);
7338  SetArg<3, T3>::set(kernel_, t3);
7339  SetArg<4, T4>::set(kernel_, t4);
7340  SetArg<5, T5>::set(kernel_, t5);
7341  SetArg<6, T6>::set(kernel_, t6);
7342  SetArg<7, T7>::set(kernel_, t7);
7343  SetArg<8, T8>::set(kernel_, t8);
7344  SetArg<9, T9>::set(kernel_, t9);
7345  SetArg<10, T10>::set(kernel_, t10);
7346  SetArg<11, T11>::set(kernel_, t11);
7347  SetArg<12, T12>::set(kernel_, t12);
7348  SetArg<13, T13>::set(kernel_, t13);
7349  SetArg<14, T14>::set(kernel_, t14);
7350  SetArg<15, T15>::set(kernel_, t15);
7351  SetArg<16, T16>::set(kernel_, t16);
7352  SetArg<17, T17>::set(kernel_, t17);
7353  SetArg<18, T18>::set(kernel_, t18);
7354  SetArg<19, T19>::set(kernel_, t19);
7355  SetArg<20, T20>::set(kernel_, t20);
7356  SetArg<21, T21>::set(kernel_, t21);
7357  SetArg<22, T22>::set(kernel_, t22);
7358  SetArg<23, T23>::set(kernel_, t23);
7359  SetArg<24, T24>::set(kernel_, t24);
7360  SetArg<25, T25>::set(kernel_, t25);
7361  SetArg<26, T26>::set(kernel_, t26);
7362  SetArg<27, T27>::set(kernel_, t27);
7363  SetArg<28, T28>::set(kernel_, t28);
7364  SetArg<29, T29>::set(kernel_, t29);
7365  SetArg<30, T30>::set(kernel_, t30);
7366  SetArg<31, T31>::set(kernel_, t31);
7367 
7369  kernel_,
7370  args.offset_,
7371  args.global_,
7372  args.local_,
7373  &args.events_,
7374  &event);
7375 
7376  return event;
7377  }
7378 
7379 };
7380 
7381 //------------------------------------------------------------------------------------------------------
7382 
7383 
7384 template<
7385  typename T0,
7386  typename T1,
7387  typename T2,
7388  typename T3,
7389  typename T4,
7390  typename T5,
7391  typename T6,
7392  typename T7,
7393  typename T8,
7394  typename T9,
7395  typename T10,
7396  typename T11,
7397  typename T12,
7398  typename T13,
7399  typename T14,
7400  typename T15,
7401  typename T16,
7402  typename T17,
7403  typename T18,
7404  typename T19,
7405  typename T20,
7406  typename T21,
7407  typename T22,
7408  typename T23,
7409  typename T24,
7410  typename T25,
7411  typename T26,
7412  typename T27,
7413  typename T28,
7414  typename T29,
7415  typename T30,
7416  typename T31>
7418 {
7420  T0,
7421  T1,
7422  T2,
7423  T3,
7424  T4,
7425  T5,
7426  T6,
7427  T7,
7428  T8,
7429  T9,
7430  T10,
7431  T11,
7432  T12,
7433  T13,
7434  T14,
7435  T15,
7436  T16,
7437  T17,
7438  T18,
7439  T19,
7440  T20,
7441  T21,
7442  T22,
7443  T23,
7444  T24,
7445  T25,
7446  T26,
7447  T27,
7448  T28,
7449  T29,
7450  T30,
7452 
7454 
7456  functor_(functor)
7457  {
7458 
7459  #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 32))
7460  // Fail variadic expansion for dev11
7461  static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
7462  #endif
7463 
7464  }
7465 
7468 
7470  typedef Event type_(
7471  const EnqueueArgs&,
7472  T0,
7473  T1,
7474  T2,
7475  T3,
7476  T4,
7477  T5,
7478  T6,
7479  T7,
7480  T8,
7481  T9,
7482  T10,
7483  T11,
7484  T12,
7485  T13,
7486  T14,
7487  T15,
7488  T16,
7489  T17,
7490  T18,
7491  T19,
7492  T20,
7493  T21,
7494  T22,
7495  T23,
7496  T24,
7497  T25,
7498  T26,
7499  T27,
7500  T28,
7501  T29,
7502  T30,
7503  T31);
7504 
7506  const EnqueueArgs& enqueueArgs,
7507  T0 arg0,
7508  T1 arg1,
7509  T2 arg2,
7510  T3 arg3,
7511  T4 arg4,
7512  T5 arg5,
7513  T6 arg6,
7514  T7 arg7,
7515  T8 arg8,
7516  T9 arg9,
7517  T10 arg10,
7518  T11 arg11,
7519  T12 arg12,
7520  T13 arg13,
7521  T14 arg14,
7522  T15 arg15,
7523  T16 arg16,
7524  T17 arg17,
7525  T18 arg18,
7526  T19 arg19,
7527  T20 arg20,
7528  T21 arg21,
7529  T22 arg22,
7530  T23 arg23,
7531  T24 arg24,
7532  T25 arg25,
7533  T26 arg26,
7534  T27 arg27,
7535  T28 arg28,
7536  T29 arg29,
7537  T30 arg30,
7538  T31 arg31)
7539  {
7540  return functor_(
7541  enqueueArgs,
7542  arg0,
7543  arg1,
7544  arg2,
7545  arg3,
7546  arg4,
7547  arg5,
7548  arg6,
7549  arg7,
7550  arg8,
7551  arg9,
7552  arg10,
7553  arg11,
7554  arg12,
7555  arg13,
7556  arg14,
7557  arg15,
7558  arg16,
7559  arg17,
7560  arg18,
7561  arg19,
7562  arg20,
7563  arg21,
7564  arg22,
7565  arg23,
7566  arg24,
7567  arg25,
7568  arg26,
7569  arg27,
7570  arg28,
7571  arg29,
7572  arg30,
7573  arg31);
7574  }
7575 
7576 
7577 };
7578 
7579 template<
7580  typename T0,
7581  typename T1,
7582  typename T2,
7583  typename T3,
7584  typename T4,
7585  typename T5,
7586  typename T6,
7587  typename T7,
7588  typename T8,
7589  typename T9,
7590  typename T10,
7591  typename T11,
7592  typename T12,
7593  typename T13,
7594  typename T14,
7595  typename T15,
7596  typename T16,
7597  typename T17,
7598  typename T18,
7599  typename T19,
7600  typename T20,
7601  typename T21,
7602  typename T22,
7603  typename T23,
7604  typename T24,
7605  typename T25,
7606  typename T26,
7607  typename T27,
7608  typename T28,
7609  typename T29,
7610  typename T30>
7612 < T0,
7613  T1,
7614  T2,
7615  T3,
7616  T4,
7617  T5,
7618  T6,
7619  T7,
7620  T8,
7621  T9,
7622  T10,
7623  T11,
7624  T12,
7625  T13,
7626  T14,
7627  T15,
7628  T16,
7629  T17,
7630  T18,
7631  T19,
7632  T20,
7633  T21,
7634  T22,
7635  T23,
7636  T24,
7637  T25,
7638  T26,
7639  T27,
7640  T28,
7641  T29,
7642  T30,
7643  NullType>
7644 {
7646  T0,
7647  T1,
7648  T2,
7649  T3,
7650  T4,
7651  T5,
7652  T6,
7653  T7,
7654  T8,
7655  T9,
7656  T10,
7657  T11,
7658  T12,
7659  T13,
7660  T14,
7661  T15,
7662  T16,
7663  T17,
7664  T18,
7665  T19,
7666  T20,
7667  T21,
7668  T22,
7669  T23,
7670  T24,
7671  T25,
7672  T26,
7673  T27,
7674  T28,
7675  T29,
7676  T30,
7678 
7680 
7682  functor_(functor)
7683  {
7684 
7685  #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 31))
7686  // Fail variadic expansion for dev11
7687  static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
7688  #endif
7689 
7690  }
7691 
7694 
7696  typedef Event type_(
7697  const EnqueueArgs&,
7698  T0,
7699  T1,
7700  T2,
7701  T3,
7702  T4,
7703  T5,
7704  T6,
7705  T7,
7706  T8,
7707  T9,
7708  T10,
7709  T11,
7710  T12,
7711  T13,
7712  T14,
7713  T15,
7714  T16,
7715  T17,
7716  T18,
7717  T19,
7718  T20,
7719  T21,
7720  T22,
7721  T23,
7722  T24,
7723  T25,
7724  T26,
7725  T27,
7726  T28,
7727  T29,
7728  T30);
7729 
7731  const EnqueueArgs& enqueueArgs,
7732  T0 arg0,
7733  T1 arg1,
7734  T2 arg2,
7735  T3 arg3,
7736  T4 arg4,
7737  T5 arg5,
7738  T6 arg6,
7739  T7 arg7,
7740  T8 arg8,
7741  T9 arg9,
7742  T10 arg10,
7743  T11 arg11,
7744  T12 arg12,
7745  T13 arg13,
7746  T14 arg14,
7747  T15 arg15,
7748  T16 arg16,
7749  T17 arg17,
7750  T18 arg18,
7751  T19 arg19,
7752  T20 arg20,
7753  T21 arg21,
7754  T22 arg22,
7755  T23 arg23,
7756  T24 arg24,
7757  T25 arg25,
7758  T26 arg26,
7759  T27 arg27,
7760  T28 arg28,
7761  T29 arg29,
7762  T30 arg30)
7763  {
7764  return functor_(
7765  enqueueArgs,
7766  arg0,
7767  arg1,
7768  arg2,
7769  arg3,
7770  arg4,
7771  arg5,
7772  arg6,
7773  arg7,
7774  arg8,
7775  arg9,
7776  arg10,
7777  arg11,
7778  arg12,
7779  arg13,
7780  arg14,
7781  arg15,
7782  arg16,
7783  arg17,
7784  arg18,
7785  arg19,
7786  arg20,
7787  arg21,
7788  arg22,
7789  arg23,
7790  arg24,
7791  arg25,
7792  arg26,
7793  arg27,
7794  arg28,
7795  arg29,
7796  arg30);
7797  }
7798 
7799 
7800 };
7801 
7802 template<
7803  typename T0,
7804  typename T1,
7805  typename T2,
7806  typename T3,
7807  typename T4,
7808  typename T5,
7809  typename T6,
7810  typename T7,
7811  typename T8,
7812  typename T9,
7813  typename T10,
7814  typename T11,
7815  typename T12,
7816  typename T13,
7817  typename T14,
7818  typename T15,
7819  typename T16,
7820  typename T17,
7821  typename T18,
7822  typename T19,
7823  typename T20,
7824  typename T21,
7825  typename T22,
7826  typename T23,
7827  typename T24,
7828  typename T25,
7829  typename T26,
7830  typename T27,
7831  typename T28,
7832  typename T29>
7834 < T0,
7835  T1,
7836  T2,
7837  T3,
7838  T4,
7839  T5,
7840  T6,
7841  T7,
7842  T8,
7843  T9,
7844  T10,
7845  T11,
7846  T12,
7847  T13,
7848  T14,
7849  T15,
7850  T16,
7851  T17,
7852  T18,
7853  T19,
7854  T20,
7855  T21,
7856  T22,
7857  T23,
7858  T24,
7859  T25,
7860  T26,
7861  T27,
7862  T28,
7863  T29,
7864  NullType,
7865  NullType>
7866 {
7868  T0,
7869  T1,
7870  T2,
7871  T3,
7872  T4,
7873  T5,
7874  T6,
7875  T7,
7876  T8,
7877  T9,
7878  T10,
7879  T11,
7880  T12,
7881  T13,
7882  T14,
7883  T15,
7884  T16,
7885  T17,
7886  T18,
7887  T19,
7888  T20,
7889  T21,
7890  T22,
7891  T23,
7892  T24,
7893  T25,
7894  T26,
7895  T27,
7896  T28,
7897  T29,
7898  NullType,
7900 
7902 
7904  functor_(functor)
7905  {
7906 
7907  #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 30))
7908  // Fail variadic expansion for dev11
7909  static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
7910  #endif
7911 
7912  }
7913 
7916 
7918  typedef Event type_(
7919  const EnqueueArgs&,
7920  T0,
7921  T1,
7922  T2,
7923  T3,
7924  T4,
7925  T5,
7926  T6,
7927  T7,
7928  T8,
7929  T9,
7930  T10,
7931  T11,
7932  T12,
7933  T13,
7934  T14,
7935  T15,
7936  T16,
7937  T17,
7938  T18,
7939  T19,
7940  T20,
7941  T21,
7942  T22,
7943  T23,
7944  T24,
7945  T25,
7946  T26,
7947  T27,
7948  T28,
7949  T29);
7950 
7952  const EnqueueArgs& enqueueArgs,
7953  T0 arg0,
7954  T1 arg1,
7955  T2 arg2,
7956  T3 arg3,
7957  T4 arg4,
7958  T5 arg5,
7959  T6 arg6,
7960  T7 arg7,
7961  T8 arg8,
7962  T9 arg9,
7963  T10 arg10,
7964  T11 arg11,
7965  T12 arg12,
7966  T13 arg13,
7967  T14 arg14,
7968  T15 arg15,
7969  T16 arg16,
7970  T17 arg17,
7971  T18 arg18,
7972  T19 arg19,
7973  T20 arg20,
7974  T21 arg21,
7975  T22 arg22,
7976  T23 arg23,
7977  T24 arg24,
7978  T25 arg25,
7979  T26 arg26,
7980  T27 arg27,
7981  T28 arg28,
7982  T29 arg29)
7983  {
7984  return functor_(
7985  enqueueArgs,
7986  arg0,
7987  arg1,
7988  arg2,
7989  arg3,
7990  arg4,
7991  arg5,
7992  arg6,
7993  arg7,
7994  arg8,
7995  arg9,
7996  arg10,
7997  arg11,
7998  arg12,
7999  arg13,
8000  arg14,
8001  arg15,
8002  arg16,
8003  arg17,
8004  arg18,
8005  arg19,
8006  arg20,
8007  arg21,
8008  arg22,
8009  arg23,
8010  arg24,
8011  arg25,
8012  arg26,
8013  arg27,
8014  arg28,
8015  arg29);
8016  }
8017 
8018 
8019 };
8020 
8021 template<
8022  typename T0,
8023  typename T1,
8024  typename T2,
8025  typename T3,
8026  typename T4,
8027  typename T5,
8028  typename T6,
8029  typename T7,
8030  typename T8,
8031  typename T9,
8032  typename T10,
8033  typename T11,
8034  typename T12,
8035  typename T13,
8036  typename T14,
8037  typename T15,
8038  typename T16,
8039  typename T17,
8040  typename T18,
8041  typename T19,
8042  typename T20,
8043  typename T21,
8044  typename T22,
8045  typename T23,
8046  typename T24,
8047  typename T25,
8048  typename T26,
8049  typename T27,
8050  typename T28>
8052 < T0,
8053  T1,
8054  T2,
8055  T3,
8056  T4,
8057  T5,
8058  T6,
8059  T7,
8060  T8,
8061  T9,
8062  T10,
8063  T11,
8064  T12,
8065  T13,
8066  T14,
8067  T15,
8068  T16,
8069  T17,
8070  T18,
8071  T19,
8072  T20,
8073  T21,
8074  T22,
8075  T23,
8076  T24,
8077  T25,
8078  T26,
8079  T27,
8080  T28,
8081  NullType,
8082  NullType,
8083  NullType>
8084 {
8086  T0,
8087  T1,
8088  T2,
8089  T3,
8090  T4,
8091  T5,
8092  T6,
8093  T7,
8094  T8,
8095  T9,
8096  T10,
8097  T11,
8098  T12,
8099  T13,
8100  T14,
8101  T15,
8102  T16,
8103  T17,
8104  T18,
8105  T19,
8106  T20,
8107  T21,
8108  T22,
8109  T23,
8110  T24,
8111  T25,
8112  T26,
8113  T27,
8114  T28,
8115  NullType,
8116  NullType,
8118 
8120 
8122  functor_(functor)
8123  {
8124 
8125  #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 29))
8126  // Fail variadic expansion for dev11
8127  static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
8128  #endif
8129 
8130  }
8131 
8134 
8136  typedef Event type_(
8137  const EnqueueArgs&,
8138  T0,
8139  T1,
8140  T2,
8141  T3,
8142  T4,
8143  T5,
8144  T6,
8145  T7,
8146  T8,
8147  T9,
8148  T10,
8149  T11,
8150  T12,
8151  T13,
8152  T14,
8153  T15,
8154  T16,
8155  T17,
8156  T18,
8157  T19,
8158  T20,
8159  T21,
8160  T22,
8161  T23,
8162  T24,
8163  T25,
8164  T26,
8165  T27,
8166  T28);
8167 
8169  const EnqueueArgs& enqueueArgs,
8170  T0 arg0,
8171  T1 arg1,
8172  T2 arg2,
8173  T3 arg3,
8174  T4 arg4,
8175  T5 arg5,
8176  T6 arg6,
8177  T7 arg7,
8178  T8 arg8,
8179  T9 arg9,
8180  T10 arg10,
8181  T11 arg11,
8182  T12 arg12,
8183  T13 arg13,
8184  T14 arg14,
8185  T15 arg15,
8186  T16 arg16,
8187  T17 arg17,
8188  T18 arg18,
8189  T19 arg19,
8190  T20 arg20,
8191  T21 arg21,
8192  T22 arg22,
8193  T23 arg23,
8194  T24 arg24,
8195  T25 arg25,
8196  T26 arg26,
8197  T27 arg27,
8198  T28 arg28)
8199  {
8200  return functor_(
8201  enqueueArgs,
8202  arg0,
8203  arg1,
8204  arg2,
8205  arg3,
8206  arg4,
8207  arg5,
8208  arg6,
8209  arg7,
8210  arg8,
8211  arg9,
8212  arg10,
8213  arg11,
8214  arg12,
8215  arg13,
8216  arg14,
8217  arg15,
8218  arg16,
8219  arg17,
8220  arg18,
8221  arg19,
8222  arg20,
8223  arg21,
8224  arg22,
8225  arg23,
8226  arg24,
8227  arg25,
8228  arg26,
8229  arg27,
8230  arg28);
8231  }
8232 
8233 
8234 };
8235 
8236 template<
8237  typename T0,
8238  typename T1,
8239  typename T2,
8240  typename T3,
8241  typename T4,
8242  typename T5,
8243  typename T6,
8244  typename T7,
8245  typename T8,
8246  typename T9,
8247  typename T10,
8248  typename T11,
8249  typename T12,
8250  typename T13,
8251  typename T14,
8252  typename T15,
8253  typename T16,
8254  typename T17,
8255  typename T18,
8256  typename T19,
8257  typename T20,
8258  typename T21,
8259  typename T22,
8260  typename T23,
8261  typename T24,
8262  typename T25,
8263  typename T26,
8264  typename T27>
8266 < T0,
8267  T1,
8268  T2,
8269  T3,
8270  T4,
8271  T5,
8272  T6,
8273  T7,
8274  T8,
8275  T9,
8276  T10,
8277  T11,
8278  T12,
8279  T13,
8280  T14,
8281  T15,
8282  T16,
8283  T17,
8284  T18,
8285  T19,
8286  T20,
8287  T21,
8288  T22,
8289  T23,
8290  T24,
8291  T25,
8292  T26,
8293  T27,
8294  NullType,
8295  NullType,
8296  NullType,
8297  NullType>
8298 {
8300  T0,
8301  T1,
8302  T2,
8303  T3,
8304  T4,
8305  T5,
8306  T6,
8307  T7,
8308  T8,
8309  T9,
8310  T10,
8311  T11,
8312  T12,
8313  T13,
8314  T14,
8315  T15,
8316  T16,
8317  T17,
8318  T18,
8319  T19,
8320  T20,
8321  T21,
8322  T22,
8323  T23,
8324  T24,
8325  T25,
8326  T26,
8327  T27,
8328  NullType,
8329  NullType,
8330  NullType,
8332 
8334 
8336  functor_(functor)
8337  {
8338 
8339  #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 28))
8340  // Fail variadic expansion for dev11
8341  static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
8342  #endif
8343 
8344  }
8345 
8348 
8350  typedef Event type_(
8351  const EnqueueArgs&,
8352  T0,
8353  T1,
8354  T2,
8355  T3,
8356  T4,
8357  T5,
8358  T6,
8359  T7,
8360  T8,
8361  T9,
8362  T10,
8363  T11,
8364  T12,
8365  T13,
8366  T14,
8367  T15,
8368  T16,
8369  T17,
8370  T18,
8371  T19,
8372  T20,
8373  T21,
8374  T22,
8375  T23,
8376  T24,
8377  T25,
8378  T26,
8379  T27);
8380 
8382  const EnqueueArgs& enqueueArgs,
8383  T0 arg0,
8384  T1 arg1,
8385  T2 arg2,
8386  T3 arg3,
8387  T4 arg4,
8388  T5 arg5,
8389  T6 arg6,
8390  T7 arg7,
8391  T8 arg8,
8392  T9 arg9,
8393  T10 arg10,
8394  T11 arg11,
8395  T12 arg12,
8396  T13 arg13,
8397  T14 arg14,
8398  T15 arg15,
8399  T16 arg16,
8400  T17 arg17,
8401  T18 arg18,
8402  T19 arg19,
8403  T20 arg20,
8404  T21 arg21,
8405  T22 arg22,
8406  T23 arg23,
8407  T24 arg24,
8408  T25 arg25,
8409  T26 arg26,
8410  T27 arg27)
8411  {
8412  return functor_(
8413  enqueueArgs,
8414  arg0,
8415  arg1,
8416  arg2,
8417  arg3,
8418  arg4,
8419  arg5,
8420  arg6,
8421  arg7,
8422  arg8,
8423  arg9,
8424  arg10,
8425  arg11,
8426  arg12,
8427  arg13,
8428  arg14,
8429  arg15,
8430  arg16,
8431  arg17,
8432  arg18,
8433  arg19,
8434  arg20,
8435  arg21,
8436  arg22,
8437  arg23,
8438  arg24,
8439  arg25,
8440  arg26,
8441  arg27);
8442  }
8443 
8444 
8445 };
8446 
8447 template<
8448  typename T0,
8449  typename T1,
8450  typename T2,
8451  typename T3,
8452  typename T4,
8453  typename T5,
8454  typename T6,
8455  typename T7,
8456  typename T8,
8457  typename T9,
8458  typename T10,
8459  typename T11,
8460  typename T12,
8461  typename T13,
8462  typename T14,
8463  typename T15,
8464  typename T16,
8465  typename T17,
8466  typename T18,
8467  typename T19,
8468  typename T20,
8469  typename T21,
8470  typename T22,
8471  typename T23,
8472  typename T24,
8473  typename T25,
8474  typename T26>
8476 < T0,
8477  T1,
8478  T2,
8479  T3,
8480  T4,
8481  T5,
8482  T6,
8483  T7,
8484  T8,
8485  T9,
8486  T10,
8487  T11,
8488  T12,
8489  T13,
8490  T14,
8491  T15,
8492  T16,
8493  T17,
8494  T18,
8495  T19,
8496  T20,
8497  T21,
8498  T22,
8499  T23,
8500  T24,
8501  T25,
8502  T26,
8503  NullType,
8504  NullType,
8505  NullType,
8506  NullType,
8507  NullType>
8508 {
8510  T0,
8511  T1,
8512  T2,
8513  T3,
8514  T4,
8515  T5,
8516  T6,
8517  T7,
8518  T8,
8519  T9,
8520  T10,
8521  T11,
8522  T12,
8523  T13,
8524  T14,
8525  T15,
8526  T16,
8527  T17,
8528  T18,
8529  T19,
8530  T20,
8531  T21,
8532  T22,
8533  T23,
8534  T24,
8535  T25,
8536  T26,
8537  NullType,
8538  NullType,
8539  NullType,
8540  NullType,
8542 
8544 
8546  functor_(functor)
8547  {
8548 
8549  #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 27))
8550  // Fail variadic expansion for dev11
8551  static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
8552  #endif
8553 
8554  }
8555 
8558 
8560  typedef Event type_(
8561  const EnqueueArgs&,
8562  T0,
8563  T1,
8564  T2,
8565  T3,
8566  T4,
8567  T5,
8568  T6,
8569  T7,
8570  T8,
8571  T9,
8572  T10,
8573  T11,
8574  T12,
8575  T13,
8576  T14,
8577  T15,
8578  T16,
8579  T17,
8580  T18,
8581  T19,
8582  T20,
8583  T21,
8584  T22,
8585  T23,
8586  T24,
8587  T25,
8588  T26);
8589 
8591  const EnqueueArgs& enqueueArgs,
8592  T0 arg0,
8593  T1 arg1,
8594  T2 arg2,
8595  T3 arg3,
8596  T4 arg4,
8597  T5 arg5,
8598  T6 arg6,
8599  T7 arg7,
8600  T8 arg8,
8601  T9 arg9,
8602  T10 arg10,
8603  T11 arg11,
8604  T12 arg12,
8605  T13 arg13,
8606  T14 arg14,
8607  T15 arg15,
8608  T16 arg16,
8609  T17 arg17,
8610  T18 arg18,
8611  T19 arg19,
8612  T20 arg20,
8613  T21 arg21,
8614  T22 arg22,
8615  T23 arg23,
8616  T24 arg24,
8617  T25 arg25,
8618  T26 arg26)
8619  {
8620  return functor_(
8621  enqueueArgs,
8622  arg0,
8623  arg1,
8624  arg2,
8625  arg3,
8626  arg4,
8627  arg5,
8628  arg6,
8629  arg7,
8630  arg8,
8631  arg9,
8632  arg10,
8633  arg11,
8634  arg12,
8635  arg13,
8636  arg14,
8637  arg15,
8638  arg16,
8639  arg17,
8640  arg18,
8641  arg19,
8642  arg20,
8643  arg21,
8644  arg22,
8645  arg23,
8646  arg24,
8647  arg25,
8648  arg26);
8649  }
8650 
8651 
8652 };
8653 
8654 template<
8655  typename T0,
8656  typename T1,
8657  typename T2,
8658  typename T3,
8659  typename T4,
8660  typename T5,
8661  typename T6,
8662  typename T7,
8663  typename T8,
8664  typename T9,
8665  typename T10,
8666  typename T11,
8667  typename T12,
8668  typename T13,
8669  typename T14,
8670  typename T15,
8671  typename T16,
8672  typename T17,
8673  typename T18,
8674  typename T19,
8675  typename T20,
8676  typename T21,
8677  typename T22,
8678  typename T23,
8679  typename T24,
8680  typename T25>
8682 < T0,
8683  T1,
8684  T2,
8685  T3,
8686  T4,
8687  T5,
8688  T6,
8689  T7,
8690  T8,
8691  T9,
8692  T10,
8693  T11,
8694  T12,
8695  T13,
8696  T14,
8697  T15,
8698  T16,
8699  T17,
8700  T18,
8701  T19,
8702  T20,
8703  T21,
8704  T22,
8705  T23,
8706  T24,
8707  T25,
8708  NullType,
8709  NullType,
8710  NullType,
8711  NullType,
8712  NullType,
8713  NullType>
8714 {
8716  T0,
8717  T1,
8718  T2,
8719  T3,
8720  T4,
8721  T5,
8722  T6,
8723  T7,
8724  T8,
8725  T9,
8726  T10,
8727  T11,
8728  T12,
8729  T13,
8730  T14,
8731  T15,
8732  T16,
8733  T17,
8734  T18,
8735  T19,
8736  T20,
8737  T21,
8738  T22,
8739  T23,
8740  T24,
8741  T25,
8742  NullType,
8743  NullType,
8744  NullType,
8745  NullType,
8746  NullType,
8748 
8750 
8752  functor_(functor)
8753  {
8754 
8755  #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 26))
8756  // Fail variadic expansion for dev11
8757  static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
8758  #endif
8759 
8760  }
8761 
8764 
8766  typedef Event type_(
8767  const EnqueueArgs&,
8768  T0,
8769  T1,
8770  T2,
8771  T3,
8772  T4,
8773  T5,
8774  T6,
8775  T7,
8776  T8,
8777  T9,
8778  T10,
8779  T11,
8780  T12,
8781  T13,
8782  T14,
8783  T15,
8784  T16,
8785  T17,
8786  T18,
8787  T19,
8788  T20,
8789  T21,
8790  T22,
8791  T23,
8792  T24,
8793  T25);
8794 
8796  const EnqueueArgs& enqueueArgs,
8797  T0 arg0,
8798  T1 arg1,
8799  T2 arg2,
8800  T3 arg3,
8801  T4 arg4,
8802  T5 arg5,
8803  T6 arg6,
8804  T7 arg7,
8805  T8 arg8,
8806  T9 arg9,
8807  T10 arg10,
8808  T11 arg11,
8809  T12 arg12,
8810  T13 arg13,
8811  T14 arg14,
8812  T15 arg15,
8813  T16 arg16,
8814  T17 arg17,
8815  T18 arg18,
8816  T19 arg19,
8817  T20 arg20,
8818  T21 arg21,
8819  T22 arg22,
8820  T23 arg23,
8821  T24 arg24,
8822  T25 arg25)
8823  {
8824  return functor_(
8825  enqueueArgs,
8826  arg0,
8827  arg1,
8828  arg2,
8829  arg3,
8830  arg4,
8831  arg5,
8832  arg6,
8833  arg7,
8834  arg8,
8835  arg9,
8836  arg10,
8837  arg11,
8838  arg12,
8839  arg13,
8840  arg14,
8841  arg15,
8842  arg16,
8843  arg17,
8844  arg18,
8845  arg19,
8846  arg20,
8847  arg21,
8848  arg22,
8849  arg23,
8850  arg24,
8851  arg25);
8852  }
8853 
8854 
8855 };
8856 
8857 template<
8858  typename T0,
8859  typename T1,
8860  typename T2,
8861  typename T3,
8862  typename T4,
8863  typename T5,
8864  typename T6,
8865  typename T7,
8866  typename T8,
8867  typename T9,
8868  typename T10,
8869  typename T11,
8870  typename T12,
8871  typename T13,
8872  typename T14,
8873  typename T15,
8874  typename T16,
8875  typename T17,
8876  typename T18,
8877  typename T19,
8878  typename T20,
8879  typename T21,
8880  typename T22,
8881  typename T23,
8882  typename T24>
8884 < T0,
8885  T1,
8886  T2,
8887  T3,
8888  T4,
8889  T5,
8890  T6,
8891  T7,
8892  T8,
8893  T9,
8894  T10,
8895  T11,
8896  T12,
8897  T13,
8898  T14,
8899  T15,
8900  T16,
8901  T17,
8902  T18,
8903  T19,
8904  T20,
8905  T21,
8906  T22,
8907  T23,
8908  T24,
8909  NullType,
8910  NullType,
8911  NullType,
8912  NullType,
8913  NullType,
8914  NullType,
8915  NullType>
8916 {
8918  T0,
8919  T1,
8920  T2,
8921  T3,
8922  T4,
8923  T5,
8924  T6,
8925  T7,
8926  T8,
8927  T9,
8928  T10,
8929  T11,
8930  T12,
8931  T13,
8932  T14,
8933  T15,
8934  T16,
8935  T17,
8936  T18,
8937  T19,
8938  T20,
8939  T21,
8940  T22,
8941  T23,
8942  T24,
8943  NullType,
8944  NullType,
8945  NullType,
8946  NullType,
8947  NullType,
8948  NullType,
8950 
8952 
8954  functor_(functor)
8955  {
8956 
8957  #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 25))
8958  // Fail variadic expansion for dev11
8959  static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
8960  #endif
8961 
8962  }
8963 
8966 
8968  typedef Event type_(
8969  const EnqueueArgs&,
8970  T0,
8971  T1,
8972  T2,
8973  T3,
8974  T4,
8975  T5,
8976  T6,
8977  T7,
8978  T8,
8979  T9,
8980  T10,
8981  T11,
8982  T12,
8983  T13,
8984  T14,
8985  T15,
8986  T16,
8987  T17,
8988  T18,
8989  T19,
8990  T20,
8991  T21,
8992  T22,
8993  T23,
8994  T24);
8995 
8997  const EnqueueArgs& enqueueArgs,
8998  T0 arg0,
8999  T1 arg1,
9000  T2 arg2,
9001  T3 arg3,
9002  T4 arg4,
9003  T5 arg5,
9004  T6 arg6,
9005  T7 arg7,
9006  T8 arg8,
9007  T9 arg9,
9008  T10 arg10,
9009  T11 arg11,
9010  T12 arg12,
9011  T13 arg13,
9012  T14 arg14,
9013  T15 arg15,
9014  T16 arg16,
9015  T17 arg17,
9016  T18 arg18,
9017  T19 arg19,
9018  T20 arg20,
9019  T21 arg21,
9020  T22 arg22,
9021  T23 arg23,
9022  T24 arg24)
9023  {
9024  return functor_(
9025  enqueueArgs,
9026  arg0,
9027  arg1,
9028  arg2,
9029  arg3,
9030  arg4,
9031  arg5,
9032  arg6,
9033  arg7,
9034  arg8,
9035  arg9,
9036  arg10,
9037  arg11,
9038  arg12,
9039  arg13,
9040  arg14,
9041  arg15,
9042  arg16,
9043  arg17,
9044  arg18,
9045  arg19,
9046  arg20,
9047  arg21,
9048  arg22,
9049  arg23,
9050  arg24);
9051  }
9052 
9053 
9054 };
9055 
9056 template<
9057  typename T0,
9058  typename T1,
9059  typename T2,
9060  typename T3,
9061  typename T4,
9062  typename T5,
9063  typename T6,
9064  typename T7,
9065  typename T8,
9066  typename T9,
9067  typename T10,
9068  typename T11,
9069  typename T12,
9070  typename T13,
9071  typename T14,
9072  typename T15,
9073  typename T16,
9074  typename T17,
9075  typename T18,
9076  typename T19,
9077  typename T20,
9078  typename T21,
9079  typename T22,
9080  typename T23>
9082 < T0,
9083  T1,
9084  T2,
9085  T3,
9086  T4,
9087  T5,
9088  T6,
9089  T7,
9090  T8,
9091  T9,
9092  T10,
9093  T11,
9094  T12,
9095  T13,
9096  T14,
9097  T15,
9098  T16,
9099  T17,
9100  T18,
9101  T19,
9102  T20,
9103  T21,
9104  T22,
9105  T23,
9106  NullType,
9107  NullType,
9108  NullType,
9109  NullType,
9110  NullType,
9111  NullType,
9112  NullType,
9113  NullType>
9114 {
9116  T0,
9117  T1,
9118  T2,
9119  T3,
9120  T4,
9121  T5,
9122  T6,
9123  T7,
9124  T8,
9125  T9,
9126  T10,
9127  T11,
9128  T12,
9129  T13,
9130  T14,
9131  T15,
9132  T16,
9133  T17,
9134  T18,
9135  T19,
9136  T20,
9137  T21,
9138  T22,
9139  T23,
9140  NullType,
9141  NullType,
9142  NullType,
9143  NullType,
9144  NullType,
9145  NullType,
9146  NullType,
9148 
9150 
9152  functor_(functor)
9153  {
9154 
9155  #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 24))
9156  // Fail variadic expansion for dev11
9157  static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
9158  #endif
9159 
9160  }
9161 
9164 
9166  typedef Event type_(
9167  const EnqueueArgs&,
9168  T0,
9169  T1,
9170  T2,
9171  T3,
9172  T4,
9173  T5,
9174  T6,
9175  T7,
9176  T8,
9177  T9,
9178  T10,
9179  T11,
9180  T12,
9181  T13,
9182  T14,
9183  T15,
9184  T16,
9185  T17,
9186  T18,
9187  T19,
9188  T20,
9189  T21,
9190  T22,
9191  T23);
9192 
9194  const EnqueueArgs& enqueueArgs,
9195  T0 arg0,
9196  T1 arg1,
9197  T2 arg2,
9198  T3 arg3,
9199  T4 arg4,
9200  T5 arg5,
9201  T6 arg6,
9202  T7 arg7,
9203  T8 arg8,
9204  T9 arg9,
9205  T10 arg10,
9206  T11 arg11,
9207  T12 arg12,
9208  T13 arg13,
9209  T14 arg14,
9210  T15 arg15,
9211  T16 arg16,
9212  T17 arg17,
9213  T18 arg18,
9214  T19 arg19,
9215  T20 arg20,
9216  T21 arg21,
9217  T22 arg22,
9218  T23 arg23)
9219  {
9220  return functor_(
9221  enqueueArgs,
9222  arg0,
9223  arg1,
9224  arg2,
9225  arg3,
9226  arg4,
9227  arg5,
9228  arg6,
9229  arg7,
9230  arg8,
9231  arg9,
9232  arg10,
9233  arg11,
9234  arg12,
9235  arg13,
9236  arg14,
9237  arg15,
9238  arg16,
9239  arg17,
9240  arg18,
9241  arg19,
9242  arg20,
9243  arg21,
9244  arg22,
9245  arg23);
9246  }
9247 
9248 
9249 };
9250 
9251 template<
9252  typename T0,
9253  typename T1,
9254  typename T2,
9255  typename T3,
9256  typename T4,
9257  typename T5,
9258  typename T6,
9259  typename T7,
9260  typename T8,
9261  typename T9,
9262  typename T10,
9263  typename T11,
9264  typename T12,
9265  typename T13,
9266  typename T14,
9267  typename T15,
9268  typename T16,
9269  typename T17,
9270  typename T18,
9271  typename T19,
9272  typename T20,
9273  typename T21,
9274  typename T22>
9276 < T0,
9277  T1,
9278  T2,
9279  T3,
9280  T4,
9281  T5,
9282  T6,
9283  T7,
9284  T8,
9285  T9,
9286  T10,
9287  T11,
9288  T12,
9289  T13,
9290  T14,
9291  T15,
9292  T16,
9293  T17,
9294  T18,
9295  T19,
9296  T20,
9297  T21,
9298  T22,
9299  NullType,
9300  NullType,
9301  NullType,
9302  NullType,
9303  NullType,
9304  NullType,
9305  NullType,
9306  NullType,
9307  NullType>
9308 {
9310  T0,
9311  T1,
9312  T2,
9313  T3,
9314  T4,
9315  T5,
9316  T6,
9317  T7,
9318  T8,
9319  T9,
9320  T10,
9321  T11,
9322  T12,
9323  T13,
9324  T14,
9325  T15,
9326  T16,
9327  T17,
9328  T18,
9329  T19,
9330  T20,
9331  T21,
9332  T22,
9333  NullType,
9334  NullType,
9335  NullType,
9336  NullType,
9337  NullType,
9338  NullType,
9339  NullType,
9340  NullType,
9342 
9344 
9346  functor_(functor)
9347  {
9348 
9349  #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 23))
9350  // Fail variadic expansion for dev11
9351  static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
9352  #endif
9353 
9354  }
9355 
9358 
9360  typedef Event type_(
9361  const EnqueueArgs&,
9362  T0,
9363  T1,
9364  T2,
9365  T3,
9366  T4,
9367  T5,
9368  T6,
9369  T7,
9370  T8,
9371  T9,
9372  T10,
9373  T11,
9374  T12,
9375  T13,
9376  T14,
9377  T15,
9378  T16,
9379  T17,
9380  T18,
9381  T19,
9382  T20,
9383  T21,
9384  T22);
9385 
9387  const EnqueueArgs& enqueueArgs,
9388  T0 arg0,
9389  T1 arg1,
9390  T2 arg2,
9391  T3 arg3,
9392  T4 arg4,
9393  T5 arg5,
9394  T6 arg6,
9395  T7 arg7,
9396  T8 arg8,
9397  T9 arg9,
9398  T10 arg10,
9399  T11 arg11,
9400  T12 arg12,
9401  T13 arg13,
9402  T14 arg14,
9403  T15 arg15,
9404  T16 arg16,
9405  T17 arg17,
9406  T18 arg18,
9407  T19 arg19,
9408  T20 arg20,
9409  T21 arg21,
9410  T22 arg22)
9411  {
9412  return functor_(
9413  enqueueArgs,
9414  arg0,
9415  arg1,
9416  arg2,
9417  arg3,
9418  arg4,
9419  arg5,
9420  arg6,
9421  arg7,
9422  arg8,
9423  arg9,
9424  arg10,
9425  arg11,
9426  arg12,
9427  arg13,
9428  arg14,
9429  arg15,
9430  arg16,
9431  arg17,
9432  arg18,
9433  arg19,
9434  arg20,
9435  arg21,
9436  arg22);
9437  }
9438 
9439 
9440 };
9441 
9442 template<
9443  typename T0,
9444  typename T1,
9445  typename T2,
9446  typename T3,
9447  typename T4,
9448  typename T5,
9449  typename T6,
9450  typename T7,
9451  typename T8,
9452  typename T9,
9453  typename T10,
9454  typename T11,
9455  typename T12,
9456  typename T13,
9457  typename T14,
9458  typename T15,
9459  typename T16,
9460  typename T17,
9461  typename T18,
9462  typename T19,
9463  typename T20,
9464  typename T21>
9466 < T0,
9467  T1,
9468  T2,
9469  T3,
9470  T4,
9471  T5,
9472  T6,
9473  T7,
9474  T8,
9475  T9,
9476  T10,
9477  T11,
9478  T12,
9479  T13,
9480  T14,
9481  T15,
9482  T16,
9483  T17,
9484  T18,
9485  T19,
9486  T20,
9487  T21,
9488  NullType,
9489  NullType,
9490  NullType,
9491  NullType,
9492  NullType,
9493  NullType,
9494  NullType,
9495  NullType,
9496  NullType,
9497  NullType>
9498 {
9500  T0,
9501  T1,
9502  T2,
9503  T3,
9504  T4,
9505  T5,
9506  T6,
9507  T7,
9508  T8,
9509  T9,
9510  T10,
9511  T11,
9512  T12,
9513  T13,
9514  T14,
9515  T15,
9516  T16,
9517  T17,
9518  T18,
9519  T19,
9520  T20,
9521  T21,
9522  NullType,
9523  NullType,
9524  NullType,
9525  NullType,
9526  NullType,
9527  NullType,
9528  NullType,
9529  NullType,
9530  NullType,
9532 
9534 
9536  functor_(functor)
9537  {
9538 
9539  #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 22))
9540  // Fail variadic expansion for dev11
9541  static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
9542  #endif
9543 
9544  }
9545 
9548 
9550  typedef Event type_(
9551  const EnqueueArgs&,
9552  T0,
9553  T1,
9554  T2,
9555  T3,
9556  T4,
9557  T5,
9558  T6,
9559  T7,
9560  T8,
9561  T9,
9562  T10,
9563  T11,
9564  T12,
9565  T13,
9566  T14,
9567  T15,
9568  T16,
9569  T17,
9570  T18,
9571  T19,
9572  T20,
9573  T21);
9574 
9576  const EnqueueArgs& enqueueArgs,
9577  T0 arg0,
9578  T1 arg1,
9579  T2 arg2,
9580  T3 arg3,
9581  T4 arg4,
9582  T5 arg5,
9583  T6 arg6,
9584  T7 arg7,
9585  T8 arg8,
9586  T9 arg9,
9587  T10 arg10,
9588  T11 arg11,
9589  T12 arg12,
9590  T13 arg13,
9591  T14 arg14,
9592  T15 arg15,
9593  T16 arg16,
9594  T17 arg17,
9595  T18 arg18,
9596  T19 arg19,
9597  T20 arg20,
9598  T21 arg21)
9599  {
9600  return functor_(
9601  enqueueArgs,
9602  arg0,
9603  arg1,
9604  arg2,
9605  arg3,
9606  arg4,
9607  arg5,
9608  arg6,
9609  arg7,
9610  arg8,
9611  arg9,
9612  arg10,
9613  arg11,
9614  arg12,
9615  arg13,
9616  arg14,
9617  arg15,
9618  arg16,
9619  arg17,
9620  arg18,
9621  arg19,
9622  arg20,
9623  arg21);
9624  }
9625 
9626 
9627 };
9628 
9629 template<
9630  typename T0,
9631  typename T1,
9632  typename T2,
9633  typename T3,
9634  typename T4,
9635  typename T5,
9636  typename T6,
9637  typename T7,
9638  typename T8,
9639  typename T9,
9640  typename T10,
9641  typename T11,
9642  typename T12,
9643  typename T13,
9644  typename T14,
9645  typename T15,
9646  typename T16,
9647  typename T17,
9648  typename T18,
9649  typename T19,
9650  typename T20>
9652 < T0,
9653  T1,
9654  T2,
9655  T3,
9656  T4,
9657  T5,
9658  T6,
9659  T7,
9660  T8,
9661  T9,
9662  T10,
9663  T11,
9664  T12,
9665  T13,
9666  T14,
9667  T15,
9668  T16,
9669  T17,
9670  T18,
9671  T19,
9672  T20,
9673  NullType,
9674  NullType,
9675  NullType,
9676  NullType,
9677  NullType,
9678  NullType,
9679  NullType,
9680  NullType,
9681  NullType,
9682  NullType,
9683  NullType>
9684 {
9686  T0,
9687  T1,
9688  T2,
9689  T3,
9690  T4,
9691  T5,
9692  T6,
9693  T7,
9694  T8,
9695  T9,
9696  T10,
9697  T11,
9698  T12,
9699  T13,
9700  T14,
9701  T15,
9702  T16,
9703  T17,
9704  T18,
9705  T19,
9706  T20,
9707  NullType,
9708  NullType,
9709  NullType,
9710  NullType,
9711  NullType,
9712  NullType,
9713  NullType,
9714  NullType,
9715  NullType,
9716  NullType,
9718 
9720 
9722  functor_(functor)
9723  {
9724 
9725  #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 21))
9726  // Fail variadic expansion for dev11
9727  static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
9728  #endif
9729 
9730  }
9731 
9734 
9736  typedef Event type_(
9737  const EnqueueArgs&,
9738  T0,
9739  T1,
9740  T2,
9741  T3,
9742  T4,
9743  T5,
9744  T6,
9745  T7,
9746  T8,
9747  T9,
9748  T10,
9749  T11,
9750  T12,
9751  T13,
9752  T14,
9753  T15,
9754  T16,
9755  T17,
9756  T18,
9757  T19,
9758  T20);
9759 
9761  const EnqueueArgs& enqueueArgs,
9762  T0 arg0,
9763  T1 arg1,
9764  T2 arg2,
9765  T3 arg3,
9766  T4 arg4,
9767  T5 arg5,
9768  T6 arg6,
9769  T7 arg7,
9770  T8 arg8,
9771  T9 arg9,
9772  T10 arg10,
9773  T11 arg11,
9774  T12 arg12,
9775  T13 arg13,
9776  T14 arg14,
9777  T15 arg15,
9778  T16 arg16,
9779  T17 arg17,
9780  T18 arg18,
9781  T19 arg19,
9782  T20 arg20)
9783  {
9784  return functor_(
9785  enqueueArgs,
9786  arg0,
9787  arg1,
9788  arg2,
9789  arg3,
9790  arg4,
9791  arg5,
9792  arg6,
9793  arg7,
9794  arg8,
9795  arg9,
9796  arg10,
9797  arg11,
9798  arg12,
9799  arg13,
9800  arg14,
9801  arg15,
9802  arg16,
9803  arg17,
9804  arg18,
9805  arg19,
9806  arg20);
9807  }
9808 
9809 
9810 };
9811 
9812 template<
9813  typename T0,
9814  typename T1,
9815  typename T2,
9816  typename T3,
9817  typename T4,
9818  typename T5,
9819  typename T6,
9820  typename T7,
9821  typename T8,
9822  typename T9,
9823  typename T10,
9824  typename T11,
9825  typename T12,
9826  typename T13,
9827  typename T14,
9828  typename T15,
9829  typename T16,
9830  typename T17,
9831  typename T18,
9832  typename T19>
9834 < T0,
9835  T1,
9836  T2,
9837  T3,
9838  T4,
9839  T5,
9840  T6,
9841  T7,
9842  T8,
9843  T9,
9844  T10,
9845  T11,
9846  T12,
9847  T13,
9848  T14,
9849  T15,
9850  T16,
9851  T17,
9852  T18,
9853  T19,
9854  NullType,
9855  NullType,
9856  NullType,
9857  NullType,
9858  NullType,
9859  NullType,
9860  NullType,
9861  NullType,
9862  NullType,
9863  NullType,
9864  NullType,
9865  NullType>
9866 {
9868  T0,
9869  T1,
9870  T2,
9871  T3,
9872  T4,
9873  T5,
9874  T6,
9875  T7,
9876  T8,
9877  T9,
9878  T10,
9879  T11,
9880  T12,
9881  T13,
9882  T14,
9883  T15,
9884  T16,
9885  T17,
9886  T18,
9887  T19,
9888  NullType,
9889  NullType,
9890  NullType,
9891  NullType,
9892  NullType,
9893  NullType,
9894  NullType,
9895  NullType,
9896  NullType,
9897  NullType,
9898  NullType,
9900 
9902 
9904  functor_(functor)
9905  {
9906 
9907  #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 20))
9908  // Fail variadic expansion for dev11
9909  static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
9910  #endif
9911 
9912  }
9913 
9916 
9918  typedef Event type_(
9919  const EnqueueArgs&,
9920  T0,
9921  T1,
9922  T2,
9923  T3,
9924  T4,
9925  T5,
9926  T6,
9927  T7,
9928  T8,
9929  T9,
9930  T10,
9931  T11,
9932  T12,
9933  T13,
9934  T14,
9935  T15,
9936  T16,
9937  T17,
9938  T18,
9939  T19);
9940 
9942  const EnqueueArgs& enqueueArgs,
9943  T0 arg0,
9944  T1 arg1,
9945  T2 arg2,
9946  T3 arg3,
9947  T4 arg4,
9948  T5 arg5,
9949  T6 arg6,
9950  T7 arg7,
9951  T8 arg8,
9952  T9 arg9,
9953  T10 arg10,
9954  T11 arg11,
9955  T12 arg12,
9956  T13 arg13,
9957  T14 arg14,
9958  T15 arg15,
9959  T16 arg16,
9960  T17 arg17,
9961  T18 arg18,
9962  T19 arg19)
9963  {
9964  return functor_(
9965  enqueueArgs,
9966  arg0,
9967  arg1,
9968  arg2,
9969  arg3,
9970  arg4,
9971  arg5,
9972  arg6,
9973  arg7,
9974  arg8,
9975  arg9,
9976  arg10,
9977  arg11,
9978  arg12,
9979  arg13,
9980  arg14,
9981  arg15,
9982  arg16,
9983  arg17,
9984  arg18,
9985  arg19);
9986  }
9987 
9988 
9989 };
9990 
9991 template<
9992  typename T0,
9993  typename T1,
9994  typename T2,
9995  typename T3,
9996  typename T4,
9997  typename T5,
9998  typename T6,
9999  typename T7,
10000  typename T8,
10001  typename T9,
10002  typename T10,
10003  typename T11,
10004  typename T12,
10005  typename T13,
10006  typename T14,
10007  typename T15,
10008  typename T16,
10009  typename T17,
10010  typename T18>
10012 < T0,
10013  T1,
10014  T2,
10015  T3,
10016  T4,
10017  T5,
10018  T6,
10019  T7,
10020  T8,
10021  T9,
10022  T10,
10023  T11,
10024  T12,
10025  T13,
10026  T14,
10027  T15,
10028  T16,
10029  T17,
10030  T18,
10031  NullType,
10032  NullType,
10033  NullType,
10034  NullType,
10035  NullType,
10036  NullType,
10037  NullType,
10038  NullType,
10039  NullType,
10040  NullType,
10041  NullType,
10042  NullType,
10043  NullType>
10044 {
10046  T0,
10047  T1,
10048  T2,
10049  T3,
10050  T4,
10051  T5,
10052  T6,
10053  T7,
10054  T8,
10055  T9,
10056  T10,
10057  T11,
10058  T12,
10059  T13,
10060  T14,
10061  T15,
10062  T16,
10063  T17,
10064  T18,
10065  NullType,
10066  NullType,
10067  NullType,
10068  NullType,
10069  NullType,
10070  NullType,
10071  NullType,
10072  NullType,
10073  NullType,
10074  NullType,
10075  NullType,
10076  NullType,
10078 
10080 
10082  functor_(functor)
10083  {
10084 
10085  #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 19))
10086  // Fail variadic expansion for dev11
10087  static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
10088  #endif
10089 
10090  }
10091 
10094 
10096  typedef Event type_(
10097  const EnqueueArgs&,
10098  T0,
10099  T1,
10100  T2,
10101  T3,
10102  T4,
10103  T5,
10104  T6,
10105  T7,
10106  T8,
10107  T9,
10108  T10,
10109  T11,
10110  T12,
10111  T13,
10112  T14,
10113  T15,
10114  T16,
10115  T17,
10116  T18);
10117 
10119  const EnqueueArgs& enqueueArgs,
10120  T0 arg0,
10121  T1 arg1,
10122  T2 arg2,
10123  T3 arg3,
10124  T4 arg4,
10125  T5 arg5,
10126  T6 arg6,
10127  T7 arg7,
10128  T8 arg8,
10129  T9 arg9,
10130  T10 arg10,
10131  T11 arg11,
10132  T12 arg12,
10133  T13 arg13,
10134  T14 arg14,
10135  T15 arg15,
10136  T16 arg16,
10137  T17 arg17,
10138  T18 arg18)
10139  {
10140  return functor_(
10141  enqueueArgs,
10142  arg0,
10143  arg1,
10144  arg2,
10145  arg3,
10146  arg4,
10147  arg5,
10148  arg6,
10149  arg7,
10150  arg8,
10151  arg9,
10152  arg10,
10153  arg11,
10154  arg12,
10155  arg13,
10156  arg14,
10157  arg15,
10158  arg16,
10159  arg17,
10160  arg18);
10161  }
10162 
10163 
10164 };
10165 
10166 template<
10167  typename T0,
10168  typename T1,
10169  typename T2,
10170  typename T3,
10171  typename T4,
10172  typename T5,
10173  typename T6,
10174  typename T7,
10175  typename T8,
10176  typename T9,
10177  typename T10,
10178  typename T11,
10179  typename T12,
10180  typename T13,
10181  typename T14,
10182  typename T15,
10183  typename T16,
10184  typename T17>
10186 < T0,
10187  T1,
10188  T2,
10189  T3,
10190  T4,
10191  T5,
10192  T6,
10193  T7,
10194  T8,
10195  T9,
10196  T10,
10197  T11,
10198  T12,
10199  T13,
10200  T14,
10201  T15,
10202  T16,
10203  T17,
10204  NullType,
10205  NullType,
10206  NullType,
10207  NullType,
10208  NullType,
10209  NullType,
10210  NullType,
10211  NullType,
10212  NullType,
10213  NullType,
10214  NullType,
10215  NullType,
10216  NullType,
10217  NullType>
10218 {
10220  T0,
10221  T1,
10222  T2,
10223  T3,
10224  T4,
10225  T5,
10226  T6,
10227  T7,
10228  T8,
10229  T9,
10230  T10,
10231  T11,
10232  T12,
10233  T13,
10234  T14,
10235  T15,
10236  T16,
10237  T17,
10238  NullType,
10239  NullType,
10240  NullType,
10241  NullType,
10242  NullType,
10243  NullType,
10244  NullType,
10245  NullType,
10246  NullType,
10247  NullType,
10248  NullType,
10249  NullType,
10250  NullType,
10252 
10254 
10256  functor_(functor)
10257  {
10258 
10259  #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 18))
10260  // Fail variadic expansion for dev11
10261  static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
10262  #endif
10263 
10264  }
10265 
10268 
10270  typedef Event type_(
10271  const EnqueueArgs&,
10272  T0,
10273  T1,
10274  T2,
10275  T3,
10276  T4,
10277  T5,
10278  T6,
10279  T7,
10280  T8,
10281  T9,
10282  T10,
10283  T11,
10284  T12,
10285  T13,
10286  T14,
10287  T15,
10288  T16,
10289  T17);
10290 
10292  const EnqueueArgs& enqueueArgs,
10293  T0 arg0,
10294  T1 arg1,
10295  T2 arg2,
10296  T3 arg3,
10297  T4 arg4,
10298  T5 arg5,
10299  T6 arg6,
10300  T7 arg7,
10301  T8 arg8,
10302  T9 arg9,
10303  T10 arg10,
10304  T11 arg11,
10305  T12 arg12,
10306  T13 arg13,
10307  T14 arg14,
10308  T15 arg15,
10309  T16 arg16,
10310  T17 arg17)
10311  {
10312  return functor_(
10313  enqueueArgs,
10314  arg0,
10315  arg1,
10316  arg2,
10317  arg3,
10318  arg4,
10319  arg5,
10320  arg6,
10321  arg7,
10322  arg8,
10323  arg9,
10324  arg10,
10325  arg11,
10326  arg12,
10327  arg13,
10328  arg14,
10329  arg15,
10330  arg16,
10331  arg17);
10332  }
10333 
10334 
10335 };
10336 
10337 template<
10338  typename T0,
10339  typename T1,
10340  typename T2,
10341  typename T3,
10342  typename T4,
10343  typename T5,
10344  typename T6,
10345  typename T7,
10346  typename T8,
10347  typename T9,
10348  typename T10,
10349  typename T11,
10350  typename T12,
10351  typename T13,
10352  typename T14,
10353  typename T15,
10354  typename T16>
10356 < T0,
10357  T1,
10358  T2,
10359  T3,
10360  T4,
10361  T5,
10362  T6,
10363  T7,
10364  T8,
10365  T9,
10366  T10,
10367  T11,
10368  T12,
10369  T13,
10370  T14,
10371  T15,
10372  T16,
10373  NullType,
10374  NullType,
10375  NullType,
10376  NullType,
10377  NullType,
10378  NullType,
10379  NullType,
10380  NullType,
10381  NullType,
10382  NullType,
10383  NullType,
10384  NullType,
10385  NullType,
10386  NullType,
10387  NullType>
10388 {
10390  T0,
10391  T1,
10392  T2,
10393  T3,
10394  T4,
10395  T5,
10396  T6,
10397  T7,
10398  T8,
10399  T9,
10400  T10,
10401  T11,
10402  T12,
10403  T13,
10404  T14,
10405  T15,
10406  T16,
10407  NullType,
10408  NullType,
10409  NullType,
10410  NullType,
10411  NullType,
10412  NullType,
10413  NullType,
10414  NullType,
10415  NullType,
10416  NullType,
10417  NullType,
10418  NullType,
10419  NullType,
10420  NullType,
10422 
10424 
10426  functor_(functor)
10427  {
10428 
10429  #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 17))
10430  // Fail variadic expansion for dev11
10431  static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
10432  #endif
10433 
10434  }
10435 
10438 
10440  typedef Event type_(
10441  const EnqueueArgs&,
10442  T0,
10443  T1,
10444  T2,
10445  T3,
10446  T4,
10447  T5,
10448  T6,
10449  T7,
10450  T8,
10451  T9,
10452  T10,
10453  T11,
10454  T12,
10455  T13,
10456  T14,
10457  T15,
10458  T16);
10459 
10461  const EnqueueArgs& enqueueArgs,
10462  T0 arg0,
10463  T1 arg1,
10464  T2 arg2,
10465  T3 arg3,
10466  T4 arg4,
10467  T5 arg5,
10468  T6 arg6,
10469  T7 arg7,
10470  T8 arg8,
10471  T9 arg9,
10472  T10 arg10,
10473  T11 arg11,
10474  T12 arg12,
10475  T13 arg13,
10476  T14 arg14,
10477  T15 arg15,
10478  T16 arg16)
10479  {
10480  return functor_(
10481  enqueueArgs,
10482  arg0,
10483  arg1,
10484  arg2,
10485  arg3,
10486  arg4,
10487  arg5,
10488  arg6,
10489  arg7,
10490  arg8,
10491  arg9,
10492  arg10,
10493  arg11,
10494  arg12,
10495  arg13,
10496  arg14,
10497  arg15,
10498  arg16);
10499  }
10500 
10501 
10502 };
10503 
10504 template<
10505  typename T0,
10506  typename T1,
10507  typename T2,
10508  typename T3,
10509  typename T4,
10510  typename T5,
10511  typename T6,
10512  typename T7,
10513  typename T8,
10514  typename T9,
10515  typename T10,
10516  typename T11,
10517  typename T12,
10518  typename T13,
10519  typename T14,
10520  typename T15>
10522 < T0,
10523  T1,
10524  T2,
10525  T3,
10526  T4,
10527  T5,
10528  T6,
10529  T7,
10530  T8,
10531  T9,
10532  T10,
10533  T11,
10534  T12,
10535  T13,
10536  T14,
10537  T15,
10538  NullType,
10539  NullType,
10540  NullType,
10541  NullType,
10542  NullType,
10543  NullType,
10544  NullType,
10545  NullType,
10546  NullType,
10547  NullType,
10548  NullType,
10549  NullType,
10550  NullType,
10551  NullType,
10552  NullType,
10553  NullType>
10554 {
10556  T0,
10557  T1,
10558  T2,
10559  T3,
10560  T4,
10561  T5,
10562  T6,
10563  T7,
10564  T8,
10565  T9,
10566  T10,
10567  T11,
10568  T12,
10569  T13,
10570  T14,
10571  T15,
10572  NullType,
10573  NullType,
10574  NullType,
10575  NullType,
10576  NullType,
10577  NullType,
10578  NullType,
10579  NullType,
10580  NullType,
10581  NullType,
10582  NullType,
10583  NullType,
10584  NullType,
10585  NullType,
10586  NullType,
10588 
10590 
10592  functor_(functor)
10593  {
10594 
10595  #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 16))
10596  // Fail variadic expansion for dev11
10597  static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
10598  #endif
10599 
10600  }
10601 
10604 
10606  typedef Event type_(
10607  const EnqueueArgs&,
10608  T0,
10609  T1,
10610  T2,
10611  T3,
10612  T4,
10613  T5,
10614  T6,
10615  T7,
10616  T8,
10617  T9,
10618  T10,
10619  T11,
10620  T12,
10621  T13,
10622  T14,
10623  T15);
10624 
10626  const EnqueueArgs& enqueueArgs,
10627  T0 arg0,
10628  T1 arg1,
10629  T2 arg2,
10630  T3 arg3,
10631  T4 arg4,
10632  T5 arg5,
10633  T6 arg6,
10634  T7 arg7,
10635  T8 arg8,
10636  T9 arg9,
10637  T10 arg10,
10638  T11 arg11,
10639  T12 arg12,
10640  T13 arg13,
10641  T14 arg14,
10642  T15 arg15)
10643  {
10644  return functor_(
10645  enqueueArgs,
10646  arg0,
10647  arg1,
10648  arg2,
10649  arg3,
10650  arg4,
10651  arg5,
10652  arg6,
10653  arg7,
10654  arg8,
10655  arg9,
10656  arg10,
10657  arg11,
10658  arg12,
10659  arg13,
10660  arg14,
10661  arg15);
10662  }
10663 
10664 
10665 };
10666 
10667 template<
10668  typename T0,
10669  typename T1,
10670  typename T2,
10671  typename T3,
10672  typename T4,
10673  typename T5,
10674  typename T6,
10675  typename T7,
10676  typename T8,
10677  typename T9,
10678  typename T10,
10679  typename T11,
10680  typename T12,
10681  typename T13,
10682  typename T14>
10684 < T0,
10685  T1,
10686  T2,
10687  T3,
10688  T4,
10689  T5,
10690  T6,
10691  T7,
10692  T8,
10693  T9,
10694  T10,
10695  T11,
10696  T12,
10697  T13,
10698  T14,
10699  NullType,
10700  NullType,
10701  NullType,
10702  NullType,
10703  NullType,
10704  NullType,
10705  NullType,
10706  NullType,
10707  NullType,
10708  NullType,
10709  NullType,
10710  NullType,
10711  NullType,
10712  NullType,
10713  NullType,
10714  NullType,
10715  NullType>
10716 {
10718  T0,
10719  T1,
10720  T2,
10721  T3,
10722  T4,
10723  T5,
10724  T6,
10725  T7,
10726  T8,
10727  T9,
10728  T10,
10729  T11,
10730  T12,
10731  T13,
10732  T14,
10733  NullType,
10734  NullType,
10735  NullType,
10736  NullType,
10737  NullType,
10738  NullType,
10739  NullType,
10740  NullType,
10741  NullType,
10742  NullType,
10743  NullType,
10744  NullType,
10745  NullType,
10746  NullType,
10747  NullType,
10748  NullType,
10750 
10752 
10754  functor_(functor)
10755  {
10756 
10757  #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 15))
10758  // Fail variadic expansion for dev11
10759  static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
10760  #endif
10761 
10762  }
10763 
10766 
10768  typedef Event type_(
10769  const EnqueueArgs&,
10770  T0,
10771  T1,
10772  T2,
10773  T3,
10774  T4,
10775  T5,
10776  T6,
10777  T7,
10778  T8,
10779  T9,
10780  T10,
10781  T11,
10782  T12,
10783  T13,
10784  T14);
10785 
10787  const EnqueueArgs& enqueueArgs,
10788  T0 arg0,
10789  T1 arg1,
10790  T2 arg2,
10791  T3 arg3,
10792  T4 arg4,
10793  T5 arg5,
10794  T6 arg6,
10795  T7 arg7,
10796  T8 arg8,
10797  T9 arg9,
10798  T10 arg10,
10799  T11 arg11,
10800  T12 arg12,
10801  T13 arg13,
10802  T14 arg14)
10803  {
10804  return functor_(
10805  enqueueArgs,
10806  arg0,
10807  arg1,
10808  arg2,
10809  arg3,
10810  arg4,
10811  arg5,
10812  arg6,
10813  arg7,
10814  arg8,
10815  arg9,
10816  arg10,
10817  arg11,
10818  arg12,
10819  arg13,
10820  arg14);
10821  }
10822 
10823 
10824 };
10825 
10826 template<
10827  typename T0,
10828  typename T1,
10829  typename T2,
10830  typename T3,
10831  typename T4,
10832  typename T5,
10833  typename T6,
10834  typename T7,
10835  typename T8,
10836  typename T9,
10837  typename T10,
10838  typename T11,
10839  typename T12,
10840  typename T13>
10842 < T0,
10843  T1,
10844  T2,
10845  T3,
10846  T4,
10847  T5,
10848  T6,
10849  T7,
10850  T8,
10851  T9,
10852  T10,
10853  T11,
10854  T12,
10855  T13,
10856  NullType,
10857  NullType,
10858  NullType,
10859  NullType,
10860  NullType,
10861  NullType,
10862  NullType,
10863  NullType,
10864  NullType,
10865  NullType,
10866  NullType,
10867  NullType,
10868  NullType,
10869  NullType,
10870  NullType,
10871  NullType,
10872  NullType,
10873  NullType>
10874 {
10876  T0,
10877  T1,
10878  T2,
10879  T3,
10880  T4,
10881  T5,
10882  T6,
10883  T7,
10884  T8,
10885  T9,
10886  T10,
10887  T11,
10888  T12,
10889  T13,
10890  NullType,
10891  NullType,
10892  NullType,
10893  NullType,
10894  NullType,
10895  NullType,
10896  NullType,
10897  NullType,
10898  NullType,
10899  NullType,
10900  NullType,
10901  NullType,
10902  NullType,
10903  NullType,
10904  NullType,
10905  NullType,
10906  NullType,
10908 
10910 
10912  functor_(functor)
10913  {
10914 
10915  #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 14))
10916  // Fail variadic expansion for dev11
10917  static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
10918  #endif
10919 
10920  }
10921 
10924 
10926  typedef Event type_(
10927  const EnqueueArgs&,
10928  T0,
10929  T1,
10930  T2,
10931  T3,
10932  T4,
10933  T5,
10934  T6,
10935  T7,
10936  T8,
10937  T9,
10938  T10,
10939  T11,
10940  T12,
10941  T13);
10942 
10944  const EnqueueArgs& enqueueArgs,
10945  T0 arg0,
10946  T1 arg1,
10947  T2 arg2,
10948  T3 arg3,
10949  T4 arg4,
10950  T5 arg5,
10951  T6 arg6,
10952  T7 arg7,
10953  T8 arg8,
10954  T9 arg9,
10955  T10 arg10,
10956  T11 arg11,
10957  T12 arg12,
10958  T13 arg13)
10959  {
10960  return functor_(
10961  enqueueArgs,
10962  arg0,
10963  arg1,
10964  arg2,
10965  arg3,
10966  arg4,
10967  arg5,
10968  arg6,
10969  arg7,
10970  arg8,
10971  arg9,
10972  arg10,
10973  arg11,
10974  arg12,
10975  arg13);
10976  }
10977 
10978 
10979 };
10980 
10981 template<
10982  typename T0,
10983  typename T1,
10984  typename T2,
10985  typename T3,
10986  typename T4,
10987  typename T5,
10988  typename T6,
10989  typename T7,
10990  typename T8,
10991  typename T9,
10992  typename T10,
10993  typename T11,
10994  typename T12>
10996 < T0,
10997  T1,
10998  T2,
10999  T3,
11000  T4,
11001  T5,
11002  T6,
11003  T7,
11004  T8,
11005  T9,
11006  T10,
11007  T11,
11008  T12,
11009  NullType,
11010  NullType,
11011  NullType,
11012  NullType,
11013  NullType,
11014  NullType,
11015  NullType,
11016  NullType,
11017  NullType,
11018  NullType,
11019  NullType,
11020  NullType,
11021  NullType,
11022  NullType,
11023  NullType,
11024  NullType,
11025  NullType,
11026  NullType,
11027  NullType>
11028 {
11030  T0,
11031  T1,
11032  T2,
11033  T3,
11034  T4,
11035  T5,
11036  T6,
11037  T7,
11038  T8,
11039  T9,
11040  T10,
11041  T11,
11042  T12,
11043  NullType,
11044  NullType,
11045  NullType,
11046  NullType,
11047  NullType,
11048  NullType,
11049  NullType,
11050  NullType,
11051  NullType,
11052  NullType,
11053  NullType,
11054  NullType,
11055  NullType,
11056  NullType,
11057  NullType,
11058  NullType,
11059  NullType,
11060  NullType,
11062 
11064 
11066  functor_(functor)
11067  {
11068 
11069  #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 13))
11070  // Fail variadic expansion for dev11
11071  static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
11072  #endif
11073 
11074  }
11075 
11078 
11080  typedef Event type_(
11081  const EnqueueArgs&,
11082  T0,
11083  T1,
11084  T2,
11085  T3,
11086  T4,
11087  T5,
11088  T6,
11089  T7,
11090  T8,
11091  T9,
11092  T10,
11093  T11,
11094  T12);
11095 
11097  const EnqueueArgs& enqueueArgs,
11098  T0 arg0,
11099  T1 arg1,
11100  T2 arg2,
11101  T3 arg3,
11102  T4 arg4,
11103  T5 arg5,
11104  T6 arg6,
11105  T7 arg7,
11106  T8 arg8,
11107  T9 arg9,
11108  T10 arg10,
11109  T11 arg11,
11110  T12 arg12)
11111  {
11112  return functor_(
11113  enqueueArgs,
11114  arg0,
11115  arg1,
11116  arg2,
11117  arg3,
11118  arg4,
11119  arg5,
11120  arg6,
11121  arg7,
11122  arg8,
11123  arg9,
11124  arg10,
11125  arg11,
11126  arg12);
11127  }
11128 
11129 
11130 };
11131 
11132 template<
11133  typename T0,
11134  typename T1,
11135  typename T2,
11136  typename T3,
11137  typename T4,
11138  typename T5,
11139  typename T6,
11140  typename T7,
11141  typename T8,
11142  typename T9,
11143  typename T10,
11144  typename T11>
11146 < T0,
11147  T1,
11148  T2,
11149  T3,
11150  T4,
11151  T5,
11152  T6,
11153  T7,
11154  T8,
11155  T9,
11156  T10,
11157  T11,
11158  NullType,
11159  NullType,
11160  NullType,
11161  NullType,
11162  NullType,
11163  NullType,
11164  NullType,
11165  NullType,
11166  NullType,
11167  NullType,
11168  NullType,
11169  NullType,
11170  NullType,
11171  NullType,
11172  NullType,
11173  NullType,
11174  NullType,
11175  NullType,
11176  NullType,
11177  NullType>
11178 {
11180  T0,
11181  T1,
11182  T2,
11183  T3,
11184  T4,
11185  T5,
11186  T6,
11187  T7,
11188  T8,
11189  T9,
11190  T10,
11191  T11,
11192  NullType,
11193  NullType,
11194  NullType,
11195  NullType,
11196  NullType,
11197  NullType,
11198  NullType,
11199  NullType,
11200  NullType,
11201  NullType,
11202  NullType,
11203  NullType,
11204  NullType,
11205  NullType,
11206  NullType,
11207  NullType,
11208  NullType,
11209  NullType,
11210  NullType,
11212 
11214 
11216  functor_(functor)
11217  {
11218 
11219  #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 12))
11220  // Fail variadic expansion for dev11
11221  static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
11222  #endif
11223 
11224  }
11225 
11228 
11230  typedef Event type_(
11231  const EnqueueArgs&,
11232  T0,
11233  T1,
11234  T2,
11235  T3,
11236  T4,
11237  T5,
11238  T6,
11239  T7,
11240  T8,
11241  T9,
11242  T10,
11243  T11);
11244 
11246  const EnqueueArgs& enqueueArgs,
11247  T0 arg0,
11248  T1 arg1,
11249  T2 arg2,
11250  T3 arg3,
11251  T4 arg4,
11252  T5 arg5,
11253  T6 arg6,
11254  T7 arg7,
11255  T8 arg8,
11256  T9 arg9,
11257  T10 arg10,
11258  T11 arg11)
11259  {
11260  return functor_(
11261  enqueueArgs,
11262  arg0,
11263  arg1,
11264  arg2,
11265  arg3,
11266  arg4,
11267  arg5,
11268  arg6,
11269  arg7,
11270  arg8,
11271  arg9,
11272  arg10,
11273  arg11);
11274  }
11275 
11276 
11277 };
11278 
11279 template<
11280  typename T0,
11281  typename T1,
11282  typename T2,
11283  typename T3,
11284  typename T4,
11285  typename T5,
11286  typename T6,
11287  typename T7,
11288  typename T8,
11289  typename T9,
11290  typename T10>
11292 < T0,
11293  T1,
11294  T2,
11295  T3,
11296  T4,
11297  T5,
11298  T6,
11299  T7,
11300  T8,
11301  T9,
11302  T10,
11303  NullType,
11304  NullType,
11305  NullType,
11306  NullType,
11307  NullType,
11308  NullType,
11309  NullType,
11310  NullType,
11311  NullType,
11312  NullType,
11313  NullType,
11314  NullType,
11315  NullType,
11316  NullType,
11317  NullType,
11318  NullType,
11319  NullType,
11320  NullType,
11321  NullType,
11322  NullType,
11323  NullType>
11324 {
11326  T0,
11327  T1,
11328  T2,
11329  T3,
11330  T4,
11331  T5,
11332  T6,
11333  T7,
11334  T8,
11335  T9,
11336  T10,
11337  NullType,
11338  NullType,
11339  NullType,
11340  NullType,
11341  NullType,
11342  NullType,
11343  NullType,
11344  NullType,
11345  NullType,
11346  NullType,
11347  NullType,
11348  NullType,
11349  NullType,
11350  NullType,
11351  NullType,
11352  NullType,
11353  NullType,
11354  NullType,
11355  NullType,
11356  NullType,
11358 
11360 
11362  functor_(functor)
11363  {
11364 
11365  #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 11))
11366  // Fail variadic expansion for dev11
11367  static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
11368  #endif
11369 
11370  }
11371 
11374 
11376  typedef Event type_(
11377  const EnqueueArgs&,
11378  T0,
11379  T1,
11380  T2,
11381  T3,
11382  T4,
11383  T5,
11384  T6,
11385  T7,
11386  T8,
11387  T9,
11388  T10);
11389 
11391  const EnqueueArgs& enqueueArgs,
11392  T0 arg0,
11393  T1 arg1,
11394  T2 arg2,
11395  T3 arg3,
11396  T4 arg4,
11397  T5 arg5,
11398  T6 arg6,
11399  T7 arg7,
11400  T8 arg8,
11401  T9 arg9,
11402  T10 arg10)
11403  {
11404  return functor_(
11405  enqueueArgs,
11406  arg0,
11407  arg1,
11408  arg2,
11409  arg3,
11410  arg4,
11411  arg5,
11412  arg6,
11413  arg7,
11414  arg8,
11415  arg9,
11416  arg10);
11417  }
11418 
11419 
11420 };
11421 
11422 template<
11423  typename T0,
11424  typename T1,
11425  typename T2,
11426  typename T3,
11427  typename T4,
11428  typename T5,
11429  typename T6,
11430  typename T7,
11431  typename T8,
11432  typename T9>
11434 < T0,
11435  T1,
11436  T2,
11437  T3,
11438  T4,
11439  T5,
11440  T6,
11441  T7,
11442  T8,
11443  T9,
11444  NullType,
11445  NullType,
11446  NullType,
11447  NullType,
11448  NullType,
11449  NullType,
11450  NullType,
11451  NullType,
11452  NullType,
11453  NullType,
11454  NullType,
11455  NullType,
11456  NullType,
11457  NullType,
11458  NullType,
11459  NullType,
11460  NullType,
11461  NullType,
11462  NullType,
11463  NullType,
11464  NullType,
11465  NullType>
11466 {
11468  T0,
11469  T1,
11470  T2,
11471  T3,
11472  T4,
11473  T5,
11474  T6,
11475  T7,
11476  T8,
11477  T9,
11478  NullType,
11479  NullType,
11480  NullType,
11481  NullType,
11482  NullType,
11483  NullType,
11484  NullType,
11485  NullType,
11486  NullType,
11487  NullType,
11488  NullType,
11489  NullType,
11490  NullType,
11491  NullType,
11492  NullType,
11493  NullType,
11494  NullType,
11495  NullType,
11496  NullType,
11497  NullType,
11498  NullType,
11500 
11502 
11504  functor_(functor)
11505  {
11506 
11507  #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 10))
11508  // Fail variadic expansion for dev11
11509  static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
11510  #endif
11511 
11512  }
11513 
11516 
11518  typedef Event type_(
11519  const EnqueueArgs&,
11520  T0,
11521  T1,
11522  T2,
11523  T3,
11524  T4,
11525  T5,
11526  T6,
11527  T7,
11528  T8,
11529  T9);
11530 
11532  const EnqueueArgs& enqueueArgs,
11533  T0 arg0,
11534  T1 arg1,
11535  T2 arg2,
11536  T3 arg3,
11537  T4 arg4,
11538  T5 arg5,
11539  T6 arg6,
11540  T7 arg7,
11541  T8 arg8,
11542  T9 arg9)
11543  {
11544  return functor_(
11545  enqueueArgs,
11546  arg0,
11547  arg1,
11548  arg2,
11549  arg3,
11550  arg4,
11551  arg5,
11552  arg6,
11553  arg7,
11554  arg8,
11555  arg9);
11556  }
11557 
11558 
11559 };
11560 
11561 template<
11562  typename T0,
11563  typename T1,
11564  typename T2,
11565  typename T3,
11566  typename T4,
11567  typename T5,
11568  typename T6,
11569  typename T7,
11570  typename T8>
11572 < T0,
11573  T1,
11574  T2,
11575  T3,
11576  T4,
11577  T5,
11578  T6,
11579  T7,
11580  T8,
11581  NullType,
11582  NullType,
11583  NullType,
11584  NullType,
11585  NullType,
11586  NullType,
11587  NullType,
11588  NullType,
11589  NullType,
11590  NullType,
11591  NullType,
11592  NullType,
11593  NullType,
11594  NullType,
11595  NullType,
11596  NullType,
11597  NullType,
11598  NullType,
11599  NullType,
11600  NullType,
11601  NullType,
11602  NullType,
11603  NullType>
11604 {
11606  T0,
11607  T1,
11608  T2,
11609  T3,
11610  T4,
11611  T5,
11612  T6,
11613  T7,
11614  T8,
11615  NullType,
11616  NullType,
11617  NullType,
11618  NullType,
11619  NullType,
11620  NullType,
11621  NullType,
11622  NullType,
11623  NullType,
11624  NullType,
11625  NullType,
11626  NullType,
11627  NullType,
11628  NullType,
11629  NullType,
11630  NullType,
11631  NullType,
11632  NullType,
11633  NullType,
11634  NullType,
11635  NullType,
11636  NullType,
11638 
11640 
11642  functor_(functor)
11643  {
11644 
11645  #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 9))
11646  // Fail variadic expansion for dev11
11647  static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
11648  #endif
11649 
11650  }
11651 
11654 
11656  typedef Event type_(
11657  const EnqueueArgs&,
11658  T0,
11659  T1,
11660  T2,
11661  T3,
11662  T4,
11663  T5,
11664  T6,
11665  T7,
11666  T8);
11667 
11669  const EnqueueArgs& enqueueArgs,
11670  T0 arg0,
11671  T1 arg1,
11672  T2 arg2,
11673  T3 arg3,
11674  T4 arg4,
11675  T5 arg5,
11676  T6 arg6,
11677  T7 arg7,
11678  T8 arg8)
11679  {
11680  return functor_(
11681  enqueueArgs,
11682  arg0,
11683  arg1,
11684  arg2,
11685  arg3,
11686  arg4,
11687  arg5,
11688  arg6,
11689  arg7,
11690  arg8);
11691  }
11692 
11693 
11694 };
11695 
11696 template<
11697  typename T0,
11698  typename T1,
11699  typename T2,
11700  typename T3,
11701  typename T4,
11702  typename T5,
11703  typename T6,
11704  typename T7>
11706 < T0,
11707  T1,
11708  T2,
11709  T3,
11710  T4,
11711  T5,
11712  T6,
11713  T7,
11714  NullType,
11715  NullType,
11716  NullType,
11717  NullType,
11718  NullType,
11719  NullType,
11720  NullType,
11721  NullType,
11722  NullType,
11723  NullType,
11724  NullType,
11725  NullType,
11726  NullType,
11727  NullType,
11728  NullType,
11729  NullType,
11730  NullType,
11731  NullType,
11732  NullType,
11733  NullType,
11734  NullType,
11735  NullType,
11736  NullType,
11737  NullType>
11738 {
11740  T0,
11741  T1,
11742  T2,
11743  T3,
11744  T4,
11745  T5,
11746  T6,
11747  T7,
11748  NullType,
11749  NullType,
11750  NullType,
11751  NullType,
11752  NullType,
11753  NullType,
11754  NullType,
11755  NullType,
11756  NullType,
11757  NullType,
11758  NullType,
11759  NullType,
11760  NullType,
11761  NullType,
11762  NullType,
11763  NullType,
11764  NullType,
11765  NullType,
11766  NullType,
11767  NullType,
11768  NullType,
11769  NullType,
11770  NullType,
11772 
11774 
11776  functor_(functor)
11777  {
11778 
11779  #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 8))
11780  // Fail variadic expansion for dev11
11781  static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
11782  #endif
11783 
11784  }
11785 
11788 
11790  typedef Event type_(
11791  const EnqueueArgs&,
11792  T0,
11793  T1,
11794  T2,
11795  T3,
11796  T4,
11797  T5,
11798  T6,
11799  T7);
11800 
11802  const EnqueueArgs& enqueueArgs,
11803  T0 arg0,
11804  T1 arg1,
11805  T2 arg2,
11806  T3 arg3,
11807  T4 arg4,
11808  T5 arg5,
11809  T6 arg6,
11810  T7 arg7)
11811  {
11812  return functor_(
11813  enqueueArgs,
11814  arg0,
11815  arg1,
11816  arg2,
11817  arg3,
11818  arg4,
11819  arg5,
11820  arg6,
11821  arg7);
11822  }
11823 
11824 
11825 };
11826 
11827 template<
11828  typename T0,
11829  typename T1,
11830  typename T2,
11831  typename T3,
11832  typename T4,
11833  typename T5,
11834  typename T6>
11836 < T0,
11837  T1,
11838  T2,
11839  T3,
11840  T4,
11841  T5,
11842  T6,
11843  NullType,
11844  NullType,
11845  NullType,
11846  NullType,
11847  NullType,
11848  NullType,
11849  NullType,
11850  NullType,
11851  NullType,
11852  NullType,
11853  NullType,
11854  NullType,
11855  NullType,
11856  NullType,
11857  NullType,
11858  NullType,
11859  NullType,
11860  NullType,
11861  NullType,
11862  NullType,
11863  NullType,
11864  NullType,
11865  NullType,
11866  NullType,
11867  NullType>
11868 {
11870  T0,
11871  T1,
11872  T2,
11873  T3,
11874  T4,
11875  T5,
11876  T6,
11877  NullType,
11878  NullType,
11879  NullType,
11880  NullType,
11881  NullType,
11882  NullType,
11883  NullType,
11884  NullType,
11885  NullType,
11886  NullType,
11887  NullType,
11888  NullType,
11889  NullType,
11890  NullType,
11891  NullType,
11892  NullType,
11893  NullType,
11894  NullType,
11895  NullType,
11896  NullType,
11897  NullType,
11898  NullType,
11899  NullType,
11900  NullType,
11902 
11904 
11906  functor_(functor)
11907  {
11908 
11909  #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 7))
11910  // Fail variadic expansion for dev11
11911  static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
11912  #endif
11913 
11914  }
11915 
11918 
11920  typedef Event type_(
11921  const EnqueueArgs&,
11922  T0,
11923  T1,
11924  T2,
11925  T3,
11926  T4,
11927  T5,
11928  T6);
11929 
11931  const EnqueueArgs& enqueueArgs,
11932  T0 arg0,
11933  T1 arg1,
11934  T2 arg2,
11935  T3 arg3,
11936  T4 arg4,
11937  T5 arg5,
11938  T6 arg6)
11939  {
11940  return functor_(
11941  enqueueArgs,
11942  arg0,
11943  arg1,
11944  arg2,
11945  arg3,
11946  arg4,
11947  arg5,
11948  arg6);
11949  }
11950 
11951 
11952 };
11953 
11954 template<
11955  typename T0,
11956  typename T1,
11957  typename T2,
11958  typename T3,
11959  typename T4,
11960  typename T5>
11962 < T0,
11963  T1,
11964  T2,
11965  T3,
11966  T4,
11967  T5,
11968  NullType,
11969  NullType,
11970  NullType,
11971  NullType,
11972  NullType,
11973  NullType,
11974  NullType,
11975  NullType,
11976  NullType,
11977  NullType,
11978  NullType,
11979  NullType,
11980  NullType,
11981  NullType,
11982  NullType,
11983  NullType,
11984  NullType,
11985  NullType,
11986  NullType,
11987  NullType,
11988  NullType,
11989  NullType,
11990  NullType,
11991  NullType,
11992  NullType,
11993  NullType>
11994 {
11996  T0,
11997  T1,
11998  T2,
11999  T3,
12000  T4,
12001  T5,
12002  NullType,
12003  NullType,
12004  NullType,
12005  NullType,
12006  NullType,
12007  NullType,
12008  NullType,
12009  NullType,
12010  NullType,
12011  NullType,
12012  NullType,
12013  NullType,
12014  NullType,
12015  NullType,
12016  NullType,
12017  NullType,
12018  NullType,
12019  NullType,
12020  NullType,
12021  NullType,
12022  NullType,
12023  NullType,
12024  NullType,
12025  NullType,
12026  NullType,
12028 
12030 
12032  functor_(functor)
12033  {
12034 
12035  #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 6))
12036  // Fail variadic expansion for dev11
12037  static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
12038  #endif
12039 
12040  }
12041 
12044 
12046  typedef Event type_(
12047  const EnqueueArgs&,
12048  T0,
12049  T1,
12050  T2,
12051  T3,
12052  T4,
12053  T5);
12054 
12056  const EnqueueArgs& enqueueArgs,
12057  T0 arg0,
12058  T1 arg1,
12059  T2 arg2,
12060  T3 arg3,
12061  T4 arg4,
12062  T5 arg5)
12063  {
12064  return functor_(
12065  enqueueArgs,
12066  arg0,
12067  arg1,
12068  arg2,
12069  arg3,
12070  arg4,
12071  arg5);
12072  }
12073 
12074 
12075 };
12076 
12077 template<
12078  typename T0,
12079  typename T1,
12080  typename T2,
12081  typename T3,
12082  typename T4>
12084 < T0,
12085  T1,
12086  T2,
12087  T3,
12088  T4,
12089  NullType,
12090  NullType,
12091  NullType,
12092  NullType,
12093  NullType,
12094  NullType,
12095  NullType,
12096  NullType,
12097  NullType,
12098  NullType,
12099  NullType,
12100  NullType,
12101  NullType,
12102  NullType,
12103  NullType,
12104  NullType,
12105  NullType,
12106  NullType,
12107  NullType,
12108  NullType,
12109  NullType,
12110  NullType,
12111  NullType,
12112  NullType,
12113  NullType,
12114  NullType,
12115  NullType>
12116 {
12118  T0,
12119  T1,
12120  T2,
12121  T3,
12122  T4,
12123  NullType,
12124  NullType,
12125  NullType,
12126  NullType,
12127  NullType,
12128  NullType,
12129  NullType,
12130  NullType,
12131  NullType,
12132  NullType,
12133  NullType,
12134  NullType,
12135  NullType,
12136  NullType,
12137  NullType,
12138  NullType,
12139  NullType,
12140  NullType,
12141  NullType,
12142  NullType,
12143  NullType,
12144  NullType,
12145  NullType,
12146  NullType,
12147  NullType,
12148  NullType,
12150 
12152 
12154  functor_(functor)
12155  {
12156 
12157  #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 5))
12158  // Fail variadic expansion for dev11
12159  static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
12160  #endif
12161 
12162  }
12163 
12166 
12168  typedef Event type_(
12169  const EnqueueArgs&,
12170  T0,
12171  T1,
12172  T2,
12173  T3,
12174  T4);
12175 
12177  const EnqueueArgs& enqueueArgs,
12178  T0 arg0,
12179  T1 arg1,
12180  T2 arg2,
12181  T3 arg3,
12182  T4 arg4)
12183  {
12184  return functor_(
12185  enqueueArgs,
12186  arg0,
12187  arg1,
12188  arg2,
12189  arg3,
12190  arg4);
12191  }
12192 
12193 
12194 };
12195 
12196 template<
12197  typename T0,
12198  typename T1,
12199  typename T2,
12200  typename T3>
12202 < T0,
12203  T1,
12204  T2,
12205  T3,
12206  NullType,
12207  NullType,
12208  NullType,
12209  NullType,
12210  NullType,
12211  NullType,
12212  NullType,
12213  NullType,
12214  NullType,
12215  NullType,
12216  NullType,
12217  NullType,
12218  NullType,
12219  NullType,
12220  NullType,
12221  NullType,
12222  NullType,
12223  NullType,
12224  NullType,
12225  NullType,
12226  NullType,
12227  NullType,
12228  NullType,
12229  NullType,
12230  NullType,
12231  NullType,
12232  NullType,
12233  NullType>
12234 {
12236  T0,
12237  T1,
12238  T2,
12239  T3,
12240  NullType,
12241  NullType,
12242  NullType,
12243  NullType,
12244  NullType,
12245  NullType,
12246  NullType,
12247  NullType,
12248  NullType,
12249  NullType,
12250  NullType,
12251  NullType,
12252  NullType,
12253  NullType,
12254  NullType,
12255  NullType,
12256  NullType,
12257  NullType,
12258  NullType,
12259  NullType,
12260  NullType,
12261  NullType,
12262  NullType,
12263  NullType,
12264  NullType,
12265  NullType,
12266  NullType,
12268 
12270 
12272  functor_(functor)
12273  {
12274 
12275  #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 4))
12276  // Fail variadic expansion for dev11
12277  static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
12278  #endif
12279 
12280  }
12281 
12284 
12286  typedef Event type_(
12287  const EnqueueArgs&,
12288  T0,
12289  T1,
12290  T2,
12291  T3);
12292 
12294  const EnqueueArgs& enqueueArgs,
12295  T0 arg0,
12296  T1 arg1,
12297  T2 arg2,
12298  T3 arg3)
12299  {
12300  return functor_(
12301  enqueueArgs,
12302  arg0,
12303  arg1,
12304  arg2,
12305  arg3);
12306  }
12307 
12308 
12309 };
12310 
12311 template<
12312  typename T0,
12313  typename T1,
12314  typename T2>
12316 < T0,
12317  T1,
12318  T2,
12319  NullType,
12320  NullType,
12321  NullType,
12322  NullType,
12323  NullType,
12324  NullType,
12325  NullType,
12326  NullType,
12327  NullType,
12328  NullType,
12329  NullType,
12330  NullType,
12331  NullType,
12332  NullType,
12333  NullType,
12334  NullType,
12335  NullType,
12336  NullType,
12337  NullType,
12338  NullType,
12339  NullType,
12340  NullType,
12341  NullType,
12342  NullType,
12343  NullType,
12344  NullType,
12345  NullType,
12346  NullType,
12347  NullType>
12348 {
12350  T0,
12351  T1,
12352  T2,
12353  NullType,
12354  NullType,
12355  NullType,
12356  NullType,
12357  NullType,
12358  NullType,
12359  NullType,
12360  NullType,
12361  NullType,
12362  NullType,
12363  NullType,
12364  NullType,
12365  NullType,
12366  NullType,
12367  NullType,
12368  NullType,
12369  NullType,
12370  NullType,
12371  NullType,
12372  NullType,
12373  NullType,
12374  NullType,
12375  NullType,
12376  NullType,
12377  NullType,
12378  NullType,
12379  NullType,
12380  NullType,
12382 
12384 
12386  functor_(functor)
12387  {
12388 
12389  #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 3))
12390  // Fail variadic expansion for dev11
12391  static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
12392  #endif
12393 
12394  }
12395 
12398 
12400  typedef Event type_(
12401  const EnqueueArgs&,
12402  T0,
12403  T1,
12404  T2);
12405 
12407  const EnqueueArgs& enqueueArgs,
12408  T0 arg0,
12409  T1 arg1,
12410  T2 arg2)
12411  {
12412  return functor_(
12413  enqueueArgs,
12414  arg0,
12415  arg1,
12416  arg2);
12417  }
12418 
12419 
12420 };
12421 
12422 template<
12423  typename T0,
12424  typename T1>
12426 < T0,
12427  T1,
12428  NullType,
12429  NullType,
12430  NullType,
12431  NullType,
12432  NullType,
12433  NullType,
12434  NullType,
12435  NullType,
12436  NullType,
12437  NullType,
12438  NullType,
12439  NullType,
12440  NullType,
12441  NullType,
12442  NullType,
12443  NullType,
12444  NullType,
12445  NullType,
12446  NullType,
12447  NullType,
12448  NullType,
12449  NullType,
12450  NullType,
12451  NullType,
12452  NullType,
12453  NullType,
12454  NullType,
12455  NullType,
12456  NullType,
12457  NullType>
12458 {
12460  T0,
12461  T1,
12462  NullType,
12463  NullType,
12464  NullType,
12465  NullType,
12466  NullType,
12467  NullType,
12468  NullType,
12469  NullType,
12470  NullType,
12471  NullType,
12472  NullType,
12473  NullType,
12474  NullType,
12475  NullType,
12476  NullType,
12477  NullType,
12478  NullType,
12479  NullType,
12480  NullType,
12481  NullType,
12482  NullType,
12483  NullType,
12484  NullType,
12485  NullType,
12486  NullType,
12487  NullType,
12488  NullType,
12489  NullType,
12490  NullType,
12492 
12494 
12496  functor_(functor)
12497  {
12498 
12499  #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 2))
12500  // Fail variadic expansion for dev11
12501  static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
12502  #endif
12503 
12504  }
12505 
12508 
12510  typedef Event type_(
12511  const EnqueueArgs&,
12512  T0,
12513  T1);
12514 
12516  const EnqueueArgs& enqueueArgs,
12517  T0 arg0,
12518  T1 arg1)
12519  {
12520  return functor_(
12521  enqueueArgs,
12522  arg0,
12523  arg1);
12524  }
12525 
12526 
12527 };
12528 
12529 template<
12530  typename T0>
12532 < T0,
12533  NullType,
12534  NullType,
12535  NullType,
12536  NullType,
12537  NullType,
12538  NullType,
12539  NullType,
12540  NullType,
12541  NullType,
12542  NullType,
12543  NullType,
12544  NullType,
12545  NullType,
12546  NullType,
12547  NullType,
12548  NullType,
12549  NullType,
12550  NullType,
12551  NullType,
12552  NullType,
12553  NullType,
12554  NullType,
12555  NullType,
12556  NullType,
12557  NullType,
12558  NullType,
12559  NullType,
12560  NullType,
12561  NullType,
12562  NullType,
12563  NullType>
12564 {
12566  T0,
12567  NullType,
12568  NullType,
12569  NullType,
12570  NullType,
12571  NullType,
12572  NullType,
12573  NullType,
12574  NullType,
12575  NullType,
12576  NullType,
12577  NullType,
12578  NullType,
12579  NullType,
12580  NullType,
12581  NullType,
12582  NullType,
12583  NullType,
12584  NullType,
12585  NullType,
12586  NullType,
12587  NullType,
12588  NullType,
12589  NullType,
12590  NullType,
12591  NullType,
12592  NullType,
12593  NullType,
12594  NullType,
12595  NullType,
12596  NullType,
12598 
12600 
12602  functor_(functor)
12603  {
12604 
12605  #if (defined(_WIN32) && defined(_VARIADIC_MAX) && (_VARIADIC_MAX < 1))
12606  // Fail variadic expansion for dev11
12607  static_assert(0, "Visual Studio has a hard limit of argument count for a std::function expansion. Please define _VARIADIC_MAX to be 10. If you need more arguments than that VC12 and below cannot support it.");
12608  #endif
12609 
12610  }
12611 
12614 
12616  typedef Event type_(
12617  const EnqueueArgs&,
12618  T0);
12619 
12621  const EnqueueArgs& enqueueArgs,
12622  T0 arg0)
12623  {
12624  return functor_(
12625  enqueueArgs,
12626  arg0);
12627  }
12628 
12629 
12630 };
12631 
12632 
12633 
12634 
12635 
12636 } // namespace detail
12637 
12638 //----------------------------------------------------------------------------------------------
12639 
12640 template <
12641  typename T0, typename T1 = detail::NullType, typename T2 = detail::NullType,
12642  typename T3 = detail::NullType, typename T4 = detail::NullType,
12643  typename T5 = detail::NullType, typename T6 = detail::NullType,
12644  typename T7 = detail::NullType, typename T8 = detail::NullType,
12645  typename T9 = detail::NullType, typename T10 = detail::NullType,
12646  typename T11 = detail::NullType, typename T12 = detail::NullType,
12647  typename T13 = detail::NullType, typename T14 = detail::NullType,
12648  typename T15 = detail::NullType, typename T16 = detail::NullType,
12649  typename T17 = detail::NullType, typename T18 = detail::NullType,
12650  typename T19 = detail::NullType, typename T20 = detail::NullType,
12651  typename T21 = detail::NullType, typename T22 = detail::NullType,
12652  typename T23 = detail::NullType, typename T24 = detail::NullType,
12653  typename T25 = detail::NullType, typename T26 = detail::NullType,
12654  typename T27 = detail::NullType, typename T28 = detail::NullType,
12655  typename T29 = detail::NullType, typename T30 = detail::NullType,
12656  typename T31 = detail::NullType
12657 >
12658 struct make_kernel :
12660  T0, T1, T2, T3,
12661  T4, T5, T6, T7,
12662  T8, T9, T10, T11,
12663  T12, T13, T14, T15,
12664  T16, T17, T18, T19,
12665  T20, T21, T22, T23,
12666  T24, T25, T26, T27,
12667  T28, T29, T30, T31
12668  >
12669 {
12670 public:
12671  typedef detail::KernelFunctorGlobal<
12672  T0, T1, T2, T3,
12673  T4, T5, T6, T7,
12674  T8, T9, T10, T11,
12675  T12, T13, T14, T15,
12676  T16, T17, T18, T19,
12677  T20, T21, T22, T23,
12678  T24, T25, T26, T27,
12679  T28, T29, T30, T31
12681 
12683  const Program& program,
12684  const STRING_CLASS name,
12685  cl_int * err = NULL) :
12686  detail::functionImplementation_<
12687  T0, T1, T2, T3,
12688  T4, T5, T6, T7,
12689  T8, T9, T10, T11,
12690  T12, T13, T14, T15,
12691  T16, T17, T18, T19,
12692  T20, T21, T22, T23,
12693  T24, T25, T26, T27,
12694  T28, T29, T30, T31
12695  >(
12696  FunctorType(program, name, err))
12697  {}
12698 
12700  const Kernel kernel) :
12701  detail::functionImplementation_<
12702  T0, T1, T2, T3,
12703  T4, T5, T6, T7,
12704  T8, T9, T10, T11,
12705  T12, T13, T14, T15,
12706  T16, T17, T18, T19,
12707  T20, T21, T22, T23,
12708  T24, T25, T26, T27,
12709  T28, T29, T30, T31
12710  >(
12711  FunctorType(kernel))
12712  {}
12713 };
12714 
12715 
12716 //----------------------------------------------------------------------------------------------------------------------
12717 
12718 #undef __ERR_STR
12719 #if !defined(__CL_USER_OVERRIDE_ERROR_STRINGS)
12720 #undef __GET_DEVICE_INFO_ERR
12721 #undef __GET_PLATFORM_INFO_ERR
12722 #undef __GET_DEVICE_IDS_ERR
12723 #undef __GET_CONTEXT_INFO_ERR
12724 #undef __GET_EVENT_INFO_ERR
12725 #undef __GET_EVENT_PROFILE_INFO_ERR
12726 #undef __GET_MEM_OBJECT_INFO_ERR
12727 #undef __GET_IMAGE_INFO_ERR
12728 #undef __GET_SAMPLER_INFO_ERR
12729 #undef __GET_KERNEL_INFO_ERR
12730 #undef __GET_KERNEL_ARG_INFO_ERR
12731 #undef __GET_KERNEL_WORK_GROUP_INFO_ERR
12732 #undef __GET_PROGRAM_INFO_ERR
12733 #undef __GET_PROGRAM_BUILD_INFO_ERR
12734 #undef __GET_COMMAND_QUEUE_INFO_ERR
12735 
12736 #undef __CREATE_CONTEXT_ERR
12737 #undef __CREATE_CONTEXT_FROM_TYPE_ERR
12738 #undef __GET_SUPPORTED_IMAGE_FORMATS_ERR
12739 
12740 #undef __CREATE_BUFFER_ERR
12741 #undef __CREATE_SUBBUFFER_ERR
12742 #undef __CREATE_IMAGE2D_ERR
12743 #undef __CREATE_IMAGE3D_ERR
12744 #undef __CREATE_SAMPLER_ERR
12745 #undef __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR
12746 
12747 #undef __CREATE_USER_EVENT_ERR
12748 #undef __SET_USER_EVENT_STATUS_ERR
12749 #undef __SET_EVENT_CALLBACK_ERR
12750 #undef __SET_PRINTF_CALLBACK_ERR
12751 
12752 #undef __WAIT_FOR_EVENTS_ERR
12753 
12754 #undef __CREATE_KERNEL_ERR
12755 #undef __SET_KERNEL_ARGS_ERR
12756 #undef __CREATE_PROGRAM_WITH_SOURCE_ERR
12757 #undef __CREATE_PROGRAM_WITH_BINARY_ERR
12758 #undef __CREATE_PROGRAM_WITH_BUILT_IN_KERNELS_ERR
12759 #undef __BUILD_PROGRAM_ERR
12760 #undef __CREATE_KERNELS_IN_PROGRAM_ERR
12761 
12762 #undef __CREATE_COMMAND_QUEUE_ERR
12763 #undef __SET_COMMAND_QUEUE_PROPERTY_ERR
12764 #undef __ENQUEUE_READ_BUFFER_ERR
12765 #undef __ENQUEUE_WRITE_BUFFER_ERR
12766 #undef __ENQUEUE_READ_BUFFER_RECT_ERR
12767 #undef __ENQUEUE_WRITE_BUFFER_RECT_ERR
12768 #undef __ENQEUE_COPY_BUFFER_ERR
12769 #undef __ENQEUE_COPY_BUFFER_RECT_ERR
12770 #undef __ENQUEUE_READ_IMAGE_ERR
12771 #undef __ENQUEUE_WRITE_IMAGE_ERR
12772 #undef __ENQUEUE_COPY_IMAGE_ERR
12773 #undef __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR
12774 #undef __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR
12775 #undef __ENQUEUE_MAP_BUFFER_ERR
12776 #undef __ENQUEUE_MAP_IMAGE_ERR
12777 #undef __ENQUEUE_UNMAP_MEM_OBJECT_ERR
12778 #undef __ENQUEUE_NDRANGE_KERNEL_ERR
12779 #undef __ENQUEUE_TASK_ERR
12780 #undef __ENQUEUE_NATIVE_KERNEL
12781 
12782 #undef __CL_EXPLICIT_CONSTRUCTORS
12783 
12784 #undef __UNLOAD_COMPILER_ERR
12785 #endif //__CL_USER_OVERRIDE_ERROR_STRINGS
12786 
12787 #undef __CL_FUNCTION_TYPE
12788 
12789 // Extensions
12793 #if defined(CL_VERSION_1_1)
12794 #undef __INIT_CL_EXT_FCN_PTR
12795 #endif // #if defined(CL_VERSION_1_1)
12796 #undef __CREATE_SUB_DEVICES
12797 
12798 #if defined(USE_CL_DEVICE_FISSION)
12799 #undef __PARAM_NAME_DEVICE_FISSION
12800 #endif // USE_CL_DEVICE_FISSION
12801 
12802 #undef __DEFAULT_NOT_INITIALIZED
12803 #undef __DEFAULT_BEING_INITIALIZED
12804 #undef __DEFAULT_INITIALIZED
12805 
12806 #undef CL_HPP_RVALUE_REFERENCES_SUPPORTED
12807 #undef CL_HPP_NOEXCEPT
12808 
12809 } // namespace cl
12810 
12811 #endif // CL_HPP_
Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19)
Function signature of kernel functor with no event dependency.
Definition: cl.hpp:9918
Event operator()(const EnqueueArgs &enqueueArgs, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15, T16 arg16, T17 arg17, T18 arg18, T19 arg19, T20 arg20, T21 arg21, T22 arg22, T23 arg23, T24 arg24, T25 arg25, T26 arg26, T27 arg27, T28 arg28, T29 arg29, T30 arg30, T31 arg31)
Definition: cl.hpp:7505
Memory()
Default constructor - initializes to NULL.
Definition: cl.hpp:2897
detail::KernelFunctorGlobal< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType > FunctorType
Definition: cl.hpp:10421
detail::KernelFunctorGlobal< T0, T1, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType > FunctorType
Definition: cl.hpp:12491
#define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
Definition: cl.hpp:103
Image3D(const Context &context, cl_mem_flags flags, ImageFormat format, ::size_t width, ::size_t height, ::size_t depth, ::size_t row_pitch=0, ::size_t slice_pitch=0, void *host_ptr=NULL, cl_int *err=NULL)
Constructs a 3D Image in a specified context.
Definition: cl.hpp:4078
cl_int getInfoHelper(Functor f, cl_uint name, T *param, long)
Definition: cl.hpp:1036
cl_int enqueueWriteBufferRect(const Buffer &buffer, cl_bool blocking, const size_t< 3 > &buffer_offset, const size_t< 3 > &host_offset, const size_t< 3 > &region, ::size_t buffer_row_pitch, ::size_t buffer_slice_pitch, ::size_t host_row_pitch, ::size_t host_slice_pitch, void *ptr, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
Definition: cl.hpp:5675
detail::KernelFunctorGlobal< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, NullType, NullType, NullType, NullType, NullType, NullType, NullType > FunctorType
Definition: cl.hpp:8949
Image2DGL(const Image2DGL &img)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl.hpp:3949
Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28)
Function signature of kernel functor with no event dependency.
Definition: cl.hpp:8136
detail::KernelFunctorGlobal< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType > FunctorType
Definition: cl.hpp:9147
detail::KernelFunctorGlobal< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, NullType > FunctorType
Definition: cl.hpp:7677
Context(const Device &device, cl_context_properties *properties=NULL, void(CL_CALLBACK *notifyFptr)(const char *, const void *, ::size_t, void *)=NULL, void *data=NULL, cl_int *err=NULL)
Definition: cl.hpp:2388
static cl_int retain(cl_sampler sampler)
Definition: cl.hpp:1583
detail::KernelFunctorGlobal< T0, T1, T2, T3, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType > FunctorType
Definition: cl.hpp:12267
cl_int getInfo(cl_context_info name, T *param) const
Wrapper for clGetContextInfo().
Definition: cl.hpp:2604
EnqueueArgs(CommandQueue &queue, NDRange offset, NDRange global, NDRange local)
Definition: cl.hpp:7182
Adds constructors and member functions for cl_image_format.
Definition: cl.hpp:1876
cl_int enqueueNDRangeKernel(const Kernel &kernel, const NDRange &offset, const NDRange &global, const NDRange &local=NullRange, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
Definition: cl.hpp:6201
Image & operator=(const cl_mem &rhs)
Assignment from cl_mem - performs shallow copy.
Definition: cl.hpp:3442
detail::KernelFunctorGlobal< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType > FunctorType
Definition: cl.hpp:11357
detail::KernelFunctorGlobal< T0, T1, T2, T3, T4, T5, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType > FunctorType
Definition: cl.hpp:12027
Buffer(const Context &context, cl_mem_flags flags, ::size_t size, void *host_ptr=NULL, cl_int *err=NULL)
Constructs a Buffer in a specified context.
Definition: cl.hpp:3028
Image3D(const Image3D &img)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl.hpp:4170
friend cl_int getInfoHelper(Func, cl_uint, U *, int, typename U::cl_type)
static Platform getDefault(cl_int *errResult=NULL)
Definition: cl.hpp:2299
__CL_EXPLICIT_CONSTRUCTORS Context(const cl_context &context)
Constructor from cl_context - takes ownership.
Definition: cl.hpp:2589
__CL_EXPLICIT_CONSTRUCTORS Kernel(const cl_kernel &kernel)
Constructor from cl_kernel - takes ownership.
Definition: cl.hpp:4734
Event operator()(const EnqueueArgs &enqueueArgs, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15, T16 arg16)
Definition: cl.hpp:10460
cl_int enqueueUnmapMemObject(const Memory &memory, void *mapped_ptr, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
Definition: cl.hpp:6082
__CL_EXPLICIT_CONSTRUCTORS Image2DGL(const cl_mem &image)
Constructor from cl_mem - takes ownership.
Definition: cl.hpp:3934
static const void * ptr(const LocalSpaceArg &)
Definition: cl.hpp:4682
static cl_int release(cl_kernel kernel)
Definition: cl.hpp:1603
cl_int getSupportedImageFormats(cl_mem_flags flags, cl_mem_object_type type, VECTOR_CLASS< ImageFormat > *formats) const
Gets a list of supported image formats.
Definition: cl.hpp:2629
Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21)
Function signature of kernel functor with no event dependency.
Definition: cl.hpp:9550
__CL_EXPLICIT_CONSTRUCTORS Program(const cl_program &program)
Definition: cl.hpp:5074
EnqueueArgs(NDRange offset, NDRange global, NDRange local)
Definition: cl.hpp:7098
static cl_int retain(cl_command_queue queue)
Definition: cl.hpp:1565
LocalSpaceArg Local(::size_t size)
Helper function for generating LocalSpaceArg objects.
Definition: cl.hpp:4705
Image2D & operator=(const cl_mem &rhs)
Assignment from cl_mem - performs shallow copy.
Definition: cl.hpp:3847
The OpenCL C++ bindings are defined within this namespace.
Definition: acl.h:33
void fence()
Definition: cl.hpp:981
detail::param_traits< detail::cl_device_info, name >::param_type getInfo(cl_int *err=NULL) const
Wrapper for clGetDeviceInfo() that returns by value.
Definition: cl.hpp:1976
Context(const Context &ctx)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl.hpp:2502
Local address wrapper for use with Kernel::setArg.
Definition: cl.hpp:4664
Class interface for GL 3D Image Memory objects.
Definition: cl.hpp:4207
EnqueueArgs(CommandQueue &queue, const VECTOR_CLASS< Event > &events, NDRange global)
Definition: cl.hpp:7218
void * enqueueMapBuffer(const Buffer &buffer, cl_bool blocking, cl_map_flags flags, ::size_t offset, ::size_t size, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL, cl_int *err=NULL) const
Definition: cl.hpp:6021
detail::param_traits< detail::cl_program_info, name >::param_type getInfo(cl_int *err=NULL) const
Definition: cl.hpp:5183
cl_int enqueueCopyImageToBuffer(const Image &src, const Buffer &dst, const size_t< 3 > &src_origin, const size_t< 3 > &region, ::size_t dst_offset, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
Definition: cl.hpp:5971
CL_EXT_PREFIX__VERSION_1_1_DEPRECATED LocalSpaceArg __local(::size_t size) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
Helper function for generating LocalSpaceArg objects. Deprecated. Replaced with Local.
Definition: cl.hpp:4695
static cl_int release(cl_mem memory)
Definition: cl.hpp:1576
Buffer(IteratorType startIterator, IteratorType endIterator, bool readOnly, bool useHostPtr=false, cl_int *err=NULL)
Construct a Buffer from a host container via iterators. IteratorType must be random access....
Definition: cl.hpp:3077
::size_t size(const LocalSpaceArg &value)
Definition: cl.hpp:4681
cl_int getWorkGroupInfo(const Device &device, cl_kernel_work_group_info name, T *param) const
Definition: cl.hpp:4822
cl_int enqueueUnmapMemObject(const Memory &memory, void *mapped_ptr, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL)
Definition: cl.hpp:6646
Context(cl_device_type type, cl_context_properties *properties=NULL, void(CL_CALLBACK *notifyFptr)(const char *, const void *, ::size_t, void *)=NULL, void *data=NULL, cl_int *err=NULL)
Constructs a context including all or a subset of devices of a specified type.
Definition: cl.hpp:2418
Class interface for cl_mem.
Definition: cl.hpp:2893
Event operator()(const EnqueueArgs &enqueueArgs, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15, T16 arg16, T17 arg17, T18 arg18, T19 arg19, T20 arg20, T21 arg21, T22 arg22, T23 arg23, T24 arg24, T25 arg25, T26 arg26, T27 arg27)
Definition: cl.hpp:8381
Device(const Device &dev)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl.hpp:1937
detail::param_traits< detail::cl_image_info, name >::param_type getImageInfo(cl_int *err=NULL) const
Wrapper for clGetImageInfo() that returns by value.
Definition: cl.hpp:3491
Context & operator=(const Context &ctx)
Copy assignment to forward copy to the superclass correctly. Required for MSVC.
Definition: cl.hpp:2507
Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27)
Function signature of kernel functor with no event dependency.
Definition: cl.hpp:8350
Event operator()(const EnqueueArgs &args, T0 t0, T1 t1=NullType(), T2 t2=NullType(), T3 t3=NullType(), T4 t4=NullType(), T5 t5=NullType(), T6 t6=NullType(), T7 t7=NullType(), T8 t8=NullType(), T9 t9=NullType(), T10 t10=NullType(), T11 t11=NullType(), T12 t12=NullType(), T13 t13=NullType(), T14 t14=NullType(), T15 t15=NullType(), T16 t16=NullType(), T17 t17=NullType(), T18 t18=NullType(), T19 t19=NullType(), T20 t20=NullType(), T21 t21=NullType(), T22 t22=NullType(), T23 t23=NullType(), T24 t24=NullType(), T25 t25=NullType(), T26 t26=NullType(), T27 t27=NullType(), T28 t28=NullType(), T29 t29=NullType(), T30 t30=NullType(), T31 t31=NullType())
Definition: cl.hpp:7298
class used to interface between C++ and OpenCL C calls that require arrays of size_t values,...
Definition: cl.hpp:998
BufferRenderGL()
Default constructor - initializes to NULL.
Definition: cl.hpp:4408
Image(const Image &img)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl.hpp:3451
size_t()
Initialize size_t to all 0s.
Definition: cl.hpp:1005
__CL_EXPLICIT_CONSTRUCTORS Image3DGL(const cl_mem &image)
Constructor from cl_mem - takes ownership.
Definition: cl.hpp:4245
Event operator()(const EnqueueArgs &enqueueArgs, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15, T16 arg16, T17 arg17, T18 arg18, T19 arg19, T20 arg20, T21 arg21, T22 arg22, T23 arg23, T24 arg24, T25 arg25, T26 arg26, T27 arg27, T28 arg28, T29 arg29, T30 arg30)
Definition: cl.hpp:7730
Kernel(const Kernel &kernel)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl.hpp:4750
EnqueueArgs(const VECTOR_CLASS< Event > &events, NDRange global, NDRange local)
Definition: cl.hpp:7144
KernelFunctorGlobal(const Program &program, const STRING_CLASS name, cl_int *err=NULL)
Definition: cl.hpp:7291
std::shared_ptr< cl::CommandQueue > CommandQueue
Definition: acl.h:51
CommandQueue(const Context &context, cl_command_queue_properties properties=0, cl_int *err=NULL)
Constructs a CommandQueue for an implementation defined device in the given context.
Definition: cl.hpp:5394
functionImplementation_(const FunctorType &functor)
Definition: cl.hpp:7455
static cl_int retain(cl_device_id)
Definition: cl.hpp:1534
detail::param_traits< detail::cl_kernel_info, name >::param_type getInfo(cl_int *err=NULL) const
Definition: cl.hpp:4787
__CL_EXPLICIT_CONSTRUCTORS Image(const cl_mem &image)
Constructor from cl_mem - takes ownership.
Definition: cl.hpp:3436
detail::KernelFunctorGlobal< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, NullType, NullType, NullType, NullType, NullType, NullType > FunctorType
Definition: cl.hpp:8747
Sampler(const Sampler &sam)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl.hpp:4556
cl_int enqueueReadImage(const Image &image, cl_bool blocking, const size_t< 3 > &origin, const size_t< 3 > &region, ::size_t row_pitch, ::size_t slice_pitch, void *ptr, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
Definition: cl.hpp:5788
const ::size_t & operator[](int index) const
Definition: cl.hpp:1017
Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29)
Function signature of kernel functor with no event dependency.
Definition: cl.hpp:7918
Event()
Default constructor - initializes to NULL.
Definition: cl.hpp:2718
Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24)
Function signature of kernel functor with no event dependency.
Definition: cl.hpp:8968
VECTOR_CLASS< std::pair< const void *, ::size_t > > Binaries
Definition: cl.hpp:4870
Wrapper(const Wrapper< cl_type > &rhs)
Definition: cl.hpp:1786
cl_int enqueueCopyImage(const Image &src, const Image &dst, const size_t< 3 > &src_origin, const size_t< 3 > &dst_origin, const size_t< 3 > &region, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
Definition: cl.hpp:5842
detail::param_traits< detail::cl_profiling_info, name >::param_type getProfilingInfo(cl_int *err=NULL) const
Wrapper for clGetEventProfilingInfo() that returns by value.
Definition: cl.hpp:2773
BufferRenderGL(const BufferRenderGL &buf)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl.hpp:4443
cl_int enqueueWriteBuffer(const Buffer &buffer, cl_bool blocking, ::size_t offset, ::size_t size, const void *ptr, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL)
Definition: cl.hpp:6596
Event operator()(const EnqueueArgs &enqueueArgs, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15, T16 arg16, T17 arg17, T18 arg18, T19 arg19, T20 arg20, T21 arg21, T22 arg22, T23 arg23, T24 arg24, T25 arg25)
Definition: cl.hpp:8795
Event operator()(const EnqueueArgs &enqueueArgs, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15, T16 arg16, T17 arg17, T18 arg18, T19 arg19, T20 arg20, T21 arg21, T22 arg22, T23 arg23)
Definition: cl.hpp:9193
Image3D()
Default constructor - initializes to NULL.
Definition: cl.hpp:4149
CommandQueue(const Context &context, const Device &device, cl_command_queue_properties properties=0, cl_int *err=NULL)
Definition: cl.hpp:5423
#define __DEFAULT_INITIALIZED
Definition: cl.hpp:953
Class interface for GL 2D Image Memory objects.
Definition: cl.hpp:3895
cl_int getInfo(cl_sampler_info name, T *param) const
Wrapper for clGetSamplerInfo().
Definition: cl.hpp:4585
cl_int enqueueReadBufferRect(const Buffer &buffer, cl_bool blocking, const size_t< 3 > &buffer_offset, const size_t< 3 > &host_offset, const size_t< 3 > &region, ::size_t buffer_row_pitch, ::size_t buffer_slice_pitch, ::size_t host_row_pitch, ::size_t host_slice_pitch, void *ptr, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
Definition: cl.hpp:5636
detail::KernelFunctorGlobal< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType > FunctorType
Definition: cl.hpp:9531
cl_int retain() const
Definition: cl.hpp:1738
Kernel()
Default constructor - initializes to NULL.
Definition: cl.hpp:4727
cl_int enqueueCopyBufferRect(const Buffer &src, const Buffer &dst, const size_t< 3 > &src_origin, const size_t< 3 > &dst_origin, const size_t< 3 > &region, ::size_t src_row_pitch, ::size_t src_slice_pitch, ::size_t dst_row_pitch, ::size_t dst_slice_pitch, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
Definition: cl.hpp:5714
static cl_int release(cl_sampler sampler)
Definition: cl.hpp:1585
static cl_int release(cl_program program)
Definition: cl.hpp:1594
Sampler()
Default constructor - initializes to NULL.
Definition: cl.hpp:4508
EnqueueArgs(const VECTOR_CLASS< Event > &events, NDRange offset, NDRange global, NDRange local)
Definition: cl.hpp:7154
#define __CL_EXPLICIT_CONSTRUCTORS
Definition: cl.hpp:97
CommandQueue queue_
Definition: cl.hpp:7074
Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25)
Function signature of kernel functor with no event dependency.
Definition: cl.hpp:8766
make_kernel(const Program &program, const STRING_CLASS name, cl_int *err=NULL)
Definition: cl.hpp:12682
detail::param_traits< detail::cl_kernel_work_group_info, name >::param_type getWorkGroupInfo(const Device &device, cl_int *err=NULL) const
Definition: cl.hpp:4833
cl_int getInfo(cl_command_queue_info name, T *param) const
Definition: cl.hpp:5541
cl_int enqueueTask(const Kernel &kernel, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
Definition: cl.hpp:6227
const NDRange global_
Definition: cl.hpp:7076
cl_int getObjectInfo(cl_gl_object_type *type, cl_GLuint *gl_object_name)
Wrapper for clGetGLObjectInfo().
Definition: cl.hpp:4486
bool operator==(const std::vector< T > &vector1, const std::vector< T > &vector2)
Compares two vectors.
Definition: aslUtilities.h:185
Event operator()(const EnqueueArgs &enqueueArgs, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14)
Definition: cl.hpp:10786
NDRange(::size_t size0, ::size_t size1)
Constructs two-dimensional range.
Definition: cl.hpp:4632
Wrapper(const cl_type &obj)
Definition: cl.hpp:1776
Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30)
Function signature of kernel functor with no event dependency.
Definition: cl.hpp:7696
Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17)
Function signature of kernel functor with no event dependency.
Definition: cl.hpp:10270
Class interface for cl_event.
Definition: cl.hpp:2714
Event operator()(const EnqueueArgs &enqueueArgs, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15, T16 arg16, T17 arg17, T18 arg18, T19 arg19, T20 arg20, T21 arg21, T22 arg22, T23 arg23, T24 arg24)
Definition: cl.hpp:8996
Program(const Context &context, const Sources &sources, cl_int *err=NULL)
Definition: cl.hpp:4942
EnqueueArgs(const VECTOR_CLASS< Event > &events, NDRange global)
Definition: cl.hpp:7134
Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26)
Function signature of kernel functor with no event dependency.
Definition: cl.hpp:8560
EnqueueArgs(NDRange global)
Definition: cl.hpp:7080
Program(const Context &context, const VECTOR_CLASS< Device > &devices, const Binaries &binaries, VECTOR_CLASS< cl_int > *binaryStatus=NULL, cl_int *err=NULL)
Definition: cl.hpp:4986
Buffer & operator=(const cl_mem &rhs)
Assignment from cl_mem - performs shallow copy.
Definition: cl.hpp:3152
#define CL_HPP_NOEXCEPT
Definition: cl.hpp:87
static cl_int retain(cl_program program)
Definition: cl.hpp:1592
detail::param_traits< detail::cl_event_info, name >::param_type getInfo(cl_int *err=NULL) const
Wrapper for clGetEventInfo() that returns by value.
Definition: cl.hpp:2750
detail::KernelFunctorGlobal< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType > FunctorType
Definition: cl.hpp:10251
cl_int enqueueReleaseGLObjects(const VECTOR_CLASS< Memory > *mem_objects=NULL, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
Definition: cl.hpp:6337
detail::KernelFunctorGlobal< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType > FunctorType
Definition: cl.hpp:11499
static void set(Kernel, NullType)
Definition: cl.hpp:7265
const NDRange offset_
Definition: cl.hpp:7075
cl_int build(const char *options=NULL, void(CL_CALLBACK *notifyFptr)(cl_program, void *)=NULL, void *data=NULL) const
Definition: cl.hpp:5136
Image2D(const Context &context, cl_mem_flags flags, ImageFormat format, ::size_t width, ::size_t height, ::size_t row_pitch=0, void *host_ptr=NULL, cl_int *err=NULL)
Constructs a 1D Image in a specified context.
Definition: cl.hpp:3769
Program & operator=(const cl_program &rhs)
Definition: cl.hpp:5076
Image2D(const Image2D &img)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl.hpp:3856
Buffer()
Default constructor - initializes to NULL.
Definition: cl.hpp:3140
cl_int enqueueCopyBuffer(const Buffer &src, const Buffer &dst, ::size_t src_offset, ::size_t dst_offset, ::size_t size, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
Definition: cl.hpp:5612
#define CL_CALLBACK
Definition: cl.hpp:110
void * enqueueMapBuffer(const Buffer &buffer, cl_bool blocking, cl_map_flags flags, ::size_t offset, ::size_t size, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL, cl_int *err=NULL)
Definition: cl.hpp:6615
static cl_int retain(cl_mem memory)
Definition: cl.hpp:1574
Image3DGL(const Image3DGL &img)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl.hpp:4260
cl_int copy(IteratorType startIterator, IteratorType endIterator, cl::Buffer &buffer)
Definition: cl.hpp:6699
EnqueueArgs(CommandQueue &queue, const VECTOR_CLASS< Event > &events, NDRange offset, NDRange global, NDRange local)
Definition: cl.hpp:7238
const Arg0 & arg0_
Definition: cl.hpp:1461
cl_int enqueueReadBuffer(const Buffer &buffer, cl_bool blocking, ::size_t offset, ::size_t size, void *ptr, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
Definition: cl.hpp:5562
cl_int getDevices(cl_device_type type, VECTOR_CLASS< Device > *devices) const
Gets a list of devices for this platform.
Definition: cl.hpp:2107
static cl_int retain(cl_kernel kernel)
Definition: cl.hpp:1601
detail::KernelFunctorGlobal< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, NullType, NullType, NullType > FunctorType
Definition: cl.hpp:8117
Event operator()(const EnqueueArgs &enqueueArgs, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15, T16 arg16, T17 arg17, T18 arg18, T19 arg19, T20 arg20, T21 arg21)
Definition: cl.hpp:9575
Image2DGL()
Default constructor - initializes to NULL.
Definition: cl.hpp:3928
Image()
Default constructor - initializes to NULL.
Definition: cl.hpp:3430
cl_int enqueueWriteBuffer(const Buffer &buffer, cl_bool blocking, ::size_t offset, ::size_t size, const void *ptr, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
Definition: cl.hpp:5587
Event result_type
Return type of the functor.
Definition: cl.hpp:7467
cl_int getInfo(cl_device_info name, T *param) const
Wrapper for clGetDeviceInfo().
Definition: cl.hpp:1966
EnqueueArgs(CommandQueue &queue, Event e, NDRange global, NDRange local)
Definition: cl.hpp:7200
Program()
Definition: cl.hpp:5072
detail::KernelFunctorGlobal< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType > FunctorType
Definition: cl.hpp:10587
static Platform get(cl_int *errResult=NULL)
Gets the first available platform, returning it by value.
Definition: cl.hpp:2269
detail::KernelFunctorGlobal< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType > FunctorType
Definition: cl.hpp:11211
CommandQueue & operator=(const CommandQueue &queue)
Copy assignment to forward copy to the superclass correctly. Required for MSVC.
Definition: cl.hpp:5447
#define __DEFAULT_NOT_INITIALIZED
Definition: cl.hpp:951
__CL_EXPLICIT_CONSTRUCTORS Image2D(const cl_mem &image2D)
Constructor from cl_mem - takes ownership.
Definition: cl.hpp:3841
Event operator()(const EnqueueArgs &enqueueArgs, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15)
Definition: cl.hpp:10625
Image3DGL(const Context &context, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texobj, cl_int *err=NULL)
Constructs an Image3DGL in a specified context, from a given GL Texture.
Definition: cl.hpp:4215
Image2D()
Default constructor - initializes to NULL.
Definition: cl.hpp:3835
Image2DGL(const Context &context, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel, cl_GLuint texobj, cl_int *err=NULL)
Constructs an Image2DGL in a specified context, from a given GL Texture.
Definition: cl.hpp:3903
__CL_EXPLICIT_CONSTRUCTORS CommandQueue(const cl_command_queue &commandQueue)
Definition: cl.hpp:5532
cl_int enqueueCopyBuffer(const Buffer &src, const Buffer &dst, ::size_t src_offset, ::size_t dst_offset, ::size_t size, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL)
Definition: cl.hpp:6674
detail::KernelFunctorGlobal< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType > FunctorType
Definition: cl.hpp:11061
cl_int flush(void)
Definition: cl.hpp:7042
__CL_EXPLICIT_CONSTRUCTORS Platform(const cl_platform_id &platform)
Constructor from cl_platform_id.
Definition: cl.hpp:2069
cl_int enqueueCopyImage(const Image &src, const Image &dst, const size_t< 3 > &src_origin, const size_t< 3 > &dst_origin, const size_t< 3 > &region, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL)
Definition: cl.hpp:6963
detail::KernelFunctorGlobal< T0, T1, T2, T3, T4, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType > FunctorType
Definition: cl.hpp:12149
std::string STRING_CLASS
Definition: cl.hpp:378
const Block offset(const Block &bl, int a=1)
Event operator()(const EnqueueArgs &enqueueArgs, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15, T16 arg16, T17 arg17, T18 arg18, T19 arg19)
Definition: cl.hpp:9941
detail::KernelFunctorGlobal< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType > FunctorType
Definition: cl.hpp:10907
static cl_int release(cl_platform_id)
Definition: cl.hpp:1549
__CL_EXPLICIT_CONSTRUCTORS Event(const cl_event &event)
Constructor from cl_event - takes ownership.
Definition: cl.hpp:2725
cl_int getInfo(cl_event_info name, T *param) const
Wrapper for clGetEventInfo().
Definition: cl.hpp:2740
cl_int enqueueCopyBufferToImage(const Buffer &src, const Image &dst, ::size_t src_offset, const size_t< 3 > &dst_origin, const size_t< 3 > &region, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
Definition: cl.hpp:5996
detail::KernelFunctorGlobal< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31 > FunctorType
Definition: cl.hpp:7451
EnqueueArgs(Event e, NDRange offset, NDRange global, NDRange local)
Definition: cl.hpp:7125
EnqueueArgs(CommandQueue &queue, Event e, NDRange global)
Definition: cl.hpp:7191
cl_int flush() const
Definition: cl.hpp:6449
make_kernel(const Kernel kernel)
Definition: cl.hpp:12699
Event operator()(const EnqueueArgs &enqueueArgs, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15, T16 arg16, T17 arg17, T18 arg18)
Definition: cl.hpp:10118
cl_int getInfo(cl_platform_info name, STRING_CLASS *param) const
Wrapper for clGetPlatformInfo().
Definition: cl.hpp:2082
cl_int getInfo(cl_kernel_info name, T *param) const
Definition: cl.hpp:4778
static bool isReferenceCountable(cl_device_id device)
Definition: cl.hpp:1759
Context(const VECTOR_CLASS< Device > &devices, cl_context_properties *properties=NULL, void(CL_CALLBACK *notifyFptr)(const char *, const void *, ::size_t, void *)=NULL, void *data=NULL, cl_int *err=NULL)
Constructs a context including a list of specified devices.
Definition: cl.hpp:2358
EnqueueArgs(CommandQueue &queue, const VECTOR_CLASS< Event > &events, NDRange global, NDRange local)
Definition: cl.hpp:7228
__CL_EXPLICIT_CONSTRUCTORS BufferRenderGL(const cl_mem &buffer)
Constructor from cl_mem - takes ownership.
Definition: cl.hpp:4418
__CL_EXPLICIT_CONSTRUCTORS Image3D(const cl_mem &image3D)
Constructor from cl_mem - takes ownership.
Definition: cl.hpp:4155
CommandQueue(const CommandQueue &queue)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl.hpp:5442
detail::KernelFunctorGlobal< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType > FunctorType
Definition: cl.hpp:9341
cl_int enqueueReadBuffer(const Buffer &buffer, cl_bool blocking, ::size_t offset, ::size_t size, void *ptr, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL)
Definition: cl.hpp:6577
acl::TypeID type(acl::typeToTypeID< FlT >())
EnqueueArgs(CommandQueue &queue, Event e, NDRange offset, NDRange global, NDRange local)
Definition: cl.hpp:7209
detail::KernelFunctorGlobal< T0, T1, T2, T3, T4, T5, T6, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType > FunctorType
Definition: cl.hpp:11901
Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18)
Function signature of kernel functor with no event dependency.
Definition: cl.hpp:10096
NDRange()
Default constructor - resulting range has zero dimensions.
Definition: cl.hpp:4620
BufferGL(const BufferGL &buf)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl.hpp:3382
EnqueueArgs(Event e, NDRange global, NDRange local)
Definition: cl.hpp:7116
EnqueueArgs(NDRange global, NDRange local)
Definition: cl.hpp:7089
Image3D & operator=(const cl_mem &rhs)
Assignment from cl_mem - performs shallow copy.
Definition: cl.hpp:4161
VECTOR_CLASS< std::pair< const char *, ::size_t > > Sources
Definition: cl.hpp:4871
cl_int operator()(cl_uint param, ::size_t size, void *value, ::size_t *size_ret)
Definition: cl.hpp:1462
CommandQueue(cl_command_queue_properties properties, cl_int *err=NULL)
Definition: cl.hpp:5365
const NDRange local_
Definition: cl.hpp:7077
detail::KernelFunctorGlobal< T0, T1, T2, T3, T4, T5, T6, T7, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType > FunctorType
Definition: cl.hpp:11771
static void set(Kernel kernel, T0 arg)
Definition: cl.hpp:7256
Image3DGL & operator=(const cl_mem &rhs)
Assignment from cl_mem - performs shallow copy.
Definition: cl.hpp:4251
cl_int wait() const
Blocks the calling thread until this event completes.
Definition: cl.hpp:2788
ImageFormat()
Default constructor - performs no initialization.
Definition: cl.hpp:1879
Event operator()(const EnqueueArgs &enqueueArgs, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15, T16 arg16, T17 arg17, T18 arg18, T19 arg19, T20 arg20, T21 arg21, T22 arg22, T23 arg23, T24 arg24, T25 arg25, T26 arg26)
Definition: cl.hpp:8590
Class interface for cl_platform_id.
Definition: cl.hpp:2059
::size_t & operator[](int index)
Definition: cl.hpp:1012
Buffer(const Buffer &buf)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl.hpp:3161
BufferRenderGL & operator=(const cl_mem &rhs)
Assignment from cl_mem - performs shallow copy.
Definition: cl.hpp:4426
cl_int enqueueAcquireGLObjects(const VECTOR_CLASS< Memory > *mem_objects=NULL, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
Definition: cl.hpp:6315
Memory(const Memory &mem)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl.hpp:2920
#define __PARAM_NAME_INFO_1_0(F)
Definition: cl.hpp:1183
Program(const Program &program)
Copy constructor to forward copy to the superclass correctly. Required for MSVC.
Definition: cl.hpp:5085
Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31)
Function signature of kernel functor with no event dependency.
Definition: cl.hpp:7470
cl_int getObjectInfo(cl_gl_object_type *type, cl_GLuint *gl_object_name)
Wrapper for clGetGLObjectInfo().
Definition: cl.hpp:3410
Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20)
Function signature of kernel functor with no event dependency.
Definition: cl.hpp:9736
EnqueueArgs(CommandQueue &queue, NDRange global)
Definition: cl.hpp:7164
#define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
Definition: cl.hpp:106
cl_int enqueueCopyImageToBuffer(const Image &src, const Buffer &dst, const size_t< 3 > &src_origin, const size_t< 3 > &region, ::size_t dst_offset, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL)
Definition: cl.hpp:6989
Event operator()(const EnqueueArgs &enqueueArgs, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15, T16 arg16, T17 arg17, T18 arg18, T19 arg19, T20 arg20, T21 arg21, T22 arg22)
Definition: cl.hpp:9386
Image3DGL()
Default constructor - initializes to NULL.
Definition: cl.hpp:4239
::size_t dimensions() const
Queries the number of dimensions in the range.
Definition: cl.hpp:4657
cl_type operator()() const
Definition: cl.hpp:1730
CommandQueue interface for cl_command_queue.
Definition: cl.hpp:5354
cl_int getInfo(Func f, cl_uint name, T *param)
Definition: cl.hpp:1453
cl_int getInfo(Func f, const Arg0 &arg0, const Arg1 &arg1, cl_uint name, T *param)
Definition: cl.hpp:1486
Sampler(const Context &context, cl_bool normalized_coords, cl_addressing_mode addressing_mode, cl_filter_mode filter_mode, cl_int *err=NULL)
Constructs a Sampler in a specified context.
Definition: cl.hpp:4514
cl_int enqueueCopyBufferToImage(const Buffer &src, const Image &dst, ::size_t src_offset, const size_t< 3 > &dst_origin, const size_t< 3 > &region, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL)
Definition: cl.hpp:7015
cl_int getBuildInfo(const Device &device, cl_program_build_info name, T *param) const
Definition: cl.hpp:5195
Device & operator=(const cl_device_id &rhs)
Assignment operator from cl_device_id.
Definition: cl.hpp:1928
detail::KernelFunctorGlobal< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType > FunctorType
Definition: cl.hpp:9899
__CL_EXPLICIT_CONSTRUCTORS Device(const cl_device_id &device)
Constructor from cl_device_id.
Definition: cl.hpp:1916
__CL_EXPLICIT_CONSTRUCTORS Buffer(const cl_mem &buffer)
Constructor from cl_mem - takes ownership.
Definition: cl.hpp:3146
cl_int finish() const
Definition: cl.hpp:6454
static cl_int release(cl_command_queue queue)
Definition: cl.hpp:1567
ImageFormat(cl_channel_order order, cl_channel_type type)
Initializing constructor.
Definition: cl.hpp:1882
Platform & operator=(const cl_platform_id &rhs)
Assignment operator from cl_platform_id.
Definition: cl.hpp:2075
detail::KernelFunctorGlobal< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31 > FunctorType
Definition: cl.hpp:12680
__CL_EXPLICIT_CONSTRUCTORS Sampler(const cl_sampler &sampler)
Constructor from cl_sampler - takes ownership.
Definition: cl.hpp:4540
Program(const Context &context, const STRING_CLASS &source, bool build=false, cl_int *err=NULL)
Definition: cl.hpp:4908
Wrapper(const cl_type &obj)
Definition: cl.hpp:1680
detail::param_traits< detail::cl_context_info, name >::param_type getInfo(cl_int *err=NULL) const
Wrapper for clGetContextInfo() that returns by value.
Definition: cl.hpp:2614
detail::KernelFunctorGlobal< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType > FunctorType
Definition: cl.hpp:10077
static CommandQueue getDefault(cl_int *err=NULL)
Definition: cl.hpp:5469
#define __DEFAULT_BEING_INITIALIZED
Definition: cl.hpp:952
EnqueueArgs(Event e, NDRange global)
Definition: cl.hpp:7107
static cl_int get(Platform *platform)
Gets the first available platform.
Definition: cl.hpp:2240
Program(const STRING_CLASS &source, bool build=false, cl_int *err=NULL)
Definition: cl.hpp:4873
cl_int createKernels(VECTOR_CLASS< Kernel > *kernels)
Definition: cl.hpp:5217
Event operator()(const EnqueueArgs &enqueueArgs, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15, T16 arg16, T17 arg17, T18 arg18, T19 arg19, T20 arg20)
Definition: cl.hpp:9760
static cl_int get(VECTOR_CLASS< Platform > *platforms)
Gets a list of available platforms.
Definition: cl.hpp:2211
Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23)
Function signature of kernel functor with no event dependency.
Definition: cl.hpp:9166
cl_int getProfilingInfo(cl_profiling_info name, T *param) const
Wrapper for clGetEventProfilingInfo().
Definition: cl.hpp:2763
Kernel & operator=(const cl_kernel &rhs)
Assignment operator from cl_kernel - takes ownership.
Definition: cl.hpp:4741
Class interface for cl_sampler.
Definition: cl.hpp:4504
static cl_int retain(cl_event event)
Definition: cl.hpp:1610
BufferGL & operator=(const cl_mem &rhs)
Assignment from cl_mem - performs shallow copy.
Definition: cl.hpp:3373
cl_int build(const VECTOR_CLASS< Device > &devices, const char *options=NULL, void(CL_CALLBACK *notifyFptr)(cl_program, void *)=NULL, void *data=NULL) const
Definition: cl.hpp:5112
Sampler & operator=(const cl_sampler &rhs)
Assignment operator from cl_sampler - takes ownership.
Definition: cl.hpp:4547
Wrapper(const Wrapper< cl_type > &rhs)
Definition: cl.hpp:1687
detail::param_traits< detail::cl_mem_info, name >::param_type getInfo(cl_int *err=NULL) const
Wrapper for clGetMemObjectInfo() that returns by value.
Definition: cl.hpp:2959
cl_int setArg(cl_uint index, ::size_t size, const void *argPtr)
Definition: cl.hpp:4856
C++ base class for Image Memory objects.
Definition: cl.hpp:3426
detail::param_traits< detail::cl_program_build_info, name >::param_type getBuildInfo(const Device &device, cl_int *err=NULL) const
Definition: cl.hpp:5206
Wrapper< cl_type > & operator=(const Wrapper< cl_type > &rhs)
Definition: cl.hpp:1701
static cl_int release(cl_event event)
Definition: cl.hpp:1612
Class interface for Buffer Memory Objects.
Definition: cl.hpp:3017
detail::param_traits< detail::cl_sampler_info, name >::param_type getInfo(cl_int *err=NULL) const
Wrapper for clGetSamplerInfo() that returns by value.
Definition: cl.hpp:4595
Class interface for specifying NDRange values.
Definition: cl.hpp:4612
Class interface for 2D Image Memory objects.
Definition: cl.hpp:3762
NDRange(::size_t size0)
Constructs one-dimensional range.
Definition: cl.hpp:4625
::size_t size(const T &)
Definition: cl.hpp:4674
Event & operator=(const cl_event &rhs)
Assignment operator from cl_event - takes ownership.
Definition: cl.hpp:2732
Class interface for cl_kernel.
Definition: cl.hpp:4721
Class interface for 3D Image Memory objects.
Definition: cl.hpp:4071
Class interface for GL Render Buffer Memory Objects.
Definition: cl.hpp:4372
NDRange(::size_t size0, ::size_t size1, ::size_t size2)
Constructs three-dimensional range.
Definition: cl.hpp:4640
Event operator()(const EnqueueArgs &enqueueArgs, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15, T16 arg16, T17 arg17, T18 arg18, T19 arg19, T20 arg20, T21 arg21, T22 arg22, T23 arg23, T24 arg24, T25 arg25, T26 arg26, T27 arg27, T28 arg28)
Definition: cl.hpp:8168
static Device getDefault(cl_int *err=NULL)
Returns the first device on the default context.
Definition: cl.hpp:2664
detail::KernelFunctorGlobal< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, NullType, NullType, NullType, NullType, NullType > FunctorType
Definition: cl.hpp:8541
cl_int enqueueWriteImage(const Image &image, cl_bool blocking, const size_t< 3 > &origin, const size_t< 3 > &region, ::size_t row_pitch, ::size_t slice_pitch, void *ptr, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL)
Definition: cl.hpp:6933
detail::param_traits< detail::cl_platform_info, name >::param_type getInfo(cl_int *err=NULL) const
Wrapper for clGetPlatformInfo() that returns by value.
Definition: cl.hpp:2092
#define __CL_DECLARE_PARAM_TRAITS(token, param_name, T)
Definition: cl.hpp:1367
Device()
Default constructor - initializes to NULL.
Definition: cl.hpp:1910
Context()
Default constructor - initializes to NULL.
Definition: cl.hpp:2582
Class interface for cl_device_id.
Definition: cl.hpp:1906
detail::KernelFunctorGlobal< T0, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType > FunctorType
Definition: cl.hpp:12597
detail::param_traits< detail::cl_command_queue_info, name >::param_type getInfo(cl_int *err=NULL) const
Definition: cl.hpp:5551
static Context getDefault(cl_int *err=NULL)
Returns a singleton context including all devices of CL_DEVICE_TYPE_DEFAULT.
Definition: cl.hpp:2533
cl_int enqueueNativeKernel(void(CL_CALLBACK *userFptr)(void *), std::pair< void *, ::size_t > args, const VECTOR_CLASS< Memory > *mem_objects=NULL, const VECTOR_CLASS< const void * > *mem_locs=NULL, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
Definition: cl.hpp:6247
static const T * ptr(const T &value)
Definition: cl.hpp:4675
Event operator()(const EnqueueArgs &enqueueArgs, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15, T16 arg16, T17 arg17)
Definition: cl.hpp:10291
detail::KernelFunctorGlobal< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, NullType, NullType > FunctorType
Definition: cl.hpp:7899
Event type_(const EnqueueArgs &, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22)
Function signature of kernel functor with no event dependency.
Definition: cl.hpp:9360
BufferRenderGL(const Context &context, cl_mem_flags flags, cl_GLuint bufobj, cl_int *err=NULL)
Constructs a BufferRenderGL in a specified context, from a given GL Renderbuffer.
Definition: cl.hpp:4385
cl_int getImageInfo(cl_image_info name, T *param) const
Wrapper for clGetImageInfo().
Definition: cl.hpp:3481
BufferGL()
Default constructor - initializes to NULL.
Definition: cl.hpp:3361
cl_int enqueueReadImage(const Image &image, cl_bool blocking, const size_t< 3 > &origin, const size_t< 3 > &region, ::size_t row_pitch, ::size_t slice_pitch, void *ptr, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL)
Definition: cl.hpp:6903
static cl_int waitForEvents(const VECTOR_CLASS< Event > &events)
Blocks the calling thread until every event specified is complete.
Definition: cl.hpp:2820
detail::KernelFunctorGlobal< T0, T1, T2, T3, T4, T5, T6, T7, T8, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType > FunctorType
Definition: cl.hpp:11637
cl_int getInfo(cl_program_info name, T *param) const
Definition: cl.hpp:5174
detail::KernelFunctorGlobal< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType > FunctorType
Definition: cl.hpp:9717
detail::KernelFunctorGlobal< T0, T1, T2, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType > FunctorType
Definition: cl.hpp:12381
::size_t size_
Definition: cl.hpp:4666
Program interface that implements cl_program.
Definition: cl.hpp:4867
detail::KernelFunctorGlobal< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, NullType, NullType, NullType, NullType > FunctorType
Definition: cl.hpp:8331
static cl_int retain(cl_platform_id)
Definition: cl.hpp:1546
static cl_int retain(cl_context context)
Definition: cl.hpp:1556
cl_int setArg(cl_uint index, const T &value)
Definition: cl.hpp:4845
cl_int finish(void)
Definition: cl.hpp:7054
static cl_int release(cl_device_id)
Definition: cl.hpp:1537
cl_int operator()(cl_uint param, ::size_t size, void *value, ::size_t *size_ret)
Definition: cl.hpp:1471
EnqueueArgs(CommandQueue &queue, NDRange global, NDRange local)
Definition: cl.hpp:7173
Event operator()(const EnqueueArgs &enqueueArgs, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15, T16 arg16, T17 arg17, T18 arg18, T19 arg19, T20 arg20, T21 arg21, T22 arg22, T23 arg23, T24 arg24, T25 arg25, T26 arg26, T27 arg27, T28 arg28, T29 arg29)
Definition: cl.hpp:7951
Class interface for GL Buffer Memory Objects.
Definition: cl.hpp:3333
cl_int copy(const CommandQueue &queue, const cl::Buffer &buffer, IteratorType startIterator, IteratorType endIterator)
Definition: cl.hpp:6770
KernelFunctorGlobal(Kernel kernel)
Definition: cl.hpp:7286
__CL_EXPLICIT_CONSTRUCTORS Memory(const cl_mem &memory)
Constructor from cl_mem - takes ownership.
Definition: cl.hpp:2904
Buffer(cl_mem_flags flags, ::size_t size, void *host_ptr=NULL, cl_int *err=NULL)
Constructs a Buffer in the default context.
Definition: cl.hpp:3053
Class interface for cl_context.
Definition: cl.hpp:2341
BufferGL(const Context &context, cl_mem_flags flags, cl_GLuint bufobj, cl_int *err=NULL)
Constructs a BufferGL in a specified context, from a given GL buffer.
Definition: cl.hpp:3341
__CL_EXPLICIT_CONSTRUCTORS BufferGL(const cl_mem &buffer)
Constructor from cl_mem - takes ownership.
Definition: cl.hpp:3367
const Arg1 & arg1_
Definition: cl.hpp:1470
static cl_int release(cl_context context)
Definition: cl.hpp:1558
const Arg0 & arg0_
Definition: cl.hpp:1470
Platform()
Default constructor - initializes to NULL.
Definition: cl.hpp:2063
cl_type object_
Definition: cl.hpp:1675
Memory & operator=(const cl_mem &rhs)
Assignment operator from cl_mem - takes ownership.
Definition: cl.hpp:2911
ImageFormat & operator=(const ImageFormat &rhs)
Assignment operator.
Definition: cl.hpp:1889
detail::KernelFunctorGlobal< T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType, NullType > FunctorType
Definition: cl.hpp:10749
cl_int release() const
Definition: cl.hpp:1743
const bool operator!=(const AVec< T > &a, const AVec< T > &b)
cl_int enqueueWriteImage(const Image &image, cl_bool blocking, const size_t< 3 > &origin, const size_t< 3 > &region, ::size_t row_pitch, ::size_t slice_pitch, void *ptr, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
Definition: cl.hpp:5815
Element operator*(Element e1, Element e2)
void * enqueueMapImage(const Image &buffer, cl_bool blocking, cl_map_flags flags, const size_t< 3 > &origin, const size_t< 3 > &region, ::size_t *row_pitch, ::size_t *slice_pitch, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL, cl_int *err=NULL) const
Definition: cl.hpp:6050
int compare_exchange(volatile int *dest, int exchange, int comparand)
Definition: cl.hpp:962
cl_int getInfo(cl_mem_info name, T *param) const
Wrapper for clGetMemObjectInfo().
Definition: cl.hpp:2949
VECTOR_CLASS< Event > events_
Definition: cl.hpp:7078