24 #pragma GCC diagnostic ignored "-Wdeprecated-declarations" 27 #pragma GCC diagnostic ignored "-Wignored-attributes" 152 #if defined(USE_DX_INTEROP) 153 #include <CL/cl_d3d10.h> 158 #if defined(USE_CL_DEVICE_FISSION) 159 #include <CL/cl_ext.h> 162 #if defined(__APPLE__) || defined(__MACOSX) 163 #include <OpenGL/OpenGL.h> 164 #include <OpenCL/opencl.h> 167 #include <CL/opencl.h> 170 #if !defined(CL_CALLBACK) 176 #if !defined(__NO_STD_VECTOR) 180 #if !defined(__NO_STD_STRING) 184 #if defined(linux) || defined(__APPLE__) || defined(__MACOSX) 197 #define __INIT_CL_EXT_FCN_PTR(name) \ 199 pfn_##name = (PFN_##name) \ 200 clGetExtensionFunctionAddress(#name); \ 211 #if defined(__CL_ENABLE_EXCEPTIONS) 216 class Error :
public std::exception
220 const char * errStr_;
225 Error(cl_int err,
const char * errStr = NULL) : err_(err), errStr_(errStr)
234 virtual const char * what()
const throw ()
236 if (errStr_ == NULL) {
248 cl_int err(
void)
const {
return err_; }
251 #define __ERR_STR(x) #x 253 #define __ERR_STR(x) NULL 254 #endif // __CL_ENABLE_EXCEPTIONS 257 #if !defined(__CL_USER_OVERRIDE_ERROR_STRINGS) 258 #define __GET_DEVICE_INFO_ERR __ERR_STR(clgetDeviceInfo) 259 #define __GET_PLATFORM_INFO_ERR __ERR_STR(clGetPlatformInfo) 260 #define __GET_DEVICE_IDS_ERR __ERR_STR(clGetDeviceIDs) 261 #define __GET_PLATFORM_IDS_ERR __ERR_STR(clGetPlatformIDs) 262 #define __GET_CONTEXT_INFO_ERR __ERR_STR(clGetContextInfo) 263 #define __GET_EVENT_INFO_ERR __ERR_STR(clGetEventInfo) 264 #define __GET_EVENT_PROFILE_INFO_ERR __ERR_STR(clGetEventProfileInfo) 265 #define __GET_MEM_OBJECT_INFO_ERR __ERR_STR(clGetMemObjectInfo) 266 #define __GET_IMAGE_INFO_ERR __ERR_STR(clGetImageInfo) 267 #define __GET_SAMPLER_INFO_ERR __ERR_STR(clGetSamplerInfo) 268 #define __GET_KERNEL_INFO_ERR __ERR_STR(clGetKernelInfo) 269 #define __GET_KERNEL_WORK_GROUP_INFO_ERR __ERR_STR(clGetKernelWorkGroupInfo) 270 #define __GET_PROGRAM_INFO_ERR __ERR_STR(clGetProgramInfo) 271 #define __GET_PROGRAM_BUILD_INFO_ERR __ERR_STR(clGetProgramBuildInfo) 272 #define __GET_COMMAND_QUEUE_INFO_ERR __ERR_STR(clGetCommandQueueInfo) 274 #define __CREATE_CONTEXT_FROM_TYPE_ERR __ERR_STR(clCreateContextFromType) 275 #define __GET_SUPPORTED_IMAGE_FORMATS_ERR __ERR_STR(clGetSupportedImageFormats) 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) 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) 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) 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_FILL_BUFFER_ERR __ERR_STR(clEnqueueFillBuffer) 304 #define __ENQUEUE_WRITE_BUFFER_RECT_ERR __ERR_STR(clEnqueueWriteBufferRect) 305 #define __ENQEUE_COPY_BUFFER_ERR __ERR_STR(clEnqueueCopyBuffer) 306 #define __ENQEUE_COPY_BUFFER_RECT_ERR __ERR_STR(clEnqueueCopyBufferRect) 307 #define __ENQUEUE_READ_IMAGE_ERR __ERR_STR(clEnqueueReadImage) 308 #define __ENQUEUE_WRITE_IMAGE_ERR __ERR_STR(clEnqueueWriteImage) 309 #define __ENQUEUE_COPY_IMAGE_ERR __ERR_STR(clEnqueueCopyImage) 310 #define __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR __ERR_STR(clEnqueueCopyImageToBuffer) 311 #define __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR __ERR_STR(clEnqueueCopyBufferToImage) 312 #define __ENQUEUE_MAP_BUFFER_ERR __ERR_STR(clEnqueueMapBuffer) 313 #define __ENQUEUE_MAP_IMAGE_ERR __ERR_STR(clEnqueueMapImage) 314 #define __ENQUEUE_UNMAP_MEM_OBJECT_ERR __ERR_STR(clEnqueueUnMapMemObject) 315 #define __ENQUEUE_NDRANGE_KERNEL_ERR __ERR_STR(clEnqueueNDRangeKernel) 316 #define __ENQUEUE_TASK_ERR __ERR_STR(clEnqueueTask) 317 #define __ENQUEUE_NATIVE_KERNEL __ERR_STR(clEnqueueNativeKernel) 318 #define __ENQUEUE_MARKER_ERR __ERR_STR(clEnqueueMarker) 319 #define __ENQUEUE_WAIT_FOR_EVENTS_ERR __ERR_STR(clEnqueueWaitForEvents) 320 #define __ENQUEUE_BARRIER_ERR __ERR_STR(clEnqueueBarrier) 322 #define __ENQUEUE_ACQUIRE_GL_ERR __ERR_STR(clEnqueueAcquireGLObjects) 323 #define __ENQUEUE_RELEASE_GL_ERR __ERR_STR(clEnqueueReleaseGLObjects) 325 #define __UNLOAD_COMPILER_ERR __ERR_STR(clUnloadCompiler) 327 #define __FLUSH_ERR __ERR_STR(clFlush) 328 #define __FINISH_ERR __ERR_STR(clFinish) 330 #define __CREATE_SUB_DEVICES __ERR_STR(clCreateSubDevicesEXT) 331 #endif // __CL_USER_OVERRIDE_ERROR_STRINGS 352 str_ =
new char[size_+1];
354 memcpy(str_, str, size_ *
sizeof(
char));
365 size_= ::strlen(str);
366 str_ =
new char[size_ + 1];
368 memcpy(str_, str, (size_ + 1) *
sizeof(
char));
381 if (rhs.
size_ == 0 || rhs.
str_ == NULL) {
387 str_ =
new char[size_ + 1];
389 memcpy(str_, rhs.
str_, (size_ + 1) *
sizeof(
char));
414 const char *
c_str(
void)
const {
return (str_) ? str_ :
"";}
417 #if !defined(__USE_DEV_STRING) && !defined(__NO_STD_STRING) 420 #elif !defined(__USE_DEV_STRING) 424 #if !defined(__USE_DEV_VECTOR) && !defined(__NO_STD_VECTOR) 426 #define VECTOR_CLASS std::vector 427 #elif !defined(__USE_DEV_VECTOR) 428 #define VECTOR_CLASS cl::vector 431 #if !defined(__MAX_DEFAULT_VECTOR_SIZE) 432 #define __MAX_DEFAULT_VECTOR_SIZE 10 439 template <
typename T,
unsigned int N = __MAX_DEFAULT_VECTOR_SIZE>
498 for (
unsigned int i = 0; i <
size; i++) {
521 if (empty_ && vec.
empty_) {
529 return memcmp(&data_[0], &vec.
data_[0], size() *
sizeof(
T)) == 0 ?
true :
false;
532 operator T* () {
return data_; }
533 operator const T* ()
const {
return data_; }
547 return sizeof(
T) * N;
585 initialized_ =
false;
617 return ((vec_ == i.
vec_) &&
624 return (!(*
this==i));
655 return iterator::begin(*
this);
660 return iterator::end(*
this);
695 template <
typename Functor,
typename T>
701 return f(name,
sizeof(
T), param, NULL);
706 template <
typename Func,
typename T>
709 static cl_int
get(Func
f, cl_uint
name, VECTOR_CLASS<T>* param)
712 cl_int err =
f(name, 0, NULL, &required);
713 if (err != CL_SUCCESS) {
717 T* value = (
T*) alloca(required);
718 err =
f(name, required, value, NULL);
719 if (err != CL_SUCCESS) {
723 param->assign(&value[0], &value[required/
sizeof(
T)]);
729 template <
typename Func>
733 get(Func
f, cl_uint
name, VECTOR_CLASS<char *>* param)
735 cl_uint err =
f(name, param->size() *
sizeof(
char *), &(*param)[0], NULL);
736 if (err != CL_SUCCESS) {
745 template <
typename Func>
748 static cl_int
get(Func
f, cl_uint
name, STRING_CLASS* param)
751 cl_int err =
f(name, 0, NULL, &required);
752 if (err != CL_SUCCESS) {
756 char* value = (
char*) alloca(required);
757 err =
f(name, required, value, NULL);
758 if (err != CL_SUCCESS) {
767 #define __GET_INFO_HELPER_WITH_RETAIN(CPP_TYPE) \ 769 template <typename Func> \ 770 struct GetInfoHelper<Func, CPP_TYPE> \ 772 static cl_int get(Func f, cl_uint name, CPP_TYPE* param) \ 774 cl_uint err = f(name, sizeof(CPP_TYPE), param, NULL); \ 775 if (err != CL_SUCCESS) { \ 779 return ReferenceHandler<CPP_TYPE::cl_type>::retain((*param)()); \ 785 #define __PARAM_NAME_INFO_1_0(F) \ 786 F(cl_platform_info, CL_PLATFORM_PROFILE, STRING_CLASS) \ 787 F(cl_platform_info, CL_PLATFORM_VERSION, STRING_CLASS) \ 788 F(cl_platform_info, CL_PLATFORM_NAME, STRING_CLASS) \ 789 F(cl_platform_info, CL_PLATFORM_VENDOR, STRING_CLASS) \ 790 F(cl_platform_info, CL_PLATFORM_EXTENSIONS, STRING_CLASS) \ 792 F(cl_device_info, CL_DEVICE_TYPE, cl_device_type) \ 793 F(cl_device_info, CL_DEVICE_VENDOR_ID, cl_uint) \ 794 F(cl_device_info, CL_DEVICE_MAX_COMPUTE_UNITS, cl_uint) \ 795 F(cl_device_info, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, cl_uint) \ 796 F(cl_device_info, CL_DEVICE_MAX_WORK_GROUP_SIZE, ::size_t) \ 797 F(cl_device_info, CL_DEVICE_MAX_WORK_ITEM_SIZES, VECTOR_CLASS< ::size_t>) \ 798 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR, cl_uint) \ 799 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT, cl_uint) \ 800 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT, cl_uint) \ 801 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG, cl_uint) \ 802 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT, cl_uint) \ 803 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE, cl_uint) \ 804 F(cl_device_info, CL_DEVICE_MAX_CLOCK_FREQUENCY, cl_uint) \ 805 F(cl_device_info, CL_DEVICE_ADDRESS_BITS, cl_bitfield) \ 806 F(cl_device_info, CL_DEVICE_MAX_READ_IMAGE_ARGS, cl_uint) \ 807 F(cl_device_info, CL_DEVICE_MAX_WRITE_IMAGE_ARGS, cl_uint) \ 808 F(cl_device_info, CL_DEVICE_MAX_MEM_ALLOC_SIZE, cl_ulong) \ 809 F(cl_device_info, CL_DEVICE_IMAGE2D_MAX_WIDTH, ::size_t) \ 810 F(cl_device_info, CL_DEVICE_IMAGE2D_MAX_HEIGHT, ::size_t) \ 811 F(cl_device_info, CL_DEVICE_IMAGE3D_MAX_WIDTH, ::size_t) \ 812 F(cl_device_info, CL_DEVICE_IMAGE3D_MAX_HEIGHT, ::size_t) \ 813 F(cl_device_info, CL_DEVICE_IMAGE3D_MAX_DEPTH, ::size_t) \ 814 F(cl_device_info, CL_DEVICE_IMAGE_SUPPORT, cl_uint) \ 815 F(cl_device_info, CL_DEVICE_MAX_PARAMETER_SIZE, ::size_t) \ 816 F(cl_device_info, CL_DEVICE_MAX_SAMPLERS, cl_uint) \ 817 F(cl_device_info, CL_DEVICE_MEM_BASE_ADDR_ALIGN, cl_uint) \ 818 F(cl_device_info, CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE, cl_uint) \ 819 F(cl_device_info, CL_DEVICE_SINGLE_FP_CONFIG, cl_device_fp_config) \ 820 F(cl_device_info, CL_DEVICE_GLOBAL_MEM_CACHE_TYPE, cl_device_mem_cache_type) \ 821 F(cl_device_info, CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE, cl_uint)\ 822 F(cl_device_info, CL_DEVICE_GLOBAL_MEM_CACHE_SIZE, cl_ulong) \ 823 F(cl_device_info, CL_DEVICE_GLOBAL_MEM_SIZE, cl_ulong) \ 824 F(cl_device_info, CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE, cl_ulong) \ 825 F(cl_device_info, CL_DEVICE_MAX_CONSTANT_ARGS, cl_uint) \ 826 F(cl_device_info, CL_DEVICE_LOCAL_MEM_TYPE, cl_device_local_mem_type) \ 827 F(cl_device_info, CL_DEVICE_LOCAL_MEM_SIZE, cl_ulong) \ 828 F(cl_device_info, CL_DEVICE_ERROR_CORRECTION_SUPPORT, cl_bool) \ 829 F(cl_device_info, CL_DEVICE_PROFILING_TIMER_RESOLUTION, ::size_t) \ 830 F(cl_device_info, CL_DEVICE_ENDIAN_LITTLE, cl_bool) \ 831 F(cl_device_info, CL_DEVICE_AVAILABLE, cl_bool) \ 832 F(cl_device_info, CL_DEVICE_COMPILER_AVAILABLE, cl_bool) \ 833 F(cl_device_info, CL_DEVICE_EXECUTION_CAPABILITIES, cl_device_exec_capabilities) \ 834 F(cl_device_info, CL_DEVICE_QUEUE_PROPERTIES, cl_command_queue_properties) \ 835 F(cl_device_info, CL_DEVICE_PLATFORM, cl_platform_id) \ 836 F(cl_device_info, CL_DEVICE_NAME, STRING_CLASS) \ 837 F(cl_device_info, CL_DEVICE_VENDOR, STRING_CLASS) \ 838 F(cl_device_info, CL_DRIVER_VERSION, STRING_CLASS) \ 839 F(cl_device_info, CL_DEVICE_PROFILE, STRING_CLASS) \ 840 F(cl_device_info, CL_DEVICE_VERSION, STRING_CLASS) \ 841 F(cl_device_info, CL_DEVICE_EXTENSIONS, STRING_CLASS) \ 843 F(cl_context_info, CL_CONTEXT_REFERENCE_COUNT, cl_uint) \ 844 F(cl_context_info, CL_CONTEXT_DEVICES, VECTOR_CLASS<Device>) \ 845 F(cl_context_info, CL_CONTEXT_PROPERTIES, VECTOR_CLASS<cl_context_properties>) \ 847 F(cl_event_info, CL_EVENT_COMMAND_QUEUE, cl::CommandQueue) \ 848 F(cl_event_info, CL_EVENT_COMMAND_TYPE, cl_command_type) \ 849 F(cl_event_info, CL_EVENT_REFERENCE_COUNT, cl_uint) \ 850 F(cl_event_info, CL_EVENT_COMMAND_EXECUTION_STATUS, cl_uint) \ 852 F(cl_profiling_info, CL_PROFILING_COMMAND_QUEUED, cl_ulong) \ 853 F(cl_profiling_info, CL_PROFILING_COMMAND_SUBMIT, cl_ulong) \ 854 F(cl_profiling_info, CL_PROFILING_COMMAND_START, cl_ulong) \ 855 F(cl_profiling_info, CL_PROFILING_COMMAND_END, cl_ulong) \ 857 F(cl_mem_info, CL_MEM_TYPE, cl_mem_object_type) \ 858 F(cl_mem_info, CL_MEM_FLAGS, cl_mem_flags) \ 859 F(cl_mem_info, CL_MEM_SIZE, ::size_t) \ 860 F(cl_mem_info, CL_MEM_HOST_PTR, void*) \ 861 F(cl_mem_info, CL_MEM_MAP_COUNT, cl_uint) \ 862 F(cl_mem_info, CL_MEM_REFERENCE_COUNT, cl_uint) \ 863 F(cl_mem_info, CL_MEM_CONTEXT, cl::Context) \ 865 F(cl_image_info, CL_IMAGE_FORMAT, cl_image_format) \ 866 F(cl_image_info, CL_IMAGE_ELEMENT_SIZE, ::size_t) \ 867 F(cl_image_info, CL_IMAGE_ROW_PITCH, ::size_t) \ 868 F(cl_image_info, CL_IMAGE_SLICE_PITCH, ::size_t) \ 869 F(cl_image_info, CL_IMAGE_WIDTH, ::size_t) \ 870 F(cl_image_info, CL_IMAGE_HEIGHT, ::size_t) \ 871 F(cl_image_info, CL_IMAGE_DEPTH, ::size_t) \ 873 F(cl_sampler_info, CL_SAMPLER_REFERENCE_COUNT, cl_uint) \ 874 F(cl_sampler_info, CL_SAMPLER_CONTEXT, cl::Context) \ 875 F(cl_sampler_info, CL_SAMPLER_NORMALIZED_COORDS, cl_addressing_mode) \ 876 F(cl_sampler_info, CL_SAMPLER_ADDRESSING_MODE, cl_filter_mode) \ 877 F(cl_sampler_info, CL_SAMPLER_FILTER_MODE, cl_bool) \ 879 F(cl_program_info, CL_PROGRAM_REFERENCE_COUNT, cl_uint) \ 880 F(cl_program_info, CL_PROGRAM_CONTEXT, cl::Context) \ 881 F(cl_program_info, CL_PROGRAM_NUM_DEVICES, cl_uint) \ 882 F(cl_program_info, CL_PROGRAM_DEVICES, VECTOR_CLASS<cl_device_id>) \ 883 F(cl_program_info, CL_PROGRAM_SOURCE, STRING_CLASS) \ 884 F(cl_program_info, CL_PROGRAM_BINARY_SIZES, VECTOR_CLASS< ::size_t>) \ 885 F(cl_program_info, CL_PROGRAM_BINARIES, VECTOR_CLASS<char *>) \ 887 F(cl_program_build_info, CL_PROGRAM_BUILD_STATUS, cl_build_status) \ 888 F(cl_program_build_info, CL_PROGRAM_BUILD_OPTIONS, STRING_CLASS) \ 889 F(cl_program_build_info, CL_PROGRAM_BUILD_LOG, STRING_CLASS) \ 891 F(cl_kernel_info, CL_KERNEL_FUNCTION_NAME, STRING_CLASS) \ 892 F(cl_kernel_info, CL_KERNEL_NUM_ARGS, cl_uint) \ 893 F(cl_kernel_info, CL_KERNEL_REFERENCE_COUNT, cl_uint) \ 894 F(cl_kernel_info, CL_KERNEL_CONTEXT, cl::Context) \ 895 F(cl_kernel_info, CL_KERNEL_PROGRAM, cl::Program) \ 897 F(cl_kernel_work_group_info, CL_KERNEL_WORK_GROUP_SIZE, ::size_t) \ 898 F(cl_kernel_work_group_info, CL_KERNEL_COMPILE_WORK_GROUP_SIZE, cl::size_t<3>) \ 899 F(cl_kernel_work_group_info, CL_KERNEL_LOCAL_MEM_SIZE, cl_ulong) \ 901 F(cl_command_queue_info, CL_QUEUE_CONTEXT, cl::Context) \ 902 F(cl_command_queue_info, CL_QUEUE_DEVICE, cl::Device) \ 903 F(cl_command_queue_info, CL_QUEUE_REFERENCE_COUNT, cl_uint) \ 904 F(cl_command_queue_info, CL_QUEUE_PROPERTIES, cl_command_queue_properties) 906 #if defined(CL_VERSION_1_1) 907 #define __PARAM_NAME_INFO_1_1(F) \ 908 F(cl_context_info, CL_CONTEXT_NUM_DEVICES, cl_uint)\ 909 F(cl_device_info, CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF, cl_uint) \ 910 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR, cl_uint) \ 911 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT, cl_uint) \ 912 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_INT, cl_uint) \ 913 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG, cl_uint) \ 914 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT, cl_uint) \ 915 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE, cl_uint) \ 916 F(cl_device_info, CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF, cl_uint) \ 917 F(cl_device_info, CL_DEVICE_DOUBLE_FP_CONFIG, cl_device_fp_config) \ 918 F(cl_device_info, CL_DEVICE_HALF_FP_CONFIG, cl_device_fp_config) \ 919 F(cl_device_info, CL_DEVICE_HOST_UNIFIED_MEMORY, cl_bool) \ 921 F(cl_mem_info, CL_MEM_ASSOCIATED_MEMOBJECT, cl::Memory) \ 922 F(cl_mem_info, CL_MEM_OFFSET, ::size_t) \ 924 F(cl_kernel_work_group_info, CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE, ::size_t) \ 925 F(cl_kernel_work_group_info, CL_KERNEL_PRIVATE_MEM_SIZE, cl_ulong) \ 927 F(cl_event_info, CL_EVENT_CONTEXT, cl::Context) 928 #endif // CL_VERSION_1_1 930 #if defined(USE_CL_DEVICE_FISSION) 931 #define __PARAM_NAME_DEVICE_FISSION(F) \ 932 F(cl_device_info, CL_DEVICE_PARENT_DEVICE_EXT, cl_device_id) \ 933 F(cl_device_info, CL_DEVICE_PARTITION_TYPES_EXT, VECTOR_CLASS<cl_device_partition_property_ext>) \ 934 F(cl_device_info, CL_DEVICE_AFFINITY_DOMAINS_EXT, VECTOR_CLASS<cl_device_partition_property_ext>) \ 935 F(cl_device_info, CL_DEVICE_REFERENCE_COUNT_EXT , cl_uint) \ 936 F(cl_device_info, CL_DEVICE_PARTITION_STYLE_EXT, VECTOR_CLASS<cl_device_partition_property_ext>) 937 #endif // USE_CL_DEVICE_FISSION 939 template <
typename enum_type, cl_
int Name>
942 #define __DECLARE_PARAM_TRAITS(token, param_name, T) \ 945 struct param_traits<detail:: token,param_name> \ 947 enum { value = param_name }; \ 948 typedef T param_type; \ 952 #if defined(CL_VERSION_1_1) 954 #endif // CL_VERSION_1_1 956 #if defined(USE_CL_DEVICE_FISSION) 958 #endif // USE_CL_DEVICE_FISSION 960 #undef __DECLARE_PARAM_TRAITS 964 template <
typename Func,
typename T>
971 template <
typename Func,
typename Arg0>
974 Func
f_;
const Arg0& arg0_;
976 cl_uint param, ::
size_t size,
void* value, ::
size_t* size_ret)
977 {
return f_(arg0_, param, size, value, size_ret); }
980 template <
typename Func,
typename Arg0,
typename Arg1>
983 Func
f_;
const Arg0& arg0_;
const Arg1& arg1_;
985 cl_uint param, ::
size_t size,
void* value, ::
size_t* size_ret)
986 {
return f_(arg0_, arg1_, param, size, value, size_ret); }
989 template <
typename Func,
typename Arg0,
typename T>
995 ::get(f0, name, param);
998 template <
typename Func,
typename Arg0,
typename Arg1,
typename T>
1004 ::get(f0, name, param);
1007 template<
typename T>
1016 {
return CL_INVALID_DEVICE; }
1019 {
return CL_INVALID_DEVICE; }
1027 {
return CL_INVALID_PLATFORM; }
1030 {
return CL_INVALID_PLATFORM; }
1037 { return ::clRetainContext(context); }
1039 { return ::clReleaseContext(context); }
1046 { return ::clRetainCommandQueue(queue); }
1048 { return ::clReleaseCommandQueue(queue); }
1055 { return ::clRetainMemObject(memory); }
1057 { return ::clReleaseMemObject(memory); }
1064 { return ::clRetainSampler(sampler); }
1066 { return ::clReleaseSampler(sampler); }
1073 { return ::clRetainProgram(program); }
1075 { return ::clReleaseProgram(program); }
1082 { return ::clRetainKernel(kernel); }
1084 { return ::clReleaseKernel(kernel); }
1091 { return ::clRetainEvent(event); }
1093 { return ::clReleaseEvent(event); }
1096 template <
typename T>
1110 if (object_ != NULL) { release(); }
1116 if (object_ != NULL) { retain(); }
1121 if (object_ != NULL) { release(); }
1123 if (object_ != NULL) { retain(); }
1127 cl_type operator ()()
const {
return object_; }
1129 cl_type& operator ()() {
return object_; }
1144 #if defined(__CL_ENABLE_EXCEPTIONS) 1145 static inline cl_int errHandler (
1147 const char * errStr = NULL)
throw(Error)
1149 if (err != CL_SUCCESS) {
1150 throw Error(err, errStr);
1155 static inline cl_int errHandler (cl_int err,
const char * errStr = NULL)
1159 #endif // __CL_ENABLE_EXCEPTIONS 1173 image_channel_order = order;
1174 image_channel_data_type =
type;
1180 this->image_channel_data_type = rhs.image_channel_data_type;
1181 this->image_channel_order = rhs.image_channel_order;
1193 Device(cl_device_id device) { object_ = device; }
1207 template <
typename T>
1210 return detail::errHandler(
1212 __GET_DEVICE_INFO_ERR);
1215 template <cl_
int name>
typename 1220 detail::cl_device_info,
name>::param_type param;
1228 #if defined(USE_CL_DEVICE_FISSION) 1229 cl_int createSubDevices(
1230 const cl_device_partition_property_ext * properties,
1231 VECTOR_CLASS<Device>* devices)
1233 typedef CL_API_ENTRY cl_int
1234 ( CL_API_CALL * PFN_clCreateSubDevicesEXT)(
1236 const cl_device_partition_property_ext * ,
1239 cl_uint * ) CL_EXT_SUFFIX__VERSION_1_1;
1241 static PFN_clCreateSubDevicesEXT pfn_clCreateSubDevicesEXT = NULL;
1245 cl_int err = pfn_clCreateSubDevicesEXT(object_, properties, 0, NULL, &n);
1246 if (err != CL_SUCCESS) {
1247 return detail::errHandler(err, __CREATE_SUB_DEVICES);
1250 cl_device_id* ids = (cl_device_id*) alloca(n *
sizeof(cl_device_id));
1251 err = pfn_clCreateSubDevicesEXT(object_, properties, n, ids, NULL);
1252 if (err != CL_SUCCESS) {
1253 return detail::errHandler(err, __CREATE_SUB_DEVICES);
1256 devices->assign(&ids[0], &ids[n]);
1270 Platform(cl_platform_id platform) { object_ = platform; }
1286 return detail::errHandler(
1288 __GET_PLATFORM_INFO_ERR);
1291 template <cl_
int name>
typename 1296 detail::cl_platform_info,
name>::param_type param;
1305 cl_device_type
type,
1306 VECTOR_CLASS<Device>* devices)
const 1309 cl_int err = ::clGetDeviceIDs(object_, type, 0, NULL, &n);
1310 if (err != CL_SUCCESS) {
1311 return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
1314 cl_device_id* ids = (cl_device_id*) alloca(n *
sizeof(cl_device_id));
1315 err = ::clGetDeviceIDs(object_, type, n, ids, NULL);
1316 if (err != CL_SUCCESS) {
1317 return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
1320 devices->assign(&ids[0], &ids[n]);
1324 #if defined(USE_DX_INTEROP) 1349 cl_d3d10_device_source_khr d3d_device_source,
1351 cl_d3d10_device_set_khr d3d_device_set,
1352 VECTOR_CLASS<Device>* devices)
const 1354 typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clGetDeviceIDsFromD3D10KHR)(
1355 cl_platform_id platform,
1356 cl_d3d10_device_source_khr d3d_device_source,
1358 cl_d3d10_device_set_khr d3d_device_set,
1359 cl_uint num_entries,
1360 cl_device_id * devices,
1361 cl_uint* num_devices);
1363 static PFN_clGetDeviceIDsFromD3D10KHR pfn_clGetDeviceIDsFromD3D10KHR = NULL;
1367 cl_int err = pfn_clGetDeviceIDsFromD3D10KHR(
1375 if (err != CL_SUCCESS) {
1376 return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
1379 cl_device_id* ids = (cl_device_id*) alloca(n *
sizeof(cl_device_id));
1380 err = pfn_clGetDeviceIDsFromD3D10KHR(
1388 if (err != CL_SUCCESS) {
1389 return detail::errHandler(err, __GET_DEVICE_IDS_ERR);
1392 devices->assign(&ids[0], &ids[n]);
1398 VECTOR_CLASS<Platform>* platforms)
1401 cl_int err = ::clGetPlatformIDs(0, NULL, &n);
1402 if (err != CL_SUCCESS) {
1403 return detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
1406 cl_platform_id* ids = (cl_platform_id*) alloca(
1407 n *
sizeof(cl_platform_id));
1408 err = ::clGetPlatformIDs(n, ids, NULL);
1409 if (err != CL_SUCCESS) {
1410 return detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
1413 platforms->assign(&ids[0], &ids[n]);
1418 static inline cl_int
1421 return ::clUnloadCompiler();
1428 const VECTOR_CLASS<Device>& devices,
1429 cl_context_properties* properties = NULL,
1439 object_ = ::clCreateContext(
1440 properties, (cl_uint) devices.size(),
1441 (cl_device_id*) &devices.front(),
1444 detail::errHandler(error, __CREATE_CONTEXT_FROM_TYPE_ERR);
1451 cl_device_type
type,
1452 cl_context_properties* properties = NULL,
1462 object_ = ::clCreateContextFromType(
1463 properties, type, notifyFptr,
data, &error);
1465 detail::errHandler(error, __CREATE_CONTEXT_FROM_TYPE_ERR);
1483 template <
typename T>
1486 return detail::errHandler(
1488 __GET_CONTEXT_INFO_ERR);
1491 template <cl_
int name>
typename 1496 detail::cl_context_info,
name>::param_type param;
1506 cl_mem_object_type type,
1507 VECTOR_CLASS<ImageFormat>* formats)
const 1510 cl_int err = ::clGetSupportedImageFormats(
1517 if (err != CL_SUCCESS) {
1518 return detail::errHandler(err, __GET_SUPPORTED_IMAGE_FORMATS_ERR);
1523 err = ::clGetSupportedImageFormats(
1528 (cl_image_format*) value,
1530 if (err != CL_SUCCESS) {
1531 return detail::errHandler(err, __GET_SUPPORTED_IMAGE_FORMATS_ERR);
1534 formats->assign(&value[0], &value[numEntries]);
1544 class
Event : public detail::Wrapper<cl_event>
1559 template <
typename T>
1562 return detail::errHandler(
1564 __GET_EVENT_INFO_ERR);
1567 template <cl_
int name>
typename 1572 detail::cl_event_info,
name>::param_type param;
1580 template <
typename T>
1584 &::clGetEventProfilingInfo, object_, name, param),
1585 __GET_EVENT_PROFILE_INFO_ERR);
1588 template <cl_
int name>
typename 1593 detail::cl_profiling_info,
name>::param_type param;
1594 cl_int result = getProfilingInfo(
name, ¶m);
1603 return detail::errHandler(
1604 ::clWaitForEvents(1, &object_),
1605 __WAIT_FOR_EVENTS_ERR);
1608 #if defined(CL_VERSION_1_1) 1611 void (
CL_CALLBACK * pfn_notify)(cl_event, cl_int,
void *),
1612 void * user_data = NULL)
1614 return detail::errHandler(
1615 ::clSetEventCallback(
1620 __SET_EVENT_CALLBACK_ERR);
1627 return detail::errHandler(
1629 (cl_uint) events.size(), (cl_event*)&events.front()),
1630 __WAIT_FOR_EVENTS_ERR);
1636 #if defined(CL_VERSION_1_1) 1640 class UserEvent :
public Event 1645 cl_int * err = NULL)
1648 object_ = ::clCreateUserEvent(
1652 detail::errHandler(error, __CREATE_USER_EVENT_ERR);
1658 UserEvent() :
Event() { }
1660 UserEvent(
const UserEvent& event) :
Event(event) { }
1662 UserEvent& operator = (
const UserEvent& rhs)
1670 cl_int setStatus(cl_int status)
1672 return detail::errHandler(
1673 ::clSetUserEventStatus(object_,status),
1674 __SET_USER_EVENT_STATUS_ERR);
1679 inline static cl_int
1680 WaitForEvents(
const VECTOR_CLASS<Event>& events)
1682 return detail::errHandler(
1684 (cl_uint) events.size(), (cl_event*)&events.front()),
1685 __WAIT_FOR_EVENTS_ERR);
1706 template <
typename T>
1709 return detail::errHandler(
1711 __GET_MEM_OBJECT_INFO_ERR);
1714 template <cl_
int name>
typename 1719 detail::cl_mem_info,
name>::param_type param;
1727 #if defined(CL_VERSION_1_1) 1728 cl_int setDestructorCallback(
1730 void * user_data = NULL)
1732 return detail::errHandler(
1733 ::clSetMemObjectDestructorCallback(
1737 __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR);
1755 void* host_ptr = NULL,
1759 object_ = ::clCreateBuffer(context(), flags, size, host_ptr, &error);
1761 detail::errHandler(error, __CREATE_BUFFER_ERR);
1779 #if defined(CL_VERSION_1_1) 1782 cl_buffer_create_type buffer_create_type,
1783 const void * buffer_create_info,
1784 cl_int * err = NULL)
1788 result.
object_ = ::clCreateSubBuffer(
1795 detail::errHandler(error, __CREATE_SUBBUFFER_ERR);
1805 #if defined (USE_DX_INTEROP) 1806 class BufferD3D10 :
public Buffer 1809 typedef CL_API_ENTRY cl_mem (CL_API_CALL *PFN_clCreateFromD3D10BufferKHR)(
1810 cl_context context, cl_mem_flags flags, ID3D10Buffer* buffer,
1811 cl_int* errcode_ret);
1816 ID3D10Buffer* bufobj,
1817 cl_int * err = NULL)
1819 static PFN_clCreateFromD3D10BufferKHR pfn_clCreateFromD3D10BufferKHR = NULL;
1823 object_ = pfn_clCreateFromD3D10BufferKHR(
1829 detail::errHandler(error, __CREATE_GL_BUFFER_ERR);
1835 BufferD3D10() :
Buffer() { }
1837 BufferD3D10(
const BufferD3D10& buffer) :
Buffer(buffer) { }
1839 BufferD3D10& operator = (
const BufferD3D10& rhs)
1859 cl_int * err = NULL)
1862 object_ = ::clCreateFromGLBuffer(
1868 detail::errHandler(error, __CREATE_GL_BUFFER_ERR);
1887 cl_gl_object_type *
type,
1888 GLuint * gl_object_name)
1890 return detail::errHandler(
1891 ::clGetGLObjectInfo(object_,type,gl_object_name),
1892 __GET_GL_OBJECT_INFO_ERR);
1906 cl_int * err = NULL)
1909 object_ = ::clCreateFromGLRenderbuffer(
1915 detail::errHandler(error, __CREATE_GL_BUFFER_ERR);
1934 cl_gl_object_type *
type,
1935 GLuint * gl_object_name)
1937 return detail::errHandler(
1938 ::clGetGLObjectInfo(object_,type,gl_object_name),
1939 __GET_GL_OBJECT_INFO_ERR);
1961 template <
typename T>
1964 return detail::errHandler(
1966 __GET_IMAGE_INFO_ERR);
1969 template <cl_
int name>
typename 1974 detail::cl_image_info,
name>::param_type param;
1975 cl_int result = getImageInfo(
name, ¶m);
1995 ::
size_t row_pitch = 0,
1996 void* host_ptr = NULL,
2000 object_ = ::clCreateImage2D(
2001 context(), flags,&format, width, height, row_pitch, host_ptr, &error);
2003 detail::errHandler(error, __CREATE_IMAGE2D_ERR);
2034 cl_int * err = NULL)
2037 object_ = ::clCreateFromGLTexture2D(
2045 detail::errHandler(error, __CREATE_GL_BUFFER_ERR);
2077 ::
size_t row_pitch = 0,
2078 ::
size_t slice_pitch = 0,
2079 void* host_ptr = NULL,
2083 object_ = ::clCreateImage3D(
2084 context(), flags, &format, width, height, depth, row_pitch,
2085 slice_pitch, host_ptr, &error);
2087 detail::errHandler(error, __CREATE_IMAGE3D_ERR);
2118 cl_int * err = NULL)
2121 object_ = ::clCreateFromGLTexture3D(
2129 detail::errHandler(error, __CREATE_GL_BUFFER_ERR);
2158 cl_bool normalized_coords,
2159 cl_addressing_mode addressing_mode,
2160 cl_filter_mode filter_mode,
2164 object_ = ::clCreateSampler(
2171 detail::errHandler(error, __CREATE_SAMPLER_ERR);
2187 template <
typename T>
2190 return detail::errHandler(
2192 __GET_SAMPLER_INFO_ERR);
2195 template <cl_
int name>
typename 2200 detail::cl_sampler_info,
name>::param_type param;
2242 NDRange(::
size_t size0, ::
size_t size1, ::
size_t size2)
2250 operator const ::size_t*()
const {
return (const ::size_t*) sizes_; }
2254 static const NDRange NullRange;
2267 template <
typename T>
2270 static ::size_t
size(
const T&) {
return sizeof(
T); }
2271 static T*
ptr(
T& value) {
return &value; }
2287 LocalSpaceArg ret = { size };
2291 class KernelFunctor;
2313 template <
typename T>
2316 return detail::errHandler(
2318 __GET_KERNEL_INFO_ERR);
2321 template <cl_
int name>
typename 2326 detail::cl_kernel_info, name>::param_type param;
2327 cl_int result =
getInfo(name, ¶m);
2334 template <
typename T>
2336 const Device& device, cl_kernel_work_group_info name,
T* param)
const 2338 return detail::errHandler(
2340 &::clGetKernelWorkGroupInfo, object_, device(), name, param),
2341 __GET_KERNEL_WORK_GROUP_INFO_ERR);
2344 template <cl_
int name>
typename 2349 detail::cl_kernel_work_group_info, name>::param_type param;
2350 cl_int result = getWorkGroupInfo(device, name, ¶m);
2357 template <
typename T>
2360 return detail::errHandler(
2366 __SET_KERNEL_ARGS_ERR);
2371 return detail::errHandler(
2372 ::clSetKernelArg(object_, index, size, argPtr),
2373 __SET_KERNEL_ARGS_ERR);
2393 class
Program : public detail::Wrapper<cl_program>
2396 typedef VECTOR_CLASS<std::pair<const void*, ::size_t> >
Binaries;
2397 typedef VECTOR_CLASS<std::pair<const char*, ::size_t> >
Sources;
2401 const Sources& sources,
2406 const ::size_t n = (
::size_t)sources.size();
2408 const char**
strings = (
const char**) alloca(n *
sizeof(
const char*));
2410 for (::
size_t i = 0; i < n; ++i) {
2411 strings[i] = sources[(int)i].first;
2412 lengths[i] = sources[(int)i].second;
2415 object_ = ::clCreateProgramWithSource(
2416 context(), (cl_uint)n, strings, lengths, &error);
2418 detail::errHandler(error, __CREATE_PROGRAM_WITH_SOURCE_ERR);
2426 const VECTOR_CLASS<Device>& devices,
2427 const Binaries& binaries,
2428 VECTOR_CLASS<cl_int>* binaryStatus = NULL,
2432 const ::size_t n = binaries.size();
2434 const unsigned char** images = (
const unsigned char**) alloca(n *
sizeof(
const void*));
2436 for (::
size_t i = 0; i < n; ++i) {
2437 images[i] = (
const unsigned char*)binaries[(
int)i].first;
2438 lengths[i] = binaries[(int)i].second;
2441 object_ = ::clCreateProgramWithBinary(
2442 context(), (cl_uint) devices.size(),
2443 (cl_device_id*)&devices.front(),
2444 lengths, images, binaryStatus != NULL
2445 ? (cl_int*) &binaryStatus->
front()
2448 detail::errHandler(error, __CREATE_PROGRAM_WITH_BINARY_ERR);
2467 const VECTOR_CLASS<Device>& devices,
2468 const char* options = NULL,
2469 void (
CL_CALLBACK * notifyFptr)(cl_program,
void *) = NULL,
2470 void*
data = NULL)
const 2472 return detail::errHandler(
2477 (cl_device_id*)&devices.front(),
2481 __BUILD_PROGRAM_ERR);
2484 template <
typename T>
2487 return detail::errHandler(
2489 __GET_PROGRAM_INFO_ERR);
2492 template <cl_
int name>
typename 2497 detail::cl_program_info,
name>::param_type param;
2505 template <
typename T>
2507 const Device& device, cl_program_build_info
name,
T* param)
const 2509 return detail::errHandler(
2511 &::clGetProgramBuildInfo, object_, device(), name, param),
2512 __GET_PROGRAM_BUILD_INFO_ERR);
2515 template <cl_
int name>
typename 2520 detail::cl_program_build_info,
name>::param_type param;
2521 cl_int result = getBuildInfo(device,
name, ¶m);
2531 cl_int err = ::clCreateKernelsInProgram(object_, 0, NULL, &numKernels);
2532 if (err != CL_SUCCESS) {
2533 return detail::errHandler(err, __CREATE_KERNELS_IN_PROGRAM_ERR);
2537 err = ::clCreateKernelsInProgram(
2538 object_, numKernels, (cl_kernel*) value, NULL);
2539 if (err != CL_SUCCESS) {
2540 return detail::errHandler(err, __CREATE_KERNELS_IN_PROGRAM_ERR);
2543 kernels->assign(&value[0], &value[numKernels]);
2554 object_ = ::clCreateKernel(program(), name, &error);
2555 detail::errHandler(error, __CREATE_KERNEL_ERR);
2572 cl_command_queue_properties properties = 0,
2576 object_ = ::clCreateCommandQueue(
2577 context(), device(), properties, &error);
2579 detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
2597 template <
typename T>
2600 return detail::errHandler(
2602 &::clGetCommandQueueInfo, object_, name, param),
2603 __GET_COMMAND_QUEUE_INFO_ERR);
2606 template <cl_
int name>
typename 2611 detail::cl_command_queue_info,
name>::param_type param;
2625 const VECTOR_CLASS<Event>* events = NULL,
2626 Event* event = NULL)
const 2628 return detail::errHandler(
2629 ::clEnqueueReadBuffer(
2630 object_, buffer(), blocking, offset, size,
2632 (events != NULL) ? (cl_uint) events->
size() : 0,
2633 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
2635 __ENQUEUE_READ_BUFFER_ERR);
2644 const VECTOR_CLASS<Event>* events = NULL,
2645 Event* event = NULL)
const 2647 return detail::errHandler(
2648 ::clEnqueueWriteBuffer(
2649 object_, buffer(), blocking, offset, size,
2651 (events != NULL) ? (cl_uint) events->
size() : 0,
2652 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
2654 __ENQUEUE_WRITE_BUFFER_ERR);
2660 ::
size_t pattern_size,
2663 const VECTOR_CLASS<Event>* events = NULL,
2664 Event* event = NULL)
const 2666 return detail::errHandler(
2667 ::clEnqueueFillBuffer(
2668 object_, buffer(), ptr, pattern_size, offset, size,
2669 (events != NULL) ? (cl_uint) events->
size() : 0,
2670 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
2672 __ENQUEUE_FILL_BUFFER_ERR);
2678 ::
size_t src_offset,
2679 ::
size_t dst_offset,
2681 const VECTOR_CLASS<Event>* events = NULL,
2682 Event* event = NULL)
const 2684 return detail::errHandler(
2685 ::clEnqueueCopyBuffer(
2686 object_, src(), dst(), src_offset, dst_offset, size,
2687 (events != NULL) ? (cl_uint) events->
size() : 0,
2688 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
2690 __ENQEUE_COPY_BUFFER_ERR);
2693 #if defined(CL_VERSION_1_1) 2694 cl_int enqueueReadBufferRect(
2700 ::
size_t buffer_row_pitch,
2701 ::
size_t buffer_slice_pitch,
2702 ::
size_t host_row_pitch,
2703 ::
size_t host_slice_pitch,
2705 const VECTOR_CLASS<Event>* events = NULL,
2706 Event* event = NULL)
const 2708 return detail::errHandler(
2709 ::clEnqueueReadBufferRect(
2713 (const ::size_t *)buffer_offset,
2714 (const ::size_t *)host_offset,
2715 (const ::size_t *)region,
2721 (events != NULL) ? (cl_uint) events->
size() : 0,
2722 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
2724 __ENQUEUE_READ_BUFFER_RECT_ERR);
2728 cl_int enqueueWriteBufferRect(
2734 ::
size_t buffer_row_pitch,
2735 ::
size_t buffer_slice_pitch,
2736 ::
size_t host_row_pitch,
2737 ::
size_t host_slice_pitch,
2739 const VECTOR_CLASS<Event>* events = NULL,
2740 Event* event = NULL)
const 2742 return detail::errHandler(
2743 ::clEnqueueWriteBufferRect(
2747 (const ::size_t *)buffer_offset,
2748 (const ::size_t *)host_offset,
2749 (const ::size_t *)region,
2755 (events != NULL) ? (cl_uint) events->
size() : 0,
2756 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
2758 __ENQUEUE_WRITE_BUFFER_RECT_ERR);
2761 cl_int enqueueCopyBufferRect(
2767 ::
size_t src_row_pitch,
2768 ::
size_t src_slice_pitch,
2769 ::
size_t dst_row_pitch,
2770 ::
size_t dst_slice_pitch,
2771 const VECTOR_CLASS<Event>* events = NULL,
2772 Event* event = NULL)
const 2774 return detail::errHandler(
2775 ::clEnqueueCopyBufferRect(
2779 (const ::size_t *)src_origin,
2780 (const ::size_t *)dst_origin,
2781 (const ::size_t *)region,
2786 (events != NULL) ? (cl_uint) events->
size() : 0,
2787 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
2789 __ENQEUE_COPY_BUFFER_RECT_ERR);
2799 ::
size_t slice_pitch,
2801 const VECTOR_CLASS<Event>* events = NULL,
2802 Event* event = NULL)
const 2804 return detail::errHandler(
2805 ::clEnqueueReadImage(
2806 object_, image(), blocking, (const ::size_t *) origin,
2807 (const ::size_t *) region, row_pitch, slice_pitch, ptr,
2808 (events != NULL) ? (cl_uint) events->
size() : 0,
2809 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
2811 __ENQUEUE_READ_IMAGE_ERR);
2820 ::
size_t slice_pitch,
2822 const VECTOR_CLASS<Event>* events = NULL,
2823 Event* event = NULL)
const 2825 return detail::errHandler(
2826 ::clEnqueueWriteImage(
2827 object_, image(), blocking, (const ::size_t *) origin,
2828 (const ::size_t *) region, row_pitch, slice_pitch, ptr,
2829 (events != NULL) ? (cl_uint) events->
size() : 0,
2830 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
2832 __ENQUEUE_WRITE_IMAGE_ERR);
2841 const VECTOR_CLASS<Event>* events = NULL,
2842 Event* event = NULL)
const 2844 return detail::errHandler(
2845 ::clEnqueueCopyImage(
2846 object_, src(), dst(), (const ::size_t *) src_origin,
2847 (const ::size_t *)dst_origin, (const ::size_t *) region,
2848 (events != NULL) ? (cl_uint) events->
size() : 0,
2849 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
2851 __ENQUEUE_COPY_IMAGE_ERR);
2859 ::
size_t dst_offset,
2860 const VECTOR_CLASS<Event>* events = NULL,
2861 Event* event = NULL)
const 2863 return detail::errHandler(
2864 ::clEnqueueCopyImageToBuffer(
2865 object_, src(), dst(), (const ::size_t *) src_origin,
2866 (const ::size_t *) region, dst_offset,
2867 (events != NULL) ? (cl_uint) events->
size() : 0,
2868 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
2870 __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR);
2876 ::
size_t src_offset,
2879 const VECTOR_CLASS<Event>* events = NULL,
2880 Event* event = NULL)
const 2882 return detail::errHandler(
2883 ::clEnqueueCopyBufferToImage(
2884 object_, src(), dst(), src_offset,
2885 (const ::size_t *) dst_origin, (const ::size_t *) region,
2886 (events != NULL) ? (cl_uint) events->
size() : 0,
2887 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
2889 __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR);
2898 const VECTOR_CLASS<Event>* events = NULL,
2899 Event* event = NULL,
2900 cl_int* err = NULL)
const 2903 void * result = ::clEnqueueMapBuffer(
2904 object_, buffer(), blocking, flags, offset, size,
2905 (events != NULL) ? (cl_uint) events->
size() : 0,
2906 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
2910 detail::errHandler(error, __ENQUEUE_MAP_BUFFER_ERR);
2918 const Image& buffer,
2923 ::
size_t * row_pitch,
2924 ::
size_t * slice_pitch,
2925 const VECTOR_CLASS<Event>* events = NULL,
2926 Event* event = NULL,
2927 cl_int* err = NULL)
const 2930 void * result = ::clEnqueueMapImage(
2931 object_, buffer(), blocking, flags,
2932 (const ::size_t *) origin, (const ::size_t *) region,
2933 row_pitch, slice_pitch,
2934 (events != NULL) ? (cl_uint) events->
size() : 0,
2935 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
2939 detail::errHandler(error, __ENQUEUE_MAP_IMAGE_ERR);
2949 const VECTOR_CLASS<Event>* events = NULL,
2950 Event* event = NULL)
const 2952 return detail::errHandler(
2953 ::clEnqueueUnmapMemObject(
2954 object_, memory(), mapped_ptr,
2955 (events != NULL) ? (cl_uint) events->size() : 0,
2956 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
2958 __ENQUEUE_UNMAP_MEM_OBJECT_ERR);
2966 const VECTOR_CLASS<Event>* events = NULL,
2967 Event* event = NULL)
const 2969 return detail::errHandler(
2970 ::clEnqueueNDRangeKernel(
2971 object_, kernel(), (cl_uint) global.
dimensions(),
2972 offset.
dimensions() != 0 ? (const ::size_t*) offset : NULL,
2973 (const ::size_t*) global,
2974 local.
dimensions() != 0 ? (const ::size_t*) local : NULL,
2975 (events != NULL) ? (cl_uint) events->size() : 0,
2976 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
2978 __ENQUEUE_NDRANGE_KERNEL_ERR);
2983 const VECTOR_CLASS<Event>* events = NULL,
2984 Event* event = NULL)
const 2986 return detail::errHandler(
2989 (events != NULL) ? (cl_uint) events->size() : 0,
2990 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
2992 __ENQUEUE_TASK_ERR);
2996 void (*userFptr)(
void *),
2997 std::pair<void*, ::size_t> args,
2998 const VECTOR_CLASS<Memory>* mem_objects = NULL,
2999 const VECTOR_CLASS<const void*>* mem_locs = NULL,
3000 const VECTOR_CLASS<Event>* events = NULL,
3001 Event* event = NULL)
const 3003 cl_mem * mems = (mem_objects != NULL && mem_objects->size() > 0)
3004 ? (cl_mem*) alloca(mem_objects->size() *
sizeof(cl_mem))
3008 for (
unsigned int i = 0; i < mem_objects->size(); i++) {
3009 mems[i] = ((*mem_objects)[i])();
3013 return detail::errHandler(
3014 ::clEnqueueNativeKernel(
3015 object_, userFptr, args.first, args.second,
3016 (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
3018 (mem_locs != NULL) ? (
const void **) &mem_locs->front() : NULL,
3019 (events != NULL) ? (cl_uint) events->size() : 0,
3020 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
3022 __ENQUEUE_NATIVE_KERNEL);
3027 return detail::errHandler(
3028 ::clEnqueueMarker(object_, (cl_event*) event),
3029 __ENQUEUE_MARKER_ERR);
3034 return detail::errHandler(
3035 ::clEnqueueWaitForEvents(
3037 (cl_uint) events.size(),
3038 (
const cl_event*) &events.front()),
3039 __ENQUEUE_WAIT_FOR_EVENTS_ERR);
3043 const VECTOR_CLASS<Memory>* mem_objects = NULL,
3044 const VECTOR_CLASS<Event>* events = NULL,
3045 Event* event = NULL)
const 3047 return detail::errHandler(
3048 ::clEnqueueAcquireGLObjects(
3050 (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
3051 (mem_objects != NULL) ? (
const cl_mem *) &mem_objects->front(): NULL,
3052 (events != NULL) ? (cl_uint) events->size() : 0,
3053 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
3055 __ENQUEUE_ACQUIRE_GL_ERR);
3059 const VECTOR_CLASS<Memory>* mem_objects = NULL,
3060 const VECTOR_CLASS<Event>* events = NULL,
3061 Event* event = NULL)
const 3063 return detail::errHandler(
3064 ::clEnqueueReleaseGLObjects(
3066 (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
3067 (mem_objects != NULL) ? (
const cl_mem *) &mem_objects->front(): NULL,
3068 (events != NULL) ? (cl_uint) events->size() : 0,
3069 (events != NULL && events->size() > 0) ? (cl_event*) &events->front() : NULL,
3071 __ENQUEUE_RELEASE_GL_ERR);
3074 #if defined (USE_DX_INTEROP) 3075 typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clEnqueueAcquireD3D10ObjectsKHR)(
3076 cl_command_queue command_queue, cl_uint num_objects,
3077 const cl_mem* mem_objects, cl_uint num_events_in_wait_list,
3078 const cl_event* event_wait_list, cl_event* event);
3079 typedef CL_API_ENTRY cl_int (CL_API_CALL *PFN_clEnqueueReleaseD3D10ObjectsKHR)(
3080 cl_command_queue command_queue, cl_uint num_objects,
3081 const cl_mem* mem_objects, cl_uint num_events_in_wait_list,
3082 const cl_event* event_wait_list, cl_event* event);
3084 cl_int enqueueAcquireD3D10Objects(
3085 const VECTOR_CLASS<Memory>* mem_objects = NULL,
3086 const VECTOR_CLASS<Event>* events = NULL,
3087 Event* event = NULL)
const 3089 static PFN_clEnqueueAcquireD3D10ObjectsKHR pfn_clEnqueueAcquireD3D10ObjectsKHR = NULL;
3092 return detail::errHandler(
3093 pfn_clEnqueueAcquireD3D10ObjectsKHR(
3095 (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
3096 (mem_objects != NULL) ? (
const cl_mem *) &mem_objects->front(): NULL,
3097 (events != NULL) ? (cl_uint) events->size() : 0,
3098 (events != NULL) ? (cl_event*) &events->front() : NULL,
3100 __ENQUEUE_ACQUIRE_GL_ERR);
3103 cl_int enqueueReleaseD3D10Objects(
3104 const VECTOR_CLASS<Memory>* mem_objects = NULL,
3105 const VECTOR_CLASS<Event>* events = NULL,
3106 Event* event = NULL)
const 3108 static PFN_clEnqueueReleaseD3D10ObjectsKHR pfn_clEnqueueReleaseD3D10ObjectsKHR = NULL;
3111 return detail::errHandler(
3112 pfn_clEnqueueReleaseD3D10ObjectsKHR(
3114 (mem_objects != NULL) ? (cl_uint) mem_objects->size() : 0,
3115 (mem_objects != NULL) ? (
const cl_mem *) &mem_objects->front(): NULL,
3116 (events != NULL) ? (cl_uint) events->size() : 0,
3117 (events != NULL) ? (cl_event*) &events->front() : NULL,
3119 __ENQUEUE_RELEASE_GL_ERR);
3125 return detail::errHandler(
3126 ::clEnqueueBarrier(object_),
3127 __ENQUEUE_BARRIER_ERR);
3132 return detail::errHandler(::clFlush(object_), __FLUSH_ERR);
3137 return detail::errHandler(::clFinish(object_), __FINISH_ERR);
3177 KernelFunctor& operator=(
const KernelFunctor& rhs);
3179 KernelFunctor(
const KernelFunctor& rhs);
3183 inline Event operator()(
const VECTOR_CLASS<Event>* events = NULL);
3185 template<
typename A1>
3186 inline Event operator()(
3188 const VECTOR_CLASS<Event>* events = NULL);
3190 template<
class A1,
class A2>
3191 inline Event operator()(
3194 const VECTOR_CLASS<Event>* events = NULL);
3196 template<
class A1,
class A2,
class A3>
3197 inline Event operator()(
3201 const VECTOR_CLASS<Event>* events = NULL);
3203 template<
class A1,
class A2,
class A3,
class A4>
3204 inline Event operator()(
3209 const VECTOR_CLASS<Event>* events = NULL);
3211 template<
class A1,
class A2,
class A3,
class A4,
class A5>
3212 inline Event operator()(
3218 const VECTOR_CLASS<Event>* events = NULL);
3220 template<
class A1,
class A2,
class A3,
class A4,
class A5,
class A6>
3221 inline Event operator()(
3228 const VECTOR_CLASS<Event>* events = NULL);
3230 template<
class A1,
class A2,
class A3,
class A4,
3231 class A5,
class A6,
class A7>
3232 inline Event operator()(
3240 const VECTOR_CLASS<Event>* events = NULL);
3242 template<
class A1,
class A2,
class A3,
class A4,
class A5,
3243 class A6,
class A7,
class A8>
3244 inline Event operator()(
3253 const VECTOR_CLASS<Event>* events = NULL);
3255 template<
class A1,
class A2,
class A3,
class A4,
class A5,
3256 class A6,
class A7,
class A8,
class A9>
3257 inline Event operator()(
3267 const VECTOR_CLASS<Event>* events = NULL);
3269 template<
class A1,
class A2,
class A3,
class A4,
class A5,
3270 class A6,
class A7,
class A8,
class A9,
class A10>
3271 inline Event operator()(
3282 const VECTOR_CLASS<Event>* events = NULL);
3284 template<
class A1,
class A2,
class A3,
class A4,
class A5,
3285 class A6,
class A7,
class A8,
class A9,
class A10,
3287 inline Event operator()(
3299 const VECTOR_CLASS<Event>* events = NULL);
3301 template<
class A1,
class A2,
class A3,
class A4,
class A5,
3302 class A6,
class A7,
class A8,
class A9,
class A10,
3303 class A11,
class A12>
3304 inline Event operator()(
3317 const VECTOR_CLASS<Event>* events = NULL);
3319 template<
class A1,
class A2,
class A3,
class A4,
class A5,
3320 class A6,
class A7,
class A8,
class A9,
class A10,
3321 class A11,
class A12,
class A13>
3322 inline Event operator()(
3336 const VECTOR_CLASS<Event>* events = NULL);
3338 template<
class A1,
class A2,
class A3,
class A4,
class A5,
3339 class A6,
class A7,
class A8,
class A9,
class A10,
3340 class A11,
class A12,
class A13,
class A14>
3341 inline Event operator()(
3356 const VECTOR_CLASS<Event>* events = NULL);
3358 template<
class A1,
class A2,
class A3,
class A4,
class A5,
3359 class A6,
class A7,
class A8,
class A9,
class A10,
3360 class A11,
class A12,
class A13,
class A14,
class A15>
3361 inline Event operator()(
3377 const VECTOR_CLASS<Event>* events = NULL);
3413 kernel_(rhs.kernel_),
3415 offset_(rhs.offset_),
3416 global_(rhs.global_),
3437 template<
typename A1>
3440 const VECTOR_CLASS<Event>* events)
3457 template<
typename A1,
typename A2>
3461 const VECTOR_CLASS<Event>* events)
3479 template<
typename A1,
typename A2,
typename A3>
3484 const VECTOR_CLASS<Event>* events)
3503 template<
typename A1,
typename A2,
typename A3,
typename A4>
3509 const VECTOR_CLASS<Event>* events)
3529 template<
typename A1,
typename A2,
typename A3,
typename A4,
typename A5>
3536 const VECTOR_CLASS<Event>* events)
3557 template<
typename A1,
typename A2,
typename A3,
typename A4,
typename A5,
3566 const VECTOR_CLASS<Event>* events)
3588 template<
typename A1,
typename A2,
typename A3,
typename A4,
3589 typename A5,
typename A6,
typename A7>
3598 const VECTOR_CLASS<Event>* events)
3621 template<
typename A1,
typename A2,
typename A3,
typename A4,
typename A5,
3622 typename A6,
typename A7,
typename A8>
3632 const VECTOR_CLASS<Event>* events)
3656 template<
typename A1,
typename A2,
typename A3,
typename A4,
typename A5,
3657 typename A6,
typename A7,
typename A8,
typename A9>
3668 const VECTOR_CLASS<Event>* events)
3693 template<
typename A1,
typename A2,
typename A3,
typename A4,
typename A5,
3694 typename A6,
typename A7,
typename A8,
typename A9,
typename A10>
3706 const VECTOR_CLASS<Event>* events)
3732 template<
class A1,
class A2,
class A3,
class A4,
class A5,
3733 class A6,
class A7,
class A8,
class A9,
class A10,
3747 const VECTOR_CLASS<Event>* events)
3774 template<
class A1,
class A2,
class A3,
class A4,
class A5,
3775 class A6,
class A7,
class A8,
class A9,
class A10,
3776 class A11,
class A12>
3790 const VECTOR_CLASS<Event>* events)
3818 template<
class A1,
class A2,
class A3,
class A4,
class A5,
3819 class A6,
class A7,
class A8,
class A9,
class A10,
3820 class A11,
class A12,
class A13>
3835 const VECTOR_CLASS<Event>* events)
3864 template<
class A1,
class A2,
class A3,
class A4,
class A5,
3865 class A6,
class A7,
class A8,
class A9,
class A10,
3866 class A11,
class A12,
class A13,
class A14>
3882 const VECTOR_CLASS<Event>* events)
3912 template<
class A1,
class A2,
class A3,
class A4,
class A5,
3913 class A6,
class A7,
class A8,
class A9,
class A10,
3914 class A11,
class A12,
class A13,
class A14,
class A15>
3931 const VECTOR_CLASS<Event>* events)
3963 #if !defined(__CL_USER_OVERRIDE_ERROR_STRINGS) 3964 #undef __GET_DEVICE_INFO_ERR 3965 #undef __GET_PLATFORM_INFO_ERR 3966 #undef __GET_DEVICE_IDS_ERR 3967 #undef __GET_CONTEXT_INFO_ERR 3968 #undef __GET_EVENT_INFO_ERR 3969 #undef __GET_EVENT_PROFILE_INFO_ERR 3970 #undef __GET_MEM_OBJECT_INFO_ERR 3971 #undef __GET_IMAGE_INFO_ERR 3972 #undef __GET_SAMPLER_INFO_ERR 3973 #undef __GET_KERNEL_INFO_ERR 3974 #undef __GET_KERNEL_WORK_GROUP_INFO_ERR 3975 #undef __GET_PROGRAM_INFO_ERR 3976 #undef __GET_PROGRAM_BUILD_INFO_ERR 3977 #undef __GET_COMMAND_QUEUE_INFO_ERR 3979 #undef __CREATE_CONTEXT_FROM_TYPE_ERR 3980 #undef __GET_SUPPORTED_IMAGE_FORMATS_ERR 3982 #undef __CREATE_BUFFER_ERR 3983 #undef __CREATE_SUBBUFFER_ERR 3984 #undef __CREATE_IMAGE2D_ERR 3985 #undef __CREATE_IMAGE3D_ERR 3986 #undef __CREATE_SAMPLER_ERR 3987 #undef __SET_MEM_OBJECT_DESTRUCTOR_CALLBACK_ERR 3989 #undef __CREATE_USER_EVENT_ERR 3990 #undef __SET_USER_EVENT_STATUS_ERR 3991 #undef __SET_EVENT_CALLBACK_ERR 3993 #undef __WAIT_FOR_EVENTS_ERR 3995 #undef __CREATE_KERNEL_ERR 3996 #undef __SET_KERNEL_ARGS_ERR 3997 #undef __CREATE_PROGRAM_WITH_SOURCE_ERR 3998 #undef __CREATE_PROGRAM_WITH_BINARY_ERR 3999 #undef __BUILD_PROGRAM_ERR 4000 #undef __CREATE_KERNELS_IN_PROGRAM_ERR 4002 #undef __CREATE_COMMAND_QUEUE_ERR 4003 #undef __SET_COMMAND_QUEUE_PROPERTY_ERR 4004 #undef __ENQUEUE_READ_BUFFER_ERR 4005 #undef __ENQUEUE_WRITE_BUFFER_ERR 4006 #undef __ENQUEUE_READ_BUFFER_RECT_ERR 4007 #undef __ENQUEUE_WRITE_BUFFER_RECT_ERR 4008 #undef __ENQEUE_COPY_BUFFER_ERR 4009 #undef __ENQEUE_COPY_BUFFER_RECT_ERR 4010 #undef __ENQUEUE_READ_IMAGE_ERR 4011 #undef __ENQUEUE_WRITE_IMAGE_ERR 4012 #undef __ENQUEUE_COPY_IMAGE_ERR 4013 #undef __ENQUEUE_COPY_IMAGE_TO_BUFFER_ERR 4014 #undef __ENQUEUE_COPY_BUFFER_TO_IMAGE_ERR 4015 #undef __ENQUEUE_MAP_BUFFER_ERR 4016 #undef __ENQUEUE_MAP_IMAGE_ERR 4017 #undef __ENQUEUE_UNMAP_MEM_OBJECT_ERR 4018 #undef __ENQUEUE_NDRANGE_KERNEL_ERR 4019 #undef __ENQUEUE_TASK_ERR 4020 #undef __ENQUEUE_NATIVE_KERNEL 4022 #undef __UNLOAD_COMPILER_ERR 4023 #endif //__CL_USER_OVERRIDE_ERROR_STRINGS 4025 #undef __GET_INFO_HELPER_WITH_RETAIN 4028 #undef __INIT_CL_EXT_FCN_PTR 4029 #undef __CREATE_SUB_DEVICES 4031 #if defined(USE_CL_DEVICE_FISSION) 4032 #undef __PARAM_NAME_DEVICE_FISSION 4033 #endif // USE_CL_DEVICE_FISSION
unsigned int capacity() const
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)
const T & front(void) const
void push_back(const T &x)
bool error(const char *fmt, const Args &...args)
#define __GET_INFO_HELPER_WITH_RETAIN(CPP_TYPE)
detail::param_traits< detail::cl_context_info, name >::param_type getInfo(cl_int *err=NULL) const
Memory & operator=(const Memory &rhs)
NDRange(::size_t size0,::size_t size1,::size_t size2)
static cl_int retain(cl_sampler sampler)
KernelFunctor & operator=(const KernelFunctor &rhs)
::size_t length(void) const
Memory(const Memory &memory)
Image & operator=(const Image &rhs)
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)
static iterator end(vector< T, N > &vec)
static cl_int release(cl_kernel kernel)
static cl_int retain(cl_command_queue queue)
CommandQueue(const CommandQueue &commandQueue)
void * enqueueMapImage(const Image &buffer, cl_bool blocking, cl_map_flags flags, const size_t< 3 > &origin, const size_t< 3 > ®ion,::size_t *row_pitch,::size_t *slice_pitch, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL, cl_int *err=NULL) const
cl_int getBuildInfo(const Device &device, cl_program_build_info name, T *param) const
KernelFunctor(const Kernel &kernel, const CommandQueue &queue, const NDRange &offset, const NDRange &global, const NDRange &local)
cl_int getSupportedImageFormats(cl_mem_flags flags, cl_mem_object_type type, VECTOR_CLASS< ImageFormat > *formats) const
cl_int getInfo(cl_mem_info name, T *param) const
detail::param_traits< detail::cl_device_info, name >::param_type getInfo(cl_int *err=NULL) const
Local address raper for use with Kernel::setArg.
detail::param_traits< detail::cl_kernel_work_group_info, name >::param_type getWorkGroupInfo(const Device &device, cl_int *err=NULL) const
Device(cl_device_id device)
BufferGL(const BufferGL &buffer)
static cl_int release(cl_mem memory)
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
cl_int getInfo(cl_program_info name, T *param) const
::size_t size(const LocalSpaceArg &value)
Memory interface for cl_mem.
cl_int getInfo(cl_sampler_info name, T *param) const
cl_int enqueueWaitForEvents(const VECTOR_CLASS< Event > &events) const
detail::param_traits< detail::cl_program_info, name >::param_type getInfo(cl_int *err=NULL) const
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)
Kernel(const Kernel &kernel)
Image3D(const Image3D &image3D)
std::vector< std::string > strings
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
static cl_int retain(cl_device_id)
Buffer(const Context &context, cl_mem_flags flags,::size_t size, void *host_ptr=NULL, cl_int *err=NULL)
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
vector(unsigned int size, const T &val=T())
VECTOR_CLASS< std::pair< const void *,::size_t > > Binaries
Image3D & operator=(const Image3D &rhs)
CommandQueue(const Context &context, const Device &device, cl_command_queue_properties properties=0, cl_int *err=NULL)
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 > ®ion, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
string(char *str,::size_t size)
vector(const vector< T, N > &vec)
Buffer(const Buffer &buffer)
static cl_int release(cl_sampler sampler)
bool operator!=(iterator i)
static cl_int release(cl_program program)
bool operator==(vector< T, N > &vec)
Device(const Device &device)
cl_int getInfo(cl_event_info name, T *param) const
cl_int setArg(cl_uint index,::size_t size, void *argPtr)
Event interface for cl_event.
Program(const Context &context, const Sources &sources, cl_int *err=NULL)
Buffer & operator=(const Buffer &rhs)
cl_int getImageInfo(cl_image_info name, T *param) const
Program(const Context &context, const VECTOR_CLASS< Device > &devices, const Binaries &binaries, VECTOR_CLASS< cl_int > *binaryStatus=NULL, cl_int *err=NULL)
string(const string &rhs)
CryptoPP::PolynomialMod2 operator*(const CryptoPP::PolynomialMod2 &a, const CryptoPP::PolynomialMod2 &b)
cl_int getObjectInfo(cl_gl_object_type *type, GLuint *gl_object_name)
Image3DGL(const Image3DGL &image)
string & operator=(const string &rhs)
static cl_int retain(cl_program program)
Image2DGL(const Context &context, cl_mem_flags flags, GLenum target, GLint miplevel, GLuint texobj, cl_int *err=NULL)
BufferGL(const Context &context, cl_mem_flags flags, GLuint bufobj, cl_int *err=NULL)
const T & back(void) const
cl_int enqueueWriteImage(const Image &image, cl_bool blocking, const size_t< 3 > &origin, const size_t< 3 > ®ion,::size_t row_pitch,::size_t slice_pitch, void *ptr, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
static cl_int retain(cl_mem memory)
cl_int enqueueCopyBufferToImage(const Buffer &src, const Image &dst,::size_t src_offset, const size_t< 3 > &dst_origin, const size_t< 3 > ®ion, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
static cl_int retain(cl_kernel kernel)
cl_int enqueueFillBuffer(const Buffer &buffer, const void *ptr,::size_t pattern_size,::size_t offset,::size_t size, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
detail::param_traits< detail::cl_event_info, name >::param_type getInfo(cl_int *err=NULL) const
cl_int getProfilingInfo(cl_profiling_info name, T *param) const
detail::param_traits< detail::cl_mem_info, name >::param_type getInfo(cl_int *err=NULL) const
T & operator[](int index)
cl_int enqueueBarrier() const
BufferRenderGL(const BufferGL &buffer)
detail::param_traits< detail::cl_image_info, name >::param_type getImageInfo(cl_int *err=NULL) const
BufferRenderGL(const Context &context, cl_mem_flags flags, GLuint bufobj, cl_int *err=NULL)
cl_int enqueueNativeKernel(void(*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
Image2D(const Image2D &image2D)
cl_int getWorkGroupInfo(const Device &device, cl_kernel_work_group_info name, T *param) const
Sampler(const Sampler &sampler)
cl_int enqueueMarker(Event *event=NULL) const
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
static void * ptr(LocalSpaceArg &)
unsigned int size(void) const
detail::param_traits< detail::cl_kernel_info, name >::param_type getInfo(cl_int *err=NULL) const
VECTOR_CLASS< std::pair< const char *,::size_t > > Sources
Fixed sized vector implementation that mirroring std::vector functionality.
Context(const Context &context)
#define __PARAM_NAME_INFO_1_0(F)
Program(const Program &program)
Image2DGL(const Image2DGL &image)
detail::param_traits< detail::cl_sampler_info, name >::param_type getInfo(cl_int *err=NULL) const
#define __INIT_CL_EXT_FCN_PTR(name)
CommandQueue interface for cl_command_queue.
cl_int getInfo(Func f, cl_uint name, T *param)
cl_int getInfo(Func f, const Arg0 &arg0, const Arg1 &arg1, cl_uint name, T *param)
Sampler(const Context &context, cl_bool normalized_coords, cl_addressing_mode addressing_mode, cl_filter_mode filter_mode, cl_int *err=NULL)
unsigned int max_size(void) const
const char * c_str(void) const
vector< T, N > & operator=(const vector< T, N > &rhs)
cl_int enqueueUnmapMemObject(const Memory &memory, void *mapped_ptr, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
static cl_int release(cl_command_queue queue)
PlatformStyle::TableColorType type
uint8_t const size_t const size
void * memcpy(void *a, const void *b, size_t c)
cl_int getObjectInfo(cl_gl_object_type *type, GLuint *gl_object_name)
bool operator==(iterator i)
cl_int createKernels(VECTOR_CLASS< Kernel > *kernels)
Event(const Event &event)
cl_int build(const VECTOR_CLASS< Device > &devices, const char *options=NULL, void(CL_CALLBACK *notifyFptr)(cl_program, void *)=NULL, void *data=NULL) const
#define __DECLARE_PARAM_TRAITS(token, param_name, T)
cl_int getInfo(cl_device_info name, T *param) const
Image3DGL(const Context &context, cl_mem_flags flags, GLenum target, GLint miplevel, GLuint texobj, cl_int *err=NULL)
void assign(I start, I end)
Sampler interface for cl_sampler.
static cl_int retain(cl_event event)
Kernel functor interface.
detail::param_traits< detail::cl_program_build_info, name >::param_type getBuildInfo(const Device &device, cl_int *err=NULL) const
::size_t size(void) const
cl_int enqueueCopyImageToBuffer(const Image &src, const Buffer &dst, const size_t< 3 > &src_origin, const size_t< 3 > ®ion,::size_t dst_offset, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
Wrapper(const Wrapper< cl_type > &rhs)
Base class interface for all images.
Wrapper< cl_type > & operator=(const Wrapper< cl_type > &rhs)
cl_int getInfo(cl_context_info name, T *param) const
static cl_int release(cl_event event)
Image interface for 2D images.
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
cl_int setArg(cl_uint index, T value)
cl_int getInfo(cl_kernel_info name, T *param) const
Kernel interface that implements cl_kernel.
Image interface for 3D images.
Memory buffer interface for GL interop with renderbuffer.
KernelFunctor bind(const CommandQueue &queue, const NDRange &offset, const NDRange &global, const NDRange &local)
detail::param_traits< detail::cl_profiling_info, name >::param_type getProfilingInfo(cl_int *err=NULL) const
cl_int enqueueAcquireGLObjects(const VECTOR_CLASS< Memory > *mem_objects=NULL, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
NDRange(::size_t size0,::size_t size1)
Event operator()(const VECTOR_CLASS< Event > *events=NULL)
Device interface for cl_device_id.
Event & operator=(const Event &rhs)
cl_int enqueueTask(const Kernel &kernel, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
cl_int enqueueReleaseGLObjects(const VECTOR_CLASS< Memory > *mem_objects=NULL, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
static cl_int waitForEvents(const VECTOR_CLASS< Event > &events)
::size_t dimensions() const
Program interface that implements cl_program.
detail::param_traits< detail::cl_command_queue_info, name >::param_type getInfo(cl_int *err=NULL) const
cl_int getInfo(cl_command_queue_info name, T *param) const
static cl_int retain(cl_context context)
size_t class used to interface between C++ and OpenCL C calls that require arrays of size_t values...
static cl_int release(cl_device_id)
Simple string class, that provides a limited subset of std::string functionality but avoids many of t...
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)
Memory buffer interface for GL interop.
2D image interface for GL interop.
static iterator begin(vector< T, N > &vec)
static cl_int release(cl_context context)
Image2D & operator=(const Image2D &rhs)
cl_int enqueueReadImage(const Image &image, cl_bool blocking, const size_t< 3 > &origin, const size_t< 3 > ®ion,::size_t row_pitch,::size_t slice_pitch, void *ptr, const VECTOR_CLASS< Event > *events=NULL, Event *event=NULL) const
T operator[](int index) const
Image(const Image &image)
LocalSpaceArg __local(::size_t size)
Iterator class for vectors.