HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cl.hpp
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright (c) 2008-2011 The Khronos Group Inc.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and/or associated documentation files (the
6  * "Materials"), to deal in the Materials without restriction, including
7  * without limitation the rights to use, copy, modify, merge, publish,
8  * distribute, sublicense, and/or sell copies of the Materials, and to
9  * permit persons to whom the Materials are furnished to do so, subject to
10  * the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included
13  * in all copies or substantial portions of the Materials.
14  *
15  * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21  * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
22  ******************************************************************************/
23 
24 /*! \file
25  *
26  * \brief C++ bindings for OpenCL 1.0 (rev 48) and OpenCL 1.1 (rev 33)
27  * \author Benedict R. Gaster and Laurent Morichetti
28  *
29  * Additions and fixes from Brian Cole, March 3rd 2010.
30  *
31  * \version 1.1
32  * \date June 2010
33  *
34  * Optional extension support
35  *
36  * cl
37  * cl_ext_device_fission
38  * #define USE_CL_DEVICE_FISSION
39  */
40 
41 // Removed 'mainpage' and 'section' directives from the multiline comment below
42 // to prevent doxygen from overriding the "Introduction to the HDK" help page.
43 
44 /*
45  * For many large applications C++ is the language of choice and so it seems
46  * reasonable to define C++ bindings for OpenCL.
47  *
48  *
49  * The interface is contained with a single C++ header file \em cl.hpp and all
50  * definitions are contained within the namespace \em cl. There is no additional
51  * requirement to include \em cl.h and to use either the C++ or original C
52  * bindings it is enough to simply include \em cl.hpp.
53  *
54  * The bindings themselves are lightweight and correspond closely to the
55  * underlying C API. Using the C++ bindings introduces no additional execution
56  * overhead.
57  *
58  * For detail documentation on the bindings see:
59  *
60  * The OpenCL C++ Wrapper API 1.1 (revision 04)
61  * http://www.khronos.org/registry/cl/specs/opencl-cplusplus-1.1.pdf
62  *
63  * \section example Example
64  *
65  * The following example shows a general use case for the C++
66  * bindings, including support for the optional exception feature and
67  * also the supplied vector and string classes, see following sections for
68  * decriptions of these features.
69  *
70  * \code
71  * #define __CL_ENABLE_EXCEPTIONS
72  *
73  * #if defined(__APPLE__) || defined(__MACOSX)
74  * #include <OpenCL/cl.hpp>
75  * #else
76  * #include <CL/cl.hpp>
77  * #endif
78  * #include <cstdio>
79  * #include <cstdlib>
80  * #include <iostream>
81  *
82  * const char * helloStr = "__kernel void "
83  * "hello(void) "
84  * "{ "
85  * " "
86  * "} ";
87  *
88  * int
89  * main(void)
90  * {
91  * cl_int err = CL_SUCCESS;
92  * try {
93  *
94  * std::vector<cl::Platform> platforms;
95  * cl::Platform::get(&platforms);
96  * if (platforms.size() == 0) {
97  * std::cout << "Platform size 0\n";
98  * return -1;
99  * }
100  *
101  * cl_context_properties properties[] =
102  * { CL_CONTEXT_PLATFORM, (cl_context_properties)(platforms[0])(), 0};
103  * cl::Context context(CL_DEVICE_TYPE_CPU, properties);
104  *
105  * std::vector<cl::Device> devices = context.getInfo<CL_CONTEXT_DEVICES>();
106  *
107  * cl::Program::Sources source(1,
108  * std::make_pair(helloStr,strlen(helloStr)));
109  * cl::Program program_ = cl::Program(context, source);
110  * program_.build(devices);
111  *
112  * cl::Kernel kernel(program_, "hello", &err);
113  *
114  * cl::Event event;
115  * cl::CommandQueue queue(context, devices[0], 0, &err);
116  * queue.enqueueNDRangeKernel(
117  * kernel,
118  * cl::NullRange,
119  * cl::NDRange(4,4),
120  * cl::NullRange,
121  * NULL,
122  * &event);
123  *
124  * event.wait();
125  * }
126  * catch (cl::Error err) {
127  * std::cerr
128  * << "ERROR: "
129  * << err.what()
130  * << "("
131  * << err.err()
132  * << ")"
133  * << std::endl;
134  * }
135  *
136  * return EXIT_SUCCESS;
137  * }
138  *
139  * \endcode
140  *
141  */
142 #ifndef CL_HPP_
143 #define CL_HPP_
144 
145 #ifdef _WIN32
146 #include <windows.h>
147 #include <malloc.h>
148 #if defined(USE_DX_INTEROP)
149 #include <CL/cl_d3d10.h>
150 #endif
151 #endif // _WIN32
152 
153 //
154 #if defined(USE_CL_DEVICE_FISSION)
155 #include <CL/cl_ext.h>
156 #endif
157 
158 #if defined(__APPLE__) || defined(__MACOSX)
159 #include <OpenCL/opencl.h>
160 #else
161 #include <CL/opencl.h>
162 #endif // !__APPLE__
163 
164 // taken from glcorearb.h to avoid including gl.h.
165 typedef int GLint;
166 typedef unsigned int GLenum;
167 typedef unsigned int GLuint;
168 
169 #if !defined(CL_CALLBACK)
170 #define CL_CALLBACK
171 #endif //CL_CALLBACK
172 
173 #include <utility>
174 
175 #if !defined(__NO_STD_VECTOR)
176 #include <vector>
177 #endif
178 
179 #if !defined(__NO_STD_STRING)
180 #include <string>
181 #endif
182 
183 #if defined(linux) || defined(__APPLE__) || defined(__MACOSX)
184 # include <alloca.h>
185 #endif // linux
186 
187 #include <cstring>
188 
189 /*! \namespace cl
190  *
191  * \brief The OpenCL C++ bindings are defined within this namespace.
192  *
193  */
194 namespace cl {
195 
196 #define __INIT_CL_EXT_FCN_PTR(name) \
197  if(!pfn_##name) { \
198  pfn_##name = (PFN_##name) \
199  clGetExtensionFunctionAddress(#name); \
200  if(!pfn_##name) { \
201  } \
202  }
203 
204 class Program;
205 class Device;
206 class Context;
207 class CommandQueue;
208 class Memory;
209 
210 #if defined(__CL_ENABLE_EXCEPTIONS)
211 #include <exception>
212 /*! \class Error
213  * \brief Exception class
214  */
215 class CE_API Error : public std::exception
216 {
217 private:
218  cl_int err_;
219  const char * errStr_;
220 public:
221  /*! Create a new CL error exception for a given error code
222  * and corresponding message.
223  */
224  Error(cl_int err, const char * errStr = NULL) : err_(err), errStr_(errStr)
225  {}
226 
227  ~Error() throw() {}
228 
229  /*! \brief Get error string associated with exception
230  *
231  * \return A memory pointer to the error message string.
232  */
233  virtual const char * what() const throw ()
234  {
235  if (errStr_ == NULL) {
236  return "empty";
237  }
238  else {
239  return errStr_;
240  }
241  }
242 
243  /*! \brief Get error code associated with exception
244  *
245  * \return The error code.
246  */
247  cl_int err(void) const { return err_; }
248 };
249 
250 #define __ERR_STR(x) #x
251 #else
252 #define __ERR_STR(x) NULL
253 #endif // __CL_ENABLE_EXCEPTIONS
254 
255 //! \cond DOXYGEN_DETAIL
256 #if !defined(__CL_USER_OVERRIDE_ERROR_STRINGS)
257 #define __GET_DEVICE_INFO_ERR __ERR_STR(clGetDeviceInfo)
258 #define __GET_PLATFORM_INFO_ERR __ERR_STR(clGetPlatformInfo)
259 #define __GET_DEVICE_IDS_ERR __ERR_STR(clGetDeviceIDs)
260 #define __GET_PLATFORM_IDS_ERR __ERR_STR(clGetPlatformIDs)
261 #define __GET_CONTEXT_INFO_ERR __ERR_STR(clGetContextInfo)
262 #define __GET_EVENT_INFO_ERR __ERR_STR(clGetEventInfo)
263 #define __GET_EVENT_PROFILE_INFO_ERR __ERR_STR(clGetEventProfileInfo)
264 #define __GET_MEM_OBJECT_INFO_ERR __ERR_STR(clGetMemObjectInfo)
265 #define __GET_IMAGE_INFO_ERR __ERR_STR(clGetImageInfo)
266 #define __GET_SAMPLER_INFO_ERR __ERR_STR(clGetSamplerInfo)
267 #define __GET_KERNEL_INFO_ERR __ERR_STR(clGetKernelInfo)
268 #define __GET_KERNEL_WORK_GROUP_INFO_ERR __ERR_STR(clGetKernelWorkGroupInfo)
269 #define __GET_PROGRAM_INFO_ERR __ERR_STR(clGetProgramInfo)
270 #define __GET_PROGRAM_BUILD_INFO_ERR __ERR_STR(clGetProgramBuildInfo)
271 #define __GET_COMMAND_QUEUE_INFO_ERR __ERR_STR(clGetCommandQueueInfo)
272 
273 #define __CREATE_CONTEXT_ERR __ERR_STR(clCreateContext)
274 #define __CREATE_CONTEXT_FROM_TYPE_ERR __ERR_STR(clCreateContextFromType)
275 #define __GET_SUPPORTED_IMAGE_FORMATS_ERR __ERR_STR(clGetSupportedImageFormats)
276 
277 #define __CREATE_BUFFER_ERR __ERR_STR(clCreateBuffer)
278 #define __CREATE_SUBBUFFER_ERR __ERR_STR(clCreateSubBuffer)
279 #define __CREATE_GL_BUFFER_ERR __ERR_STR(clCreateFromGLBuffer)
280 #define __GET_GL_OBJECT_INFO_ERR __ERR_STR(clGetGLObjectInfo)
281 #define __CREATE_IMAGE2D_ERR __ERR_STR(clCreateImage2D)
282 #define __CREATE_IMAGE3D_ERR __ERR_STR(clCreateImage3D)
283 #define __CREATE_SAMPLER_ERR __ERR_STR(clCreateSampler)
284 #define __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR __ERR_STR(clSetMemObjectDestructorCallback)
285 
286 #define __CREATE_USER_EVENT_ERR __ERR_STR(clCreateUserEvent)
287 #define __SET_USER_EVENT_STATUS_ERR __ERR_STR(clSetUserEventStatus)
288 #define __SET_EVENT_CALLBACK_ERR __ERR_STR(clSetEventCallback)
289 #define __WAIT_FOR_EVENTS_ERR __ERR_STR(clWaitForEvents)
290 
291 #define __CREATE_KERNEL_ERR __ERR_STR(clCreateKernel)
292 #define __SET_KERNEL_ARGS_ERR __ERR_STR(clSetKernelArg)
293 #define __CREATE_PROGRAM_WITH_SOURCE_ERR __ERR_STR(clCreateProgramWithSource)
294 #define __CREATE_PROGRAM_WITH_BINARY_ERR __ERR_STR(clCreateProgramWithBinary)
295 #define __BUILD_PROGRAM_ERR __ERR_STR(clBuildProgram)
296 #define __CREATE_KERNELS_IN_PROGRAM_ERR __ERR_STR(clCreateKernelsInProgram)
297 
298 #define __CREATE_COMMAND_QUEUE_ERR __ERR_STR(clCreateCommandQueue)
299 #define __SET_COMMAND_QUEUE_PROPERTY_ERR __ERR_STR(clSetCommandQueueProperty)
300 #define __ENQUEUE_READ_BUFFER_ERR __ERR_STR(clEnqueueReadBuffer)
301 #define __ENQUEUE_READ_BUFFER_RECT_ERR __ERR_STR(clEnqueueReadBufferRect)
302 #define __ENQUEUE_WRITE_BUFFER_ERR __ERR_STR(clEnqueueWriteBuffer)
303 #define __ENQUEUE_WRITE_BUFFER_RECT_ERR __ERR_STR(clEnqueueWriteBufferRect)
304 #define __ENQEUE_COPY_BUFFER_ERR __ERR_STR(clEnqueueCopyBuffer)
305 #define __ENQEUE_COPY_BUFFER_RECT_ERR __ERR_STR(clEnqueueCopyBufferRect)
306 #define __ENQUEUE_READ_IMAGE_ERR __ERR_STR(clEnqueueReadImage)
307 #define __ENQUEUE_WRITE_IMAGE_ERR __ERR_STR(clEnqueueWriteImage)
308 #define __ENQUEUE_COPY_IMAGE_ERR __ERR_STR(clEnqueueCopyImage)
309 #define __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR __ERR_STR(clEnqueueCopyImageToBuffer)
310 #define __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR __ERR_STR(clEnqueueCopyBufferToImage)
311 #define __ENQUEUE_MAP_BUFFER_ERR __ERR_STR(clEnqueueMapBuffer)
312 #define __ENQUEUE_MAP_IMAGE_ERR __ERR_STR(clEnqueueMapImage)
313 #define __ENQUEUE_UNMAP_MEM_OBJECT_ERR __ERR_STR(clEnqueueUnMapMemObject)
314 #define __ENQUEUE_NDRANGE_KERNEL_ERR __ERR_STR(clEnqueueNDRangeKernel)
315 #define __ENQUEUE_TASK_ERR __ERR_STR(clEnqueueTask)
316 #define __ENQUEUE_NATIVE_KERNEL __ERR_STR(clEnqueueNativeKernel)
317 #define __ENQUEUE_MARKER_ERR __ERR_STR(clEnqueueMarker)
318 #define __ENQUEUE_WAIT_FOR_EVENTS_ERR __ERR_STR(clEnqueueWaitForEvents)
319 #define __ENQUEUE_BARRIER_ERR __ERR_STR(clEnqueueBarrier)
320 #if defined(CL_VERSION_1_2)
321 #define __ENQUEUE_MARKER_WITH_WAIT_LIST_ERR \
322  __ERR_STR(clEnqueueMarkerWithWaitList)
323 #define __ENQUEUE_BARRIER_WITH_WAIT_LIST_ERR \
324  __ERR_STR(clEnqueueBarrierWithWaitList)
325 #endif
326 
327 #define __ENQUEUE_ACQUIRE_GL_ERR __ERR_STR(clEnqueueAcquireGLObjects)
328 #define __ENQUEUE_RELEASE_GL_ERR __ERR_STR(clEnqueueReleaseGLObjects)
329 
330 #define __UNLOAD_COMPILER_ERR __ERR_STR(clUnloadCompiler)
331 
332 #define __FLUSH_ERR __ERR_STR(clFlush)
333 #define __FINISH_ERR __ERR_STR(clFinish)
334 
335 #define __CREATE_SUB_DEVICES __ERR_STR(clCreateSubDevicesEXT)
336 #endif // __CL_USER_OVERRIDE_ERROR_STRINGS
337 //! \endcond
338 
339 /*! \class string
340  * \brief Simple string class, that provides a limited subset of std::string
341  * functionality but avoids many of the issues that come with that class.
342  */
344 {
345 private:
346  ::size_t size_;
347  char * str_;
348 public:
349  string(void) : size_(0), str_(NULL)
350  {
351  }
352 
353  string(char * str, ::size_t size) :
354  size_(size),
355  str_(NULL)
356  {
357  str_ = new char[size_+1];
358  if (str_ != NULL) {
359  memcpy(str_, str, size_ * sizeof(char));
360  str_[size_] = '\0';
361  }
362  else {
363  size_ = 0;
364  }
365  }
366 
367  string(char * str) :
368  str_(NULL)
369  {
370  size_= ::strlen(str);
371  str_ = new char[size_ + 1];
372  if (str_ != NULL) {
373  memcpy(str_, str, (size_ + 1) * sizeof(char));
374  }
375  else {
376  size_ = 0;
377  }
378  }
379 
380  string& operator=(const string& rhs)
381  {
382  if (this == &rhs) {
383  return *this;
384  }
385 
386  if (rhs.size_ == 0 || rhs.str_ == NULL) {
387  size_ = 0;
388  str_ = NULL;
389  }
390  else {
391  size_ = rhs.size_;
392  str_ = new char[size_ + 1];
393  if (str_ != NULL) {
394  memcpy(str_, rhs.str_, (size_ + 1) * sizeof(char));
395  }
396  else {
397  size_ = 0;
398  }
399  }
400 
401  return *this;
402  }
403 
404  string(const string& rhs)
405  {
406  *this = rhs;
407  }
408 
410  {
411  if (str_ != NULL) {
412  delete[] str_;
413  }
414  }
415 
416  ::size_t size(void) const { return size_; }
417  ::size_t length(void) const { return size(); }
418 
419  const char * c_str(void) const { return (str_) ? str_ : "";}
420 };
421 
422 #if !defined(__USE_DEV_STRING) && !defined(__NO_STD_STRING)
423 #include <string>
425 #elif !defined(__USE_DEV_STRING)
426 typedef cl::string STRING_CLASS;
427 #endif
428 
429 #if !defined(__USE_DEV_VECTOR) && !defined(__NO_STD_VECTOR)
430 #include <vector>
431 #define VECTOR_CLASS std::vector
432 #elif !defined(__USE_DEV_VECTOR)
433 #define VECTOR_CLASS cl::vector
434 #endif
435 
436 #if !defined(__MAX_DEFAULT_VECTOR_SIZE)
437 #define __MAX_DEFAULT_VECTOR_SIZE 10
438 #endif
439 
440 /*! \class vector
441  * \brief Fixed sized vector implementation that mirroring
442  * std::vector functionality.
443  */
444 template <typename T, unsigned int N = __MAX_DEFAULT_VECTOR_SIZE>
445 class vector
446 {
447 private:
448  T data_[N];
449  unsigned int size_;
450  bool empty_;
451 public:
452  vector() :
453  size_(static_cast<unsigned int>(-1)),
454  empty_(true)
455  {}
456 
457  ~vector() {}
458 
459  unsigned int size(void) const
460  {
461  return size_ + 1;
462  }
463 
464  void clear()
465  {
466  size_ = -1;
467  empty_ = true;
468  }
469 
470  void push_back (const T& x)
471  {
472  if (size() < N) {
473  size_++;
474  data_[size_] = x;
475  empty_ = false;
476  }
477  }
478 
479  void pop_back(void)
480  {
481  if (!empty_) {
482  data_[size_].~T();
483  size_--;
484  if (size_ == -1) {
485  empty_ = true;
486  }
487  }
488  }
489 
490  vector(const vector<T, N>& vec) :
491  size_(vec.size_),
492  empty_(vec.empty_)
493  {
494  if (!empty_) {
495  memcpy(&data_[0], &vec.data_[0], size() * sizeof(T));
496  }
497  }
498 
499  vector(unsigned int size, const T& val = T()) :
500  size_(-1),
501  empty_(true)
502  {
503  for (unsigned int i = 0; i < size; i++) {
504  push_back(val);
505  }
506  }
507 
509  {
510  if (this == &rhs) {
511  return *this;
512  }
513 
514  size_ = rhs.size_;
515  empty_ = rhs.empty_;
516 
517  if (!empty_) {
518  memcpy(&data_[0], &rhs.data_[0], size() * sizeof(T));
519  }
520 
521  return *this;
522  }
523 
525  {
526  if (empty_ && vec.empty_) {
527  return true;
528  }
529 
530  if (size() != vec.size()) {
531  return false;
532  }
533 
534  return memcmp(&data_[0], &vec.data_[0], size() * sizeof(T)) == 0 ? true : false;
535  }
536 
537  operator T* () { return data_; }
538  operator const T* () const { return data_; }
539 
540  bool empty (void) const
541  {
542  return empty_;
543  }
544 
545  unsigned int max_size (void) const
546  {
547  return N;
548  }
549 
550  unsigned int capacity () const
551  {
552  return sizeof(T) * N;
553  }
554 
556  {
557  return data_[index];
558  }
559 
560  T operator[](int index) const
561  {
562  return data_[index];
563  }
564 
565  template<class I>
566  void assign(I start, I end)
567  {
568  clear();
569  while(start < end) {
570  push_back(*start);
571  start++;
572  }
573  }
574 
575  /*! \class iterator
576  * \brief Iterator class for vectors
577  */
578  class iterator
579  {
580  private:
581  vector<T,N> vec_;
582  int index_;
583  bool initialized_;
584  public:
585  iterator(void) :
586  index_(-1),
587  initialized_(false)
588  {
589  index_ = -1;
590  initialized_ = false;
591  }
592 
593  ~iterator(void) {}
594 
596  {
597  iterator i;
598 
599  if (!vec.empty()) {
600  i.index_ = 0;
601  }
602 
603  i.vec_ = vec;
604  i.initialized_ = true;
605  return i;
606  }
607 
608  static iterator end(vector<T,N> &vec)
609  {
610  iterator i;
611 
612  if (!vec.empty()) {
613  i.index_ = vec.size();
614  }
615  i.vec_ = vec;
616  i.initialized_ = true;
617  return i;
618  }
619 
621  {
622  return ((vec_ == i.vec_) &&
623  (index_ == i.index_) &&
624  (initialized_ == i.initialized_));
625  }
626 
628  {
629  return (!(*this==i));
630  }
631 
632  void operator++()
633  {
634  index_++;
635  }
636 
637  void operator++(int x)
638  {
639  index_ += x;
640  }
641 
642  void operator--()
643  {
644  index_--;
645  }
646 
647  void operator--(int x)
648  {
649  index_ -= x;
650  }
651 
653  {
654  return vec_[index_];
655  }
656  };
657 
658  iterator begin(void)
659  {
660  return iterator::begin(*this);
661  }
662 
663  iterator end(void)
664  {
665  return iterator::end(*this);
666  }
667 
668  T& front(void)
669  {
670  return data_[0];
671  }
672 
673  T& back(void)
674  {
675  return data_[size_];
676  }
677 
678  const T& front(void) const
679  {
680  return data_[0];
681  }
682 
683  const T& back(void) const
684  {
685  return data_[size_];
686  }
687 };
688 
689 /*!
690  * \brief size_t class used to interface between C++ and
691  * OpenCL C calls that require arrays of size_t values, who's
692  * size is known statically.
693  */
694 template <int N>
695 struct size_t : public cl::vector< ::size_t, N> { };
696 
697 namespace detail {
698 
699 // GetInfo help struct
700 template <typename Functor, typename T>
702 {
703  static cl_int
704  get(Functor f, cl_uint name, T* param)
705  {
706  return f(name, sizeof(T), param, NULL);
707  }
708 };
709 
710 // Specialized GetInfoHelper for VECTOR_CLASS params
711 template <typename Func, typename T>
712 struct GetInfoHelper<Func, VECTOR_CLASS<T> >
713 {
714  static cl_int get(Func f, cl_uint name, VECTOR_CLASS<T>* param)
715  {
716  ::size_t required;
717  cl_int err = f(name, 0, NULL, &required);
718  if (err != CL_SUCCESS) {
719  return err;
720  }
721 
722  T* value = (T*) alloca(required);
723  err = f(name, required, value, NULL);
724  if (err != CL_SUCCESS) {
725  return err;
726  }
727 
728  param->assign(&value[0], &value[required/sizeof(T)]);
729  return CL_SUCCESS;
730  }
731 };
732 
733 // Specialized for getInfo<CL_PROGRAM_BINARIES>
734 template <typename Func>
735 struct GetInfoHelper<Func, VECTOR_CLASS<char *> >
736 {
737  static cl_int
738  get(Func f, cl_uint name, VECTOR_CLASS<char *>* param)
739  {
740  ::size_t nDevices;
741  ::size_t * binary_sizes;
742  char ** values;
743 
744  cl_int err = f(CL_PROGRAM_NUM_DEVICES, sizeof(nDevices), &nDevices, NULL);
745  if (err != CL_SUCCESS) {
746  return err;
747  }
748 
749  binary_sizes = (::size_t*)alloca(sizeof(::size_t)*nDevices);
750  err = f(CL_PROGRAM_BINARY_SIZES, sizeof(::size_t)*nDevices, binary_sizes, NULL);
751  if (err != CL_SUCCESS) {
752  return err;
753  }
754 
755  values = (char **) alloca(sizeof(char*)*nDevices);
756  for(cl_uint i = 0; i < nDevices; i++ )
757  {
758  if( binary_sizes[i] != 0 )
759  {
760  values[i]= (char *)malloc( sizeof(char)*binary_sizes[i]);
761  }
762  else
763  {
764  values[i] = NULL;
765  }
766  }
767  err = f(name, sizeof(char *)*nDevices, values, NULL);
768  if (err != CL_SUCCESS) {
769  return err;
770  }
771 
772  param->assign(values,values+nDevices);
773  return CL_SUCCESS;
774  }
775 };
776 
777 // Specialized GetInfoHelper for STRING_CLASS params
778 template <typename Func>
780 {
781  static cl_int get(Func f, cl_uint name, STRING_CLASS* param)
782  {
783  ::size_t required;
784  cl_int err = f(name, 0, NULL, &required);
785  if (err != CL_SUCCESS) {
786  return err;
787  }
788 
789  char* value = (char*) alloca(required);
790  err = f(name, required, value, NULL);
791  if (err != CL_SUCCESS) {
792  return err;
793  }
794 
795  *param = value;
796  return CL_SUCCESS;
797  }
798 };
799 
800 #define __GET_INFO_HELPER_WITH_RETAIN(CPP_TYPE) \
801 namespace detail { \
802 template <typename Func> \
803 struct GetInfoHelper<Func, CPP_TYPE> \
804 { \
805  static cl_int get(Func f, cl_uint name, CPP_TYPE* param) \
806  { \
807  cl_uint err = f(name, sizeof(CPP_TYPE), param, NULL); \
808  if (err != CL_SUCCESS) { \
809  return err; \
810  } \
811  \
812  return ReferenceHandler<CPP_TYPE::cl_type>::retain((*param)()); \
813  } \
814 }; \
815 }
816 
817 
818 #define __PARAM_NAME_INFO_1_0(F) \
819  F(cl_platform_info, CL_PLATFORM_PROFILE, STRING_CLASS) \
820  F(cl_platform_info, CL_PLATFORM_VERSION, STRING_CLASS) \
821  F(cl_platform_info, CL_PLATFORM_NAME, STRING_CLASS) \
822  F(cl_platform_info, CL_PLATFORM_VENDOR, STRING_CLASS) \
823  F(cl_platform_info, CL_PLATFORM_EXTENSIONS, STRING_CLASS) \
824  \
825  F(cl_device_info, CL_DEVICE_TYPE, cl_device_type) \
826  F(cl_device_info, CL_DEVICE_VENDOR_ID, cl_uint) \
827  F(cl_device_info, CL_DEVICE_MAX_COMPUTE_UNITS, cl_uint) \
828  F(cl_device_info, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, cl_uint) \
829  F(cl_device_info, CL_DEVICE_MAX_WORK_GROUP_SIZE, ::size_t) \
830  F(cl_device_info, CL_DEVICE_MAX_WORK_ITEM_SIZES, VECTOR_CLASS< ::size_t>) \
831  F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR, cl_uint) \
832  F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT, cl_uint) \
833  F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT, cl_uint) \
834  F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG, cl_uint) \
835  F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT, cl_uint) \
836  F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE, cl_uint) \
837  F(cl_device_info, CL_DEVICE_MAX_CLOCK_FREQUENCY, cl_uint) \
838  F(cl_device_info, CL_DEVICE_ADDRESS_BITS, cl_bitfield) \
839  F(cl_device_info, CL_DEVICE_MAX_READ_IMAGE_ARGS, cl_uint) \
840  F(cl_device_info, CL_DEVICE_MAX_WRITE_IMAGE_ARGS, cl_uint) \
841  F(cl_device_info, CL_DEVICE_MAX_MEM_ALLOC_SIZE, cl_ulong) \
842  F(cl_device_info, CL_DEVICE_IMAGE2D_MAX_WIDTH, ::size_t) \
843  F(cl_device_info, CL_DEVICE_IMAGE2D_MAX_HEIGHT, ::size_t) \
844  F(cl_device_info, CL_DEVICE_IMAGE3D_MAX_WIDTH, ::size_t) \
845  F(cl_device_info, CL_DEVICE_IMAGE3D_MAX_HEIGHT, ::size_t) \
846  F(cl_device_info, CL_DEVICE_IMAGE3D_MAX_DEPTH, ::size_t) \
847  F(cl_device_info, CL_DEVICE_IMAGE_SUPPORT, cl_bool) \
848  F(cl_device_info, CL_DEVICE_MAX_PARAMETER_SIZE, ::size_t) \
849  F(cl_device_info, CL_DEVICE_MAX_SAMPLERS, cl_uint) \
850  F(cl_device_info, CL_DEVICE_MEM_BASE_ADDR_ALIGN, cl_uint) \
851  F(cl_device_info, CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE, cl_uint) \
852  F(cl_device_info, CL_DEVICE_SINGLE_FP_CONFIG, cl_device_fp_config) \
853  F(cl_device_info, CL_DEVICE_GLOBAL_MEM_CACHE_TYPE, cl_device_mem_cache_type) \
854  F(cl_device_info, CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE, cl_uint)\
855  F(cl_device_info, CL_DEVICE_GLOBAL_MEM_CACHE_SIZE, cl_ulong) \
856  F(cl_device_info, CL_DEVICE_GLOBAL_MEM_SIZE, cl_ulong) \
857  F(cl_device_info, CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE, cl_ulong) \
858  F(cl_device_info, CL_DEVICE_MAX_CONSTANT_ARGS, cl_uint) \
859  F(cl_device_info, CL_DEVICE_LOCAL_MEM_TYPE, cl_device_local_mem_type) \
860  F(cl_device_info, CL_DEVICE_LOCAL_MEM_SIZE, cl_ulong) \
861  F(cl_device_info, CL_DEVICE_ERROR_CORRECTION_SUPPORT, cl_bool) \
862  F(cl_device_info, CL_DEVICE_PROFILING_TIMER_RESOLUTION, ::size_t) \
863  F(cl_device_info, CL_DEVICE_ENDIAN_LITTLE, cl_bool) \
864  F(cl_device_info, CL_DEVICE_AVAILABLE, cl_bool) \
865  F(cl_device_info, CL_DEVICE_COMPILER_AVAILABLE, cl_bool) \
866  F(cl_device_info, CL_DEVICE_EXECUTION_CAPABILITIES, cl_device_exec_capabilities) \
867  F(cl_device_info, CL_DEVICE_QUEUE_PROPERTIES, cl_command_queue_properties) \
868  F(cl_device_info, CL_DEVICE_PLATFORM, cl_platform_id) \
869  F(cl_device_info, CL_DEVICE_NAME, STRING_CLASS) \
870  F(cl_device_info, CL_DEVICE_VENDOR, STRING_CLASS) \
871  F(cl_device_info, CL_DRIVER_VERSION, STRING_CLASS) \
872  F(cl_device_info, CL_DEVICE_PROFILE, STRING_CLASS) \
873  F(cl_device_info, CL_DEVICE_VERSION, STRING_CLASS) \
874  F(cl_device_info, CL_DEVICE_EXTENSIONS, STRING_CLASS) \
875  \
876  F(cl_context_info, CL_CONTEXT_REFERENCE_COUNT, cl_uint) \
877  F(cl_context_info, CL_CONTEXT_DEVICES, VECTOR_CLASS<Device>) \
878  F(cl_context_info, CL_CONTEXT_PROPERTIES, VECTOR_CLASS<cl_context_properties>) \
879  \
880  F(cl_event_info, CL_EVENT_COMMAND_QUEUE, cl::CommandQueue) \
881  F(cl_event_info, CL_EVENT_COMMAND_TYPE, cl_command_type) \
882  F(cl_event_info, CL_EVENT_REFERENCE_COUNT, cl_uint) \
883  F(cl_event_info, CL_EVENT_COMMAND_EXECUTION_STATUS, cl_uint) \
884  \
885  F(cl_profiling_info, CL_PROFILING_COMMAND_QUEUED, cl_ulong) \
886  F(cl_profiling_info, CL_PROFILING_COMMAND_SUBMIT, cl_ulong) \
887  F(cl_profiling_info, CL_PROFILING_COMMAND_START, cl_ulong) \
888  F(cl_profiling_info, CL_PROFILING_COMMAND_END, cl_ulong) \
889  \
890  F(cl_mem_info, CL_MEM_TYPE, cl_mem_object_type) \
891  F(cl_mem_info, CL_MEM_FLAGS, cl_mem_flags) \
892  F(cl_mem_info, CL_MEM_SIZE, ::size_t) \
893  F(cl_mem_info, CL_MEM_HOST_PTR, void*) \
894  F(cl_mem_info, CL_MEM_MAP_COUNT, cl_uint) \
895  F(cl_mem_info, CL_MEM_REFERENCE_COUNT, cl_uint) \
896  F(cl_mem_info, CL_MEM_CONTEXT, cl::Context) \
897  \
898  F(cl_image_info, CL_IMAGE_FORMAT, cl_image_format) \
899  F(cl_image_info, CL_IMAGE_ELEMENT_SIZE, ::size_t) \
900  F(cl_image_info, CL_IMAGE_ROW_PITCH, ::size_t) \
901  F(cl_image_info, CL_IMAGE_SLICE_PITCH, ::size_t) \
902  F(cl_image_info, CL_IMAGE_WIDTH, ::size_t) \
903  F(cl_image_info, CL_IMAGE_HEIGHT, ::size_t) \
904  F(cl_image_info, CL_IMAGE_DEPTH, ::size_t) \
905  \
906  F(cl_sampler_info, CL_SAMPLER_REFERENCE_COUNT, cl_uint) \
907  F(cl_sampler_info, CL_SAMPLER_CONTEXT, cl::Context) \
908  F(cl_sampler_info, CL_SAMPLER_NORMALIZED_COORDS, cl_addressing_mode) \
909  F(cl_sampler_info, CL_SAMPLER_ADDRESSING_MODE, cl_filter_mode) \
910  F(cl_sampler_info, CL_SAMPLER_FILTER_MODE, cl_bool) \
911  \
912  F(cl_program_info, CL_PROGRAM_REFERENCE_COUNT, cl_uint) \
913  F(cl_program_info, CL_PROGRAM_CONTEXT, cl::Context) \
914  F(cl_program_info, CL_PROGRAM_NUM_DEVICES, cl_uint) \
915  F(cl_program_info, CL_PROGRAM_DEVICES, VECTOR_CLASS<cl_device_id>) \
916  F(cl_program_info, CL_PROGRAM_SOURCE, STRING_CLASS) \
917  F(cl_program_info, CL_PROGRAM_BINARY_SIZES, VECTOR_CLASS< ::size_t>) \
918  F(cl_program_info, CL_PROGRAM_BINARIES, VECTOR_CLASS<char *>) \
919  \
920  F(cl_program_build_info, CL_PROGRAM_BUILD_STATUS, cl_build_status) \
921  F(cl_program_build_info, CL_PROGRAM_BUILD_OPTIONS, STRING_CLASS) \
922  F(cl_program_build_info, CL_PROGRAM_BUILD_LOG, STRING_CLASS) \
923  \
924  F(cl_kernel_info, CL_KERNEL_FUNCTION_NAME, STRING_CLASS) \
925  F(cl_kernel_info, CL_KERNEL_NUM_ARGS, cl_uint) \
926  F(cl_kernel_info, CL_KERNEL_REFERENCE_COUNT, cl_uint) \
927  F(cl_kernel_info, CL_KERNEL_CONTEXT, cl::Context) \
928  F(cl_kernel_info, CL_KERNEL_PROGRAM, cl::Program) \
929  \
930  F(cl_kernel_work_group_info, CL_KERNEL_WORK_GROUP_SIZE, ::size_t) \
931  F(cl_kernel_work_group_info, CL_KERNEL_COMPILE_WORK_GROUP_SIZE, cl::size_t<3>) \
932  F(cl_kernel_work_group_info, CL_KERNEL_LOCAL_MEM_SIZE, cl_ulong) \
933  \
934  F(cl_command_queue_info, CL_QUEUE_CONTEXT, cl::Context) \
935  F(cl_command_queue_info, CL_QUEUE_DEVICE, cl::Device) \
936  F(cl_command_queue_info, CL_QUEUE_REFERENCE_COUNT, cl_uint) \
937  F(cl_command_queue_info, CL_QUEUE_PROPERTIES, cl_command_queue_properties)
938 
939 #if defined(CL_VERSION_1_1)
940 #define __PARAM_NAME_INFO_1_1(F) \
941  F(cl_context_info, CL_CONTEXT_NUM_DEVICES, cl_uint)\
942  F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF, cl_uint) \
943  F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR, cl_uint) \
944  F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT, cl_uint) \
945  F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_INT, cl_uint) \
946  F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG, cl_uint) \
947  F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT, cl_uint) \
948  F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE, cl_uint) \
949  F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF, cl_uint) \
950  F(cl_device_info, CL_DEVICE_DOUBLE_FP_CONFIG, cl_device_fp_config) \
951  F(cl_device_info, CL_DEVICE_HALF_FP_CONFIG, cl_device_fp_config) \
952  F(cl_device_info, CL_DEVICE_HOST_UNIFIED_MEMORY, cl_bool) \
953  F(cl_device_info, CL_DEVICE_OPENCL_C_VERSION, STRING_CLASS) \
954  \
955  F(cl_mem_info, CL_MEM_ASSOCIATED_MEMOBJECT, cl::Memory) \
956  F(cl_mem_info, CL_MEM_OFFSET, ::size_t) \
957  \
958  F(cl_kernel_work_group_info, CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE, ::size_t) \
959  F(cl_kernel_work_group_info, CL_KERNEL_PRIVATE_MEM_SIZE, cl_ulong) \
960  \
961  F(cl_event_info, CL_EVENT_CONTEXT, cl::Context)
962 #endif // CL_VERSION_1_1
963 
964 #if defined(USE_CL_DEVICE_FISSION)
965 #define __PARAM_NAME_DEVICE_FISSION(F) \
966  F(cl_device_info, CL_DEVICE_PARENT_DEVICE_EXT, cl_device_id) \
967  F(cl_device_info, CL_DEVICE_PARTITION_TYPES_EXT, VECTOR_CLASS<cl_device_partition_property_ext>) \
968  F(cl_device_info, CL_DEVICE_AFFINITY_DOMAINS_EXT, VECTOR_CLASS<cl_device_partition_property_ext>) \
969  F(cl_device_info, CL_DEVICE_REFERENCE_COUNT_EXT , cl_uint) \
970  F(cl_device_info, CL_DEVICE_PARTITION_STYLE_EXT, VECTOR_CLASS<cl_device_partition_property_ext>)
971 #endif // USE_CL_DEVICE_FISSION
972 
973 template <typename enum_type, cl_int Name>
974 struct param_traits {};
975 
976 #define __CL_DECLARE_PARAM_TRAITS(token, param_name, T) \
977 struct token; \
978 template<> \
979 struct param_traits<detail:: token,param_name> \
980 { \
981  enum { value = param_name }; \
982  typedef T param_type; \
983 };
984 
986 #if defined(CL_VERSION_1_1)
987 __PARAM_NAME_INFO_1_1(__CL_DECLARE_PARAM_TRAITS)
988 #endif // CL_VERSION_1_1
989 
990 #if defined(USE_CL_DEVICE_FISSION)
991 __PARAM_NAME_DEVICE_FISSION(__CL_DECLARE_PARAM_TRAITS);
992 #endif // USE_CL_DEVICE_FISSION
993 
994 #ifdef CL_PLATFORM_ICD_SUFFIX_KHR
996 #endif
997 
998 #ifdef CL_DEVICE_PROFILING_TIMER_OFFSET_AMD
1000 #endif
1001 
1002 #ifdef CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
1004 #endif
1005 #ifdef CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
1007 #endif
1008 #ifdef CL_DEVICE_REGISTERS_PER_BLOCK_NV
1010 #endif
1011 #ifdef CL_DEVICE_WARP_SIZE_NV
1013 #endif
1014 #ifdef CL_DEVICE_GPU_OVERLAP_NV
1016 #endif
1017 #ifdef CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV
1019 #endif
1020 #ifdef CL_DEVICE_INTEGRATED_MEMORY_NV
1022 #endif
1023 
1024 // Convenience functions
1025 
1026 template <typename Func, typename T>
1027 inline cl_int
1028 getInfo(Func f, cl_uint name, T* param)
1029 {
1030  return GetInfoHelper<Func, T>::get(f, name, param);
1031 }
1032 
1033 template <typename Func, typename Arg0>
1035 {
1036  Func f_; const Arg0& arg0_;
1037  cl_int operator ()(
1038  cl_uint param, ::size_t size, void* value, ::size_t* size_ret)
1039  { return f_(arg0_, param, size, value, size_ret); }
1040 };
1041 
1042 template <typename Func, typename Arg0, typename Arg1>
1044 {
1045  Func f_; const Arg0& arg0_; const Arg1& arg1_;
1046  cl_int operator ()(
1047  cl_uint param, ::size_t size, void* value, ::size_t* size_ret)
1048  { return f_(arg0_, arg1_, param, size, value, size_ret); }
1049 };
1050 
1051 template <typename Func, typename Arg0, typename T>
1052 inline cl_int
1053 getInfo(Func f, const Arg0& arg0, cl_uint name, T* param)
1054 {
1055  GetInfoFunctor0<Func, Arg0> f0 = { f, arg0 };
1057  ::get(f0, name, param);
1058 }
1059 
1060 template <typename Func, typename Arg0, typename Arg1, typename T>
1061 inline cl_int
1062 getInfo(Func f, const Arg0& arg0, const Arg1& arg1, cl_uint name, T* param)
1063 {
1064  GetInfoFunctor1<Func, Arg0, Arg1> f0 = { f, arg0, arg1 };
1066  ::get(f0, name, param);
1067 }
1068 
1069 template<typename T>
1071 { };
1072 
1073 template <>
1075 {
1076  // cl_device_id does not have retain().
1077  static cl_int retain(cl_device_id)
1078  { return CL_INVALID_DEVICE; }
1079  // cl_device_id does not have release().
1080  static cl_int release(cl_device_id)
1081  { return CL_INVALID_DEVICE; }
1082 };
1083 
1084 template <>
1086 {
1087  // cl_platform_id does not have retain().
1088  static cl_int retain(cl_platform_id)
1089  { return CL_INVALID_PLATFORM; }
1090  // cl_platform_id does not have release().
1091  static cl_int release(cl_platform_id)
1092  { return CL_INVALID_PLATFORM; }
1093 };
1094 
1095 template <>
1097 {
1098  static cl_int retain(cl_context context)
1099  { return ::clRetainContext(context); }
1100  static cl_int release(cl_context context)
1101  { return ::clReleaseContext(context); }
1102 };
1103 
1104 template <>
1106 {
1107  static cl_int retain(cl_command_queue queue)
1108  { return ::clRetainCommandQueue(queue); }
1109  static cl_int release(cl_command_queue queue)
1110  { return ::clReleaseCommandQueue(queue); }
1111 };
1112 
1113 template <>
1115 {
1116  static cl_int retain(cl_mem memory)
1117  { return ::clRetainMemObject(memory); }
1118  static cl_int release(cl_mem memory)
1119  { return ::clReleaseMemObject(memory); }
1120 };
1121 
1122 template <>
1124 {
1125  static cl_int retain(cl_sampler sampler)
1126  { return ::clRetainSampler(sampler); }
1127  static cl_int release(cl_sampler sampler)
1128  { return ::clReleaseSampler(sampler); }
1129 };
1130 
1131 template <>
1133 {
1134  static cl_int retain(cl_program program)
1135  { return ::clRetainProgram(program); }
1136  static cl_int release(cl_program program)
1137  { return ::clReleaseProgram(program); }
1138 };
1139 
1140 template <>
1142 {
1143  static cl_int retain(cl_kernel kernel)
1144  { return ::clRetainKernel(kernel); }
1145  static cl_int release(cl_kernel kernel)
1146  { return ::clReleaseKernel(kernel); }
1147 };
1148 
1149 template <>
1151 {
1152  static cl_int retain(cl_event event)
1153  { return ::clRetainEvent(event); }
1154  static cl_int release(cl_event event)
1155  { return ::clReleaseEvent(event); }
1156 };
1157 
1158 template <typename T>
1159 class Wrapper
1160 {
1161 public:
1162  typedef T cl_type;
1163 
1164 protected:
1166 
1167 public:
1168  Wrapper() : object_(NULL) { }
1169 
1170  Wrapper(const cl_type &obj) : object_(obj) { }
1171 
1173  {
1174  if (object_ != NULL) { release(); }
1175  }
1176 
1178  {
1179  object_ = rhs.object_;
1180  if (object_ != NULL) { retain(); }
1181  }
1182 
1184  {
1185  if (object_ != NULL) { release(); }
1186  object_ = rhs.object_;
1187  if (object_ != NULL) { retain(); }
1188  return *this;
1189  }
1190 
1192  {
1193  if (object_ != NULL) { release(); }
1194  object_ = rhs;
1195  return *this;
1196  }
1197 
1198  cl_type operator ()() const { return object_; }
1199 
1200  cl_type& operator ()() { return object_; }
1201 
1202 protected:
1203 
1204  cl_int retain() const
1205  {
1207  }
1208 
1209  cl_int release() const
1210  {
1212  }
1213 };
1214 
1215 #if defined(__CL_ENABLE_EXCEPTIONS)
1216 static inline cl_int errHandler (
1217  cl_int err,
1218  const char * errStr = NULL)
1219 {
1220  if (err != CL_SUCCESS) {
1221  throw Error(err, errStr);
1222  }
1223  return err;
1224 }
1225 #else
1226 static inline cl_int errHandler (cl_int err, const char * errStr = NULL)
1227 {
1228  return err;
1229 }
1230 #endif // __CL_ENABLE_EXCEPTIONS
1231 
1232 } // namespace detail
1233 //! \endcond
1234 
1235 /*! \stuct ImageFormat
1236  * \brief ImageFormat interface fro cl_image_format.
1237  */
1239 {
1241 
1243  {
1244  image_channel_order = order;
1246  }
1247 
1249  {
1250  if (this != &rhs) {
1253  }
1254  return *this;
1255  }
1256 };
1257 
1258 /*! \class Device
1259  * \brief Device interface for cl_device_id.
1260  */
1261 class CE_API Device : public detail::Wrapper<cl_device_id>
1262 {
1263 public:
1264  Device() : detail::Wrapper<cl_type>() { }
1265 
1266  Device(const Device& device) : detail::Wrapper<cl_type>(device) { }
1267 
1268  Device(const cl_device_id &device) : detail::Wrapper<cl_type>(device) { }
1269 
1270  Device& operator = (const Device& rhs)
1271  {
1272  if (this != &rhs) {
1274  }
1275  return *this;
1276  }
1277 
1278  Device& operator = (const cl_device_id& rhs)
1279  {
1281  return *this;
1282  }
1283 
1284  template <typename T>
1285  cl_int getInfo(cl_device_info name, T* param) const
1286  {
1287  return detail::errHandler(
1288  detail::getInfo(&::clGetDeviceInfo, object_, name, param),
1289  __GET_DEVICE_INFO_ERR);
1290  }
1291 
1292  template <cl_int name> typename
1294  getInfo(cl_int* err = NULL) const
1295  {
1296  typename detail::param_traits<
1297  detail::cl_device_info, name>::param_type param;
1298  cl_int result = getInfo(name, &param);
1299  if (err != NULL) {
1300  *err = result;
1301  }
1302  return param;
1303  }
1304 
1305 #if defined(USE_CL_DEVICE_FISSION)
1306  cl_int createSubDevices(
1307  const cl_device_partition_property_ext * properties,
1308  VECTOR_CLASS<Device>* devices)
1309  {
1310  typedef CL_API_ENTRY cl_int
1311  ( CL_API_CALL * PFN_clCreateSubDevicesEXT)(
1312  cl_device_id /*in_device*/,
1313  const cl_device_partition_property_ext * /* properties */,
1314  cl_uint /*num_entries*/,
1315  cl_device_id * /*out_devices*/,
1316  cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1;
1317 
1318  static PFN_clCreateSubDevicesEXT pfn_clCreateSubDevicesEXT = NULL;
1319  __INIT_CL_EXT_FCN_PTR(clCreateSubDevicesEXT);
1320 
1321  cl_uint n = 0;
1322  cl_int err = pfn_clCreateSubDevicesEXT(object_, properties, 0, NULL, &n);
1323  if (err != CL_SUCCESS) {
1324  return detail::errHandler(err, __CREATE_SUB_DEVICES);
1325  }
1326 
1327  cl_device_id* ids = (cl_device_id*) alloca(n * sizeof(cl_device_id));
1328  err = pfn_clCreateSubDevicesEXT(object_, properties, n, ids, NULL);
1329  if (err != CL_SUCCESS) {
1330  return detail::errHandler(err, __CREATE_SUB_DEVICES);
1331  }
1332 
1333  devices->assign(&ids[0], &ids[n]);
1334  return CL_SUCCESS;
1335  }
1336 #endif
1337 };
1338 
1339 /*! \class Platform
1340  * \brief Platform interface.
1341  */
1342 class CE_API Platform : public detail::Wrapper<cl_platform_id>
1343 {
1344 public:
1345  static const Platform null();
1346 
1347  Platform() : detail::Wrapper<cl_type>() { }
1348 
1349  Platform(const Platform& platform) : detail::Wrapper<cl_type>(platform) { }
1350 
1351  Platform(const cl_platform_id &platform) : detail::Wrapper<cl_type>(platform) { }
1352 
1353  Platform& operator = (const Platform& rhs)
1354  {
1355  if (this != &rhs) {
1357  }
1358  return *this;
1359  }
1360 
1361  Platform& operator = (const cl_platform_id& rhs)
1362  {
1364  return *this;
1365  }
1366 
1368  {
1369  return detail::errHandler(
1370  detail::getInfo(&::clGetPlatformInfo, object_, name, param),
1371  __GET_PLATFORM_INFO_ERR);
1372  }
1373 
1374  template <cl_int name> typename
1376  getInfo(cl_int* err = NULL) const
1377  {
1378  typename detail::param_traits<
1379  detail::cl_platform_info, name>::param_type param;
1380  cl_int result = getInfo(name, &param);
1381  if (err != NULL) {
1382  *err = result;
1383  }
1384  return param;
1385  }
1386 
1387  cl_int getDevices(
1389  VECTOR_CLASS<Device>* devices) const
1390  {
1391  cl_uint n = 0;
1392  cl_int err = ::clGetDeviceIDs(object_, type, 0, NULL, &n);
1393  if (err != CL_SUCCESS) {
1394  return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
1395  }
1396 
1397  cl_device_id* ids = (cl_device_id*) alloca(n * sizeof(cl_device_id));
1398  err = ::clGetDeviceIDs(object_, type, n, ids, NULL);
1399  if (err != CL_SUCCESS) {
1400  return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
1401  }
1402 
1403  devices->assign(&ids[0], &ids[n]);
1404  return CL_SUCCESS;
1405  }
1406 
1407 #if defined(USE_DX_INTEROP)
1408  /*! \brief Get the list of available D3D10 devices.
1409  *
1410  * \param d3d_device_source.
1411  *
1412  * \param d3d_object.
1413  *
1414  * \param d3d_device_set.
1415  *
1416  * \param devices returns a vector of OpenCL D3D10 devices found. The cl::Device
1417  * values returned in devices can be used to identify a specific OpenCL
1418  * device. If \a devices argument is NULL, this argument is ignored.
1419  *
1420  * \return One of the following values:
1421  * - CL_SUCCESS if the function is executed successfully.
1422  *
1423  * The application can query specific capabilities of the OpenCL device(s)
1424  * returned by cl::getDevices. This can be used by the application to
1425  * determine which device(s) to use.
1426  *
1427  * \note In the case that exceptions are enabled and a return value
1428  * other than CL_SUCCESS is generated, then cl::Error exception is
1429  * generated.
1430  */
1431  cl_int getDevices(
1432  cl_d3d10_device_source_khr d3d_device_source,
1433  void * d3d_object,
1434  cl_d3d10_device_set_khr d3d_device_set,
1435  VECTOR_CLASS<Device>* devices) const
1436  {
1437  typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clGetDeviceIDsFromD3D10KHR)(
1438  cl_platform_id platform,
1439  cl_d3d10_device_source_khr d3d_device_source,
1440  void * d3d_object,
1441  cl_d3d10_device_set_khr d3d_device_set,
1442  cl_uint num_entries,
1443  cl_device_id * devices,
1444  cl_uint* num_devices);
1445 
1446  static PFN_clGetDeviceIDsFromD3D10KHR pfn_clGetDeviceIDsFromD3D10KHR = NULL;
1447  __INIT_CL_EXT_FCN_PTR(clGetDeviceIDsFromD3D10KHR);
1448 
1449  cl_uint n = 0;
1450  cl_int err = pfn_clGetDeviceIDsFromD3D10KHR(
1451  object_,
1452  d3d_device_source,
1453  d3d_object,
1454  d3d_device_set,
1455  0,
1456  NULL,
1457  &n);
1458  if (err != CL_SUCCESS) {
1459  return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
1460  }
1461 
1462  cl_device_id* ids = (cl_device_id*) alloca(n * sizeof(cl_device_id));
1463  err = pfn_clGetDeviceIDsFromD3D10KHR(
1464  object_,
1465  d3d_device_source,
1466  d3d_object,
1467  d3d_device_set,
1468  n,
1469  ids,
1470  NULL);
1471  if (err != CL_SUCCESS) {
1472  return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
1473  }
1474 
1475  devices->assign(&ids[0], &ids[n]);
1476  return CL_SUCCESS;
1477  }
1478 #endif
1479 
1480  static cl_int get(
1481  VECTOR_CLASS<Platform>* platforms)
1482  {
1483  cl_uint n = 0;
1484  cl_int err = ::clGetPlatformIDs(0, NULL, &n);
1485  if (err != CL_SUCCESS) {
1486  return detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
1487  }
1488 
1489  cl_platform_id* ids = (cl_platform_id*) alloca(
1490  n * sizeof(cl_platform_id));
1491  err = ::clGetPlatformIDs(n, ids, NULL);
1492  if (err != CL_SUCCESS) {
1493  return detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
1494  }
1495 
1496  platforms->assign(&ids[0], &ids[n]);
1497  return CL_SUCCESS;
1498  }
1499 };
1500 
1501 #if defined(CL_VERSION_1_2)
1502 static inline cl_int
1503 UnloadCompiler(cl_platform_id platform)
1504 {
1506 }
1507 #else
1508 static inline cl_int
1509 UnloadCompiler()
1510 {
1512 }
1513 #endif
1514 
1515 class CE_API Context : public detail::Wrapper<cl_context>
1516 {
1517 public:
1519  const VECTOR_CLASS<Device>& devices,
1520  cl_context_properties* properties = NULL,
1521  void (CL_CALLBACK * notifyFptr)(
1522  const char *,
1523  const void *,
1524  ::size_t,
1525  void *) = NULL,
1526  void* data = NULL,
1527  cl_int* err = NULL)
1528  {
1529  cl_int error;
1530  object_ = ::clCreateContext(
1531  properties, (cl_uint) devices.size(),
1532  (cl_device_id*) &devices.front(),
1533  notifyFptr, data, &error);
1534 
1535  detail::errHandler(error, __CREATE_CONTEXT_ERR);
1536  if (err != NULL) {
1537  *err = error;
1538  }
1539  }
1540 
1543  cl_context_properties* properties = NULL,
1544  void (CL_CALLBACK * notifyFptr)(
1545  const char *,
1546  const void *,
1547  ::size_t,
1548  void *) = NULL,
1549  void* data = NULL,
1550  cl_int* err = NULL)
1551  {
1552  cl_int error;
1553  object_ = ::clCreateContextFromType(
1554  properties, type, notifyFptr, data, &error);
1555 
1556  detail::errHandler(error, __CREATE_CONTEXT_FROM_TYPE_ERR);
1557  if (err != NULL) {
1558  *err = error;
1559  }
1560  }
1561 
1562  Context() : detail::Wrapper<cl_type>() { }
1563 
1564  Context(const Context& context) : detail::Wrapper<cl_type>(context) { }
1565 
1566  Context(const cl_context& context) : detail::Wrapper<cl_type>(context) { }
1567 
1568  Context& operator = (const Context& rhs)
1569  {
1570  if (this != &rhs) {
1572  }
1573  return *this;
1574  }
1575 
1576  Context& operator = (const cl_context& rhs)
1577  {
1579  return *this;
1580  }
1581 
1582  template <typename T>
1583  cl_int getInfo(cl_context_info name, T* param) const
1584  {
1585  return detail::errHandler(
1586  detail::getInfo(&::clGetContextInfo, object_, name, param),
1587  __GET_CONTEXT_INFO_ERR);
1588  }
1589 
1590  template <cl_int name> typename
1592  getInfo(cl_int* err = NULL) const
1593  {
1594  typename detail::param_traits<
1595  detail::cl_context_info, name>::param_type param;
1596  cl_int result = getInfo(name, &param);
1597  if (err != NULL) {
1598  *err = result;
1599  }
1600  return param;
1601  }
1602 
1605  cl_mem_object_type type,
1606  VECTOR_CLASS<ImageFormat>* formats) const
1607  {
1608  cl_uint numEntries;
1609  cl_int err = ::clGetSupportedImageFormats(
1610  object_,
1611  flags,
1612  type,
1613  0,
1614  NULL,
1615  &numEntries);
1616  if (err != CL_SUCCESS) {
1617  return detail::errHandler(err, __GET_SUPPORTED_IMAGE_FORMATS_ERR);
1618  }
1619 
1621  alloca(numEntries * sizeof(ImageFormat));
1623  object_,
1624  flags,
1625  type,
1626  numEntries,
1627  (cl_image_format*) value,
1628  NULL);
1629  if (err != CL_SUCCESS) {
1630  return detail::errHandler(err, __GET_SUPPORTED_IMAGE_FORMATS_ERR);
1631  }
1632 
1633  formats->assign(&value[0], &value[numEntries]);
1634  return CL_SUCCESS;
1635  }
1636 };
1637 
1639 
1640 /*! \class Event
1641  * \brief Event interface for cl_event.
1642  */
1643 class CE_API Event : public detail::Wrapper<cl_event>
1644 {
1645 public:
1646  Event() : detail::Wrapper<cl_type>() { }
1647 
1648  Event(const Event& event) : detail::Wrapper<cl_type>(event) { }
1649 
1650  Event(const cl_event& event) : detail::Wrapper<cl_type>(event) { }
1651 
1652  Event& operator = (const Event& rhs)
1653  {
1654  if (this != &rhs) {
1656  }
1657  return *this;
1658  }
1659 
1660  Event& operator = (const cl_event& rhs)
1661  {
1663  return *this;
1664  }
1665 
1666  template <typename T>
1667  cl_int getInfo(cl_event_info name, T* param) const
1668  {
1669  return detail::errHandler(
1670  detail::getInfo(&::clGetEventInfo, object_, name, param),
1671  __GET_EVENT_INFO_ERR);
1672  }
1673 
1674  template <cl_int name> typename
1676  getInfo(cl_int* err = NULL) const
1677  {
1678  typename detail::param_traits<
1679  detail::cl_event_info, name>::param_type param;
1680  cl_int result = getInfo(name, &param);
1681  if (err != NULL) {
1682  *err = result;
1683  }
1684  return param;
1685  }
1686 
1687  template <typename T>
1689  {
1690  return detail::errHandler(detail::getInfo(
1691  &::clGetEventProfilingInfo, object_, name, param),
1692  __GET_EVENT_PROFILE_INFO_ERR);
1693  }
1694 
1695  template <cl_int name> typename
1697  getProfilingInfo(cl_int* err = NULL) const
1698  {
1699  typename detail::param_traits<
1700  detail::cl_profiling_info, name>::param_type param;
1701  cl_int result = getProfilingInfo(name, &param);
1702  if (err != NULL) {
1703  *err = result;
1704  }
1705  return param;
1706  }
1707 
1708  cl_int wait() const
1709  {
1710  return detail::errHandler(
1711  ::clWaitForEvents(1, &object_),
1712  __WAIT_FOR_EVENTS_ERR);
1713  }
1714 
1715 #if defined(CL_VERSION_1_1)
1716  cl_int setCallback(
1717  cl_int type,
1718  void (CL_CALLBACK * pfn_notify)(cl_event, cl_int, void *),
1719  void * user_data = NULL)
1720  {
1721  return detail::errHandler(
1723  object_,
1724  type,
1725  pfn_notify,
1726  user_data),
1727  __SET_EVENT_CALLBACK_ERR);
1728  }
1729 #endif
1730 
1731  static cl_int
1732  waitForEvents(const VECTOR_CLASS<Event>& events)
1733  {
1734  return detail::errHandler(
1735  ::clWaitForEvents(
1736  (cl_uint) events.size(), (cl_event*)&events.front()),
1737  __WAIT_FOR_EVENTS_ERR);
1738  }
1739 };
1740 
1742 
1743 #if defined(CL_VERSION_1_1)
1744 /*! \class UserEvent
1745  * \brief User event interface for cl_event.
1746  */
1747 class CE_API UserEvent : public Event
1748 {
1749 public:
1750  UserEvent(
1751  const Context& context,
1752  cl_int * err = NULL)
1753  {
1754  cl_int error;
1755  object_ = ::clCreateUserEvent(
1756  context(),
1757  &error);
1758 
1759  detail::errHandler(error, __CREATE_USER_EVENT_ERR);
1760  if (err != NULL) {
1761  *err = error;
1762  }
1763  }
1764 
1765  UserEvent() : Event() { }
1766 
1767  UserEvent(const UserEvent& event) : Event(event) { }
1768 
1769  UserEvent& operator = (const UserEvent& rhs)
1770  {
1771  if (this != &rhs) {
1772  Event::operator=(rhs);
1773  }
1774  return *this;
1775  }
1776 
1777  cl_int setStatus(cl_int status)
1778  {
1779  return detail::errHandler(
1780  ::clSetUserEventStatus(object_,status),
1781  __SET_USER_EVENT_STATUS_ERR);
1782  }
1783 };
1784 #endif
1785 
1786 inline static cl_int
1787 WaitForEvents(const VECTOR_CLASS<Event>& events)
1788 {
1789  return detail::errHandler(
1790  ::clWaitForEvents(
1791  (cl_uint) events.size(), (cl_event*)&events.front()),
1792  __WAIT_FOR_EVENTS_ERR);
1793 }
1794 
1795 /*! \class Memory
1796  * \brief Memory interface for cl_mem.
1797  */
1798 class CE_API Memory : public detail::Wrapper<cl_mem>
1799 {
1800 public:
1801  Memory() : detail::Wrapper<cl_type>() { }
1802 
1803  Memory(const Memory& memory) : detail::Wrapper<cl_type>(memory) { }
1804 
1805  Memory(const cl_mem& memory) : detail::Wrapper<cl_type>(memory) { }
1806 
1807  Memory& operator = (const Memory& rhs)
1808  {
1809  if (this != &rhs) {
1811  }
1812  return *this;
1813  }
1814 
1815  Memory& operator = (const cl_mem& rhs)
1816  {
1818  return *this;
1819  }
1820 
1821  template <typename T>
1822  cl_int getInfo(cl_mem_info name, T* param) const
1823  {
1824  return detail::errHandler(
1825  detail::getInfo(&::clGetMemObjectInfo, object_, name, param),
1826  __GET_MEM_OBJECT_INFO_ERR);
1827  }
1828 
1829  template <cl_int name> typename
1831  getInfo(cl_int* err = NULL) const
1832  {
1833  typename detail::param_traits<
1834  detail::cl_mem_info, name>::param_type param;
1835  cl_int result = getInfo(name, &param);
1836  if (err != NULL) {
1837  *err = result;
1838  }
1839  return param;
1840  }
1841 
1842 #if defined(CL_VERSION_1_1)
1843  cl_int setDestructorCallback(
1844  void (CL_CALLBACK * pfn_notify)(cl_mem, void *),
1845  void * user_data = NULL)
1846  {
1847  return detail::errHandler(
1849  object_,
1850  pfn_notify,
1851  user_data),
1852  __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR);
1853  }
1854 #endif
1855 
1856 };
1857 
1859 
1860 /*! \class Buffer
1861  * \brief Memory buffer interface.
1862  */
1863 class CE_API Buffer : public Memory
1864 {
1865 public:
1867  const Context& context,
1869  ::size_t size,
1870  void* host_ptr = NULL,
1871  cl_int* err = NULL)
1872  {
1873  cl_int error;
1874  object_ = ::clCreateBuffer(context(), flags, size, host_ptr, &error);
1875 
1876  detail::errHandler(error, __CREATE_BUFFER_ERR);
1877  if (err != NULL) {
1878  *err = error;
1879  }
1880  }
1881 
1882  Buffer() : Memory() { }
1883 
1884  Buffer(const Buffer& buffer) : Memory(buffer) { }
1885 
1886  Buffer(const cl_mem& buffer) : Memory(buffer) { }
1887 
1888  Buffer& operator = (const Buffer& rhs)
1889  {
1890  if (this != &rhs) {
1891  Memory::operator=(rhs);
1892  }
1893  return *this;
1894  }
1895 
1896  Buffer& operator = (const cl_mem& rhs)
1897  {
1898  Memory::operator=(rhs);
1899  return *this;
1900  }
1901 
1902 #if defined(CL_VERSION_1_1)
1903  Buffer createSubBuffer(
1905  cl_buffer_create_type buffer_create_type,
1906  const void * buffer_create_info,
1907  cl_int * err = NULL)
1908  {
1909  Buffer result;
1910  cl_int error;
1911  result.object_ = ::clCreateSubBuffer(
1912  object_,
1913  flags,
1914  buffer_create_type,
1915  buffer_create_info,
1916  &error);
1917 
1918  detail::errHandler(error, __CREATE_SUBBUFFER_ERR);
1919  if (err != NULL) {
1920  *err = error;
1921  }
1922 
1923  return result;
1924  }
1925 #endif
1926 };
1927 
1928 #if defined (USE_DX_INTEROP)
1929 class CE_API BufferD3D10 : public Buffer
1930 {
1931 public:
1932  typedef CL_API_ENTRY cl_mem (CL_API_CALL *PFN_clCreateFromD3D10BufferKHR)(
1933  cl_context context, cl_mem_flags flags, ID3D10Buffer* buffer,
1934  cl_int* errcode_ret);
1935 
1936  BufferD3D10(
1937  const Context& context,
1939  ID3D10Buffer* bufobj,
1940  cl_int * err = NULL)
1941  {
1942  static PFN_clCreateFromD3D10BufferKHR pfn_clCreateFromD3D10BufferKHR = NULL;
1943  __INIT_CL_EXT_FCN_PTR(clCreateFromD3D10BufferKHR);
1944 
1945  cl_int error;
1946  object_ = pfn_clCreateFromD3D10BufferKHR(
1947  context(),
1948  flags,
1949  bufobj,
1950  &error);
1951 
1952  detail::errHandler(error, __CREATE_GL_BUFFER_ERR);
1953  if (err != NULL) {
1954  *err = error;
1955  }
1956  }
1957 
1958  BufferD3D10() : Buffer() { }
1959 
1960  BufferD3D10(const BufferD3D10& buffer) : Buffer(buffer) { }
1961 
1962  BufferD3D10(const cl_mem& buffer) : Buffer(buffer) { }
1963 
1964  BufferD3D10& operator = (const BufferD3D10& rhs)
1965  {
1966  if (this != &rhs) {
1967  Buffer::operator=(rhs);
1968  }
1969  return *this;
1970  }
1971 
1972  BufferD3D10& operator = (const cl_mem& rhs)
1973  {
1974  Buffer::operator=(rhs);
1975  return *this;
1976  }
1977 };
1978 #endif
1979 
1980 /*! \class BufferGL
1981  * \brief Memory buffer interface for GL interop.
1982  */
1983 class CE_API BufferGL : public Buffer
1984 {
1985 public:
1987  const Context& context,
1988  cl_mem_flags flags,
1989  GLuint bufobj,
1990  cl_int * err = NULL)
1991  {
1992  cl_int error;
1993  object_ = ::clCreateFromGLBuffer(
1994  context(),
1995  flags,
1996  bufobj,
1997  &error);
1998 
1999  detail::errHandler(error, __CREATE_GL_BUFFER_ERR);
2000  if (err != NULL) {
2001  *err = error;
2002  }
2003  }
2004 
2005  BufferGL() : Buffer() { }
2006 
2007  BufferGL(const BufferGL& buffer) : Buffer(buffer) { }
2008 
2009  BufferGL(const cl_mem& buffer) : Buffer(buffer) { }
2010 
2011  BufferGL& operator = (const BufferGL& rhs)
2012  {
2013  if (this != &rhs) {
2014  Buffer::operator=(rhs);
2015  }
2016  return *this;
2017  }
2018 
2019  BufferGL& operator = (const cl_mem& rhs)
2020  {
2021  Buffer::operator=(rhs);
2022  return *this;
2023  }
2024 
2026  cl_gl_object_type *type,
2027  GLuint * gl_object_name)
2028  {
2029  return detail::errHandler(
2030  ::clGetGLObjectInfo(object_,type,gl_object_name),
2031  __GET_GL_OBJECT_INFO_ERR);
2032  }
2033 };
2034 
2035 /*! \class BufferRenderGL
2036  * \brief Memory buffer interface for GL interop with renderbuffer.
2037  */
2039 {
2040 public:
2042  const Context& context,
2043  cl_mem_flags flags,
2044  GLuint bufobj,
2045  cl_int * err = NULL)
2046  {
2047  cl_int error;
2048  object_ = ::clCreateFromGLRenderbuffer(
2049  context(),
2050  flags,
2051  bufobj,
2052  &error);
2053 
2054  detail::errHandler(error, __CREATE_GL_BUFFER_ERR);
2055  if (err != NULL) {
2056  *err = error;
2057  }
2058  }
2059 
2061 
2062  BufferRenderGL(const BufferGL& buffer) : Buffer(buffer) { }
2063 
2064  BufferRenderGL(const cl_mem& buffer) : Buffer(buffer) { }
2065 
2066  BufferRenderGL& operator = (const BufferRenderGL& rhs)
2067  {
2068  if (this != &rhs) {
2069  Buffer::operator=(rhs);
2070  }
2071  return *this;
2072  }
2073 
2074  BufferRenderGL& operator = (const cl_mem& rhs)
2075  {
2076  Buffer::operator=(rhs);
2077  return *this;
2078  }
2079 
2081  cl_gl_object_type *type,
2082  GLuint * gl_object_name)
2083  {
2084  return detail::errHandler(
2085  ::clGetGLObjectInfo(object_,type,gl_object_name),
2086  __GET_GL_OBJECT_INFO_ERR);
2087  }
2088 };
2089 
2090 /*! \class Image
2091  * \brief Base class interface for all images.
2092  */
2093 class CE_API Image : public Memory
2094 {
2095 protected:
2096  Image() : Memory() { }
2097 
2098  Image(const Image& image) : Memory(image) { }
2099 
2100  Image(const cl_mem& image) : Memory(image) { }
2101 
2102  Image& operator = (const Image& rhs)
2103  {
2104  if (this != &rhs) {
2105  Memory::operator=(rhs);
2106  }
2107  return *this;
2108  }
2109 
2110  Image& operator = (const cl_mem& rhs)
2111  {
2112  Memory::operator=(rhs);
2113  return *this;
2114  }
2115 
2116 public:
2117  template <typename T>
2119  {
2120  return detail::errHandler(
2121  detail::getInfo(&::clGetImageInfo, object_, name, param),
2122  __GET_IMAGE_INFO_ERR);
2123  }
2124 
2125  template <cl_int name> typename
2127  getImageInfo(cl_int* err = NULL) const
2128  {
2129  typename detail::param_traits<
2130  detail::cl_image_info, name>::param_type param;
2131  cl_int result = getImageInfo(name, &param);
2132  if (err != NULL) {
2133  *err = result;
2134  }
2135  return param;
2136  }
2137 };
2138 
2139 /*! \class Image2D
2140  * \brief Image interface for 2D images.
2141  */
2142 class CE_API Image2D : public Image
2143 {
2144 public:
2146  const Context& context,
2147  cl_mem_flags flags,
2149  ::size_t width,
2150  ::size_t height,
2151  ::size_t row_pitch = 0,
2152  void* host_ptr = NULL,
2153  cl_int* err = NULL)
2154  {
2155  cl_int error;
2156 #if defined(CL_VERSION_1_2)
2157  cl_image_desc image_desc;
2158  image_desc.image_width = width;
2159  image_desc.image_height = height;
2160  image_desc.image_row_pitch = row_pitch;
2161 
2162  object_ = ::clCreateImage(
2163  context(), flags, &format, &image_desc, host_ptr, &error);
2164 #else
2165  object_ = ::clCreateImage2D(
2166  context(), flags,&format, width, height, row_pitch, host_ptr, &error);
2167 #endif
2168 
2169  detail::errHandler(error, __CREATE_IMAGE2D_ERR);
2170  if (err != NULL) {
2171  *err = error;
2172  }
2173  }
2174 
2175  Image2D() { }
2176 
2177  Image2D(const Image2D& image2D) : Image(image2D) { }
2178 
2179  Image2D(const cl_mem& image2D) : Image(image2D) { }
2180 
2181  Image2D& operator = (const Image2D& rhs)
2182  {
2183  if (this != &rhs) {
2184  Image::operator=(rhs);
2185  }
2186  return *this;
2187  }
2188 
2189  Image2D& operator = (const cl_mem& rhs)
2190  {
2191  Image::operator=(rhs);
2192  return *this;
2193  }
2194 };
2195 
2196 /*! \class Image2DGL
2197  * \brief 2D image interface for GL interop.
2198  */
2199 class CE_API Image2DGL : public Image2D
2200 {
2201 public:
2203  const Context& context,
2204  cl_mem_flags flags,
2205  GLenum target,
2206  GLint miplevel,
2207  GLuint texobj,
2208  cl_int * err = NULL)
2209  {
2210  cl_int error;
2211 #if defined(CL_VERSION_1_2)
2212  object_ = ::clCreateFromGLTexture(
2213  context(),
2214  flags,
2215  target,
2216  miplevel,
2217  texobj,
2218  &error);
2219 #else
2220  object_ = ::clCreateFromGLTexture2D(
2221  context(),
2222  flags,
2223  target,
2224  miplevel,
2225  texobj,
2226  &error);
2227 #endif
2228 
2229  detail::errHandler(error, __CREATE_GL_BUFFER_ERR);
2230  if (err != NULL) {
2231  *err = error;
2232  }
2233  }
2234 
2235  Image2DGL() : Image2D() { }
2236 
2237  Image2DGL(const Image2DGL& image) : Image2D(image) { }
2238 
2239  Image2DGL(const cl_mem& image) : Image2D(image) { }
2240 
2241  Image2DGL& operator = (const Image2DGL& rhs)
2242  {
2243  if (this != &rhs) {
2244  Image2D::operator=(rhs);
2245  }
2246  return *this;
2247  }
2248 
2249  Image2DGL& operator = (const cl_mem& rhs)
2250  {
2251  Image2D::operator=(rhs);
2252  return *this;
2253  }
2254 };
2255 
2256 /*! \class Image3D
2257  * \brief Image interface for 3D images.
2258  */
2259 class CE_API Image3D : public Image
2260 {
2261 public:
2263  const Context& context,
2264  cl_mem_flags flags,
2266  ::size_t width,
2267  ::size_t height,
2268  ::size_t depth,
2269  ::size_t row_pitch = 0,
2270  ::size_t slice_pitch = 0,
2271  void* host_ptr = NULL,
2272  cl_int* err = NULL)
2273  {
2274  cl_int error;
2275 #if defined(CL_VERSION_1_2)
2276  cl_image_desc image_desc;
2277  image_desc.image_width = width;
2278  image_desc.image_height = height;
2279  image_desc.image_depth = depth;
2280  image_desc.image_row_pitch = row_pitch;
2281  image_desc.image_slice_pitch = slice_pitch;
2282 
2283  object_ = ::clCreateImage(
2284  context(), flags, &format, &image_desc, host_ptr, &error);
2285 #else
2286  object_ = ::clCreateImage3D(
2287  context(), flags, &format, width, height, depth, row_pitch,
2288  slice_pitch, host_ptr, &error);
2289 #endif
2290 
2291  detail::errHandler(error, __CREATE_IMAGE3D_ERR);
2292  if (err != NULL) {
2293  *err = error;
2294  }
2295  }
2296 
2297  Image3D() { }
2298 
2299  Image3D(const Image3D& image3D) : Image(image3D) { }
2300 
2301  Image3D(const cl_mem& image3D) : Image(image3D) { }
2302 
2303  Image3D& operator = (const Image3D& rhs)
2304  {
2305  if (this != &rhs) {
2306  Image::operator=(rhs);
2307  }
2308  return *this;
2309  }
2310 
2311  Image3D& operator = (const cl_mem& rhs)
2312  {
2313  Image::operator=(rhs);
2314  return *this;
2315  }
2316 };
2317 
2318 /*! \class Image2DGL
2319  * \brief 2D image interface for GL interop.
2320  */
2321 class CE_API Image3DGL : public Image3D
2322 {
2323 public:
2325  const Context& context,
2326  cl_mem_flags flags,
2327  GLenum target,
2328  GLint miplevel,
2329  GLuint texobj,
2330  cl_int * err = NULL)
2331  {
2332  cl_int error;
2333 #if defined(CL_VERSION_1_2)
2334  object_ = ::clCreateFromGLTexture(
2335  context(),
2336  flags,
2337  target,
2338  miplevel,
2339  texobj,
2340  &error);
2341 #else
2342  object_ = ::clCreateFromGLTexture3D(
2343  context(),
2344  flags,
2345  target,
2346  miplevel,
2347  texobj,
2348  &error);
2349 #endif
2350 
2351  detail::errHandler(error, __CREATE_GL_BUFFER_ERR);
2352  if (err != NULL) {
2353  *err = error;
2354  }
2355  }
2356 
2357  Image3DGL() : Image3D() { }
2358 
2359  Image3DGL(const Image3DGL& image) : Image3D(image) { }
2360 
2361  Image3DGL(const cl_mem& image) : Image3D(image) { }
2362 
2363  Image3DGL& operator = (const Image3DGL& rhs)
2364  {
2365  if (this != &rhs) {
2366  Image3D::operator=(rhs);
2367  }
2368  return *this;
2369  }
2370 
2371  Image3DGL& operator = (const cl_mem& rhs)
2372  {
2373  Image3D::operator=(rhs);
2374  return *this;
2375  }
2376 };
2377 
2378 /*! \class Sampler
2379  * \brief Sampler interface for cl_sampler.
2380  */
2381 class CE_API Sampler : public detail::Wrapper<cl_sampler>
2382 {
2383 public:
2384  Sampler() { }
2385 
2387  const Context& context,
2388  cl_bool normalized_coords,
2389  cl_addressing_mode addressing_mode,
2390  cl_filter_mode filter_mode,
2391  cl_int* err = NULL)
2392  {
2393  cl_int error;
2394  object_ = ::clCreateSampler(
2395  context(),
2396  normalized_coords,
2397  addressing_mode,
2398  filter_mode,
2399  &error);
2400 
2401  detail::errHandler(error, __CREATE_SAMPLER_ERR);
2402  if (err != NULL) {
2403  *err = error;
2404  }
2405  }
2406 
2407  Sampler(const Sampler& sampler) : detail::Wrapper<cl_type>(sampler) { }
2408 
2409  Sampler(const cl_sampler& sampler) : detail::Wrapper<cl_type>(sampler) { }
2410 
2411  Sampler& operator = (const Sampler& rhs)
2412  {
2413  if (this != &rhs) {
2415  }
2416  return *this;
2417  }
2418 
2419  Sampler& operator = (const cl_sampler& rhs)
2420  {
2422  return *this;
2423  }
2424 
2425  template <typename T>
2426  cl_int getInfo(cl_sampler_info name, T* param) const
2427  {
2428  return detail::errHandler(
2429  detail::getInfo(&::clGetSamplerInfo, object_, name, param),
2430  __GET_SAMPLER_INFO_ERR);
2431  }
2432 
2433  template <cl_int name> typename
2435  getInfo(cl_int* err = NULL) const
2436  {
2437  typename detail::param_traits<
2438  detail::cl_sampler_info, name>::param_type param;
2439  cl_int result = getInfo(name, &param);
2440  if (err != NULL) {
2441  *err = result;
2442  }
2443  return param;
2444  }
2445 };
2446 
2448 
2449 class Program;
2450 class CommandQueue;
2451 class Kernel;
2452 
2453 /*! \class NDRange
2454  * \brief NDRange interface
2455  */
2457 {
2458 private:
2459  size_t<3> sizes_;
2460  cl_uint dimensions_;
2461 
2462 public:
2464  : dimensions_(0)
2465  { }
2466 
2467  NDRange(::size_t size0)
2468  : dimensions_(1)
2469  {
2470  sizes_.push_back(size0);
2471  }
2472 
2473  NDRange(::size_t size0, ::size_t size1)
2474  : dimensions_(2)
2475  {
2476  sizes_.push_back(size0);
2477  sizes_.push_back(size1);
2478  }
2479 
2480  NDRange(::size_t size0, ::size_t size1, ::size_t size2)
2481  : dimensions_(3)
2482  {
2483  sizes_.push_back(size0);
2484  sizes_.push_back(size1);
2485  sizes_.push_back(size2);
2486  }
2487 
2488  operator const ::size_t*() const { return (const ::size_t*) sizes_; }
2489  ::size_t dimensions() const { return dimensions_; }
2490 };
2491 
2492 static const NDRange NullRange;
2493 
2494 /*!
2495  * \struct LocalSpaceArg
2496  * \brief Local address raper for use with Kernel::setArg
2497  */
2499 {
2501 };
2502 
2503 namespace detail {
2504 
2505 template <typename T>
2507 {
2508  static ::size_t size(const T&) { return sizeof(T); }
2509  static T* ptr(T& value) { return &value; }
2510 };
2511 
2512 template <>
2514 {
2515  static ::size_t size(const LocalSpaceArg& value) { return value.size_; }
2516  static void* ptr(LocalSpaceArg&) { return NULL; }
2517 };
2518 
2519 }
2520 //! \endcond
2521 
2522 inline LocalSpaceArg
2523 __local(::size_t size)
2524 {
2525  LocalSpaceArg ret = { size };
2526  return ret;
2527 }
2528 
2530 
2531 /*! \class Kernel
2532  * \brief Kernel interface that implements cl_kernel
2533  */
2534 class CE_API Kernel : public detail::Wrapper<cl_kernel>
2535 {
2536 public:
2537  inline Kernel(const Program& program, const char* name, cl_int* err = NULL);
2538 
2539  Kernel() { }
2540 
2541  Kernel(const Kernel& kernel) : detail::Wrapper<cl_type>(kernel) { }
2542 
2543  Kernel(const cl_kernel& kernel) : detail::Wrapper<cl_type>(kernel) { }
2544 
2545  Kernel& operator = (const Kernel& rhs)
2546  {
2547  if (this != &rhs) {
2549  }
2550  return *this;
2551  }
2552 
2553  Kernel& operator = (const cl_kernel& rhs)
2554  {
2556  return *this;
2557  }
2558 
2559  template <typename T>
2560  cl_int getInfo(cl_kernel_info name, T* param) const
2561  {
2562  return detail::errHandler(
2563  detail::getInfo(&::clGetKernelInfo, object_, name, param),
2564  __GET_KERNEL_INFO_ERR);
2565  }
2566 
2567  template <cl_int name> typename
2569  getInfo(cl_int* err = NULL) const
2570  {
2571  typename detail::param_traits<
2572  detail::cl_kernel_info, name>::param_type param;
2573  cl_int result = getInfo(name, &param);
2574  if (err != NULL) {
2575  *err = result;
2576  }
2577  return param;
2578  }
2579 
2580  template <typename T>
2582  const Device& device, cl_kernel_work_group_info name, T* param) const
2583  {
2584  return detail::errHandler(
2586  &::clGetKernelWorkGroupInfo, object_, device(), name, param),
2587  __GET_KERNEL_WORK_GROUP_INFO_ERR);
2588  }
2589 
2590  template <cl_int name> typename
2592  getWorkGroupInfo(const Device& device, cl_int* err = NULL) const
2593  {
2594  typename detail::param_traits<
2595  detail::cl_kernel_work_group_info, name>::param_type param;
2596  cl_int result = getWorkGroupInfo(device, name, &param);
2597  if (err != NULL) {
2598  *err = result;
2599  }
2600  return param;
2601  }
2602 
2603  template <typename T>
2604  cl_int setArg(cl_uint index, T value)
2605  {
2606  return detail::errHandler(
2607  ::clSetKernelArg(
2608  object_,
2609  index,
2612  __SET_KERNEL_ARGS_ERR);
2613  }
2614 
2615  cl_int setArg(cl_uint index, ::size_t size, void* argPtr)
2616  {
2617  return detail::errHandler(
2618  ::clSetKernelArg(object_, index, size, argPtr),
2619  __SET_KERNEL_ARGS_ERR);
2620  }
2621 
2622  KernelFunctor bind(
2623  const CommandQueue& queue,
2624  const NDRange& offset,
2625  const NDRange& global,
2626  const NDRange& local);
2627 
2628  KernelFunctor bind(
2629  const CommandQueue& queue,
2630  const NDRange& global,
2631  const NDRange& local);
2632 };
2633 
2635 
2636 /*! \class Program
2637  * \brief Program interface that implements cl_program.
2638  */
2639 class CE_API Program : public detail::Wrapper<cl_program>
2640 {
2641 public:
2642  typedef VECTOR_CLASS<std::pair<const void*, ::size_t> > Binaries;
2643  typedef VECTOR_CLASS<std::pair<const char*, ::size_t> > Sources;
2644 
2646  const Context& context,
2647  const Sources& sources,
2648  cl_int* err = NULL)
2649  {
2650  cl_int error;
2651 
2652  const ::size_t n = (::size_t)sources.size();
2653  ::size_t* lengths = (::size_t*) alloca(n * sizeof(::size_t));
2654  const char** strings = (const char**) alloca(n * sizeof(const char*));
2655 
2656  for (::size_t i = 0; i < n; ++i) {
2657  strings[i] = sources[(int)i].first;
2658  lengths[i] = sources[(int)i].second;
2659  }
2660 
2661  object_ = ::clCreateProgramWithSource(
2662  context(), (cl_uint)n, strings, lengths, &error);
2663 
2664  detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR);
2665  if (err != NULL) {
2666  *err = error;
2667  }
2668  }
2669 
2671  const Context& context,
2672  const VECTOR_CLASS<Device>& devices,
2673  const Binaries& binaries,
2674  VECTOR_CLASS<cl_int>* binaryStatus = NULL,
2675  cl_int* err = NULL)
2676  {
2677  cl_int error;
2678  const ::size_t n = binaries.size();
2679  ::size_t* lengths = (::size_t*) alloca(n * sizeof(::size_t));
2680  const unsigned char** images = (const unsigned char**) alloca(n * sizeof(const void*));
2681 
2682  for (::size_t i = 0; i < n; ++i) {
2683  images[i] = (const unsigned char*)binaries[(int)i].first;
2684  lengths[i] = binaries[(int)i].second;
2685  }
2686 
2687  object_ = ::clCreateProgramWithBinary(
2688  context(), (cl_uint) devices.size(),
2689  (cl_device_id*)&devices.front(),
2690  lengths, images, binaryStatus != NULL
2691  ? (cl_int*) &binaryStatus->front()
2692  : NULL, &error);
2693 
2694  detail::errHandler(error, __CREATE_PROGRAM_WITH_BINARY_ERR);
2695  if (err != NULL) {
2696  *err = error;
2697  }
2698  }
2699 
2700  Program() { }
2701 
2702  Program(const Program& program) : detail::Wrapper<cl_type>(program) { }
2703 
2704  Program(const cl_program& program) : detail::Wrapper<cl_type>(program) { }
2705 
2706  Program& operator = (const Program& rhs)
2707  {
2708  if (this != &rhs) {
2710  }
2711  return *this;
2712  }
2713 
2714  Program& operator = (const cl_program& rhs)
2715  {
2717  return *this;
2718  }
2719 
2720  cl_int build(
2721  const VECTOR_CLASS<Device>& devices,
2722  const char* options = NULL,
2723  void (CL_CALLBACK * notifyFptr)(cl_program, void *) = NULL,
2724  void* data = NULL) const
2725  {
2726  return detail::errHandler(
2727  ::clBuildProgram(
2728  object_,
2729  (cl_uint)
2730  devices.size(),
2731  (cl_device_id*)&devices.front(),
2732  options,
2733  notifyFptr,
2734  data),
2735  __BUILD_PROGRAM_ERR);
2736  }
2737 
2738  template <typename T>
2739  cl_int getInfo(cl_program_info name, T* param) const
2740  {
2741  return detail::errHandler(
2742  detail::getInfo(&::clGetProgramInfo, object_, name, param),
2743  __GET_PROGRAM_INFO_ERR);
2744  }
2745 
2746  template <cl_int name> typename
2748  getInfo(cl_int* err = NULL) const
2749  {
2750  typename detail::param_traits<
2751  detail::cl_program_info, name>::param_type param;
2752  cl_int result = getInfo(name, &param);
2753  if (err != NULL) {
2754  *err = result;
2755  }
2756  return param;
2757  }
2758 
2759  template <typename T>
2761  const Device& device, cl_program_build_info name, T* param) const
2762  {
2763  return detail::errHandler(
2765  &::clGetProgramBuildInfo, object_, device(), name, param),
2766  __GET_PROGRAM_BUILD_INFO_ERR);
2767  }
2768 
2769  template <cl_int name> typename
2771  getBuildInfo(const Device& device, cl_int* err = NULL) const
2772  {
2773  typename detail::param_traits<
2775  cl_int result = getBuildInfo(device, name, &param);
2776  if (err != NULL) {
2777  *err = result;
2778  }
2779  return param;
2780  }
2781 
2782  cl_int createKernels(VECTOR_CLASS<Kernel>* kernels)
2783  {
2784  cl_uint numKernels;
2785  cl_int err = ::clCreateKernelsInProgram(object_, 0, NULL, &numKernels);
2786  if (err != CL_SUCCESS) {
2787  return detail::errHandler(err, __CREATE_KERNELS_IN_PROGRAM_ERR);
2788  }
2789 
2790  Kernel* value = (Kernel*) alloca(numKernels * sizeof(Kernel));
2792  object_, numKernels, (cl_kernel*) value, NULL);
2793  if (err != CL_SUCCESS) {
2794  return detail::errHandler(err, __CREATE_KERNELS_IN_PROGRAM_ERR);
2795  }
2796 
2797  kernels->assign(&value[0], &value[numKernels]);
2798  return CL_SUCCESS;
2799  }
2800 };
2801 
2802 template<>
2803 inline VECTOR_CLASS<char *> cl::Program::getInfo<CL_PROGRAM_BINARIES>(cl_int* err) const
2804 {
2805  VECTOR_CLASS< ::size_t> sizes = getInfo<CL_PROGRAM_BINARY_SIZES>();
2806  VECTOR_CLASS<char *> binaries;
2807  for (VECTOR_CLASS< ::size_t>::iterator s = sizes.begin(); s != sizes.end(); ++s)
2808  {
2809  char *ptr = NULL;
2810  if (*s != 0)
2811  ptr = new char[*s];
2812  binaries.push_back(ptr);
2813  }
2814 
2815  cl_int result = getInfo(CL_PROGRAM_BINARIES, &binaries);
2816  if (err != NULL) {
2817  *err = result;
2818  }
2819  return binaries;
2820 }
2821 
2823 
2824 inline Kernel::Kernel(const Program& program, const char* name, cl_int* err)
2825 {
2826  cl_int error;
2827 
2828  object_ = ::clCreateKernel(program(), name, &error);
2829  detail::errHandler(error, __CREATE_KERNEL_ERR);
2830 
2831  if (err != NULL) {
2832  *err = error;
2833  }
2834 
2835 }
2836 
2837 /*! \class CommandQueue
2838  * \brief CommandQueue interface for cl_command_queue.
2839  */
2840 class CE_API CommandQueue : public detail::Wrapper<cl_command_queue>
2841 {
2842 public:
2844  const Context& context,
2845  const Device& device,
2846  cl_command_queue_properties properties = 0,
2847  cl_int* err = NULL)
2848  {
2849  cl_int error;
2850  object_ = ::clCreateCommandQueue(
2851  context(), device(), properties, &error);
2852 
2853  detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
2854  if (err != NULL) {
2855  *err = error;
2856  }
2857  }
2858 
2860 
2861  CommandQueue(const CommandQueue& commandQueue) : detail::Wrapper<cl_type>(commandQueue) { }
2862 
2863  CommandQueue(const cl_command_queue& commandQueue) : detail::Wrapper<cl_type>(commandQueue) { }
2864 
2865  CommandQueue& operator = (const CommandQueue& rhs)
2866  {
2867  if (this != &rhs) {
2869  }
2870  return *this;
2871  }
2872 
2873  CommandQueue& operator = (const cl_command_queue& rhs)
2874  {
2876  return *this;
2877  }
2878 
2879  template <typename T>
2881  {
2882  return detail::errHandler(
2884  &::clGetCommandQueueInfo, object_, name, param),
2885  __GET_COMMAND_QUEUE_INFO_ERR);
2886  }
2887 
2888  template <cl_int name> typename
2890  getInfo(cl_int* err = NULL) const
2891  {
2892  typename detail::param_traits<
2894  cl_int result = getInfo(name, &param);
2895  if (err != NULL) {
2896  *err = result;
2897  }
2898  return param;
2899  }
2900 
2902  const Buffer& buffer,
2903  cl_bool blocking,
2904  ::size_t offset,
2905  ::size_t size,
2906  void* ptr,
2907  const VECTOR_CLASS<Event>* events = NULL,
2908  Event* event = NULL) const
2909  {
2910  cl_event tmp;
2911  cl_int err = detail::errHandler(
2913  object_, buffer(), blocking, offset, size,
2914  ptr,
2915  (events != NULL) ? (cl_uint) events->size() : 0,
2916  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
2917  (event != NULL) ? &tmp : NULL),
2918  __ENQUEUE_READ_BUFFER_ERR);
2919 
2920  if (event != NULL && err == CL_SUCCESS)
2921  *event = tmp;
2922 
2923  return err;
2924  }
2925 
2927  const Buffer& buffer,
2928  cl_bool blocking,
2929  ::size_t offset,
2930  ::size_t size,
2931  const void* ptr,
2932  const VECTOR_CLASS<Event>* events = NULL,
2933  Event* event = NULL) const
2934  {
2935  cl_event tmp;
2936  cl_int err = detail::errHandler(
2938  object_, buffer(), blocking, offset, size,
2939  ptr,
2940  (events != NULL) ? (cl_uint) events->size() : 0,
2941  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
2942  (event != NULL) ? &tmp : NULL),
2943  __ENQUEUE_WRITE_BUFFER_ERR);
2944 
2945  if (event != NULL && err == CL_SUCCESS)
2946  *event = tmp;
2947 
2948  return err;
2949  }
2950 
2952  const Buffer& src,
2953  const Buffer& dst,
2954  ::size_t src_offset,
2955  ::size_t dst_offset,
2956  ::size_t size,
2957  const VECTOR_CLASS<Event>* events = NULL,
2958  Event* event = NULL) const
2959  {
2960  cl_event tmp;
2961  cl_int err = detail::errHandler(
2963  object_, src(), dst(), src_offset, dst_offset, size,
2964  (events != NULL) ? (cl_uint) events->size() : 0,
2965  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
2966  (event != NULL) ? &tmp : NULL),
2967  __ENQEUE_COPY_BUFFER_ERR);
2968 
2969  if (event != NULL && err == CL_SUCCESS)
2970  *event = tmp;
2971 
2972  return err;
2973  }
2974 
2975 #if defined(CL_VERSION_1_1)
2976  cl_int enqueueReadBufferRect(
2977  const Buffer& buffer,
2978  cl_bool blocking,
2979  const size_t<3>& buffer_offset,
2980  const size_t<3>& host_offset,
2981  const size_t<3>& region,
2982  ::size_t buffer_row_pitch,
2983  ::size_t buffer_slice_pitch,
2984  ::size_t host_row_pitch,
2985  ::size_t host_slice_pitch,
2986  void *ptr,
2987  const VECTOR_CLASS<Event>* events = NULL,
2988  Event* event = NULL) const
2989  {
2990  cl_event tmp;
2991  cl_int err = detail::errHandler(
2993  object_,
2994  buffer(),
2995  blocking,
2996  (const ::size_t *)buffer_offset,
2997  (const ::size_t *)host_offset,
2998  (const ::size_t *)region,
2999  buffer_row_pitch,
3000  buffer_slice_pitch,
3001  host_row_pitch,
3002  host_slice_pitch,
3003  ptr,
3004  (events != NULL) ? (cl_uint) events->size() : 0,
3005  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
3006  (event != NULL) ? &tmp : NULL),
3007  __ENQUEUE_READ_BUFFER_RECT_ERR);
3008 
3009  if (event != NULL && err == CL_SUCCESS)
3010  *event = tmp;
3011 
3012  return err;
3013  }
3014 
3015 
3016  cl_int enqueueWriteBufferRect(
3017  const Buffer& buffer,
3018  cl_bool blocking,
3019  const size_t<3>& buffer_offset,
3020  const size_t<3>& host_offset,
3021  const size_t<3>& region,
3022  ::size_t buffer_row_pitch,
3023  ::size_t buffer_slice_pitch,
3024  ::size_t host_row_pitch,
3025  ::size_t host_slice_pitch,
3026  void *ptr,
3027  const VECTOR_CLASS<Event>* events = NULL,
3028  Event* event = NULL) const
3029  {
3030  cl_event tmp;
3031  cl_int err = detail::errHandler(
3033  object_,
3034  buffer(),
3035  blocking,
3036  (const ::size_t *)buffer_offset,
3037  (const ::size_t *)host_offset,
3038  (const ::size_t *)region,
3039  buffer_row_pitch,
3040  buffer_slice_pitch,
3041  host_row_pitch,
3042  host_slice_pitch,
3043  ptr,
3044  (events != NULL) ? (cl_uint) events->size() : 0,
3045  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
3046  (event != NULL) ? &tmp : NULL),
3047  __ENQUEUE_WRITE_BUFFER_RECT_ERR);
3048 
3049  if (event != NULL && err == CL_SUCCESS)
3050  *event = tmp;
3051 
3052  return err;
3053  }
3054 
3055  cl_int enqueueCopyBufferRect(
3056  const Buffer& src,
3057  const Buffer& dst,
3058  const size_t<3>& src_origin,
3059  const size_t<3>& dst_origin,
3060  const size_t<3>& region,
3061  ::size_t src_row_pitch,
3062  ::size_t src_slice_pitch,
3063  ::size_t dst_row_pitch,
3064  ::size_t dst_slice_pitch,
3065  const VECTOR_CLASS<Event>* events = NULL,
3066  Event* event = NULL) const
3067  {
3068  cl_event tmp;
3069  cl_int err = detail::errHandler(
3071  object_,
3072  src(),
3073  dst(),
3074  (const ::size_t *)src_origin,
3075  (const ::size_t *)dst_origin,
3076  (const ::size_t *)region,
3077  src_row_pitch,
3078  src_slice_pitch,
3079  dst_row_pitch,
3080  dst_slice_pitch,
3081  (events != NULL) ? (cl_uint) events->size() : 0,
3082  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
3083  (event != NULL) ? &tmp : NULL),
3084  __ENQEUE_COPY_BUFFER_RECT_ERR);
3085 
3086  if (event != NULL && err == CL_SUCCESS)
3087  *event = tmp;
3088 
3089  return err;
3090  }
3091 #endif
3092 
3094  const Image& image,
3095  cl_bool blocking,
3096  const size_t<3>& origin,
3097  const size_t<3>& region,
3098  ::size_t row_pitch,
3099  ::size_t slice_pitch,
3100  void* ptr,
3101  const VECTOR_CLASS<Event>* events = NULL,
3102  Event* event = NULL) const
3103  {
3104  cl_event tmp;
3105  cl_int err = detail::errHandler(
3107  object_, image(), blocking, (const ::size_t *) origin,
3108  (const ::size_t *) region, row_pitch, slice_pitch, ptr,
3109  (events != NULL) ? (cl_uint) events->size() : 0,
3110  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
3111  (event != NULL) ? &tmp : NULL),
3112  __ENQUEUE_READ_IMAGE_ERR);
3113 
3114  if (event != NULL && err == CL_SUCCESS)
3115  *event = tmp;
3116 
3117  return err;
3118  }
3119 
3121  const Image& image,
3122  cl_bool blocking,
3123  const size_t<3>& origin,
3124  const size_t<3>& region,
3125  ::size_t row_pitch,
3126  ::size_t slice_pitch,
3127  void* ptr,
3128  const VECTOR_CLASS<Event>* events = NULL,
3129  Event* event = NULL) const
3130  {
3131  cl_event tmp;
3132  cl_int err = detail::errHandler(
3134  object_, image(), blocking, (const ::size_t *) origin,
3135  (const ::size_t *) region, row_pitch, slice_pitch, ptr,
3136  (events != NULL) ? (cl_uint) events->size() : 0,
3137  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
3138  (event != NULL) ? &tmp : NULL),
3139  __ENQUEUE_WRITE_IMAGE_ERR);
3140 
3141  if (event != NULL && err == CL_SUCCESS)
3142  *event = tmp;
3143 
3144  return err;
3145  }
3146 
3148  const Image& src,
3149  const Image& dst,
3150  const size_t<3>& src_origin,
3151  const size_t<3>& dst_origin,
3152  const size_t<3>& region,
3153  const VECTOR_CLASS<Event>* events = NULL,
3154  Event* event = NULL) const
3155  {
3156  cl_event tmp;
3157  cl_int err = detail::errHandler(
3159  object_, src(), dst(), (const ::size_t *) src_origin,
3160  (const ::size_t *)dst_origin, (const ::size_t *) region,
3161  (events != NULL) ? (cl_uint) events->size() : 0,
3162  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
3163  (event != NULL) ? &tmp : NULL),
3164  __ENQUEUE_COPY_IMAGE_ERR);
3165 
3166  if (event != NULL && err == CL_SUCCESS)
3167  *event = tmp;
3168 
3169  return err;
3170  }
3171 
3173  const Image& src,
3174  const Buffer& dst,
3175  const size_t<3>& src_origin,
3176  const size_t<3>& region,
3177  ::size_t dst_offset,
3178  const VECTOR_CLASS<Event>* events = NULL,
3179  Event* event = NULL) const
3180  {
3181  cl_event tmp;
3182  cl_int err = detail::errHandler(
3184  object_, src(), dst(), (const ::size_t *) src_origin,
3185  (const ::size_t *) region, dst_offset,
3186  (events != NULL) ? (cl_uint) events->size() : 0,
3187  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
3188  (event != NULL) ? &tmp : NULL),
3189  __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR);
3190 
3191  if (event != NULL && err == CL_SUCCESS)
3192  *event = tmp;
3193 
3194  return err;
3195  }
3196 
3198  const Buffer& src,
3199  const Image& dst,
3200  ::size_t src_offset,
3201  const size_t<3>& dst_origin,
3202  const size_t<3>& region,
3203  const VECTOR_CLASS<Event>* events = NULL,
3204  Event* event = NULL) const
3205  {
3206  cl_event tmp;
3207  cl_int err = detail::errHandler(
3209  object_, src(), dst(), src_offset,
3210  (const ::size_t *) dst_origin, (const ::size_t *) region,
3211  (events != NULL) ? (cl_uint) events->size() : 0,
3212  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
3213  (event != NULL) ? &tmp : NULL),
3214  __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR);
3215 
3216  if (event != NULL && err == CL_SUCCESS)
3217  *event = tmp;
3218 
3219  return err;
3220  }
3221 
3223  const Buffer& buffer,
3224  cl_bool blocking,
3225  cl_map_flags flags,
3226  ::size_t offset,
3227  ::size_t size,
3228  const VECTOR_CLASS<Event>* events = NULL,
3229  Event* event = NULL,
3230  cl_int* err = NULL) const
3231  {
3232  cl_int error;
3233  void * result = ::clEnqueueMapBuffer(
3234  object_, buffer(), blocking, flags, offset, size,
3235  (events != NULL) ? (cl_uint) events->size() : 0,
3236  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
3237  (cl_event*) event,
3238  &error);
3239 
3240  detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
3241  if (err != NULL) {
3242  *err = error;
3243  }
3244  return result;
3245  }
3246 
3248  const Image& buffer,
3249  cl_bool blocking,
3250  cl_map_flags flags,
3251  const size_t<3>& origin,
3252  const size_t<3>& region,
3253  ::size_t * row_pitch,
3254  ::size_t * slice_pitch,
3255  const VECTOR_CLASS<Event>* events = NULL,
3256  Event* event = NULL,
3257  cl_int* err = NULL) const
3258  {
3259  cl_int error;
3260  void * result = ::clEnqueueMapImage(
3261  object_, buffer(), blocking, flags,
3262  (const ::size_t *) origin, (const ::size_t *) region,
3263  row_pitch, slice_pitch,
3264  (events != NULL) ? (cl_uint) events->size() : 0,
3265  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
3266  (cl_event*) event,
3267  &error);
3268 
3269  detail::errHandler(error, __ENQUEUE_MAP_IMAGE_ERR);
3270  if (err != NULL) {
3271  *err = error;
3272  }
3273  return result;
3274  }
3275 
3277  const Memory& memory,
3278  void* mapped_ptr,
3279  const VECTOR_CLASS<Event>* events = NULL,
3280  Event* event = NULL) const
3281  {
3282  cl_event tmp;
3283  cl_int err = detail::errHandler(
3285  object_, memory(), mapped_ptr,
3286  (events != NULL) ? (cl_uint) events->size() : 0,
3287  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
3288  (event != NULL) ? &tmp : NULL),
3289  __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
3290 
3291  if (event != NULL && err == CL_SUCCESS)
3292  *event = tmp;
3293 
3294  return err;
3295  }
3296 
3298  const Kernel& kernel,
3299  const NDRange& offset,
3300  const NDRange& global,
3301  const NDRange& local,
3302  const VECTOR_CLASS<Event>* events = NULL,
3303  Event* event = NULL) const
3304  {
3305  cl_event tmp;
3306  cl_int err = detail::errHandler(
3308  object_, kernel(), (cl_uint) global.dimensions(),
3309  offset.dimensions() != 0 ? (const ::size_t*) offset : NULL,
3310  (const ::size_t*) global,
3311  local.dimensions() != 0 ? (const ::size_t*) local : NULL,
3312  (events != NULL) ? (cl_uint) events->size() : 0,
3313  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
3314  (event != NULL) ? &tmp : NULL),
3315  __ENQUEUE_NDRANGE_KERNEL_ERR);
3316 
3317  if (event != NULL && err == CL_SUCCESS)
3318  *event = tmp;
3319 
3320  return err;
3321  }
3322 
3323  cl_int enqueueTask(
3324  const Kernel& kernel,
3325  const VECTOR_CLASS<Event>* events = NULL,
3326  Event* event = NULL) const
3327  {
3328  cl_event tmp;
3329  cl_int err = detail::errHandler(
3330  ::clEnqueueTask(
3331  object_, kernel(),
3332  (events != NULL) ? (cl_uint) events->size() : 0,
3333  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
3334  (event != NULL) ? &tmp : NULL),
3335  __ENQUEUE_TASK_ERR);
3336 
3337  if (event != NULL && err == CL_SUCCESS)
3338  *event = tmp;
3339 
3340  return err;
3341  }
3342 
3344  // Our windows API doesn't have the __stdcall for the user pointer
3345  // so we have to change the definition here.
3346 #ifdef _WIN32
3347  void (*userFptr)(void *),
3348 #else
3349  void (CL_CALLBACK *userFptr)(void *),
3350 #endif
3351  std::pair<void*, ::size_t> args,
3352  const VECTOR_CLASS<Memory>* mem_objects = NULL,
3353  const VECTOR_CLASS<const void*>* mem_locs = NULL,
3354  const VECTOR_CLASS<Event>* events = NULL,
3355  Event* event = NULL) const
3356  {
3357  cl_mem * mems = (mem_objects != NULL && mem_objects->size() > 0)
3358  ? (cl_mem*) alloca(mem_objects->size() * sizeof(cl_mem))
3359  : NULL;
3360 
3361  if (mems != NULL) {
3362  for (unsigned int i = 0; i < mem_objects->size(); i++) {
3363  mems[i] = ((*mem_objects)[i])();
3364  }
3365  }
3366 
3367  cl_event tmp;
3368  cl_int err = detail::errHandler(
3370  object_, userFptr, args.first, args.second,
3371  (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
3372  mems,
3373  (mem_locs != NULL) ? (const void **) &mem_locs->front() : NULL,
3374  (events != NULL) ? (cl_uint) events->size() : 0,
3375  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
3376  (event != NULL) ? &tmp : NULL),
3377  __ENQUEUE_NATIVE_KERNEL);
3378 
3379  if (event != NULL && err == CL_SUCCESS)
3380  *event = tmp;
3381 
3382  return err;
3383  }
3384 
3385 #if defined(CL_VERSION_1_2)
3386  cl_int enqueueMarkerWithWaitList(
3387  const VECTOR_CLASS<Event>& events, Event* event = NULL) const
3388  {
3389  return detail::errHandler(
3391  object_,
3392  (cl_uint) events.size(),
3393  (const cl_event*) &events.front(),
3394  (cl_event *)event),
3395  __ENQUEUE_MARKER_WITH_WAIT_LIST_ERR);
3396  }
3397 #else
3398  cl_int enqueueMarker(Event* event = NULL) const
3399  {
3400  return detail::errHandler(
3401  ::clEnqueueMarker(object_, (cl_event*) event),
3402  __ENQUEUE_MARKER_ERR);
3403  }
3404 
3405  cl_int enqueueWaitForEvents(const VECTOR_CLASS<Event>& events) const
3406  {
3407  return detail::errHandler(
3409  object_,
3410  (cl_uint) events.size(),
3411  (const cl_event*) &events.front()),
3412  __ENQUEUE_WAIT_FOR_EVENTS_ERR);
3413  }
3414 #endif
3415 
3417  const VECTOR_CLASS<Memory>* mem_objects = NULL,
3418  const VECTOR_CLASS<Event>* events = NULL,
3419  Event* event = NULL) const
3420  {
3421  cl_event tmp;
3422  cl_int err = detail::errHandler(
3424  object_,
3425  (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
3426  (mem_objects != NULL) ? (const cl_mem *) &mem_objects->front(): NULL,
3427  (events != NULL) ? (cl_uint) events->size() : 0,
3428  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
3429  (event != NULL) ? &tmp : NULL),
3430  __ENQUEUE_ACQUIRE_GL_ERR);
3431 
3432  if (event != NULL && err == CL_SUCCESS)
3433  *event = tmp;
3434 
3435  return err;
3436  }
3437 
3439  const VECTOR_CLASS<Memory>* mem_objects = NULL,
3440  const VECTOR_CLASS<Event>* events = NULL,
3441  Event* event = NULL) const
3442  {
3443  cl_event tmp;
3444  cl_int err = detail::errHandler(
3446  object_,
3447  (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
3448  (mem_objects != NULL) ? (const cl_mem *) &mem_objects->front(): NULL,
3449  (events != NULL) ? (cl_uint) events->size() : 0,
3450  (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
3451  (event != NULL) ? &tmp : NULL),
3452  __ENQUEUE_RELEASE_GL_ERR);
3453 
3454  if (event != NULL && err == CL_SUCCESS)
3455  *event = tmp;
3456 
3457  return err;
3458  }
3459 
3460 #if defined (USE_DX_INTEROP)
3461 typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clEnqueueAcquireD3D10ObjectsKHR)(
3462  cl_command_queue command_queue, cl_uint num_objects,
3463  const cl_mem* mem_objects, cl_uint num_events_in_wait_list,
3464  const cl_event* event_wait_list, cl_event* event);
3465 typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clEnqueueReleaseD3D10ObjectsKHR)(
3466  cl_command_queue command_queue, cl_uint num_objects,
3467  const cl_mem* mem_objects, cl_uint num_events_in_wait_list,
3468  const cl_event* event_wait_list, cl_event* event);
3469 
3470  cl_int enqueueAcquireD3D10Objects(
3471  const VECTOR_CLASS<Memory>* mem_objects = NULL,
3472  const VECTOR_CLASS<Event>* events = NULL,
3473  Event* event = NULL) const
3474  {
3475  static PFN_clEnqueueAcquireD3D10ObjectsKHR pfn_clEnqueueAcquireD3D10ObjectsKHR = NULL;
3476  __INIT_CL_EXT_FCN_PTR(clEnqueueAcquireD3D10ObjectsKHR);
3477 
3478  cl_event tmp;
3479  cl_int err = detail::errHandler(
3480  pfn_clEnqueueAcquireD3D10ObjectsKHR(
3481  object_,
3482  (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
3483  (mem_objects != NULL) ? (const cl_mem *) &mem_objects->front(): NULL,
3484  (events != NULL) ? (cl_uint) events->size() : 0,
3485  (events != NULL) ? (cl_event*) &events->front() : NULL,
3486  (event != NULL) ? &tmp : NULL),
3487  __ENQUEUE_ACQUIRE_GL_ERR);
3488 
3489  if (event != NULL && err == CL_SUCCESS)
3490  *event = tmp;
3491 
3492  return err;
3493  }
3494 
3495  cl_int enqueueReleaseD3D10Objects(
3496  const VECTOR_CLASS<Memory>* mem_objects = NULL,
3497  const VECTOR_CLASS<Event>* events = NULL,
3498  Event* event = NULL) const
3499  {
3500  static PFN_clEnqueueReleaseD3D10ObjectsKHR pfn_clEnqueueReleaseD3D10ObjectsKHR = NULL;
3501  __INIT_CL_EXT_FCN_PTR(clEnqueueReleaseD3D10ObjectsKHR);
3502 
3503  cl_event tmp;
3504  cl_int err = detail::errHandler(
3505  pfn_clEnqueueReleaseD3D10ObjectsKHR(
3506  object_,
3507  (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
3508  (mem_objects != NULL) ? (const cl_mem *) &mem_objects->front(): NULL,
3509  (events != NULL) ? (cl_uint) events->size() : 0,
3510  (events != NULL) ? (cl_event*) &events->front() : NULL,
3511  (event != NULL) ? &tmp : NULL),
3512  __ENQUEUE_RELEASE_GL_ERR);
3513 
3514  if (event != NULL && err == CL_SUCCESS)
3515  *event = tmp;
3516 
3517  return err;
3518  }
3519 #endif
3520 
3521 #if defined(CL_VERSION_1_2)
3522  cl_int enqueueBarrierWithWaitList(
3523  const VECTOR_CLASS<Event>& events, Event* event = NULL) const
3524  {
3525  return detail::errHandler(
3527  object_,
3528  (cl_uint) events.size(),
3529  (const cl_event*) &events.front(),
3530  (cl_event *)event),
3531  __ENQUEUE_BARRIER_ERR);
3532  }
3533 #else
3534  cl_int enqueueBarrier() const
3535  {
3536  return detail::errHandler(
3537  ::clEnqueueBarrier(object_),
3538  __ENQUEUE_BARRIER_ERR);
3539  }
3540 #endif
3541 
3542  cl_int flush() const
3543  {
3544  return detail::errHandler(::clFlush(object_), __FLUSH_ERR);
3545  }
3546 
3547  cl_int finish() const
3548  {
3549  return detail::errHandler(::clFinish(object_), __FINISH_ERR);
3550  }
3551 };
3552 
3554 
3555 /*! \class KernelFunctor
3556  * \brief Kernel functor interface
3557  *
3558  * \note Currently only functors of zero to ten arguments are supported. It
3559  * is straightforward to add more and a more general solution, similar to
3560  * Boost.Lambda could be followed if required in the future.
3561  */
3563 {
3564 private:
3565  Kernel kernel_;
3566  CommandQueue queue_;
3567  NDRange offset_;
3568  NDRange global_;
3569  NDRange local_;
3570 
3571  cl_int err_;
3572 public:
3574 
3576  const Kernel& kernel,
3577  const CommandQueue& queue,
3578  const NDRange& offset,
3579  const NDRange& global,
3580  const NDRange& local) :
3581  kernel_(kernel),
3582  queue_(queue),
3583  offset_(offset),
3584  global_(global),
3585  local_(local),
3586  err_(CL_SUCCESS)
3587  {}
3588 
3589  KernelFunctor& operator=(const KernelFunctor& rhs);
3590 
3591  KernelFunctor(const KernelFunctor& rhs);
3592 
3593  cl_int getError() { return err_; }
3594 
3595  inline Event operator()(const VECTOR_CLASS<Event>* events = NULL);
3596 
3597  template<typename A1>
3598  inline Event operator()(
3599  const A1& a1,
3600  const VECTOR_CLASS<Event>* events = NULL);
3601 
3602  template<class A1, class A2>
3603  inline Event operator()(
3604  const A1& a1,
3605  const A2& a2,
3606  const VECTOR_CLASS<Event>* events = NULL);
3607 
3608  template<class A1, class A2, class A3>
3609  inline Event operator()(
3610  const A1& a1,
3611  const A2& a2,
3612  const A3& a3,
3613  const VECTOR_CLASS<Event>* events = NULL);
3614 
3615  template<class A1, class A2, class A3, class A4>
3616  inline Event operator()(
3617  const A1& a1,
3618  const A2& a2,
3619  const A3& a3,
3620  const A4& a4,
3621  const VECTOR_CLASS<Event>* events = NULL);
3622 
3623  template<class A1, class A2, class A3, class A4, class A5>
3624  inline Event operator()(
3625  const A1& a1,
3626  const A2& a2,
3627  const A3& a3,
3628  const A4& a4,
3629  const A5& a5,
3630  const VECTOR_CLASS<Event>* events = NULL);
3631 
3632  template<class A1, class A2, class A3, class A4, class A5, class A6>
3633  inline Event operator()(
3634  const A1& a1,
3635  const A2& a2,
3636  const A3& a3,
3637  const A4& a4,
3638  const A5& a5,
3639  const A6& a6,
3640  const VECTOR_CLASS<Event>* events = NULL);
3641 
3642  template<class A1, class A2, class A3, class A4,
3643  class A5, class A6, class A7>
3644  inline Event operator()(
3645  const A1& a1,
3646  const A2& a2,
3647  const A3& a3,
3648  const A4& a4,
3649  const A5& a5,
3650  const A6& a6,
3651  const A7& a7,
3652  const VECTOR_CLASS<Event>* events = NULL);
3653 
3654  template<class A1, class A2, class A3, class A4, class A5,
3655  class A6, class A7, class A8>
3656  inline Event operator()(
3657  const A1& a1,
3658  const A2& a2,
3659  const A3& a3,
3660  const A4& a4,
3661  const A5& a5,
3662  const A6& a6,
3663  const A7& a7,
3664  const A8& a8,
3665  const VECTOR_CLASS<Event>* events = NULL);
3666 
3667  template<class A1, class A2, class A3, class A4, class A5,
3668  class A6, class A7, class A8, class A9>
3669  inline Event operator()(
3670  const A1& a1,
3671  const A2& a2,
3672  const A3& a3,
3673  const A4& a4,
3674  const A5& a5,
3675  const A6& a6,
3676  const A7& a7,
3677  const A8& a8,
3678  const A9& a9,
3679  const VECTOR_CLASS<Event>* events = NULL);
3680 
3681  template<class A1, class A2, class A3, class A4, class A5,
3682  class A6, class A7, class A8, class A9, class A10>
3683  inline Event operator()(
3684  const A1& a1,
3685  const A2& a2,
3686  const A3& a3,
3687  const A4& a4,
3688  const A5& a5,
3689  const A6& a6,
3690  const A7& a7,
3691  const A8& a8,
3692  const A9& a9,
3693  const A10& a10,
3694  const VECTOR_CLASS<Event>* events = NULL);
3695 
3696  template<class A1, class A2, class A3, class A4, class A5,
3697  class A6, class A7, class A8, class A9, class A10,
3698  class A11>
3699  inline Event operator()(
3700  const A1& a1,
3701  const A2& a2,
3702  const A3& a3,
3703  const A4& a4,
3704  const A5& a5,
3705  const A6& a6,
3706  const A7& a7,
3707  const A8& a8,
3708  const A9& a9,
3709  const A10& a10,
3710  const A11& a11,
3711  const VECTOR_CLASS<Event>* events = NULL);
3712 
3713  template<class A1, class A2, class A3, class A4, class A5,
3714  class A6, class A7, class A8, class A9, class A10,
3715  class A11, class A12>
3716  inline Event operator()(
3717  const A1& a1,
3718  const A2& a2,
3719  const A3& a3,
3720  const A4& a4,
3721  const A5& a5,
3722  const A6& a6,
3723  const A7& a7,
3724  const A8& a8,
3725  const A9& a9,
3726  const A10& a10,
3727  const A11& a11,
3728  const A12& a12,
3729  const VECTOR_CLASS<Event>* events = NULL);
3730 
3731  template<class A1, class A2, class A3, class A4, class A5,
3732  class A6, class A7, class A8, class A9, class A10,
3733  class A11, class A12, class A13>
3734  inline Event operator()(
3735  const A1& a1,
3736  const A2& a2,
3737  const A3& a3,
3738  const A4& a4,
3739  const A5& a5,
3740  const A6& a6,
3741  const A7& a7,
3742  const A8& a8,
3743  const A9& a9,
3744  const A10& a10,
3745  const A11& a11,
3746  const A12& a12,
3747  const A13& a13,
3748  const VECTOR_CLASS<Event>* events = NULL);
3749 
3750  template<class A1, class A2, class A3, class A4, class A5,
3751  class A6, class A7, class A8, class A9, class A10,
3752  class A11, class A12, class A13, class A14>
3753  inline Event operator()(
3754  const A1& a1,
3755  const A2& a2,
3756  const A3& a3,
3757  const A4& a4,
3758  const A5& a5,
3759  const A6& a6,
3760  const A7& a7,
3761  const A8& a8,
3762  const A9& a9,
3763  const A10& a10,
3764  const A11& a11,
3765  const A12& a12,
3766  const A13& a13,
3767  const A14& a14,
3768  const VECTOR_CLASS<Event>* events = NULL);
3769 
3770  template<class A1, class A2, class A3, class A4, class A5,
3771  class A6, class A7, class A8, class A9, class A10,
3772  class A11, class A12, class A13, class A14, class A15>
3773  inline Event operator()(
3774  const A1& a1,
3775  const A2& a2,
3776  const A3& a3,
3777  const A4& a4,
3778  const A5& a5,
3779  const A6& a6,
3780  const A7& a7,
3781  const A8& a8,
3782  const A9& a9,
3783  const A10& a10,
3784  const A11& a11,
3785  const A12& a12,
3786  const A13& a13,
3787  const A14& a14,
3788  const A15& a15,
3789  const VECTOR_CLASS<Event>* events = NULL);
3790 };
3791 
3793  const CommandQueue& queue,
3794  const NDRange& offset,
3795  const NDRange& global,
3796  const NDRange& local)
3797 {
3798  return KernelFunctor(*this,queue,offset,global,local);
3799 }
3800 
3802  const CommandQueue& queue,
3803  const NDRange& global,
3804  const NDRange& local)
3805 {
3806  return KernelFunctor(*this,queue,NullRange,global,local);
3807 }
3808 
3810 {
3811  if (this == &rhs) {
3812  return *this;
3813  }
3814 
3815  kernel_ = rhs.kernel_;
3816  queue_ = rhs.queue_;
3817  offset_ = rhs.offset_;
3818  global_ = rhs.global_;
3819  local_ = rhs.local_;
3820 
3821  return *this;
3822 }
3823 
3825  kernel_(rhs.kernel_),
3826  queue_(rhs.queue_),
3827  offset_(rhs.offset_),
3828  global_(rhs.global_),
3829  local_(rhs.local_)
3830 {
3831 }
3832 
3833 Event KernelFunctor::operator()(const VECTOR_CLASS<Event>* )
3834 {
3835  Event event;
3836 
3837  err_ = queue_.enqueueNDRangeKernel(
3838  kernel_,
3839  offset_,
3840  global_,
3841  local_,
3842  NULL, // bgaster_fixme - do we want to allow wait event lists?
3843  &event);
3844 
3845  return event;
3846 }
3847 
3848 template<typename A1>
3850  const A1& a1,
3851  const VECTOR_CLASS<Event>* )
3852 {
3853  Event event;
3854 
3855  kernel_.setArg(0,a1);
3856 
3857  err_ = queue_.enqueueNDRangeKernel(
3858  kernel_,
3859  offset_,
3860  global_,
3861  local_,
3862  NULL, // bgaster_fixme - do we want to allow wait event lists?
3863  &event);
3864 
3865  return event;
3866 }
3867 
3868 template<typename A1, typename A2>
3870  const A1& a1,
3871  const A2& a2,
3872  const VECTOR_CLASS<Event>* )
3873 {
3874  Event event;
3875 
3876  kernel_.setArg(0,a1);
3877  kernel_.setArg(1,a2);
3878 
3879  err_ = queue_.enqueueNDRangeKernel(
3880  kernel_,
3881  offset_,
3882  global_,
3883  local_,
3884  NULL, // bgaster_fixme - do we want to allow wait event lists?
3885  &event);
3886 
3887  return event;
3888 }
3889 
3890 template<typename A1, typename A2, typename A3>
3892  const A1& a1,
3893  const A2& a2,
3894  const A3& a3,
3895  const VECTOR_CLASS<Event>* )
3896 {
3897  Event event;
3898 
3899  kernel_.setArg(0,a1);
3900  kernel_.setArg(1,a2);
3901  kernel_.setArg(2,a3);
3902 
3903  err_ = queue_.enqueueNDRangeKernel(
3904  kernel_,
3905  offset_,
3906  global_,
3907  local_,
3908  NULL, // bgaster_fixme - do we want to allow wait event lists?
3909  &event);
3910 
3911  return event;
3912 }
3913 
3914 template<typename A1, typename A2, typename A3, typename A4>
3916  const A1& a1,
3917  const A2& a2,
3918  const A3& a3,
3919  const A4& a4,
3920  const VECTOR_CLASS<Event>* )
3921 {
3922  Event event;
3923 
3924  kernel_.setArg(0,a1);
3925  kernel_.setArg(1,a2);
3926  kernel_.setArg(2,a3);
3927  kernel_.setArg(3,a4);
3928 
3929  err_ = queue_.enqueueNDRangeKernel(
3930  kernel_,
3931  offset_,
3932  global_,
3933  local_,
3934  NULL, // bgaster_fixme - do we want to allow wait event lists?
3935  &event);
3936 
3937  return event;
3938 }
3939 
3940 template<typename A1, typename A2, typename A3, typename A4, typename A5>
3942  const A1& a1,
3943  const A2& a2,
3944  const A3& a3,
3945  const A4& a4,
3946  const A5& a5,
3947  const VECTOR_CLASS<Event>* )
3948 {
3949  Event event;
3950 
3951  kernel_.setArg(0,a1);
3952  kernel_.setArg(1,a2);
3953  kernel_.setArg(2,a3);
3954  kernel_.setArg(3,a4);
3955  kernel_.setArg(4,a5);
3956 
3957  err_ = queue_.enqueueNDRangeKernel(
3958  kernel_,
3959  offset_,
3960  global_,
3961  local_,
3962  NULL, // bgaster_fixme - do we want to allow wait event lists?
3963  &event);
3964 
3965  return event;
3966 }
3967 
3968 template<typename A1, typename A2, typename A3, typename A4, typename A5,
3969  typename A6>
3971  const A1& a1,
3972  const A2& a2,
3973  const A3& a3,
3974  const A4& a4,
3975  const A5& a5,
3976  const A6& a6,
3977  const VECTOR_CLASS<Event>* )
3978 {
3979  Event event;
3980 
3981  kernel_.setArg(0,a1);
3982  kernel_.setArg(1,a2);
3983  kernel_.setArg(2,a3);
3984  kernel_.setArg(3,a4);
3985  kernel_.setArg(4,a5);
3986  kernel_.setArg(5,a6);
3987 
3988  err_ = queue_.enqueueNDRangeKernel(
3989  kernel_,
3990  offset_,
3991  global_,
3992  local_,
3993  NULL, // bgaster_fixme - do we want to allow wait event lists?
3994  &event);
3995 
3996  return event;
3997 }
3998 
3999 template<typename A1, typename A2, typename A3, typename A4,
4000  typename A5, typename A6, typename A7>
4002  const A1& a1,
4003  const A2& a2,
4004  const A3& a3,
4005  const A4& a4,
4006  const A5& a5,
4007  const A6& a6,
4008  const A7& a7,
4009  const VECTOR_CLASS<Event>* )
4010 {
4011  Event event;
4012 
4013  kernel_.setArg(0,a1);
4014  kernel_.setArg(1,a2);
4015  kernel_.setArg(2,a3);
4016  kernel_.setArg(3,a4);
4017  kernel_.setArg(4,a5);
4018  kernel_.setArg(5,a6);
4019  kernel_.setArg(6,a7);
4020 
4021  err_ = queue_.enqueueNDRangeKernel(
4022  kernel_,
4023  offset_,
4024  global_,
4025  local_,
4026  NULL, // bgaster_fixme - do we want to allow wait event lists?
4027  &event);
4028 
4029  return event;
4030 }
4031 
4032 template<typename A1, typename A2, typename A3, typename A4, typename A5,
4033  typename A6, typename A7, typename A8>
4035  const A1& a1,
4036  const A2& a2,
4037  const A3& a3,
4038  const A4& a4,
4039  const A5& a5,
4040  const A6& a6,
4041  const A7& a7,
4042  const A8& a8,
4043  const VECTOR_CLASS<Event>* )
4044 {
4045  Event event;
4046 
4047  kernel_.setArg(0,a1);
4048  kernel_.setArg(1,a2);
4049  kernel_.setArg(2,a3);
4050  kernel_.setArg(3,a4);
4051  kernel_.setArg(4,a5);
4052  kernel_.setArg(5,a6);
4053  kernel_.setArg(6,a7);
4054  kernel_.setArg(7,a8);
4055 
4056  err_ = queue_.enqueueNDRangeKernel(
4057  kernel_,
4058  offset_,
4059  global_,
4060  local_,
4061  NULL, // bgaster_fixme - do we want to allow wait event lists?
4062  &event);
4063 
4064  return event;
4065 }
4066 
4067 template<typename A1, typename A2, typename A3, typename A4, typename A5,
4068  typename A6, typename A7, typename A8, typename A9>
4070  const A1& a1,
4071  const A2& a2,
4072  const A3& a3,
4073  const A4& a4,
4074  const A5& a5,
4075  const A6& a6,
4076  const A7& a7,
4077  const A8& a8,
4078  const A9& a9,
4079  const VECTOR_CLASS<Event>* )
4080 {
4081  Event event;
4082 
4083  kernel_.setArg(0,a1);
4084  kernel_.setArg(1,a2);
4085  kernel_.setArg(2,a3);
4086  kernel_.setArg(3,a4);
4087  kernel_.setArg(4,a5);
4088  kernel_.setArg(5,a6);
4089  kernel_.setArg(6,a7);
4090  kernel_.setArg(7,a8);
4091  kernel_.setArg(8,a9);
4092 
4093  err_ = queue_.enqueueNDRangeKernel(
4094  kernel_,
4095  offset_,
4096  global_,
4097  local_,
4098  NULL, // bgaster_fixme - do we want to allow wait event lists?
4099  &event);
4100 
4101  return event;
4102 }
4103 
4104 template<typename A1, typename A2, typename A3, typename A4, typename A5,
4105  typename A6, typename A7, typename A8, typename A9, typename A10>
4107  const A1& a1,
4108  const A2& a2,
4109  const A3& a3,
4110  const A4& a4,
4111  const A5& a5,
4112  const A6& a6,
4113  const A7& a7,
4114  const A8& a8,
4115  const A9& a9,
4116  const A10& a10,
4117  const VECTOR_CLASS<Event>* )
4118 {
4119  Event event;
4120 
4121  kernel_.setArg(0,a1);
4122  kernel_.setArg(1,a2);
4123  kernel_.setArg(2,a3);
4124  kernel_.setArg(3,a4);
4125  kernel_.setArg(4,a5);
4126  kernel_.setArg(5,a6);
4127  kernel_.setArg(6,a7);
4128  kernel_.setArg(7,a8);
4129  kernel_.setArg(8,a9);
4130  kernel_.setArg(9,a10);
4131 
4132  err_ = queue_.enqueueNDRangeKernel(
4133  kernel_,
4134  offset_,
4135  global_,
4136  local_,
4137  NULL, // bgaster_fixme - do we want to allow wait event lists?
4138  &event);
4139 
4140  return event;
4141 }
4142 
4143 template<class A1, class A2, class A3, class A4, class A5,
4144  class A6, class A7, class A8, class A9, class A10,
4145  class A11>
4147  const A1& a1,
4148  const A2& a2,
4149  const A3& a3,
4150  const A4& a4,
4151  const A5& a5,
4152  const A6& a6,
4153  const A7& a7,
4154  const A8& a8,
4155  const A9& a9,
4156  const A10& a10,
4157  const A11& a11,
4158  const VECTOR_CLASS<Event>* )
4159 {
4160  Event event;
4161 
4162  kernel_.setArg(0,a1);
4163  kernel_.setArg(1,a2);
4164  kernel_.setArg(2,a3);
4165  kernel_.setArg(3,a4);
4166  kernel_.setArg(4,a5);
4167  kernel_.setArg(5,a6);
4168  kernel_.setArg(6,a7);
4169  kernel_.setArg(7,a8);
4170  kernel_.setArg(8,a9);
4171  kernel_.setArg(9,a10);
4172  kernel_.setArg(10,a11);
4173 
4174  err_ = queue_.enqueueNDRangeKernel(
4175  kernel_,
4176  offset_,
4177  global_,
4178  local_,
4179  NULL, // bgaster_fixme - do we want to allow wait event lists?
4180  &event);
4181 
4182  return event;
4183 }
4184 
4185 template<class A1, class A2, class A3, class A4, class A5,
4186  class A6, class A7, class A8, class A9, class A10,
4187  class A11, class A12>
4189  const A1& a1,
4190  const A2& a2,
4191  const A3& a3,
4192  const A4& a4,
4193  const A5& a5,
4194  const A6& a6,
4195  const A7& a7,
4196  const A8& a8,
4197  const A9& a9,
4198  const A10& a10,
4199  const A11& a11,
4200  const A12& a12,
4201  const VECTOR_CLASS<Event>* )
4202 {
4203  Event event;
4204 
4205  kernel_.setArg(0,a1);
4206  kernel_.setArg(1,a2);
4207  kernel_.setArg(2,a3);
4208  kernel_.setArg(3,a4);
4209  kernel_.setArg(4,a5);
4210  kernel_.setArg(5,a6);
4211  kernel_.setArg(6,a7);
4212  kernel_.setArg(7,a8);
4213  kernel_.setArg(8,a9);
4214  kernel_.setArg(9,a10);
4215  kernel_.setArg(10,a11);
4216  kernel_.setArg(11,a12);
4217 
4218  err_ = queue_.enqueueNDRangeKernel(
4219  kernel_,
4220  offset_,
4221  global_,
4222  local_,
4223  NULL, // bgaster_fixme - do we want to allow wait event lists?
4224  &event);
4225 
4226  return event;
4227 }
4228 
4229 template<class A1, class A2, class A3, class A4, class A5,
4230  class A6, class A7, class A8, class A9, class A10,
4231  class A11, class A12, class A13>
4233  const A1& a1,
4234  const A2& a2,
4235  const A3& a3,
4236  const A4& a4,
4237  const A5& a5,
4238  const A6& a6,
4239  const A7& a7,
4240  const A8& a8,
4241  const A9& a9,
4242  const A10& a10,
4243  const A11& a11,
4244  const A12& a12,
4245  const A13& a13,
4246  const VECTOR_CLASS<Event>* )
4247 {
4248  Event event;
4249 
4250  kernel_.setArg(0,a1);
4251  kernel_.setArg(1,a2);
4252  kernel_.setArg(2,a3);
4253  kernel_.setArg(3,a4);
4254  kernel_.setArg(4,a5);
4255  kernel_.setArg(5,a6);
4256  kernel_.setArg(6,a7);
4257  kernel_.setArg(7,a8);
4258  kernel_.setArg(8,a9);
4259  kernel_.setArg(9,a10);
4260  kernel_.setArg(10,a11);
4261  kernel_.setArg(11,a12);
4262  kernel_.setArg(12,a13);
4263 
4264  err_ = queue_.enqueueNDRangeKernel(
4265  kernel_,
4266  offset_,
4267  global_,
4268  local_,
4269  NULL, // bgaster_fixme - do we want to allow wait event lists?
4270  &event);
4271 
4272  return event;
4273 }
4274 
4275 template<class A1, class A2, class A3, class A4, class A5,
4276  class A6, class A7, class A8, class A9, class A10,
4277  class A11, class A12, class A13, class A14>
4279  const A1& a1,
4280  const A2& a2,
4281  const A3& a3,
4282  const A4& a4,
4283  const A5& a5,
4284  const A6& a6,
4285  const A7& a7,
4286  const A8& a8,
4287  const A9& a9,
4288  const A10& a10,
4289  const A11& a11,
4290  const A12& a12,
4291  const A13& a13,
4292  const A14& a14,
4293  const VECTOR_CLASS<Event>* )
4294 {
4295  Event event;
4296 
4297  kernel_.setArg(0,a1);
4298  kernel_.setArg(1,a2);
4299  kernel_.setArg(2,a3);
4300  kernel_.setArg(3,a4);
4301  kernel_.setArg(4,a5);
4302  kernel_.setArg(5,a6);
4303  kernel_.setArg(6,a7);
4304  kernel_.setArg(7,a8);
4305  kernel_.setArg(8,a9);
4306  kernel_.setArg(9,a10);
4307  kernel_.setArg(10,a11);
4308  kernel_.setArg(11,a12);
4309  kernel_.setArg(12,a13);
4310  kernel_.setArg(13,a14);
4311 
4312  err_ = queue_.enqueueNDRangeKernel(
4313  kernel_,
4314  offset_,
4315  global_,
4316  local_,
4317  NULL, // bgaster_fixme - do we want to allow wait event lists?
4318  &event);
4319 
4320  return event;
4321 }
4322 
4323 template<class A1, class A2, class A3, class A4, class A5,
4324  class A6, class A7, class A8, class A9, class A10,
4325  class A11, class A12, class A13, class A14, class A15>
4327  const A1& a1,
4328  const A2& a2,
4329  const A3& a3,
4330  const A4& a4,
4331  const A5& a5,
4332  const A6& a6,
4333  const A7& a7,
4334  const A8& a8,
4335  const A9& a9,
4336  const A10& a10,
4337  const A11& a11,
4338  const A12& a12,
4339  const A13& a13,
4340  const A14& a14,
4341  const A15& a15,
4342  const VECTOR_CLASS<Event>* )
4343 {
4344  Event event;
4345 
4346  kernel_.setArg(0,a1);
4347  kernel_.setArg(1,a2);
4348  kernel_.setArg(2,a3);
4349  kernel_.setArg(3,a4);
4350  kernel_.setArg(4,a5);
4351  kernel_.setArg(5,a6);
4352  kernel_.setArg(6,a7);
4353  kernel_.setArg(7,a8);
4354  kernel_.setArg(8,a9);
4355  kernel_.setArg(9,a10);
4356  kernel_.setArg(10,a11);
4357  kernel_.setArg(11,a12);
4358  kernel_.setArg(12,a13);
4359  kernel_.setArg(13,a14);
4360  kernel_.setArg(14,a15);
4361 
4362  err_ = queue_.enqueueNDRangeKernel(
4363  kernel_,
4364  offset_,
4365  global_,
4366  local_,
4367  NULL, // bgaster_fixme - do we want to allow wait event lists?
4368  &event);
4369 
4370  return event;
4371 }
4372 
4373 #undef __ERR_STR
4374 #if !defined(__CL_USER_OVERRIDE_ERROR_STRINGS)
4375 #undef __GET_DEVICE_INFO_ERR
4376 #undef __GET_PLATFORM_INFO_ERR
4377 #undef __GET_DEVICE_IDS_ERR
4378 #undef __GET_CONTEXT_INFO_ERR
4379 #undef __GET_EVENT_INFO_ERR
4380 #undef __GET_EVENT_PROFILE_INFO_ERR
4381 #undef __GET_MEM_OBJECT_INFO_ERR
4382 #undef __GET_IMAGE_INFO_ERR
4383 #undef __GET_SAMPLER_INFO_ERR
4384 #undef __GET_KERNEL_INFO_ERR
4385 #undef __GET_KERNEL_WORK_GROUP_INFO_ERR
4386 #undef __GET_PROGRAM_INFO_ERR
4387 #undef __GET_PROGRAM_BUILD_INFO_ERR
4388 #undef __GET_COMMAND_QUEUE_INFO_ERR
4389 
4390 #undef __CREATE_CONTEXT_ERR
4391 #undef __CREATE_CONTEXT_FROM_TYPE_ERR
4392 #undef __GET_SUPPORTED_IMAGE_FORMATS_ERR
4393 
4394 #undef __CREATE_BUFFER_ERR
4395 #undef __CREATE_SUBBUFFER_ERR
4396 #undef __CREATE_IMAGE2D_ERR
4397 #undef __CREATE_IMAGE3D_ERR
4398 #undef __CREATE_SAMPLER_ERR
4399 #undef __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR
4400 
4401 #undef __CREATE_USER_EVENT_ERR
4402 #undef __SET_USER_EVENT_STATUS_ERR
4403 #undef __SET_EVENT_CALLBACK_ERR
4404 
4405 #undef __WAIT_FOR_EVENTS_ERR
4406 
4407 #undef __CREATE_KERNEL_ERR
4408 #undef __SET_KERNEL_ARGS_ERR
4409 #undef __CREATE_PROGRAM_WITH_SOURCE_ERR
4410 #undef __CREATE_PROGRAM_WITH_BINARY_ERR
4411 #undef __BUILD_PROGRAM_ERR
4412 #undef __CREATE_KERNELS_IN_PROGRAM_ERR
4413 
4414 #undef __CREATE_COMMAND_QUEUE_ERR
4415 #undef __SET_COMMAND_QUEUE_PROPERTY_ERR
4416 #undef __ENQUEUE_READ_BUFFER_ERR
4417 #undef __ENQUEUE_WRITE_BUFFER_ERR
4418 #undef __ENQUEUE_READ_BUFFER_RECT_ERR
4419 #undef __ENQUEUE_WRITE_BUFFER_RECT_ERR
4420 #undef __ENQEUE_COPY_BUFFER_ERR
4421 #undef __ENQEUE_COPY_BUFFER_RECT_ERR
4422 #undef __ENQUEUE_READ_IMAGE_ERR
4423 #undef __ENQUEUE_WRITE_IMAGE_ERR
4424 #undef __ENQUEUE_COPY_IMAGE_ERR
4425 #undef __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR
4426 #undef __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR
4427 #undef __ENQUEUE_MAP_BUFFER_ERR
4428 #undef __ENQUEUE_MAP_IMAGE_ERR
4429 #undef __ENQUEUE_UNMAP_MEM_OBJECT_ERR
4430 #undef __ENQUEUE_NDRANGE_KERNEL_ERR
4431 #undef __ENQUEUE_TASK_ERR
4432 #undef __ENQUEUE_NATIVE_KERNEL
4433 
4434 #undef __UNLOAD_COMPILER_ERR
4435 #endif //__CL_USER_OVERRIDE_ERROR_STRINGS
4436 
4437 #undef __GET_INFO_HELPER_WITH_RETAIN
4438 
4439 // Extensions
4440 #undef __INIT_CL_EXT_FCN_PTR
4441 #undef __CREATE_SUB_DEVICES
4442 
4443 #if defined(USE_CL_DEVICE_FISSION)
4444 #undef __PARAM_NAME_DEVICE_FISSION
4445 #endif // USE_CL_DEVICE_FISSION
4446 
4447 } // namespace cl
4448 
4449 #endif // CL_HPP_
size_t image_depth
Definition: cl.h:101
#define CE_API
Definition: CE_API.h:10
struct _cl_device_id * cl_device_id
Definition: cl.h:40
cl_uint cl_device_info
Definition: cl.h:53
unsigned int capacity() const
Definition: cl.hpp:550
GLuint GLsizei const GLuint const GLintptr const GLsizeiptr * sizes
Definition: glcorearb.h:2620
vector()
Definition: cl.hpp:452
Memory()
Definition: cl.hpp:1801
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)
Definition: cl.hpp:2145
Image3D(const cl_mem &image3D)
Definition: cl.hpp:2301
GLint first
Definition: glcorearb.h:404
const T & front(void) const
Definition: cl.hpp:678
void push_back(const T &x)
Definition: cl.hpp:470
CL_API_ENTRY cl_int CL_API_CALL clGetEventProfilingInfo(cl_event, cl_profiling_info, size_t, void *, size_t *) CL_API_SUFFIX__VERSION_1_0
#define __GET_INFO_HELPER_WITH_RETAIN(CPP_TYPE)
Definition: cl.hpp:800
CL_API_ENTRY cl_int CL_API_CALL clRetainEvent(cl_event) CL_API_SUFFIX__VERSION_1_0
cl_int getInfo(cl_platform_info name, STRING_CLASS *param) const
Definition: cl.hpp:1367
Image2D(const cl_mem &image2D)
Definition: cl.hpp:2179
detail::param_traits< detail::cl_context_info, name >::param_type getInfo(cl_int *err=NULL) const
Definition: cl.hpp:1592
struct _cl_context * cl_context
Definition: cl.h:41
Memory & operator=(const Memory &rhs)
Definition: cl.hpp:1807
NDRange(::size_t size0,::size_t size1,::size_t size2)
Definition: cl.hpp:2480
int GLint
Definition: cl.hpp:165
static cl_int retain(cl_sampler sampler)
Definition: cl.hpp:1125
CL_API_ENTRY cl_int CL_API_CALL clReleaseMemObject(cl_mem) CL_API_SUFFIX__VERSION_1_0
CL_API_ENTRY cl_kernel CL_API_CALL clCreateKernel(cl_program, const char *, cl_int *) CL_API_SUFFIX__VERSION_1_0
CL_API_ENTRY cl_int CL_API_CALL clEnqueueReadBufferRect(cl_command_queue, cl_mem, cl_bool, const size_t *, const size_t *, const size_t *, size_t, size_t, size_t, size_t, void *, cl_uint, const cl_event *, cl_event *) CL_API_SUFFIX__VERSION_1_1
CL_API_ENTRY cl_int CL_API_CALL clEnqueueReadBuffer(cl_command_queue, cl_mem, cl_bool, size_t, size_t, void *, cl_uint, const cl_event *, cl_event *) CL_API_SUFFIX__VERSION_1_0
KernelFunctor & operator=(const KernelFunctor &rhs)
Definition: cl.hpp:3809
ImageFormat interface fro cl_image_format.
Definition: cl.hpp:1238
CL_API_ENTRY cl_int CL_API_CALL clReleaseKernel(cl_kernel) CL_API_SUFFIX__VERSION_1_0
::size_t length(void) const
Definition: cl.hpp:417
Memory(const Memory &memory)
Definition: cl.hpp:1803
CL_API_ENTRY void *CL_API_CALL clEnqueueMapImage(cl_command_queue, cl_mem, cl_bool, cl_map_flags, const size_t *, const size_t *, size_t *, size_t *, cl_uint, const cl_event *, cl_event *, cl_int *) CL_API_SUFFIX__VERSION_1_0
CL_API_ENTRY cl_int CL_API_CALL clGetGLObjectInfo(cl_mem, cl_gl_object_type *, cl_GLuint *) CL_API_SUFFIX__VERSION_1_0
cl_uint cl_mem_object_type
Definition: cl.h:68
cl_uint cl_program_build_info
Definition: cl.h:78
Image & operator=(const Image &rhs)
Definition: cl.hpp:2102
cl_uint cl_addressing_mode
Definition: cl.h:73
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)
Definition: cl.hpp:1541
CL_API_ENTRY cl_command_queue CL_API_CALL clCreateCommandQueue(cl_context, cl_device_id, cl_command_queue_properties, cl_int *) CL_API_SUFFIX__VERSION_1_0
static iterator end(vector< T, N > &vec)
Definition: cl.hpp:608
CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL clEnqueueMarker(cl_command_queue, cl_event *) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
CL_API_ENTRY cl_program CL_API_CALL clCreateProgramWithSource(cl_context, cl_uint, const char **, const size_t *, cl_int *) CL_API_SUFFIX__VERSION_1_0
static cl_int release(cl_kernel kernel)
Definition: cl.hpp:1145
static cl_int retain(cl_command_queue queue)
Definition: cl.hpp:1107
CommandQueue(const CommandQueue &commandQueue)
Definition: cl.hpp:2861
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:3247
cl_int getBuildInfo(const Device &device, cl_program_build_info name, T *param) const
Definition: cl.hpp:2760
KernelFunctor(const Kernel &kernel, const CommandQueue &queue, const NDRange &offset, const NDRange &global, const NDRange &local)
Definition: cl.hpp:3575
cl_int getSupportedImageFormats(cl_mem_flags flags, cl_mem_object_type type, VECTOR_CLASS< ImageFormat > *formats) const
Definition: cl.hpp:1603
CL_API_ENTRY cl_int CL_API_CALL clGetDeviceInfo(cl_device_id, cl_device_info, size_t, void *, size_t *) CL_API_SUFFIX__VERSION_1_0
cl_int getInfo(cl_mem_info name, T *param) const
Definition: cl.hpp:1822
CL_API_ENTRY cl_int CL_API_CALL clRetainMemObject(cl_mem) CL_API_SUFFIX__VERSION_1_0
detail::param_traits< detail::cl_device_info, name >::param_type getInfo(cl_int *err=NULL) const
Definition: cl.hpp:1294
Local address raper for use with Kernel::setArg.
Definition: cl.hpp:2498
CL_API_ENTRY cl_int CL_API_CALL clReleaseProgram(cl_program) CL_API_SUFFIX__VERSION_1_0
detail::param_traits< detail::cl_kernel_work_group_info, name >::param_type getWorkGroupInfo(const Device &device, cl_int *err=NULL) const
Definition: cl.hpp:2592
GLuint start
Definition: glcorearb.h:474
GLsizei const GLchar *const * string
Definition: glcorearb.h:813
png_voidp ptr
Definition: png.h:2145
BufferGL(const BufferGL &buffer)
Definition: cl.hpp:2007
cl_uint cl_context_info
Definition: cl.h:63
cl_bitfield cl_map_flags
Definition: cl.h:76
static cl_int release(cl_mem memory)
Definition: cl.hpp:1118
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:3222
CL_API_ENTRY cl_int CL_API_CALL clReleaseSampler(cl_sampler) CL_API_SUFFIX__VERSION_1_0
LocalSpaceArg __local(::size_t size)
Definition: cl.hpp:2523
#define CL_PLATFORM_ICD_SUFFIX_KHR
Definition: cl_ext.h:102
CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL clUnloadCompiler(void) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
cl_int getInfo(cl_program_info name, T *param) const
Definition: cl.hpp:2739
::size_t size(const LocalSpaceArg &value)
Definition: cl.hpp:2515
Memory interface for cl_mem.
Definition: cl.hpp:1798
cl_uint cl_program_info
Definition: cl.h:77
CommandQueue(const cl_command_queue &commandQueue)
Definition: cl.hpp:2863
cl_int getInfo(cl_sampler_info name, T *param) const
Definition: cl.hpp:2426
cl_int enqueueWaitForEvents(const VECTOR_CLASS< Event > &events) const
Definition: cl.hpp:3405
Program(const cl_program &program)
Definition: cl.hpp:2704
cl_uint cl_channel_order
Definition: cl.h:65
CL_API_ENTRY cl_mem CL_API_CALL clCreateBuffer(cl_context, cl_mem_flags, size_t, void *, cl_int *) CL_API_SUFFIX__VERSION_1_0
detail::param_traits< detail::cl_program_info, name >::param_type getInfo(cl_int *err=NULL) const
Definition: cl.hpp:2748
GLbitfield flags
Definition: glcorearb.h:1595
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)
Definition: cl.hpp:2262
Kernel(const Kernel &kernel)
Definition: cl.hpp:2541
void operator--(int x)
Definition: cl.hpp:647
Image3D(const Image3D &image3D)
Definition: cl.hpp:2299
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:2926
static cl_int retain(cl_device_id)
Definition: cl.hpp:1077
Buffer(const Context &context, cl_mem_flags flags,::size_t size, void *host_ptr=NULL, cl_int *err=NULL)
Definition: cl.hpp:1866
unsigned int GLuint
Definition: cl.hpp:167
CL_API_ENTRY cl_int CL_API_CALL clReleaseContext(cl_context) CL_API_SUFFIX__VERSION_1_0
T & front(void)
Definition: cl.hpp:668
string(char *str)
Definition: cl.hpp:367
CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL clCreateImage2D(cl_context, cl_mem_flags, const cl_image_format *, size_t, size_t, size_t, void *, cl_int *) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
unsigned int GLenum
Definition: cl.hpp:166
CL_API_ENTRY cl_int CL_API_CALL clEnqueueNDRangeKernel(cl_command_queue, cl_kernel, cl_uint, const size_t *, const size_t *, const size_t *, cl_uint, const cl_event *, cl_event *) CL_API_SUFFIX__VERSION_1_0
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:2951
vector(unsigned int size, const T &val=T())
Definition: cl.hpp:499
cl_uint cl_d3d10_device_source_khr
Definition: cl_d3d10.h:41
Event()
Definition: cl.hpp:1646
CL_API_ENTRY cl_mem CL_API_CALL clCreateFromGLRenderbuffer(cl_context, cl_mem_flags, cl_GLuint, cl_int *) CL_API_SUFFIX__VERSION_1_0
#define CL_PROGRAM_BINARIES
Definition: cl.h:455
GLuint sampler
Definition: glcorearb.h:1655
CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL clCreateImage3D(cl_context, cl_mem_flags, const cl_image_format *, size_t, size_t, size_t, size_t, size_t, void *, cl_int *) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
VECTOR_CLASS< std::pair< const void *,::size_t > > Binaries
Definition: cl.hpp:2642
GLuint * ids
Definition: glcorearb.h:651
Image3D & operator=(const Image3D &rhs)
Definition: cl.hpp:2303
CL_API_ENTRY cl_int CL_API_CALL clBuildProgram(cl_program, cl_uint, const cl_device_id *, const char *, void(CL_CALLBACK *)(cl_program, void *), void *) CL_API_SUFFIX__VERSION_1_0
CL_API_ENTRY cl_program CL_API_CALL clCreateProgramWithBinary(cl_context, cl_uint, const cl_device_id *, const size_t *, const unsigned char **, cl_int *, cl_int *) CL_API_SUFFIX__VERSION_1_0
cl_int getDevices(cl_device_type type, VECTOR_CLASS< Device > *devices) const
Definition: cl.hpp:1387
CL_API_ENTRY cl_int CL_API_CALL clRetainProgram(cl_program) CL_API_SUFFIX__VERSION_1_0
#define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV
Definition: cl_ext.h:169
GLuint buffer
Definition: glcorearb.h:659
Image3D()
Definition: cl.hpp:2297
CommandQueue(const Context &context, const Device &device, cl_command_queue_properties properties=0, cl_int *err=NULL)
Definition: cl.hpp:2843
cl_uint cl_filter_mode
Definition: cl.h:74
png_uint_32 i
Definition: png.h:2877
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:3147
string(char *str,::size_t size)
Definition: cl.hpp:353
CL_API_ENTRY cl_int CL_API_CALL clGetEventInfo(cl_event, cl_event_info, size_t, void *, size_t *) CL_API_SUFFIX__VERSION_1_0
Kernel()
Definition: cl.hpp:2539
vector(const vector< T, N > &vec)
Definition: cl.hpp:490
Buffer(const Buffer &buffer)
Definition: cl.hpp:1884
static cl_int release(cl_sampler sampler)
Definition: cl.hpp:1127
bool operator!=(iterator i)
Definition: cl.hpp:627
static cl_int release(cl_program program)
Definition: cl.hpp:1136
Sampler()
Definition: cl.hpp:2384
CL_API_ENTRY cl_context CL_API_CALL clCreateContextFromType(const cl_context_properties *, cl_device_type, void(CL_CALLBACK *)(const char *, const void *, size_t, void *), void *, cl_int *) CL_API_SUFFIX__VERSION_1_0
GLsizeiptr size
Definition: glcorearb.h:663
CL_API_ENTRY cl_int CL_API_CALL clGetProgramBuildInfo(cl_program, cl_device_id, cl_program_build_info, size_t, void *, size_t *) CL_API_SUFFIX__VERSION_1_0
struct _cl_platform_id * cl_platform_id
Definition: cl.h:39
cl_uint cl_sampler_info
Definition: cl.h:75
CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL clEnqueueBarrier(cl_command_queue) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
GLint GLsizei width
Definition: glcorearb.h:102
png_bytepp image
Definition: png.h:1849
size_t image_row_pitch
Definition: cl.h:103
Image(const cl_mem &image)
Definition: cl.hpp:2100
bool operator==(vector< T, N > &vec)
Definition: cl.hpp:524
cl_channel_type image_channel_data_type
Definition: cl.h:94
cl_int finish() const
Definition: cl.hpp:3547
struct _cl_event * event
Definition: glcorearb.h:2960
CL_API_ENTRY cl_sampler CL_API_CALL clCreateSampler(cl_context, cl_bool, cl_addressing_mode, cl_filter_mode, cl_int *) CL_API_SUFFIX__VERSION_1_0
Device(const Device &device)
Definition: cl.hpp:1266
cl_int getError()
Definition: cl.hpp:3593
#define CL_API_ENTRY
Definition: cl_platform.h:43
cl_int release() const
Definition: cl.hpp:1209
cl_int getInfo(cl_event_info name, T *param) const
Definition: cl.hpp:1667
cl_uint cl_channel_type
Definition: cl.h:66
#define CL_DEVICE_INTEGRATED_MEMORY_NV
Definition: cl_ext.h:174
#define CL_DEVICE_REGISTERS_PER_BLOCK_NV
Definition: cl_ext.h:170
T & back(void)
Definition: cl.hpp:673
cl_int setArg(cl_uint index,::size_t size, void *argPtr)
Definition: cl.hpp:2615
cl_uint cl_platform_info
Definition: cl.h:52
cl_uint cl_command_queue_info
Definition: cl.h:64
Event interface for cl_event.
Definition: cl.hpp:1643
Program(const Context &context, const Sources &sources, cl_int *err=NULL)
Definition: cl.hpp:2645
CL_API_ENTRY cl_int CL_API_CALL clGetCommandQueueInfo(cl_command_queue, cl_command_queue_info, size_t, void *, size_t *) CL_API_SUFFIX__VERSION_1_0
Buffer & operator=(const Buffer &rhs)
Definition: cl.hpp:1888
GLdouble n
Definition: glcorearb.h:2007
GLsizei GLenum * sources
Definition: glcorearb.h:2541
cl_int getImageInfo(cl_image_info name, T *param) const
Definition: cl.hpp:2118
GLfloat f
Definition: glcorearb.h:1925
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:2670
string(const string &rhs)
Definition: cl.hpp:404
cl_int getObjectInfo(cl_gl_object_type *type, GLuint *gl_object_name)
Definition: cl.hpp:2080
CL_API_ENTRY cl_mem CL_API_CALL clCreateFromGLTexture(cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int *) CL_API_SUFFIX__VERSION_1_2
Image3DGL(const Image3DGL &image)
Definition: cl.hpp:2359
CL_API_ENTRY cl_int CL_API_CALL clSetUserEventStatus(cl_event, cl_int) CL_API_SUFFIX__VERSION_1_1
string & operator=(const string &rhs)
Definition: cl.hpp:380
CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL clEnqueueWaitForEvents(cl_command_queue, cl_uint, const cl_event *) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
GLint GLint GLsizei GLsizei GLsizei depth
Definition: glcorearb.h:475
CL_API_ENTRY cl_int CL_API_CALL clGetContextInfo(cl_context, cl_context_info, size_t, void *, size_t *) CL_API_SUFFIX__VERSION_1_0
#define CL_SUCCESS
Definition: cl.h:119
static cl_int retain(cl_program program)
Definition: cl.hpp:1134
Image2DGL(const Context &context, cl_mem_flags flags, GLenum target, GLint miplevel, GLuint texobj, cl_int *err=NULL)
Definition: cl.hpp:2202
BufferGL(const Context &context, cl_mem_flags flags, GLuint bufobj, cl_int *err=NULL)
Definition: cl.hpp:1986
CL_API_ENTRY cl_int CL_API_CALL clSetMemObjectDestructorCallback(cl_mem, void(CL_CALLBACK *)(cl_mem, void *), void *) CL_API_SUFFIX__VERSION_1_1
cl_uint cl_d3d10_device_set_khr
Definition: cl_d3d10.h:42
cl_bitfield cl_device_type
Definition: cl.h:51
Buffer()
Definition: cl.hpp:1882
#define VECTOR_CLASS
Definition: cl.hpp:431
const T & back(void) const
Definition: cl.hpp:683
CL_API_ENTRY cl_int CL_API_CALL clEnqueueCopyImageToBuffer(cl_command_queue, cl_mem, cl_mem, const size_t *, const size_t *, size_t, cl_uint, const cl_event *, cl_event *) CL_API_SUFFIX__VERSION_1_0
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:3120
#define CL_CALLBACK
Definition: cl.hpp:170
static cl_int retain(cl_mem memory)
Definition: cl.hpp:1116
const Arg0 & arg0_
Definition: cl.hpp:1036
CL_API_ENTRY cl_mem CL_API_CALL clCreateFromGLBuffer(cl_context, cl_mem_flags, cl_GLuint, int *) CL_API_SUFFIX__VERSION_1_0
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:3197
CL_API_ENTRY cl_int CL_API_CALL clReleaseEvent(cl_event) CL_API_SUFFIX__VERSION_1_0
CL_API_ENTRY cl_int CL_API_CALL clFinish(cl_command_queue) CL_API_SUFFIX__VERSION_1_0
static cl_int retain(cl_kernel kernel)
Definition: cl.hpp:1143
CL_API_ENTRY void *CL_API_CALL clEnqueueMapBuffer(cl_command_queue, cl_mem, cl_bool, cl_map_flags, size_t, size_t, cl_uint, const cl_event *, cl_event *, cl_int *) CL_API_SUFFIX__VERSION_1_0
static cl_int get(Functor f, cl_uint name, T *param)
Definition: cl.hpp:704
CL_API_ENTRY cl_int CL_API_CALL clEnqueueUnmapMemObject(cl_command_queue, cl_mem, void *, cl_uint, const cl_event *, cl_event *) CL_API_SUFFIX__VERSION_1_0
detail::param_traits< detail::cl_event_info, name >::param_type getInfo(cl_int *err=NULL) const
Definition: cl.hpp:1676
Image()
Definition: cl.hpp:2096
#define CL_EXT_SUFFIX__VERSION_1_1
Definition: cl_platform.h:75
CL_API_ENTRY cl_int CL_API_CALL clEnqueueWriteBuffer(cl_command_queue, cl_mem, cl_bool, size_t, size_t, const void *, cl_uint, const cl_event *, cl_event *) CL_API_SUFFIX__VERSION_1_0
CL_API_ENTRY cl_int CL_API_CALL clRetainCommandQueue(cl_command_queue) CL_API_SUFFIX__VERSION_1_0
Program()
Definition: cl.hpp:2700
struct _cl_kernel * cl_kernel
Definition: cl.h:45
CL_API_ENTRY cl_mem CL_API_CALL clCreateImage(cl_context, cl_mem_flags, const cl_image_format *, const cl_image_desc *, void *, cl_int *) CL_API_SUFFIX__VERSION_1_2
cl_int getProfilingInfo(cl_profiling_info name, T *param) const
Definition: cl.hpp:1688
detail::param_traits< detail::cl_mem_info, name >::param_type getInfo(cl_int *err=NULL) const
Definition: cl.hpp:1831
CL_API_ENTRY cl_int CL_API_CALL clGetDeviceIDs(cl_platform_id, cl_device_type, cl_uint, cl_device_id *, cl_uint *) CL_API_SUFFIX__VERSION_1_0
iterator end(void)
Definition: cl.hpp:663
CL_API_ENTRY cl_int CL_API_CALL clSetEventCallback(cl_event, cl_int, void(CL_CALLBACK *)(cl_event, cl_int, void *), void *) CL_API_SUFFIX__VERSION_1_1
GLuint GLuint end
Definition: glcorearb.h:474
cl_bitfield cl_command_queue_properties
Definition: cl.h:58
CL_API_ENTRY cl_int CL_API_CALL clGetImageInfo(cl_mem, cl_image_info, size_t, void *, size_t *) CL_API_SUFFIX__VERSION_1_0
Image2D()
Definition: cl.hpp:2175
GLintptr offset
Definition: glcorearb.h:664
T & operator[](int index)
Definition: cl.hpp:555
cl_int enqueueBarrier() const
Definition: cl.hpp:3534
CL_API_ENTRY cl_int CL_API_CALL clEnqueueTask(cl_command_queue, cl_kernel, cl_uint, const cl_event *, cl_event *) CL_API_SUFFIX__VERSION_1_0
CL_API_ENTRY cl_int CL_API_CALL clEnqueueBarrierWithWaitList(cl_command_queue, cl_uint, const cl_event *, cl_event *) CL_API_SUFFIX__VERSION_1_2
BufferRenderGL(const BufferGL &buffer)
Definition: cl.hpp:2062
cl_int operator()(cl_uint param,::size_t size, void *value,::size_t *size_ret)
Definition: cl.hpp:1046
std::string STRING_CLASS
Definition: cl.hpp:424
void operator--()
Definition: cl.hpp:642
static cl_int release(cl_platform_id)
Definition: cl.hpp:1091
detail::param_traits< detail::cl_image_info, name >::param_type getImageInfo(cl_int *err=NULL) const
Definition: cl.hpp:2127
~vector()
Definition: cl.hpp:457
BufferRenderGL(const Context &context, cl_mem_flags flags, GLuint bufobj, cl_int *err=NULL)
Definition: cl.hpp:2041
#define CL_PROGRAM_BINARY_SIZES
Definition: cl.h:454
cl_uint cl_event_info
Definition: cl.h:87
Platform(const cl_platform_id &platform)
Definition: cl.hpp:1351
Sampler(const cl_sampler &sampler)
Definition: cl.hpp:2409
GLenum target
Definition: glcorearb.h:1666
Image2D(const Image2D &image2D)
Definition: cl.hpp:2177
#define CL_INVALID_PLATFORM
Definition: cl.h:142
cl_channel_order image_channel_order
Definition: cl.h:93
Device(const cl_device_id &device)
Definition: cl.hpp:1268
GLenum GLsizei GLsizei GLint * values
Definition: glcorearb.h:1601
Image2DGL(const cl_mem &image)
Definition: cl.hpp:2239
cl_int getWorkGroupInfo(const Device &device, cl_kernel_work_group_info name, T *param) const
Definition: cl.hpp:2581
Sampler(const Sampler &sampler)
Definition: cl.hpp:2407
#define CL_DEVICE_GPU_OVERLAP_NV
Definition: cl_ext.h:172
CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL clCreateFromGLTexture2D(cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int *) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
CL_API_ENTRY cl_int CL_API_CALL clEnqueueReleaseGLObjects(cl_command_queue, cl_uint, const cl_mem *, cl_uint, const cl_event *, cl_event *) CL_API_SUFFIX__VERSION_1_0
struct _cl_mem * cl_mem
Definition: cl.h:43
cl_int enqueueMarker(Event *event=NULL) const
Definition: cl.hpp:3398
GLboolean * data
Definition: glcorearb.h:130
Image3DGL(const cl_mem &image)
Definition: cl.hpp:2361
CL_API_ENTRY cl_int CL_API_CALL clSetKernelArg(cl_kernel, cl_uint, size_t, const void *) CL_API_SUFFIX__VERSION_1_0
CL_API_ENTRY cl_int CL_API_CALL clGetPlatformIDs(cl_uint, cl_platform_id *, cl_uint *) CL_API_SUFFIX__VERSION_1_0
CL_API_ENTRY cl_int CL_API_CALL clEnqueueCopyBufferRect(cl_command_queue, cl_mem, cl_mem, const size_t *, const size_t *, const size_t *, size_t, size_t, size_t, size_t, cl_uint, const cl_event *, cl_event *) CL_API_SUFFIX__VERSION_1_1
GLuint const GLchar * name
Definition: glcorearb.h:785
GLsizei const GLchar *const * strings
Definition: glcorearb.h:1932
cl_int enqueueNDRangeKernel(const Kernel &kernel, const NDRange &offset, const NDRange &global, const NDRange &local, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
Definition: cl.hpp:3297
cl_uint cl_mem_info
Definition: cl.h:69
static void * ptr(LocalSpaceArg &)
Definition: cl.hpp:2516
unsigned int size(void) const
Definition: cl.hpp:459
BufferGL(const cl_mem &buffer)
Definition: cl.hpp:2009
CL_API_ENTRY cl_context CL_API_CALL clCreateContext(const cl_context_properties *, cl_uint, const cl_device_id *, void(CL_CALLBACK *)(const char *, const void *, size_t, void *), void *, cl_int *) CL_API_SUFFIX__VERSION_1_0
NDRange()
Definition: cl.hpp:2463
detail::param_traits< detail::cl_kernel_info, name >::param_type getInfo(cl_int *err=NULL) const
Definition: cl.hpp:2569
VECTOR_CLASS< std::pair< const char *,::size_t > > Sources
Definition: cl.hpp:2643
CL_API_ENTRY cl_int CL_API_CALL clRetainKernel(cl_kernel) CL_API_SUFFIX__VERSION_1_0
CL_API_ENTRY cl_int CL_API_CALL clRetainSampler(cl_sampler) CL_API_SUFFIX__VERSION_1_0
CL_API_ENTRY cl_int CL_API_CALL clEnqueueWriteBufferRect(cl_command_queue, cl_mem, cl_bool, const size_t *, const size_t *, const size_t *, size_t, size_t, size_t, size_t, const void *, cl_uint, const cl_event *, cl_event *) CL_API_SUFFIX__VERSION_1_1
Fixed sized vector implementation that mirroring std::vector functionality.
Definition: cl.hpp:445
Platform interface.
Definition: cl.hpp:1342
struct _cl_sampler * cl_sampler
Definition: cl.h:47
Context(const Context &context)
Definition: cl.hpp:1564
size_t image_width
Definition: cl.h:99
Buffer(const cl_mem &buffer)
Definition: cl.hpp:1886
#define __PARAM_NAME_INFO_1_0(F)
Definition: cl.hpp:818
GLint GLsizei GLsizei height
Definition: glcorearb.h:102
Program(const Program &program)
Definition: cl.hpp:2702
cl_type operator()() const
Definition: cl.hpp:1198
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:3343
Memory(const cl_mem &memory)
Definition: cl.hpp:1805
CL_API_ENTRY cl_int CL_API_CALL clGetSupportedImageFormats(cl_context, cl_mem_flags, cl_mem_object_type, cl_uint, cl_image_format *, cl_uint *) CL_API_SUFFIX__VERSION_1_0
Image2DGL(const Image2DGL &image)
Definition: cl.hpp:2237
CL_API_ENTRY cl_int CL_API_CALL clGetPlatformInfo(cl_platform_id, cl_platform_info, size_t, void *, size_t *) CL_API_SUFFIX__VERSION_1_0
CL_API_ENTRY cl_int CL_API_CALL clGetSamplerInfo(cl_sampler, cl_sampler_info, size_t, void *, size_t *) CL_API_SUFFIX__VERSION_1_0
CL_API_ENTRY cl_int CL_API_CALL clGetProgramInfo(cl_program, cl_program_info, size_t, void *, size_t *) CL_API_SUFFIX__VERSION_1_0
#define CL_DEVICE_WARP_SIZE_NV
Definition: cl_ext.h:171
GLint GLint GLsizei GLint GLenum format
Definition: glcorearb.h:107
detail::param_traits< detail::cl_sampler_info, name >::param_type getInfo(cl_int *err=NULL) const
Definition: cl.hpp:2435
Platform(const Platform &platform)
Definition: cl.hpp:1349
CL_API_ENTRY cl_int CL_API_CALL clFlush(cl_command_queue) CL_API_SUFFIX__VERSION_1_0
GLenum GLenum dst
Definition: glcorearb.h:1792
GLsizei const GLfloat * value
Definition: glcorearb.h:823
cl_int wait() const
Definition: cl.hpp:1708
#define __INIT_CL_EXT_FCN_PTR(name)
Definition: cl.hpp:196
CommandQueue interface for cl_command_queue.
Definition: cl.hpp:2840
cl_int getInfo(Func f, cl_uint name, T *param)
Definition: cl.hpp:1028
cl_int getInfo(Func f, const Arg0 &arg0, const Arg1 &arg1, cl_uint name, T *param)
Definition: cl.hpp:1062
Context(const cl_context &context)
Definition: cl.hpp:1566
GLenum GLfloat param
Definition: glcorearb.h:103
Sampler(const Context &context, cl_bool normalized_coords, cl_addressing_mode addressing_mode, cl_filter_mode filter_mode, cl_int *err=NULL)
Definition: cl.hpp:2386
unsigned int max_size(void) const
Definition: cl.hpp:545
const char * c_str(void) const
Definition: cl.hpp:419
vector< T, N > & operator=(const vector< T, N > &rhs)
Definition: cl.hpp:508
cl_uint cl_image_info
Definition: cl.h:71
cl_int enqueueUnmapMemObject(const Memory &memory, void *mapped_ptr, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
Definition: cl.hpp:3276
typedef int
Definition: png.h:1175
static cl_int release(cl_command_queue queue)
Definition: cl.hpp:1109
ImageFormat(cl_channel_order order, cl_channel_type type)
Definition: cl.hpp:1242
intptr_t cl_context_properties
Definition: cl.h:62
Wrapper(const cl_type &obj)
Definition: cl.hpp:1170
struct _cl_event * cl_event
Definition: cl.h:46
class CE_API KernelFunctor
Definition: cl.hpp:2529
cl_int getObjectInfo(cl_gl_object_type *type, GLuint *gl_object_name)
Definition: cl.hpp:2025
struct _cl_command_queue * cl_command_queue
Definition: cl.h:42
void pop_back(void)
Definition: cl.hpp:479
#define CL_PROGRAM_NUM_DEVICES
Definition: cl.h:451
CL_API_ENTRY cl_int CL_API_CALL clEnqueueCopyBufferToImage(cl_command_queue, cl_mem, cl_mem, size_t, const size_t *, const size_t *, cl_uint, const cl_event *, cl_event *) CL_API_SUFFIX__VERSION_1_0
bool operator==(iterator i)
Definition: cl.hpp:620
cl_int createKernels(VECTOR_CLASS< Kernel > *kernels)
Definition: cl.hpp:2782
GLuint index
Definition: glcorearb.h:785
Event(const Event &event)
Definition: cl.hpp:1648
cl_int operator()(cl_uint param,::size_t size, void *value,::size_t *size_ret)
Definition: cl.hpp:1037
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:2720
CL_API_ENTRY cl_event CL_API_CALL clCreateUserEvent(cl_context, cl_int *) CL_API_SUFFIX__VERSION_1_1
cl_int getInfo(cl_device_info name, T *param) const
Definition: cl.hpp:1285
CL_API_ENTRY cl_int CL_API_CALL clWaitForEvents(cl_uint, const cl_event *) CL_API_SUFFIX__VERSION_1_0
Image3DGL(const Context &context, cl_mem_flags flags, GLenum target, GLint miplevel, GLuint texobj, cl_int *err=NULL)
Definition: cl.hpp:2324
GLint GLenum GLint x
Definition: glcorearb.h:408
void assign(I start, I end)
Definition: cl.hpp:566
GLuint GLfloat * val
Definition: glcorearb.h:1607
#define CL_INVALID_DEVICE
Definition: cl.h:143
CL_API_ENTRY cl_int CL_API_CALL clEnqueueNativeKernel(cl_command_queue, void(CL_CALLBACK *)(void *), void *, size_t, cl_uint, const cl_mem *, const void **, cl_uint, const cl_event *, cl_event *) CL_API_SUFFIX__VERSION_1_0
Sampler interface for cl_sampler.
Definition: cl.hpp:2381
static cl_int retain(cl_event event)
Definition: cl.hpp:1152
CL_API_ENTRY cl_int CL_API_CALL clGetMemObjectInfo(cl_mem, cl_mem_info, size_t, void *, size_t *) CL_API_SUFFIX__VERSION_1_0
Kernel functor interface.
Definition: cl.hpp:3562
detail::param_traits< detail::cl_program_build_info, name >::param_type getBuildInfo(const Device &device, cl_int *err=NULL) const
Definition: cl.hpp:2771
::size_t size(void) const
Definition: cl.hpp:416
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:3172
Wrapper(const Wrapper< cl_type > &rhs)
Definition: cl.hpp:1177
GA_API const UT_StringHolder N
Base class interface for all images.
Definition: cl.hpp:2093
cl_int retain() const
Definition: cl.hpp:1204
Wrapper< cl_type > & operator=(const Wrapper< cl_type > &rhs)
Definition: cl.hpp:1183
~string()
Definition: cl.hpp:409
cl_int getInfo(cl_context_info name, T *param) const
Definition: cl.hpp:1583
static cl_int release(cl_event event)
Definition: cl.hpp:1154
#define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV
Definition: cl_ext.h:173
cl_int flush() const
Definition: cl.hpp:3542
Memory buffer interface.
Definition: cl.hpp:1863
CL_API_ENTRY cl_int CL_API_CALL clEnqueueAcquireGLObjects(cl_command_queue, cl_uint, const cl_mem *, cl_uint, const cl_event *, cl_event *) CL_API_SUFFIX__VERSION_1_0
BufferRenderGL(const cl_mem &buffer)
Definition: cl.hpp:2064
CL_API_ENTRY cl_int CL_API_CALL clEnqueueWriteImage(cl_command_queue, cl_mem, cl_bool, const size_t *, const size_t *, size_t, size_t, const void *, cl_uint, const cl_event *, cl_event *) CL_API_SUFFIX__VERSION_1_0
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
NDRange interface.
Definition: cl.hpp:2456
Image interface for 2D images.
Definition: cl.hpp:2142
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:2901
NDRange(::size_t size0)
Definition: cl.hpp:2467
CL_API_ENTRY cl_int CL_API_CALL clRetainContext(cl_context) CL_API_SUFFIX__VERSION_1_0
::size_t size(const T &)
Definition: cl.hpp:2508
size_t image_height
Definition: cl.h:100
CL_API_ENTRY cl_int CL_API_CALL clEnqueueCopyImage(cl_command_queue, cl_mem, cl_mem, const size_t *, const size_t *, const size_t *, cl_uint, const cl_event *, cl_event *) CL_API_SUFFIX__VERSION_1_0
cl_int setArg(cl_uint index, T value)
Definition: cl.hpp:2604
cl_uint cl_kernel_work_group_info
Definition: cl.h:86
CL_API_ENTRY cl_int CL_API_CALL clEnqueueMarkerWithWaitList(cl_command_queue, cl_uint, const cl_event *, cl_event *) CL_API_SUFFIX__VERSION_1_2
cl_int getInfo(cl_kernel_info name, T *param) const
Definition: cl.hpp:2560
Kernel interface that implements cl_kernel.
Definition: cl.hpp:2534
#define CL_API_CALL
Definition: cl_platform.h:44
Event(const cl_event &event)
Definition: cl.hpp:1650
Image interface for 3D images.
Definition: cl.hpp:2259
Memory buffer interface for GL interop with renderbuffer.
Definition: cl.hpp:2038
KernelFunctor bind(const CommandQueue &queue, const NDRange &offset, const NDRange &global, const NDRange &local)
Definition: cl.hpp:3792
if(rank==1) return rank
detail::param_traits< detail::cl_profiling_info, name >::param_type getProfilingInfo(cl_int *err=NULL) const
Definition: cl.hpp:1697
cl_uint cl_buffer_create_type
Definition: cl.h:72
cl_int enqueueAcquireGLObjects(const VECTOR_CLASS< Memory > *mem_objects=NULL, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
Definition: cl.hpp:3416
CL_API_ENTRY cl_mem CL_API_CALL clCreateSubBuffer(cl_mem, cl_mem_flags, cl_buffer_create_type, const void *, cl_int *) CL_API_SUFFIX__VERSION_1_1
struct _cl_program * cl_program
Definition: cl.h:44
NDRange(::size_t size0,::size_t size1)
Definition: cl.hpp:2473
cl_uint cl_kernel_info
Definition: cl.h:81
#define const
Definition: zconf.h:214
CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL clCreateFromGLTexture3D(cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int *) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED
#define __CL_DECLARE_PARAM_TRAITS(token, param_name, T)
Definition: cl.hpp:976
Device()
Definition: cl.hpp:1264
void operator++()
Definition: cl.hpp:632
CL_API_ENTRY cl_int CL_API_CALL clEnqueueCopyBuffer(cl_command_queue, cl_mem, cl_mem, size_t, size_t, size_t, cl_uint, const cl_event *, cl_event *) CL_API_SUFFIX__VERSION_1_0
#define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV
Definition: cl_ext.h:168
Context()
Definition: cl.hpp:1562
size_t image_slice_pitch
Definition: cl.h:104
Event operator()(const VECTOR_CLASS< Event > *events=NULL)
Definition: cl.hpp:3833
Device interface for cl_device_id.
Definition: cl.hpp:1261
Event & operator=(const Event &rhs)
Definition: cl.hpp:1652
iterator begin(void)
Definition: cl.hpp:658
#define CL_DEVICE_PROFILING_TIMER_OFFSET_AMD
Definition: cl_ext.h:179
cl_int enqueueTask(const Kernel &kernel, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
Definition: cl.hpp:3323
BufferGL()
Definition: cl.hpp:2005
bool empty(void) const
Definition: cl.hpp:540
CL_API_ENTRY cl_int CL_API_CALL clReleaseCommandQueue(cl_command_queue) CL_API_SUFFIX__VERSION_1_0
cl_int enqueueReleaseGLObjects(const VECTOR_CLASS< Memory > *mem_objects=NULL, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
Definition: cl.hpp:3438
static cl_int waitForEvents(const VECTOR_CLASS< Event > &events)
Definition: cl.hpp:1732
::size_t dimensions() const
Definition: cl.hpp:2489
::size_t size_
Definition: cl.hpp:2500
Program interface that implements cl_program.
Definition: cl.hpp:2639
detail::param_traits< detail::cl_command_queue_info, name >::param_type getInfo(cl_int *err=NULL) const
Definition: cl.hpp:2890
static T * ptr(T &value)
Definition: cl.hpp:2509
static cl_int retain(cl_platform_id)
Definition: cl.hpp:1088
cl_int getInfo(cl_command_queue_info name, T *param) const
Definition: cl.hpp:2880
static cl_int retain(cl_context context)
Definition: cl.hpp:1098
size_t class used to interface between C++ and OpenCL C calls that require arrays of size_t values...
Definition: cl.hpp:695
static cl_int release(cl_device_id)
Definition: cl.hpp:1080
Simple string class, that provides a limited subset of std::string functionality but avoids many of t...
Definition: cl.hpp:343
CL_API_ENTRY cl_int CL_API_CALL clGetKernelInfo(cl_kernel, cl_kernel_info, size_t, void *, size_t *) CL_API_SUFFIX__VERSION_1_0
cl_uint cl_gl_object_type
Definition: cl_gl.h:37
CL_API_ENTRY cl_int CL_API_CALL clUnloadPlatformCompiler(cl_platform_id) CL_API_SUFFIX__VERSION_1_2
GLbitfield GLuint program
Definition: glcorearb.h:1930
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)
Definition: cl.hpp:1518
cl_uint cl_bool
Definition: cl.h:49
Memory buffer interface for GL interop.
Definition: cl.hpp:1983
Kernel(const cl_kernel &kernel)
Definition: cl.hpp:2543
2D image interface for GL interop.
Definition: cl.hpp:2199
cl_bitfield cl_mem_flags
Definition: cl.h:67
static iterator begin(vector< T, N > &vec)
Definition: cl.hpp:595
void clear()
Definition: cl.hpp:464
const Arg1 & arg1_
Definition: cl.hpp:1045
static cl_int release(cl_context context)
Definition: cl.hpp:1100
const Arg0 & arg0_
Definition: cl.hpp:1045
Platform()
Definition: cl.hpp:1347
cl_type object_
Definition: cl.hpp:1165
Image2D & operator=(const Image2D &rhs)
Definition: cl.hpp:2181
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:3093
ImageFormat & operator=(const ImageFormat &rhs)
Definition: cl.hpp:1248
CL_API_ENTRY cl_int CL_API_CALL clEnqueueReadImage(cl_command_queue, cl_mem, cl_bool, const size_t *, const size_t *, size_t, size_t, void *, cl_uint, const cl_event *, cl_event *) CL_API_SUFFIX__VERSION_1_0
T operator[](int index) const
Definition: cl.hpp:560
Image(const Image &image)
Definition: cl.hpp:2098
void operator++(int x)
Definition: cl.hpp:637
GLsizei GLenum GLenum GLuint GLenum GLsizei * lengths
Definition: glcorearb.h:2541
Iterator class for vectors.
Definition: cl.hpp:578
detail::param_traits< detail::cl_platform_info, name >::param_type getInfo(cl_int *err=NULL) const
Definition: cl.hpp:1376
cl_uint cl_profiling_info
Definition: cl.h:89
GLenum src
Definition: glcorearb.h:1792
string(void)
Definition: cl.hpp:349
CL_API_ENTRY cl_int CL_API_CALL clGetKernelWorkGroupInfo(cl_kernel, cl_device_id, cl_kernel_work_group_info, size_t, void *, size_t *) CL_API_SUFFIX__VERSION_1_0
CL_API_ENTRY cl_int CL_API_CALL clCreateKernelsInProgram(cl_program, cl_uint, cl_kernel *, cl_uint *) CL_API_SUFFIX__VERSION_1_0