146 #if defined(USE_DX_INTEROP)
147 #include <CL/cl_d3d10.h>
152 #if defined(USE_CL_DEVICE_FISSION)
153 #include <CL/cl_ext.h>
156 #if defined(__APPLE__) || defined(__MACOSX)
157 #include <OpenGL/OpenGL.h>
158 #include <OpenCL/opencl.h>
161 #include <CL/opencl.h>
164 #if !defined(CL_CALLBACK)
170 #if !defined(__NO_STD_VECTOR)
174 #if !defined(__NO_STD_STRING)
178 #if defined(linux) || defined(__APPLE__) || defined(__MACOSX)
191 #define __INIT_CL_EXT_FCN_PTR(name) \
193 pfn_##name = (PFN_##name) \
194 clGetExtensionFunctionAddress(#name); \
205 #if defined(__CL_ENABLE_EXCEPTIONS)
210 class Error :
public std::exception
214 const char * errStr_;
219 Error(cl_int
err,
const char * errStr = NULL) : err_(err), errStr_(errStr)
228 virtual const char * what()
const throw ()
230 if (errStr_ == NULL) {
242 const cl_int
err(
void)
const {
return err_; }
245 #define __ERR_STR(x) #x
247 #define __ERR_STR(x) NULL
248 #endif // __CL_ENABLE_EXCEPTIONS
251 #if !defined(__CL_USER_OVERRIDE_ERROR_STRINGS)
252 #define __GET_DEVICE_INFO_ERR __ERR_STR(clgetDeviceInfo)
253 #define __GET_PLATFORM_INFO_ERR __ERR_STR(clGetPlatformInfo)
254 #define __GET_DEVICE_IDS_ERR __ERR_STR(clGetDeviceIDs)
255 #define __GET_PLATFORM_IDS_ERR __ERR_STR(clGetPlatformIDs)
256 #define __GET_CONTEXT_INFO_ERR __ERR_STR(clGetContextInfo)
257 #define __GET_EVENT_INFO_ERR __ERR_STR(clGetEventInfo)
258 #define __GET_EVENT_PROFILE_INFO_ERR __ERR_STR(clGetEventProfileInfo)
259 #define __GET_MEM_OBJECT_INFO_ERR __ERR_STR(clGetMemObjectInfo)
260 #define __GET_IMAGE_INFO_ERR __ERR_STR(clGetImageInfo)
261 #define __GET_SAMPLER_INFO_ERR __ERR_STR(clGetSamplerInfo)
262 #define __GET_KERNEL_INFO_ERR __ERR_STR(clGetKernelInfo)
263 #define __GET_KERNEL_WORK_GROUP_INFO_ERR __ERR_STR(clGetKernelWorkGroupInfo)
264 #define __GET_PROGRAM_INFO_ERR __ERR_STR(clGetProgramInfo)
265 #define __GET_PROGRAM_BUILD_INFO_ERR __ERR_STR(clGetProgramBuildInfo)
266 #define __GET_COMMAND_QUEUE_INFO_ERR __ERR_STR(clGetCommandQueueInfo)
268 #define __CREATE_CONTEXT_FROM_TYPE_ERR __ERR_STR(clCreateContextFromType)
269 #define __GET_SUPPORTED_IMAGE_FORMATS_ERR __ERR_STR(clGetSupportedImageFormats)
271 #define __CREATE_BUFFER_ERR __ERR_STR(clCreateBuffer)
272 #define __CREATE_SUBBUFFER_ERR __ERR_STR(clCreateSubBuffer)
273 #define __CREATE_GL_BUFFER_ERR __ERR_STR(clCreateFromGLBuffer)
274 #define __GET_GL_OBJECT_INFO_ERR __ERR_STR(clGetGLObjectInfo)
275 #define __CREATE_IMAGE2D_ERR __ERR_STR(clCreateImage2D)
276 #define __CREATE_IMAGE3D_ERR __ERR_STR(clCreateImage3D)
277 #define __CREATE_SAMPLER_ERR __ERR_STR(clCreateSampler)
278 #define __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR __ERR_STR(clSetMemObjectDestructorCallback)
280 #define __CREATE_USER_EVENT_ERR __ERR_STR(clCreateUserEvent)
281 #define __SET_USER_EVENT_STATUS_ERR __ERR_STR(clSetUserEventStatus)
282 #define __SET_EVENT_CALLBACK_ERR __ERR_STR(clSetEventCallback)
283 #define __WAIT_FOR_EVENTS_ERR __ERR_STR(clWaitForEvents)
285 #define __CREATE_KERNEL_ERR __ERR_STR(clCreateKernel)
286 #define __SET_KERNEL_ARGS_ERR __ERR_STR(clSetKernelArg)
287 #define __CREATE_PROGRAM_WITH_SOURCE_ERR __ERR_STR(clCreateProgramWithSource)
288 #define __CREATE_PROGRAM_WITH_BINARY_ERR __ERR_STR(clCreateProgramWithBinary)
289 #define __BUILD_PROGRAM_ERR __ERR_STR(clBuildProgram)
290 #define __CREATE_KERNELS_IN_PROGRAM_ERR __ERR_STR(clCreateKernelsInProgram)
292 #define __CREATE_COMMAND_QUEUE_ERR __ERR_STR(clCreateCommandQueue)
293 #define __SET_COMMAND_QUEUE_PROPERTY_ERR __ERR_STR(clSetCommandQueueProperty)
294 #define __ENQUEUE_READ_BUFFER_ERR __ERR_STR(clEnqueueReadBuffer)
295 #define __ENQUEUE_READ_BUFFER_RECT_ERR __ERR_STR(clEnqueueReadBufferRect)
296 #define __ENQUEUE_WRITE_BUFFER_ERR __ERR_STR(clEnqueueWriteBuffer)
297 #define __ENQUEUE_WRITE_BUFFER_RECT_ERR __ERR_STR(clEnqueueWriteBufferRect)
298 #define __ENQEUE_COPY_BUFFER_ERR __ERR_STR(clEnqueueCopyBuffer)
299 #define __ENQEUE_COPY_BUFFER_RECT_ERR __ERR_STR(clEnqueueCopyBufferRect)
300 #define __ENQUEUE_READ_IMAGE_ERR __ERR_STR(clEnqueueReadImage)
301 #define __ENQUEUE_WRITE_IMAGE_ERR __ERR_STR(clEnqueueWriteImage)
302 #define __ENQUEUE_COPY_IMAGE_ERR __ERR_STR(clEnqueueCopyImage)
303 #define __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR __ERR_STR(clEnqueueCopyImageToBuffer)
304 #define __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR __ERR_STR(clEnqueueCopyBufferToImage)
305 #define __ENQUEUE_MAP_BUFFER_ERR __ERR_STR(clEnqueueMapBuffer)
306 #define __ENQUEUE_MAP_IMAGE_ERR __ERR_STR(clEnqueueMapImage)
307 #define __ENQUEUE_UNMAP_MEM_OBJECT_ERR __ERR_STR(clEnqueueUnMapMemObject)
308 #define __ENQUEUE_NDRANGE_KERNEL_ERR __ERR_STR(clEnqueueNDRangeKernel)
309 #define __ENQUEUE_TASK_ERR __ERR_STR(clEnqueueTask)
310 #define __ENQUEUE_NATIVE_KERNEL __ERR_STR(clEnqueueNativeKernel)
311 #define __ENQUEUE_MARKER_ERR __ERR_STR(clEnqueueMarker)
312 #define __ENQUEUE_WAIT_FOR_EVENTS_ERR __ERR_STR(clEnqueueWaitForEvents)
313 #define __ENQUEUE_BARRIER_ERR __ERR_STR(clEnqueueBarrier)
315 #define __ENQUEUE_ACQUIRE_GL_ERR __ERR_STR(clEnqueueAcquireGLObjects)
316 #define __ENQUEUE_RELEASE_GL_ERR __ERR_STR(clEnqueueReleaseGLObjects)
318 #define __UNLOAD_COMPILER_ERR __ERR_STR(clUnloadCompiler)
320 #define __FLUSH_ERR __ERR_STR(clFlush)
321 #define __FINISH_ERR __ERR_STR(clFinish)
323 #define __CREATE_SUB_DEVICES __ERR_STR(clCreateSubDevicesEXT)
324 #endif // __CL_USER_OVERRIDE_ERROR_STRINGS
358 size_= ::strlen(str);
361 memcpy(
str_, str, (
size_ + 1) *
sizeof(
char));
374 if (rhs.
size_ == 0 || rhs.
str_ == NULL) {
410 #if !defined(__USE_DEV_STRING) && !defined(__NO_STD_STRING)
413 #elif !defined(__USE_DEV_STRING)
417 #if !defined(__USE_DEV_VECTOR) && !defined(__NO_STD_VECTOR)
419 #define VECTOR_CLASS std::vector
420 #elif !defined(__USE_DEV_VECTOR)
421 #define VECTOR_CLASS cl::vector
424 #if !defined(__MAX_DEFAULT_VECTOR_SIZE)
425 #define __MAX_DEFAULT_VECTOR_SIZE 10
432 template <
typename T,
unsigned int N = __MAX_DEFAULT_VECTOR_SIZE>
491 for (
unsigned int i = 0;
i <
size;
i++) {
506 memcpy(&
data_[0], &rhs.
data_[0], size() *
sizeof(
T));
522 return memcmp(&
data_[0], &vec.
data_[0], size() *
sizeof(
T)) == 0 ?
true :
false;
526 operator const T* ()
const {
return data_; }
540 return sizeof(
T) *
N;
617 return (!(*
this==i));
688 template <
typename Functor,
typename T>
694 return f(
name,
sizeof(
T), param, NULL);
699 template <
typename Func,
typename T>
702 static cl_int
get(Func
f, cl_uint
name, VECTOR_CLASS<T>* param)
705 cl_int
err =
f(
name, 0, NULL, &required);
706 if (err != CL_SUCCESS) {
710 T*
value = (
T*) alloca(required);
711 err =
f(
name, required, value, NULL);
712 if (err != CL_SUCCESS) {
716 param->assign(&value[0], &value[required/
sizeof(
T)]);
722 template <
typename Func>
726 get(Func
f, cl_uint
name, VECTOR_CLASS<char *>* param)
728 cl_uint
err =
f(name, param->size() *
sizeof(
char *), &(*param)[0], NULL);
729 if (err != CL_SUCCESS) {
738 template <
typename Func>
744 cl_int
err =
f(
name, 0, NULL, &required);
745 if (err != CL_SUCCESS) {
749 char*
value = (
char*) alloca(required);
750 err =
f(
name, required, value, NULL);
751 if (err != CL_SUCCESS) {
760 #define __GET_INFO_HELPER_WITH_RETAIN(CPP_TYPE) \
762 template <typename Func> \
763 struct GetInfoHelper<Func, CPP_TYPE> \
765 static cl_int get(Func f, cl_uint name, CPP_TYPE* param) \
767 cl_uint err = f(name, sizeof(CPP_TYPE), param, NULL); \
768 if (err != CL_SUCCESS) { \
772 return ReferenceHandler<CPP_TYPE::cl_type>::retain((*param)()); \
778 #define __PARAM_NAME_INFO_1_0(F) \
779 F(cl_platform_info, CL_PLATFORM_PROFILE, STRING_CLASS) \
780 F(cl_platform_info, CL_PLATFORM_VERSION, STRING_CLASS) \
781 F(cl_platform_info, CL_PLATFORM_NAME, STRING_CLASS) \
782 F(cl_platform_info, CL_PLATFORM_VENDOR, STRING_CLASS) \
783 F(cl_platform_info, CL_PLATFORM_EXTENSIONS, STRING_CLASS) \
785 F(cl_device_info, CL_DEVICE_TYPE, cl_device_type) \
786 F(cl_device_info, CL_DEVICE_VENDOR_ID, cl_uint) \
787 F(cl_device_info, CL_DEVICE_MAX_COMPUTE_UNITS, cl_uint) \
788 F(cl_device_info, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, cl_uint) \
789 F(cl_device_info, CL_DEVICE_MAX_WORK_GROUP_SIZE, ::size_t) \
790 F(cl_device_info, CL_DEVICE_MAX_WORK_ITEM_SIZES, VECTOR_CLASS< ::size_t>) \
791 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR, cl_uint) \
792 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT, cl_uint) \
793 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT, cl_uint) \
794 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG, cl_uint) \
795 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT, cl_uint) \
796 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE, cl_uint) \
797 F(cl_device_info, CL_DEVICE_MAX_CLOCK_FREQUENCY, cl_uint) \
798 F(cl_device_info, CL_DEVICE_ADDRESS_BITS, cl_bitfield) \
799 F(cl_device_info, CL_DEVICE_MAX_READ_IMAGE_ARGS, cl_uint) \
800 F(cl_device_info, CL_DEVICE_MAX_WRITE_IMAGE_ARGS, cl_uint) \
801 F(cl_device_info, CL_DEVICE_MAX_MEM_ALLOC_SIZE, cl_ulong) \
802 F(cl_device_info, CL_DEVICE_IMAGE2D_MAX_WIDTH, ::size_t) \
803 F(cl_device_info, CL_DEVICE_IMAGE2D_MAX_HEIGHT, ::size_t) \
804 F(cl_device_info, CL_DEVICE_IMAGE3D_MAX_WIDTH, ::size_t) \
805 F(cl_device_info, CL_DEVICE_IMAGE3D_MAX_HEIGHT, ::size_t) \
806 F(cl_device_info, CL_DEVICE_IMAGE3D_MAX_DEPTH, ::size_t) \
807 F(cl_device_info, CL_DEVICE_IMAGE_SUPPORT, cl_uint) \
808 F(cl_device_info, CL_DEVICE_MAX_PARAMETER_SIZE, ::size_t) \
809 F(cl_device_info, CL_DEVICE_MAX_SAMPLERS, cl_uint) \
810 F(cl_device_info, CL_DEVICE_MEM_BASE_ADDR_ALIGN, cl_uint) \
811 F(cl_device_info, CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE, cl_uint) \
812 F(cl_device_info, CL_DEVICE_SINGLE_FP_CONFIG, cl_device_fp_config) \
813 F(cl_device_info, CL_DEVICE_GLOBAL_MEM_CACHE_TYPE, cl_device_mem_cache_type) \
814 F(cl_device_info, CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE, cl_uint)\
815 F(cl_device_info, CL_DEVICE_GLOBAL_MEM_CACHE_SIZE, cl_ulong) \
816 F(cl_device_info, CL_DEVICE_GLOBAL_MEM_SIZE, cl_ulong) \
817 F(cl_device_info, CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE, cl_ulong) \
818 F(cl_device_info, CL_DEVICE_MAX_CONSTANT_ARGS, cl_uint) \
819 F(cl_device_info, CL_DEVICE_LOCAL_MEM_TYPE, cl_device_local_mem_type) \
820 F(cl_device_info, CL_DEVICE_LOCAL_MEM_SIZE, cl_ulong) \
821 F(cl_device_info, CL_DEVICE_ERROR_CORRECTION_SUPPORT, cl_bool) \
822 F(cl_device_info, CL_DEVICE_PROFILING_TIMER_RESOLUTION, ::size_t) \
823 F(cl_device_info, CL_DEVICE_ENDIAN_LITTLE, cl_bool) \
824 F(cl_device_info, CL_DEVICE_AVAILABLE, cl_bool) \
825 F(cl_device_info, CL_DEVICE_COMPILER_AVAILABLE, cl_bool) \
826 F(cl_device_info, CL_DEVICE_EXECUTION_CAPABILITIES, cl_device_exec_capabilities) \
827 F(cl_device_info, CL_DEVICE_QUEUE_PROPERTIES, cl_command_queue_properties) \
828 F(cl_device_info, CL_DEVICE_PLATFORM, cl_platform_id) \
829 F(cl_device_info, CL_DEVICE_NAME, STRING_CLASS) \
830 F(cl_device_info, CL_DEVICE_VENDOR, STRING_CLASS) \
831 F(cl_device_info, CL_DRIVER_VERSION, STRING_CLASS) \
832 F(cl_device_info, CL_DEVICE_PROFILE, STRING_CLASS) \
833 F(cl_device_info, CL_DEVICE_VERSION, STRING_CLASS) \
834 F(cl_device_info, CL_DEVICE_EXTENSIONS, STRING_CLASS) \
836 F(cl_context_info, CL_CONTEXT_REFERENCE_COUNT, cl_uint) \
837 F(cl_context_info, CL_CONTEXT_DEVICES, VECTOR_CLASS<Device>) \
838 F(cl_context_info, CL_CONTEXT_PROPERTIES, VECTOR_CLASS<cl_context_properties>) \
840 F(cl_event_info, CL_EVENT_COMMAND_QUEUE, cl::CommandQueue) \
841 F(cl_event_info, CL_EVENT_COMMAND_TYPE, cl_command_type) \
842 F(cl_event_info, CL_EVENT_REFERENCE_COUNT, cl_uint) \
843 F(cl_event_info, CL_EVENT_COMMAND_EXECUTION_STATUS, cl_uint) \
845 F(cl_profiling_info, CL_PROFILING_COMMAND_QUEUED, cl_ulong) \
846 F(cl_profiling_info, CL_PROFILING_COMMAND_SUBMIT, cl_ulong) \
847 F(cl_profiling_info, CL_PROFILING_COMMAND_START, cl_ulong) \
848 F(cl_profiling_info, CL_PROFILING_COMMAND_END, cl_ulong) \
850 F(cl_mem_info, CL_MEM_TYPE, cl_mem_object_type) \
851 F(cl_mem_info, CL_MEM_FLAGS, cl_mem_flags) \
852 F(cl_mem_info, CL_MEM_SIZE, ::size_t) \
853 F(cl_mem_info, CL_MEM_HOST_PTR, void*) \
854 F(cl_mem_info, CL_MEM_MAP_COUNT, cl_uint) \
855 F(cl_mem_info, CL_MEM_REFERENCE_COUNT, cl_uint) \
856 F(cl_mem_info, CL_MEM_CONTEXT, cl::Context) \
858 F(cl_image_info, CL_IMAGE_FORMAT, cl_image_format) \
859 F(cl_image_info, CL_IMAGE_ELEMENT_SIZE, ::size_t) \
860 F(cl_image_info, CL_IMAGE_ROW_PITCH, ::size_t) \
861 F(cl_image_info, CL_IMAGE_SLICE_PITCH, ::size_t) \
862 F(cl_image_info, CL_IMAGE_WIDTH, ::size_t) \
863 F(cl_image_info, CL_IMAGE_HEIGHT, ::size_t) \
864 F(cl_image_info, CL_IMAGE_DEPTH, ::size_t) \
866 F(cl_sampler_info, CL_SAMPLER_REFERENCE_COUNT, cl_uint) \
867 F(cl_sampler_info, CL_SAMPLER_CONTEXT, cl::Context) \
868 F(cl_sampler_info, CL_SAMPLER_NORMALIZED_COORDS, cl_addressing_mode) \
869 F(cl_sampler_info, CL_SAMPLER_ADDRESSING_MODE, cl_filter_mode) \
870 F(cl_sampler_info, CL_SAMPLER_FILTER_MODE, cl_bool) \
872 F(cl_program_info, CL_PROGRAM_REFERENCE_COUNT, cl_uint) \
873 F(cl_program_info, CL_PROGRAM_CONTEXT, cl::Context) \
874 F(cl_program_info, CL_PROGRAM_NUM_DEVICES, cl_uint) \
875 F(cl_program_info, CL_PROGRAM_DEVICES, VECTOR_CLASS<cl_device_id>) \
876 F(cl_program_info, CL_PROGRAM_SOURCE, STRING_CLASS) \
877 F(cl_program_info, CL_PROGRAM_BINARY_SIZES, VECTOR_CLASS< ::size_t>) \
878 F(cl_program_info, CL_PROGRAM_BINARIES, VECTOR_CLASS<char *>) \
880 F(cl_program_build_info, CL_PROGRAM_BUILD_STATUS, cl_build_status) \
881 F(cl_program_build_info, CL_PROGRAM_BUILD_OPTIONS, STRING_CLASS) \
882 F(cl_program_build_info, CL_PROGRAM_BUILD_LOG, STRING_CLASS) \
884 F(cl_kernel_info, CL_KERNEL_FUNCTION_NAME, STRING_CLASS) \
885 F(cl_kernel_info, CL_KERNEL_NUM_ARGS, cl_uint) \
886 F(cl_kernel_info, CL_KERNEL_REFERENCE_COUNT, cl_uint) \
887 F(cl_kernel_info, CL_KERNEL_CONTEXT, cl::Context) \
888 F(cl_kernel_info, CL_KERNEL_PROGRAM, cl::Program) \
890 F(cl_kernel_work_group_info, CL_KERNEL_WORK_GROUP_SIZE, ::size_t) \
891 F(cl_kernel_work_group_info, CL_KERNEL_COMPILE_WORK_GROUP_SIZE, cl::size_t<3>) \
892 F(cl_kernel_work_group_info, CL_KERNEL_LOCAL_MEM_SIZE, cl_ulong) \
894 F(cl_command_queue_info, CL_QUEUE_CONTEXT, cl::Context) \
895 F(cl_command_queue_info, CL_QUEUE_DEVICE, cl::Device) \
896 F(cl_command_queue_info, CL_QUEUE_REFERENCE_COUNT, cl_uint) \
897 F(cl_command_queue_info, CL_QUEUE_PROPERTIES, cl_command_queue_properties)
899 #if defined(CL_VERSION_1_1)
900 #define __PARAM_NAME_INFO_1_1(F) \
901 F(cl_context_info, CL_CONTEXT_NUM_DEVICES, cl_uint)\
902 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF, cl_uint) \
903 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR, cl_uint) \
904 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT, cl_uint) \
905 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_INT, cl_uint) \
906 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG, cl_uint) \
907 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT, cl_uint) \
908 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE, cl_uint) \
909 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF, cl_uint) \
910 F(cl_device_info, CL_DEVICE_DOUBLE_FP_CONFIG, cl_device_fp_config) \
911 F(cl_device_info, CL_DEVICE_HALF_FP_CONFIG, cl_device_fp_config) \
912 F(cl_device_info, CL_DEVICE_HOST_UNIFIED_MEMORY, cl_bool) \
914 F(cl_mem_info, CL_MEM_ASSOCIATED_MEMOBJECT, cl::Memory) \
915 F(cl_mem_info, CL_MEM_OFFSET, ::size_t) \
917 F(cl_kernel_work_group_info, CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE, ::size_t) \
918 F(cl_kernel_work_group_info, CL_KERNEL_PRIVATE_MEM_SIZE, cl_ulong) \
920 F(cl_event_info, CL_EVENT_CONTEXT, cl::Context)
921 #endif // CL_VERSION_1_1
923 #if defined(USE_CL_DEVICE_FISSION)
924 #define __PARAM_NAME_DEVICE_FISSION(F) \
925 F(cl_device_info, CL_DEVICE_PARENT_DEVICE_EXT, cl_device_id) \
926 F(cl_device_info, CL_DEVICE_PARTITION_TYPES_EXT, VECTOR_CLASS<cl_device_partition_property_ext>) \
927 F(cl_device_info, CL_DEVICE_AFFINITY_DOMAINS_EXT, VECTOR_CLASS<cl_device_partition_property_ext>) \
928 F(cl_device_info, CL_DEVICE_REFERENCE_COUNT_EXT , cl_uint) \
929 F(cl_device_info, CL_DEVICE_PARTITION_STYLE_EXT, VECTOR_CLASS<cl_device_partition_property_ext>)
930 #endif // USE_CL_DEVICE_FISSION
932 template <
typename enum_type, cl_
int Name>
935 #define __DECLARE_PARAM_TRAITS(token, param_name, T) \
938 struct param_traits<detail:: token,param_name> \
940 enum { value = param_name }; \
941 typedef T param_type; \
945 #if defined(CL_VERSION_1_1)
947 #endif // CL_VERSION_1_1
949 #if defined(USE_CL_DEVICE_FISSION)
951 #endif // USE_CL_DEVICE_FISSION
953 #undef __DECLARE_PARAM_TRAITS
957 template <
typename Func,
typename T>
964 template <
typename Func,
typename Arg0>
969 cl_uint param, ::
size_t size,
void*
value, ::
size_t* size_ret)
970 {
return f_(
arg0_, param, size, value, size_ret); }
973 template <
typename Func,
typename Arg0,
typename Arg1>
978 cl_uint param, ::
size_t size,
void*
value, ::
size_t* size_ret)
979 {
return f_(
arg0_,
arg1_, param, size, value, size_ret); }
982 template <
typename Func,
typename Arg0,
typename T>
988 ::get(f0, name, param);
991 template <
typename Func,
typename Arg0,
typename Arg1,
typename T>
997 ::get(f0, name, param);
1000 template<
typename T>
1008 static cl_int retain(cl_device_id)
1009 {
return CL_INVALID_DEVICE; }
1011 static cl_int release(cl_device_id)
1012 {
return CL_INVALID_DEVICE; }
1019 static cl_int retain(cl_platform_id)
1020 {
return CL_INVALID_PLATFORM; }
1022 static cl_int release(cl_platform_id)
1023 {
return CL_INVALID_PLATFORM; }
1029 static cl_int retain(cl_context context)
1030 { return ::clRetainContext(context); }
1031 static cl_int release(cl_context context)
1032 { return ::clReleaseContext(context); }
1038 static cl_int retain(cl_command_queue queue)
1039 { return ::clRetainCommandQueue(queue); }
1040 static cl_int release(cl_command_queue queue)
1041 { return ::clReleaseCommandQueue(queue); }
1048 { return ::clRetainMemObject(memory); }
1050 { return ::clReleaseMemObject(memory); }
1056 static cl_int retain(cl_sampler sampler)
1057 { return ::clRetainSampler(sampler); }
1058 static cl_int release(cl_sampler sampler)
1059 { return ::clReleaseSampler(sampler); }
1065 static cl_int retain(cl_program program)
1066 { return ::clRetainProgram(program); }
1067 static cl_int release(cl_program program)
1068 { return ::clReleaseProgram(program); }
1074 static cl_int retain(cl_kernel kernel)
1075 { return ::clRetainKernel(kernel); }
1076 static cl_int release(cl_kernel kernel)
1077 { return ::clReleaseKernel(kernel); }
1084 { return ::clRetainEvent(event); }
1086 { return ::clReleaseEvent(event); }
1089 template <
typename T>
1137 #if defined(__CL_ENABLE_EXCEPTIONS)
1140 const char * errStr = NULL) throw(
Error)
1142 if (err != CL_SUCCESS) {
1143 throw Error(err, errStr);
1148 static inline cl_int
errHandler (cl_int err,
const char * errStr = NULL)
1152 #endif // __CL_ENABLE_EXCEPTIONS
1166 image_channel_order = order;
1167 image_channel_data_type =
type;
1173 this->image_channel_data_type = rhs.image_channel_data_type;
1174 this->image_channel_order = rhs.image_channel_order;
1200 template <
typename T>
1205 __GET_DEVICE_INFO_ERR);
1208 template <cl_
int name>
typename
1213 detail::cl_device_info,
name>::param_type param;
1221 #if defined(USE_CL_DEVICE_FISSION)
1222 cl_int createSubDevices(
1223 const cl_device_partition_property_ext * properties,
1224 VECTOR_CLASS<Device>* devices)
1226 typedef CL_API_ENTRY cl_int
1227 ( CL_API_CALL * PFN_clCreateSubDevicesEXT)(
1229 const cl_device_partition_property_ext * ,
1232 cl_uint * ) CL_EXT_SUFFIX__VERSION_1_1;
1234 static PFN_clCreateSubDevicesEXT pfn_clCreateSubDevicesEXT = NULL;
1238 cl_int
err = pfn_clCreateSubDevicesEXT(
object_, properties, 0, NULL, &n);
1239 if (err != CL_SUCCESS) {
1243 cl_device_id*
ids = (cl_device_id*) alloca(n *
sizeof(cl_device_id));
1244 err = pfn_clCreateSubDevicesEXT(
object_, properties, n, ids, NULL);
1245 if (err != CL_SUCCESS) {
1249 devices->assign(&ids[0], &ids[n]);
1281 __GET_PLATFORM_INFO_ERR);
1284 template <cl_
int name>
typename
1289 detail::cl_platform_info,
name>::param_type param;
1298 cl_device_type
type,
1299 VECTOR_CLASS<Device>* devices)
const
1302 cl_int err = ::clGetDeviceIDs(
object_, type, 0, NULL, &n);
1303 if (err != CL_SUCCESS) {
1307 cl_device_id* ids = (cl_device_id*) alloca(n *
sizeof(cl_device_id));
1308 err = ::clGetDeviceIDs(
object_, type, n, ids, NULL);
1309 if (err != CL_SUCCESS) {
1313 devices->assign(&ids[0], &ids[n]);
1317 #if defined(USE_DX_INTEROP)
1342 cl_d3d10_device_source_khr d3d_device_source,
1344 cl_d3d10_device_set_khr d3d_device_set,
1345 VECTOR_CLASS<Device>* devices)
const
1347 typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clGetDeviceIDsFromD3D10KHR)(
1348 cl_platform_id platform,
1349 cl_d3d10_device_source_khr d3d_device_source,
1351 cl_d3d10_device_set_khr d3d_device_set,
1352 cl_uint num_entries,
1353 cl_device_id * devices,
1354 cl_uint* num_devices);
1356 static PFN_clGetDeviceIDsFromD3D10KHR pfn_clGetDeviceIDsFromD3D10KHR = NULL;
1360 cl_int err = pfn_clGetDeviceIDsFromD3D10KHR(
1368 if (err != CL_SUCCESS) {
1372 cl_device_id* ids = (cl_device_id*) alloca(n *
sizeof(cl_device_id));
1373 err = pfn_clGetDeviceIDsFromD3D10KHR(
1381 if (err != CL_SUCCESS) {
1385 devices->assign(&ids[0], &ids[n]);
1391 VECTOR_CLASS<Platform>* platforms)
1394 cl_int err = ::clGetPlatformIDs(0, NULL, &n);
1395 if (err != CL_SUCCESS) {
1399 cl_platform_id* ids = (cl_platform_id*) alloca(
1400 n *
sizeof(cl_platform_id));
1401 err = ::clGetPlatformIDs(n, ids, NULL);
1402 if (err != CL_SUCCESS) {
1406 platforms->assign(&ids[0], &ids[n]);
1411 static inline cl_int
1414 return ::clUnloadCompiler();
1421 const VECTOR_CLASS<Device>& devices,
1422 cl_context_properties* properties = NULL,
1433 properties, (cl_uint) devices.size(),
1434 (cl_device_id*) &devices.front(),
1444 cl_device_type
type,
1445 cl_context_properties* properties = NULL,
1455 object_ = ::clCreateContextFromType(
1456 properties, type, notifyFptr,
data, &error);
1476 template <
typename T>
1481 __GET_CONTEXT_INFO_ERR);
1484 template <cl_
int name>
typename
1489 detail::cl_context_info,
name>::param_type param;
1499 cl_mem_object_type type,
1500 VECTOR_CLASS<ImageFormat>* formats)
const
1503 cl_int err = ::clGetSupportedImageFormats(
1510 if (err != CL_SUCCESS) {
1516 err = ::clGetSupportedImageFormats(
1521 (cl_image_format*) value,
1523 if (err != CL_SUCCESS) {
1527 formats->assign(&value[0], &value[numEntries]);
1552 template <
typename T>
1557 __GET_EVENT_INFO_ERR);
1560 template <cl_
int name>
typename
1565 detail::cl_event_info,
name>::param_type param;
1573 template <
typename T>
1574 cl_int getProfilingInfo(cl_profiling_info
name,
T* param)
const
1577 &::clGetEventProfilingInfo, object_, name, param),
1578 __GET_EVENT_PROFILE_INFO_ERR);
1581 template <cl_
int name>
typename
1583 getProfilingInfo(cl_int* err = NULL)
const
1586 detail::cl_profiling_info,
name>::param_type param;
1587 cl_int result = getProfilingInfo(
name, ¶m);
1597 ::clWaitForEvents(1, &object_),
1598 __WAIT_FOR_EVENTS_ERR);
1601 #if defined(CL_VERSION_1_1)
1604 void (
CL_CALLBACK * pfn_notify)(cl_event, cl_int,
void *),
1605 void * user_data = NULL)
1608 ::clSetEventCallback(
1613 __SET_EVENT_CALLBACK_ERR);
1618 waitForEvents(
const VECTOR_CLASS<Event>&
events)
1622 (cl_uint) events.size(), (cl_event*)&events.front()),
1623 __WAIT_FOR_EVENTS_ERR);
1629 #if defined(CL_VERSION_1_1)
1633 class UserEvent :
public Event
1637 const Context& context,
1638 cl_int * err = NULL)
1641 object_ = ::clCreateUserEvent(
1651 UserEvent() :
Event() { }
1653 UserEvent(
const UserEvent&
event) :
Event(event) { }
1663 cl_int setStatus(cl_int
status)
1666 ::clSetUserEventStatus(object_,status),
1667 __SET_USER_EVENT_STATUS_ERR);
1672 inline static cl_int
1677 (cl_uint) events.size(), (cl_event*)&events.front()),
1678 __WAIT_FOR_EVENTS_ERR);
1699 template <
typename T>
1704 __GET_MEM_OBJECT_INFO_ERR);
1707 template <cl_
int name>
typename
1712 detail::cl_mem_info,
name>::param_type param;
1720 #if defined(CL_VERSION_1_1)
1721 cl_int setDestructorCallback(
1723 void * user_data = NULL)
1726 ::clSetMemObjectDestructorCallback(
1730 __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR);
1748 void* host_ptr = NULL,
1752 object_ = ::clCreateBuffer(context(), flags, size, host_ptr, &error);
1772 #if defined(CL_VERSION_1_1)
1775 cl_buffer_create_type buffer_create_type,
1776 const void * buffer_create_info,
1777 cl_int * err = NULL)
1781 result.
object_ = ::clCreateSubBuffer(
1798 #if defined (USE_DX_INTEROP)
1799 class BufferD3D10 :
public Buffer
1802 typedef CL_API_ENTRY cl_mem (CL_API_CALL *PFN_clCreateFromD3D10BufferKHR)(
1803 cl_context context, cl_mem_flags flags, ID3D10Buffer*
buffer,
1804 cl_int* errcode_ret);
1807 const Context& context,
1809 ID3D10Buffer* bufobj,
1810 cl_int * err = NULL)
1812 static PFN_clCreateFromD3D10BufferKHR pfn_clCreateFromD3D10BufferKHR = NULL;
1816 object_ = pfn_clCreateFromD3D10BufferKHR(
1828 BufferD3D10() : Buffer() { }
1830 BufferD3D10(
const BufferD3D10&
buffer) : Buffer(buffer) { }
1832 BufferD3D10&
operator = (
const BufferD3D10& rhs)
1852 cl_int * err = NULL)
1855 object_ = ::clCreateFromGLBuffer(
1880 cl_gl_object_type *type,
1881 GLuint * gl_object_name)
1884 ::clGetGLObjectInfo(
object_,type,gl_object_name),
1885 __GET_GL_OBJECT_INFO_ERR);
1899 cl_int * err = NULL)
1902 object_ = ::clCreateFromGLRenderbuffer(
1927 cl_gl_object_type *type,
1928 GLuint * gl_object_name)
1931 ::clGetGLObjectInfo(
object_,type,gl_object_name),
1932 __GET_GL_OBJECT_INFO_ERR);
1954 template <
typename T>
1959 __GET_IMAGE_INFO_ERR);
1962 template <cl_
int name>
typename
1967 detail::cl_image_info,
name>::param_type param;
1988 ::
size_t row_pitch = 0,
1989 void* host_ptr = NULL,
1994 context(), flags,&format, width, height, row_pitch, host_ptr, &error);
2027 cl_int * err = NULL)
2030 object_ = ::clCreateFromGLTexture2D(
2070 ::
size_t row_pitch = 0,
2071 ::
size_t slice_pitch = 0,
2072 void* host_ptr = NULL,
2077 context(), flags, &format, width, height, depth, row_pitch,
2078 slice_pitch, host_ptr, &error);
2111 cl_int * err = NULL)
2114 object_ = ::clCreateFromGLTexture3D(
2151 cl_bool normalized_coords,
2152 cl_addressing_mode addressing_mode,
2153 cl_filter_mode filter_mode,
2180 template <
typename T>
2185 __GET_SAMPLER_INFO_ERR);
2188 template <cl_
int name>
typename
2193 detail::cl_sampler_info,
name>::param_type param;
2222 NDRange(::
size_t size0)
2228 NDRange(::
size_t size0, ::
size_t size1)
2235 NDRange(::
size_t size0, ::
size_t size1, ::
size_t size2)
2243 operator const ::size_t*()
const {
return (const ::size_t*) sizes_; }
2260 template <
typename T>
2263 static ::size_t
size(
const T&) {
return sizeof(
T); }
2277 inline LocalSpaceArg
2284 class KernelFunctor;
2306 template <
typename T>
2311 __GET_KERNEL_INFO_ERR);
2314 template <cl_
int name>
typename
2319 detail::cl_kernel_info, name>::param_type param;
2320 cl_int result =
getInfo(name, ¶m);
2327 template <
typename T>
2329 const Device& device, cl_kernel_work_group_info name,
T* param)
const
2333 &::clGetKernelWorkGroupInfo,
object_, device(), name, param),
2334 __GET_KERNEL_WORK_GROUP_INFO_ERR);
2337 template <cl_
int name>
typename
2342 detail::cl_kernel_work_group_info, name>::param_type param;
2350 template <
typename T>
2359 __SET_KERNEL_ARGS_ERR);
2365 ::clSetKernelArg(
object_, index, size, argPtr),
2366 __SET_KERNEL_ARGS_ERR);
2389 typedef VECTOR_CLASS<std::pair<const void*, ::size_t> >
Binaries;
2390 typedef VECTOR_CLASS<std::pair<const char*, ::size_t> >
Sources;
2394 const Sources& sources,
2399 const ::size_t n = (
::size_t)sources.size();
2401 const char** strings = (
const char**) alloca(n *
sizeof(
const char*));
2403 for (::
size_t i = 0;
i <
n; ++
i) {
2404 strings[
i] = sources[(int)
i].first;
2405 lengths[
i] = sources[(int)
i].second;
2408 object_ = ::clCreateProgramWithSource(
2409 context(), (cl_uint)n, strings, lengths, &error);
2419 const VECTOR_CLASS<Device>& devices,
2420 const Binaries& binaries,
2421 VECTOR_CLASS<cl_int>* binaryStatus = NULL,
2425 const ::size_t n = binaries.size();
2427 const unsigned char** images = (
const unsigned char**) alloca(n *
sizeof(
const void*));
2429 for (::
size_t i = 0;
i <
n; ++
i) {
2430 images[
i] = (
const unsigned char*)binaries[(
int)
i].first;
2431 lengths[
i] = binaries[(int)
i].second;
2434 object_ = ::clCreateProgramWithBinary(
2435 context(), (cl_uint) devices.size(),
2436 (cl_device_id*)&devices.front(),
2437 lengths, images, binaryStatus != NULL
2438 ? (cl_int*) &binaryStatus->
front()
2460 const VECTOR_CLASS<Device>& devices,
2462 void (
CL_CALLBACK * notifyFptr)(cl_program,
void *) = NULL,
2463 void*
data = NULL)
const
2470 (cl_device_id*)&devices.front(),
2474 __BUILD_PROGRAM_ERR);
2477 template <
typename T>
2482 __GET_PROGRAM_INFO_ERR);
2485 template <cl_
int name>
typename
2490 detail::cl_program_info,
name>::param_type param;
2498 template <
typename T>
2499 cl_int getBuildInfo(
2500 const Device& device, cl_program_build_info
name,
T* param)
const
2504 &::clGetProgramBuildInfo, object_, device(), name, param),
2505 __GET_PROGRAM_BUILD_INFO_ERR);
2508 template <cl_
int name>
typename
2510 getBuildInfo(
const Device& device, cl_int* err = NULL)
const
2513 detail::cl_program_build_info,
name>::param_type param;
2514 cl_int result = getBuildInfo(device,
name, ¶m);
2521 cl_int createKernels(VECTOR_CLASS<Kernel>* kernels)
2524 cl_int err = ::clCreateKernelsInProgram(object_, 0, NULL, &numKernels);
2525 if (err != CL_SUCCESS) {
2530 err = ::clCreateKernelsInProgram(
2531 object_, numKernels, (cl_kernel*) value, NULL);
2532 if (err != CL_SUCCESS) {
2536 kernels->assign(&value[0], &value[numKernels]);
2547 object_ = ::clCreateKernel(program(), name, &error);
2565 cl_command_queue_properties properties = 0,
2569 object_ = ::clCreateCommandQueue(
2570 context(), device(), properties, &error);
2590 template <
typename T>
2595 &::clGetCommandQueueInfo,
object_, name, param),
2596 __GET_COMMAND_QUEUE_INFO_ERR);
2599 template <cl_
int name>
typename
2604 detail::cl_command_queue_info,
name>::param_type param;
2618 const VECTOR_CLASS<Event>*
events = NULL,
2622 ::clEnqueueReadBuffer(
2623 object_, buffer(), blocking, offset, size,
2628 __ENQUEUE_READ_BUFFER_ERR);
2637 const VECTOR_CLASS<Event>*
events = NULL,
2641 ::clEnqueueWriteBuffer(
2642 object_, buffer(), blocking, offset, size,
2647 __ENQUEUE_WRITE_BUFFER_ERR);
2653 ::
size_t src_offset,
2654 ::
size_t dst_offset,
2656 const VECTOR_CLASS<Event>*
events = NULL,
2660 ::clEnqueueCopyBuffer(
2661 object_, src(), dst(), src_offset, dst_offset, size,
2665 __ENQEUE_COPY_BUFFER_ERR);
2668 #if defined(CL_VERSION_1_1)
2669 cl_int enqueueReadBufferRect(
2675 ::
size_t buffer_row_pitch,
2676 ::
size_t buffer_slice_pitch,
2677 ::
size_t host_row_pitch,
2678 ::
size_t host_slice_pitch,
2680 const VECTOR_CLASS<Event>*
events = NULL,
2684 ::clEnqueueReadBufferRect(
2688 (const ::size_t *)buffer_offset,
2689 (const ::size_t *)host_offset,
2690 (const ::size_t *)region,
2699 __ENQUEUE_READ_BUFFER_RECT_ERR);
2703 cl_int enqueueWriteBufferRect(
2704 const Buffer& buffer,
2706 const size_t<3>& buffer_offset,
2707 const size_t<3>& host_offset,
2708 const size_t<3>& region,
2709 ::
size_t buffer_row_pitch,
2710 ::
size_t buffer_slice_pitch,
2711 ::
size_t host_row_pitch,
2712 ::
size_t host_slice_pitch,
2714 const VECTOR_CLASS<Event>*
events = NULL,
2718 ::clEnqueueWriteBufferRect(
2722 (const ::size_t *)buffer_offset,
2723 (const ::size_t *)host_offset,
2724 (const ::size_t *)region,
2733 __ENQUEUE_WRITE_BUFFER_RECT_ERR);
2736 cl_int enqueueCopyBufferRect(
2739 const size_t<3>& src_origin,
2740 const size_t<3>& dst_origin,
2741 const size_t<3>& region,
2742 ::
size_t src_row_pitch,
2743 ::
size_t src_slice_pitch,
2744 ::
size_t dst_row_pitch,
2745 ::
size_t dst_slice_pitch,
2746 const VECTOR_CLASS<Event>*
events = NULL,
2750 ::clEnqueueCopyBufferRect(
2754 (const ::size_t *)src_origin,
2755 (const ::size_t *)dst_origin,
2756 (const ::size_t *)region,
2764 __ENQEUE_COPY_BUFFER_RECT_ERR);
2774 ::
size_t slice_pitch,
2776 const VECTOR_CLASS<Event>*
events = NULL,
2780 ::clEnqueueReadImage(
2781 object_, image(), blocking, (const ::size_t *) origin,
2782 (const ::size_t *) region, row_pitch, slice_pitch, ptr,
2786 __ENQUEUE_READ_IMAGE_ERR);
2795 ::
size_t slice_pitch,
2797 const VECTOR_CLASS<Event>*
events = NULL,
2801 ::clEnqueueWriteImage(
2802 object_, image(), blocking, (const ::size_t *) origin,
2803 (const ::size_t *) region, row_pitch, slice_pitch, ptr,
2807 __ENQUEUE_WRITE_IMAGE_ERR);
2816 const VECTOR_CLASS<Event>*
events = NULL,
2820 ::clEnqueueCopyImage(
2821 object_, src(), dst(), (const ::size_t *) src_origin,
2822 (const ::size_t *)dst_origin, (const ::size_t *) region,
2826 __ENQUEUE_COPY_IMAGE_ERR);
2834 ::
size_t dst_offset,
2835 const VECTOR_CLASS<Event>*
events = NULL,
2839 ::clEnqueueCopyImageToBuffer(
2840 object_, src(), dst(), (const ::size_t *) src_origin,
2841 (const ::size_t *) region, dst_offset,
2845 __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR);
2851 ::
size_t src_offset,
2854 const VECTOR_CLASS<Event>*
events = NULL,
2858 ::clEnqueueCopyBufferToImage(
2859 object_, src(), dst(), src_offset,
2860 (const ::size_t *) dst_origin, (const ::size_t *) region,
2864 __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR);
2873 const VECTOR_CLASS<Event>*
events = NULL,
2875 cl_int* err = NULL)
const
2878 void * result = ::clEnqueueMapBuffer(
2879 object_, buffer(), blocking, flags, offset, size,
2893 const Image& buffer,
2898 ::
size_t * row_pitch,
2899 ::
size_t * slice_pitch,
2900 const VECTOR_CLASS<Event>*
events = NULL,
2902 cl_int* err = NULL)
const
2905 void * result = ::clEnqueueMapImage(
2906 object_, buffer(), blocking, flags,
2907 (const ::size_t *) origin, (const ::size_t *) region,
2908 row_pitch, slice_pitch,
2924 const VECTOR_CLASS<Event>*
events = NULL,
2928 ::clEnqueueUnmapMemObject(
2933 __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
2941 const VECTOR_CLASS<Event>*
events = NULL,
2945 ::clEnqueueNDRangeKernel(
2947 offset.
dimensions() != 0 ? (const ::size_t*) offset : NULL,
2948 (const ::size_t*) global,
2949 local.
dimensions() != 0 ? (const ::size_t*) local : NULL,
2953 __ENQUEUE_NDRANGE_KERNEL_ERR);
2958 const VECTOR_CLASS<Event>*
events = NULL,
2967 __ENQUEUE_TASK_ERR);
2971 void (*userFptr)(
void *),
2972 std::pair<void*, ::size_t>
args,
2973 const VECTOR_CLASS<Memory>* mem_objects = NULL,
2974 const VECTOR_CLASS<const void*>* mem_locs = NULL,
2975 const VECTOR_CLASS<Event>*
events = NULL,
2978 cl_mem * mems = (mem_objects != NULL && mem_objects->size() > 0)
2979 ? (cl_mem*) alloca(mem_objects->size() *
sizeof(cl_mem))
2983 for (
unsigned int i = 0;
i < mem_objects->size();
i++) {
2984 mems[
i] = ((*mem_objects)[
i])();
2989 ::clEnqueueNativeKernel(
2990 object_, userFptr, args.first, args.second,
2991 (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
2993 (mem_locs != NULL) ? (
const void **) &mem_locs->front() : NULL,
2997 __ENQUEUE_NATIVE_KERNEL);
3004 __ENQUEUE_MARKER_ERR);
3010 ::clEnqueueWaitForEvents(
3012 (cl_uint) events.size(),
3013 (
const cl_event*) &events.front()),
3014 __ENQUEUE_WAIT_FOR_EVENTS_ERR);
3018 const VECTOR_CLASS<Memory>* mem_objects = NULL,
3019 const VECTOR_CLASS<Event>*
events = NULL,
3023 ::clEnqueueAcquireGLObjects(
3025 (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
3026 (mem_objects != NULL) ? (
const cl_mem *) &mem_objects->front(): NULL,
3030 __ENQUEUE_ACQUIRE_GL_ERR);
3034 const VECTOR_CLASS<Memory>* mem_objects = NULL,
3035 const VECTOR_CLASS<Event>*
events = NULL,
3039 ::clEnqueueReleaseGLObjects(
3041 (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
3042 (mem_objects != NULL) ? (
const cl_mem *) &mem_objects->front(): NULL,
3046 __ENQUEUE_RELEASE_GL_ERR);
3049 #if defined (USE_DX_INTEROP)
3050 typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clEnqueueAcquireD3D10ObjectsKHR)(
3051 cl_command_queue command_queue, cl_uint num_objects,
3052 const cl_mem* mem_objects, cl_uint num_events_in_wait_list,
3053 const cl_event* event_wait_list, cl_event*
event);
3054 typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clEnqueueReleaseD3D10ObjectsKHR)(
3055 cl_command_queue command_queue, cl_uint num_objects,
3056 const cl_mem* mem_objects, cl_uint num_events_in_wait_list,
3057 const cl_event* event_wait_list, cl_event*
event);
3059 cl_int enqueueAcquireD3D10Objects(
3060 const VECTOR_CLASS<Memory>* mem_objects = NULL,
3061 const VECTOR_CLASS<Event>*
events = NULL,
3064 static PFN_clEnqueueAcquireD3D10ObjectsKHR pfn_clEnqueueAcquireD3D10ObjectsKHR = NULL;
3068 pfn_clEnqueueAcquireD3D10ObjectsKHR(
3070 (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
3071 (mem_objects != NULL) ? (
const cl_mem *) &mem_objects->front(): NULL,
3073 (
events != NULL) ? (cl_event*) &
events->front() : NULL,
3075 __ENQUEUE_ACQUIRE_GL_ERR);
3078 cl_int enqueueReleaseD3D10Objects(
3081 Event* event = NULL)
const
3083 static PFN_clEnqueueReleaseD3D10ObjectsKHR pfn_clEnqueueReleaseD3D10ObjectsKHR = NULL;
3087 pfn_clEnqueueReleaseD3D10ObjectsKHR(
3089 (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
3090 (mem_objects != NULL) ? (
const cl_mem *) &mem_objects->front(): NULL,
3092 (
events != NULL) ? (cl_event*) &
events->front() : NULL,
3094 __ENQUEUE_RELEASE_GL_ERR);
3102 __ENQUEUE_BARRIER_ERR);
3152 KernelFunctor&
operator=(
const KernelFunctor& rhs);
3154 KernelFunctor(
const KernelFunctor& rhs);
3160 template<
typename A1>
3163 const VECTOR_CLASS<Event>*
events = NULL);
3165 template<
class A1,
class A2>
3169 const VECTOR_CLASS<Event>*
events = NULL);
3171 template<
class A1,
class A2,
class A3>
3176 const VECTOR_CLASS<Event>*
events = NULL);
3178 template<
class A1,
class A2,
class A3,
class A4>
3184 const VECTOR_CLASS<Event>*
events = NULL);
3186 template<
class A1,
class A2,
class A3,
class A4,
class A5>
3193 const VECTOR_CLASS<Event>*
events = NULL);
3195 template<
class A1,
class A2,
class A3,
class A4,
class A5,
class A6>
3203 const VECTOR_CLASS<Event>*
events = NULL);
3205 template<
class A1,
class A2,
class A3,
class A4,
3206 class A5,
class A6,
class A7>
3215 const VECTOR_CLASS<Event>*
events = NULL);
3217 template<
class A1,
class A2,
class A3,
class A4,
class A5,
3218 class A6,
class A7,
class A8>
3228 const VECTOR_CLASS<Event>*
events = NULL);
3230 template<
class A1,
class A2,
class A3,
class A4,
class A5,
3231 class A6,
class A7,
class A8,
class A9>
3242 const VECTOR_CLASS<Event>*
events = NULL);
3244 template<
class A1,
class A2,
class A3,
class A4,
class A5,
3245 class A6,
class A7,
class A8,
class A9,
class A10>
3257 const VECTOR_CLASS<Event>*
events = NULL);
3259 template<
class A1,
class A2,
class A3,
class A4,
class A5,
3260 class A6,
class A7,
class A8,
class A9,
class A10,
3274 const VECTOR_CLASS<Event>*
events = NULL);
3276 template<
class A1,
class A2,
class A3,
class A4,
class A5,
3277 class A6,
class A7,
class A8,
class A9,
class A10,
3278 class A11,
class A12>
3292 const VECTOR_CLASS<Event>*
events = NULL);
3294 template<
class A1,
class A2,
class A3,
class A4,
class A5,
3295 class A6,
class A7,
class A8,
class A9,
class A10,
3296 class A11,
class A12,
class A13>
3311 const VECTOR_CLASS<Event>*
events = NULL);
3313 template<
class A1,
class A2,
class A3,
class A4,
class A5,
3314 class A6,
class A7,
class A8,
class A9,
class A10,
3315 class A11,
class A12,
class A13,
class A14>
3331 const VECTOR_CLASS<Event>*
events = NULL);
3333 template<
class A1,
class A2,
class A3,
class A4,
class A5,
3334 class A6,
class A7,
class A8,
class A9,
class A10,
3335 class A11,
class A12,
class A13,
class A14,
class A15>
3352 const VECTOR_CLASS<Event>*
events = NULL);
3388 kernel_(rhs.kernel_),
3390 offset_(rhs.offset_),
3391 global_(rhs.global_),
3411 template<
typename A1>
3414 const VECTOR_CLASS<Event>*
events)
3431 template<
typename A1,
typename A2>
3435 const VECTOR_CLASS<Event>*
events)
3453 template<
typename A1,
typename A2,
typename A3>
3458 const VECTOR_CLASS<Event>*
events)
3477 template<
typename A1,
typename A2,
typename A3,
typename A4>
3483 const VECTOR_CLASS<Event>*
events)
3503 template<
typename A1,
typename A2,
typename A3,
typename A4,
typename A5>
3510 const VECTOR_CLASS<Event>*
events)
3531 template<
typename A1,
typename A2,
typename A3,
typename A4,
typename A5,
3540 const VECTOR_CLASS<Event>*
events)
3562 template<
typename A1,
typename A2,
typename A3,
typename A4,
3563 typename A5,
typename A6,
typename A7>
3572 const VECTOR_CLASS<Event>*
events)
3595 template<
typename A1,
typename A2,
typename A3,
typename A4,
typename A5,
3596 typename A6,
typename A7,
typename A8>
3606 const VECTOR_CLASS<Event>*
events)
3630 template<
typename A1,
typename A2,
typename A3,
typename A4,
typename A5,
3631 typename A6,
typename A7,
typename A8,
typename A9>
3642 const VECTOR_CLASS<Event>*
events)
3667 template<
typename A1,
typename A2,
typename A3,
typename A4,
typename A5,
3668 typename A6,
typename A7,
typename A8,
typename A9,
typename A10>
3680 const VECTOR_CLASS<Event>*
events)
3706 template<
class A1,
class A2,
class A3,
class A4,
class A5,
3707 class A6,
class A7,
class A8,
class A9,
class A10,
3721 const VECTOR_CLASS<Event>*
events)
3748 template<
class A1,
class A2,
class A3,
class A4,
class A5,
3749 class A6,
class A7,
class A8,
class A9,
class A10,
3750 class A11,
class A12>
3764 const VECTOR_CLASS<Event>*
events)
3792 template<
class A1,
class A2,
class A3,
class A4,
class A5,
3793 class A6,
class A7,
class A8,
class A9,
class A10,
3794 class A11,
class A12,
class A13>
3809 const VECTOR_CLASS<Event>*
events)
3838 template<
class A1,
class A2,
class A3,
class A4,
class A5,
3839 class A6,
class A7,
class A8,
class A9,
class A10,
3840 class A11,
class A12,
class A13,
class A14>
3856 const VECTOR_CLASS<Event>*
events)
3886 template<
class A1,
class A2,
class A3,
class A4,
class A5,
3887 class A6,
class A7,
class A8,
class A9,
class A10,
3888 class A11,
class A12,
class A13,
class A14,
class A15>
3905 const VECTOR_CLASS<Event>*
events)
3937 #if !defined(__CL_USER_OVERRIDE_ERROR_STRINGS)
3938 #undef __GET_DEVICE_INFO_ERR
3939 #undef __GET_PLATFORM_INFO_ERR
3940 #undef __GET_DEVICE_IDS_ERR
3941 #undef __GET_CONTEXT_INFO_ERR
3942 #undef __GET_EVENT_INFO_ERR
3943 #undef __GET_EVENT_PROFILE_INFO_ERR
3944 #undef __GET_MEM_OBJECT_INFO_ERR
3945 #undef __GET_IMAGE_INFO_ERR
3946 #undef __GET_SAMPLER_INFO_ERR
3947 #undef __GET_KERNEL_INFO_ERR
3948 #undef __GET_KERNEL_WORK_GROUP_INFO_ERR
3949 #undef __GET_PROGRAM_INFO_ERR
3950 #undef __GET_PROGRAM_BUILD_INFO_ERR
3951 #undef __GET_COMMAND_QUEUE_INFO_ERR
3953 #undef __CREATE_CONTEXT_FROM_TYPE_ERR
3954 #undef __GET_SUPPORTED_IMAGE_FORMATS_ERR
3956 #undef __CREATE_BUFFER_ERR
3957 #undef __CREATE_SUBBUFFER_ERR
3958 #undef __CREATE_IMAGE2D_ERR
3959 #undef __CREATE_IMAGE3D_ERR
3960 #undef __CREATE_SAMPLER_ERR
3961 #undef __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR
3963 #undef __CREATE_USER_EVENT_ERR
3964 #undef __SET_USER_EVENT_STATUS_ERR
3965 #undef __SET_EVENT_CALLBACK_ERR
3967 #undef __WAIT_FOR_EVENTS_ERR
3969 #undef __CREATE_KERNEL_ERR
3970 #undef __SET_KERNEL_ARGS_ERR
3971 #undef __CREATE_PROGRAM_WITH_SOURCE_ERR
3972 #undef __CREATE_PROGRAM_WITH_BINARY_ERR
3973 #undef __BUILD_PROGRAM_ERR
3974 #undef __CREATE_KERNELS_IN_PROGRAM_ERR
3976 #undef __CREATE_COMMAND_QUEUE_ERR
3977 #undef __SET_COMMAND_QUEUE_PROPERTY_ERR
3978 #undef __ENQUEUE_READ_BUFFER_ERR
3979 #undef __ENQUEUE_WRITE_BUFFER_ERR
3980 #undef __ENQUEUE_READ_BUFFER_RECT_ERR
3981 #undef __ENQUEUE_WRITE_BUFFER_RECT_ERR
3982 #undef __ENQEUE_COPY_BUFFER_ERR
3983 #undef __ENQEUE_COPY_BUFFER_RECT_ERR
3984 #undef __ENQUEUE_READ_IMAGE_ERR
3985 #undef __ENQUEUE_WRITE_IMAGE_ERR
3986 #undef __ENQUEUE_COPY_IMAGE_ERR
3987 #undef __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR
3988 #undef __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR
3989 #undef __ENQUEUE_MAP_BUFFER_ERR
3990 #undef __ENQUEUE_MAP_IMAGE_ERR
3991 #undef __ENQUEUE_UNMAP_MEM_OBJECT_ERR
3992 #undef __ENQUEUE_NDRANGE_KERNEL_ERR
3993 #undef __ENQUEUE_TASK_ERR
3994 #undef __ENQUEUE_NATIVE_KERNEL
3996 #undef __UNLOAD_COMPILER_ERR
3997 #endif //__CL_USER_OVERRIDE_ERROR_STRINGS
3999 #undef __GET_INFO_HELPER_WITH_RETAIN
4002 #undef __INIT_CL_EXT_FCN_PTR
4003 #undef __CREATE_SUB_DEVICES
4005 #if defined(USE_CL_DEVICE_FISSION)
4006 #undef __PARAM_NAME_DEVICE_FISSION
4007 #endif // USE_CL_DEVICE_FISSION