cl_sys/
cl_h.rs

1//! Rust bindings for the OpenCL ABI.
2//!
3//! Supports OpenCL versions 1.1+ (1.0 not supported).
4//!
5//! This file was originally adapted from
6//! [https://www.khronos.org/registry/cl/api/1.1/cl.h](https://www.khronos.org/registry/cl/api/1.1/cl.h)
7//! and will continue to be updated with additions to newer versions of that
8//! document.
9//!
10//! The layout and format of this document are meant to mimic the original
11//! source in order to ease maintenance (as loatheful as that style may be).
12//!
13//!
14
15#![allow(
16    non_camel_case_types,
17    dead_code,
18    unused_variables,
19    improper_ctypes,
20    non_upper_case_globals
21)]
22
23// use std::fmt::{Display, Formatter, Result};
24use libc::{c_char, c_uchar, c_void, intptr_t, size_t};
25
26pub type cl_platform_id = *mut c_void;
27pub type cl_device_id = *mut c_void;
28pub type cl_context = *mut c_void;
29pub type cl_command_queue = *mut c_void;
30pub type cl_mem = *mut c_void;
31pub type cl_program = *mut c_void;
32pub type cl_kernel = *mut c_void;
33pub type cl_event = *mut c_void;
34pub type cl_sampler = *mut c_void;
35
36pub type cl_char = i8;
37pub type cl_uchar = u8;
38pub type cl_short = i16;
39pub type cl_ushort = u16;
40pub type cl_int = i32;
41pub type cl_uint = u32;
42pub type cl_long = i64;
43pub type cl_ulong = u64;
44pub type cl_half = u16;
45pub type cl_float = f32;
46pub type cl_double = f64;
47pub type cl_bool = cl_uint;
48pub type cl_bitfield = cl_ulong;
49pub type cl_device_type = cl_bitfield;
50pub type cl_platform_info = cl_uint;
51pub type cl_device_info = cl_uint;
52pub type cl_device_fp_config = cl_bitfield;
53pub type cl_device_mem_cache_type = cl_uint;
54pub type cl_device_local_mem_type = cl_uint;
55pub type cl_device_exec_capabilities = cl_bitfield;
56pub type cl_device_svm_capabilities = cl_bitfield;
57pub type cl_command_queue_properties = cl_bitfield;
58pub type cl_device_partition_property = intptr_t;
59pub type cl_device_affinity_domain = cl_bitfield;
60pub type cl_context_properties = intptr_t;
61pub type cl_context_info = cl_uint;
62pub type cl_queue_properties = cl_bitfield;
63pub type cl_command_queue_info = cl_uint;
64pub type cl_channel_order = cl_uint;
65pub type cl_channel_type = cl_uint;
66pub type cl_mem_flags = cl_bitfield;
67pub type cl_svm_mem_flags = cl_bitfield;
68pub type cl_mem_object_type = cl_uint;
69pub type cl_mem_info = cl_uint;
70pub type cl_mem_migration_flags = cl_bitfield;
71pub type cl_image_info = cl_uint;
72pub type cl_buffer_create_type = cl_uint;
73pub type cl_addressing_mode = cl_uint;
74pub type cl_filter_mode = cl_uint;
75pub type cl_sampler_info = cl_uint;
76pub type cl_map_flags = cl_bitfield;
77pub type cl_pipe_properties = intptr_t;
78pub type cl_pipe_info = cl_uint;
79pub type cl_program_info = cl_uint;
80pub type cl_program_build_info = cl_uint;
81pub type cl_program_binary_type = cl_uint;
82pub type cl_build_status = cl_int;
83pub type cl_kernel_info = cl_uint;
84pub type cl_kernel_arg_info = cl_uint;
85pub type cl_kernel_arg_address_qualifier = cl_uint;
86pub type cl_kernel_arg_access_qualifier = cl_uint;
87pub type cl_kernel_arg_type_qualifier = cl_uint;
88pub type cl_kernel_work_group_info = cl_uint;
89pub type cl_kernel_sub_group_info = cl_uint;
90pub type cl_event_info = cl_uint;
91pub type cl_command_type = cl_uint;
92pub type cl_profiling_info = cl_uint;
93pub type cl_sampler_properties = cl_bitfield;
94pub type cl_kernel_exec_info = cl_uint;
95
96#[repr(C)]
97pub struct cl_image_format {
98    pub image_channel_order: cl_channel_order,
99    pub image_channel_data_type: cl_channel_type,
100}
101
102#[repr(C)]
103pub struct cl_image_desc {
104    pub image_type: cl_mem_object_type,
105    pub image_width: size_t,
106    pub image_height: size_t,
107    pub image_depth: size_t,
108    pub image_array_size: size_t,
109    pub image_row_pitch: size_t,
110    pub image_slice_pitch: size_t,
111    pub num_mip_levels: cl_uint,
112    pub num_samples: cl_uint,
113    // AKA `mem_object` in 2.0+
114    pub buffer: cl_mem,
115}
116
117#[repr(C)]
118pub struct cl_buffer_region {
119    pub origin: size_t,
120    pub size: size_t,
121}
122
123// Error Codes:
124pub const CL_SUCCESS: cl_int = 0;
125pub const CL_DEVICE_NOT_FOUND: cl_int = -1;
126pub const CL_DEVICE_NOT_AVAILABLE: cl_int = -2;
127pub const CL_COMPILER_NOT_AVAILABLE: cl_int = -3;
128pub const CL_MEM_OBJECT_ALLOCATION_FAILURE: cl_int = -4;
129pub const CL_OUT_OF_RESOURCES: cl_int = -5;
130pub const CL_OUT_OF_HOST_MEMORY: cl_int = -6;
131pub const CL_PROFILING_INFO_NOT_AVAILABLE: cl_int = -7;
132pub const CL_MEM_COPY_OVERLAP: cl_int = -8;
133pub const CL_IMAGE_FORMAT_MISMATCH: cl_int = -9;
134pub const CL_IMAGE_FORMAT_NOT_SUPPORTED: cl_int = -10;
135pub const CL_BUILD_PROGRAM_FAILURE: cl_int = -11;
136pub const CL_MAP_FAILURE: cl_int = -12;
137pub const CL_MISALIGNED_SUB_BUFFER_OFFSET: cl_int = -13;
138pub const CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST: cl_int = -14;
139pub const CL_COMPILE_PROGRAM_FAILURE: cl_int = -15;
140pub const CL_LINKER_NOT_AVAILABLE: cl_int = -16;
141pub const CL_LINK_PROGRAM_FAILURE: cl_int = -17;
142pub const CL_DEVICE_PARTITION_FAILED: cl_int = -18;
143pub const CL_KERNEL_ARG_INFO_NOT_AVAILABLE: cl_int = -19;
144
145pub const CL_INVALID_VALUE: cl_int = -30;
146pub const CL_INVALID_DEVICE_TYPE: cl_int = -31;
147pub const CL_INVALID_PLATFORM: cl_int = -32;
148pub const CL_INVALID_DEVICE: cl_int = -33;
149pub const CL_INVALID_CONTEXT: cl_int = -34;
150pub const CL_INVALID_QUEUE_PROPERTIES: cl_int = -35;
151pub const CL_INVALID_COMMAND_QUEUE: cl_int = -36;
152pub const CL_INVALID_HOST_PTR: cl_int = -37;
153pub const CL_INVALID_MEM_OBJECT: cl_int = -38;
154pub const CL_INVALID_IMAGE_FORMAT_DESCRIPTOR: cl_int = -39;
155pub const CL_INVALID_IMAGE_SIZE: cl_int = -40;
156pub const CL_INVALID_SAMPLER: cl_int = -41;
157pub const CL_INVALID_BINARY: cl_int = -42;
158pub const CL_INVALID_BUILD_OPTIONS: cl_int = -43;
159pub const CL_INVALID_PROGRAM: cl_int = -44;
160pub const CL_INVALID_PROGRAM_EXECUTABLE: cl_int = -45;
161pub const CL_INVALID_KERNEL_NAME: cl_int = -46;
162pub const CL_INVALID_KERNEL_DEFINITION: cl_int = -47;
163pub const CL_INVALID_KERNEL: cl_int = -48;
164pub const CL_INVALID_ARG_INDEX: cl_int = -49;
165pub const CL_INVALID_ARG_VALUE: cl_int = -50;
166pub const CL_INVALID_ARG_SIZE: cl_int = -51;
167pub const CL_INVALID_KERNEL_ARGS: cl_int = -52;
168pub const CL_INVALID_WORK_DIMENSION: cl_int = -53;
169pub const CL_INVALID_WORK_GROUP_SIZE: cl_int = -54;
170pub const CL_INVALID_WORK_ITEM_SIZE: cl_int = -55;
171pub const CL_INVALID_GLOBAL_OFFSET: cl_int = -56;
172pub const CL_INVALID_EVENT_WAIT_LIST: cl_int = -57;
173pub const CL_INVALID_EVENT: cl_int = -58;
174pub const CL_INVALID_OPERATION: cl_int = -59;
175pub const CL_INVALID_GL_OBJECT: cl_int = -60;
176pub const CL_INVALID_BUFFER_SIZE: cl_int = -61;
177pub const CL_INVALID_MIP_LEVEL: cl_int = -62;
178pub const CL_INVALID_GLOBAL_WORK_SIZE: cl_int = -63;
179pub const CL_INVALID_PROPERTY: cl_int = -64;
180pub const CL_INVALID_IMAGE_DESCRIPTOR: cl_int = -65;
181pub const CL_INVALID_COMPILER_OPTIONS: cl_int = -66;
182pub const CL_INVALID_LINKER_OPTIONS: cl_int = -67;
183pub const CL_INVALID_DEVICE_PARTITION_COUNT: cl_int = -68;
184pub const CL_INVALID_PIPE_SIZE: cl_int = -69;
185pub const CL_INVALID_DEVICE_QUEUE: cl_int = -70;
186pub const CL_PLATFORM_NOT_FOUND_KHR: cl_int = -1001;
187
188// Version:
189pub const CL_VERSION_1_0: cl_bool = 1;
190pub const CL_VERSION_1_1: cl_bool = 1;
191pub const CL_VERSION_1_2: cl_bool = 1;
192pub const CL_VERSION_2_0: cl_bool = 1;
193pub const CL_VERSION_2_1: cl_bool = 1;
194
195// cl_bool:
196pub const CL_FALSE: cl_bool = 0;
197pub const CL_TRUE: cl_bool = 1;
198pub const CL_BLOCKING: cl_bool = CL_TRUE;
199pub const CL_NON_BLOCKING: cl_bool = CL_FALSE;
200
201// cl_platform_info:
202pub const CL_PLATFORM_PROFILE: cl_uint = 0x0900;
203pub const CL_PLATFORM_VERSION: cl_uint = 0x0901;
204pub const CL_PLATFORM_NAME: cl_uint = 0x0902;
205pub const CL_PLATFORM_VENDOR: cl_uint = 0x0903;
206pub const CL_PLATFORM_EXTENSIONS: cl_uint = 0x0904;
207//###### NEW ########
208pub const CL_PLATFORM_HOST_TIMER_RESOLUTION: cl_uint = 0x0905;
209
210// cl_device_type - bitfield:
211pub const CL_DEVICE_TYPE_DEFAULT: cl_bitfield = 1 << 0;
212pub const CL_DEVICE_TYPE_CPU: cl_bitfield = 1 << 1;
213pub const CL_DEVICE_TYPE_GPU: cl_bitfield = 1 << 2;
214pub const CL_DEVICE_TYPE_ACCELERATOR: cl_bitfield = 1 << 3;
215pub const CL_DEVICE_TYPE_CUSTOM: cl_bitfield = 1 << 4;
216pub const CL_DEVICE_TYPE_ALL: cl_bitfield = 0xFFFFFFFF;
217
218// cl_device_info:
219pub const CL_DEVICE_TYPE: cl_uint = 0x1000;
220pub const CL_DEVICE_VENDOR_ID: cl_uint = 0x1001;
221pub const CL_DEVICE_MAX_COMPUTE_UNITS: cl_uint = 0x1002;
222pub const CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS: cl_uint = 0x1003;
223pub const CL_DEVICE_MAX_WORK_GROUP_SIZE: cl_uint = 0x1004;
224pub const CL_DEVICE_MAX_WORK_ITEM_SIZES: cl_uint = 0x1005;
225pub const CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR: cl_uint = 0x1006;
226pub const CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT: cl_uint = 0x1007;
227pub const CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT: cl_uint = 0x1008;
228pub const CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG: cl_uint = 0x1009;
229pub const CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT: cl_uint = 0x100A;
230pub const CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE: cl_uint = 0x100B;
231pub const CL_DEVICE_MAX_CLOCK_FREQUENCY: cl_uint = 0x100C;
232pub const CL_DEVICE_ADDRESS_BITS: cl_uint = 0x100D;
233pub const CL_DEVICE_MAX_READ_IMAGE_ARGS: cl_uint = 0x100E;
234pub const CL_DEVICE_MAX_WRITE_IMAGE_ARGS: cl_uint = 0x100F;
235pub const CL_DEVICE_MAX_MEM_ALLOC_SIZE: cl_uint = 0x1010;
236pub const CL_DEVICE_IMAGE2D_MAX_WIDTH: cl_uint = 0x1011;
237pub const CL_DEVICE_IMAGE2D_MAX_HEIGHT: cl_uint = 0x1012;
238pub const CL_DEVICE_IMAGE3D_MAX_WIDTH: cl_uint = 0x1013;
239pub const CL_DEVICE_IMAGE3D_MAX_HEIGHT: cl_uint = 0x1014;
240pub const CL_DEVICE_IMAGE3D_MAX_DEPTH: cl_uint = 0x1015;
241pub const CL_DEVICE_IMAGE_SUPPORT: cl_uint = 0x1016;
242pub const CL_DEVICE_MAX_PARAMETER_SIZE: cl_uint = 0x1017;
243pub const CL_DEVICE_MAX_SAMPLERS: cl_uint = 0x1018;
244pub const CL_DEVICE_MEM_BASE_ADDR_ALIGN: cl_uint = 0x1019;
245pub const CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE: cl_uint = 0x101A;
246pub const CL_DEVICE_SINGLE_FP_CONFIG: cl_uint = 0x101B;
247pub const CL_DEVICE_GLOBAL_MEM_CACHE_TYPE: cl_uint = 0x101C;
248pub const CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE: cl_uint = 0x101D;
249pub const CL_DEVICE_GLOBAL_MEM_CACHE_SIZE: cl_uint = 0x101E;
250pub const CL_DEVICE_GLOBAL_MEM_SIZE: cl_uint = 0x101F;
251pub const CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE: cl_uint = 0x1020;
252pub const CL_DEVICE_MAX_CONSTANT_ARGS: cl_uint = 0x1021;
253pub const CL_DEVICE_LOCAL_MEM_TYPE: cl_uint = 0x1022;
254pub const CL_DEVICE_LOCAL_MEM_SIZE: cl_uint = 0x1023;
255pub const CL_DEVICE_ERROR_CORRECTION_SUPPORT: cl_uint = 0x1024;
256pub const CL_DEVICE_PROFILING_TIMER_RESOLUTION: cl_uint = 0x1025;
257pub const CL_DEVICE_ENDIAN_LITTLE: cl_uint = 0x1026;
258pub const CL_DEVICE_AVAILABLE: cl_uint = 0x1027;
259pub const CL_DEVICE_COMPILER_AVAILABLE: cl_uint = 0x1028;
260pub const CL_DEVICE_EXECUTION_CAPABILITIES: cl_uint = 0x1029;
261// DEPRICATED 2.0:
262pub const CL_DEVICE_QUEUE_PROPERTIES: cl_uint = 0x102A;
263pub const CL_DEVICE_QUEUE_ON_HOST_PROPERTIES: cl_uint = 0x102A;
264pub const CL_DEVICE_NAME: cl_uint = 0x102B;
265pub const CL_DEVICE_VENDOR: cl_uint = 0x102C;
266pub const CL_DRIVER_VERSION: cl_uint = 0x102D;
267pub const CL_DEVICE_PROFILE: cl_uint = 0x102E;
268pub const CL_DEVICE_VERSION: cl_uint = 0x102F;
269pub const CL_DEVICE_EXTENSIONS: cl_uint = 0x1030;
270pub const CL_DEVICE_PLATFORM: cl_uint = 0x1031;
271pub const CL_DEVICE_DOUBLE_FP_CONFIG: cl_uint = 0x1032;
272pub const CL_DEVICE_HALF_FP_CONFIG: cl_uint = 0x1033;
273pub const CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF: cl_uint = 0x1034;
274// DEPRICATED 2.0:
275pub const CL_DEVICE_HOST_UNIFIED_MEMORY: cl_uint = 0x1035;
276pub const CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR: cl_uint = 0x1036;
277pub const CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT: cl_uint = 0x1037;
278pub const CL_DEVICE_NATIVE_VECTOR_WIDTH_INT: cl_uint = 0x1038;
279pub const CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG: cl_uint = 0x1039;
280pub const CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT: cl_uint = 0x103A;
281pub const CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE: cl_uint = 0x103B;
282pub const CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF: cl_uint = 0x103C;
283pub const CL_DEVICE_OPENCL_C_VERSION: cl_uint = 0x103D;
284pub const CL_DEVICE_LINKER_AVAILABLE: cl_uint = 0x103E;
285pub const CL_DEVICE_BUILT_IN_KERNELS: cl_uint = 0x103F;
286pub const CL_DEVICE_IMAGE_MAX_BUFFER_SIZE: cl_uint = 0x1040;
287pub const CL_DEVICE_IMAGE_MAX_ARRAY_SIZE: cl_uint = 0x1041;
288pub const CL_DEVICE_PARENT_DEVICE: cl_uint = 0x1042;
289pub const CL_DEVICE_PARTITION_MAX_SUB_DEVICES: cl_uint = 0x1043;
290pub const CL_DEVICE_PARTITION_PROPERTIES: cl_uint = 0x1044;
291pub const CL_DEVICE_PARTITION_AFFINITY_DOMAIN: cl_uint = 0x1045;
292pub const CL_DEVICE_PARTITION_TYPE: cl_uint = 0x1046;
293pub const CL_DEVICE_REFERENCE_COUNT: cl_uint = 0x1047;
294pub const CL_DEVICE_PREFERRED_INTEROP_USER_SYNC: cl_uint = 0x1048;
295pub const CL_DEVICE_PRINTF_BUFFER_SIZE: cl_uint = 0x1049;
296pub const CL_DEVICE_IMAGE_PITCH_ALIGNMENT: cl_uint = 0x104A;
297pub const CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT: cl_uint = 0x104B;
298//###### NEW ########
299pub const CL_DEVICE_MAX_READ_WRITE_IMAGE_ARGS: cl_uint = 0x104C;
300pub const CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE: cl_uint = 0x104D;
301pub const CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES: cl_uint = 0x104E;
302pub const CL_DEVICE_QUEUE_ON_DEVICE_PREFERRED_SIZE: cl_uint = 0x104F;
303pub const CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE: cl_uint = 0x1050;
304pub const CL_DEVICE_MAX_ON_DEVICE_QUEUES: cl_uint = 0x1051;
305pub const CL_DEVICE_MAX_ON_DEVICE_EVENTS: cl_uint = 0x1052;
306pub const CL_DEVICE_SVM_CAPABILITIES: cl_uint = 0x1053;
307pub const CL_DEVICE_GLOBAL_VARIABLE_PREFERRED_TOTAL_SIZE: cl_uint = 0x1054;
308pub const CL_DEVICE_MAX_PIPE_ARGS: cl_uint = 0x1055;
309pub const CL_DEVICE_PIPE_MAX_ACTIVE_RESERVATIONS: cl_uint = 0x1056;
310pub const CL_DEVICE_PIPE_MAX_PACKET_SIZE: cl_uint = 0x1057;
311pub const CL_DEVICE_PREFERRED_PLATFORM_ATOMIC_ALIGNMENT: cl_uint = 0x1058;
312pub const CL_DEVICE_PREFERRED_GLOBAL_ATOMIC_ALIGNMENT: cl_uint = 0x1059;
313pub const CL_DEVICE_PREFERRED_LOCAL_ATOMIC_ALIGNMENT: cl_uint = 0x105A;
314pub const CL_DEVICE_IL_VERSION: cl_uint = 0x105B;
315pub const CL_DEVICE_MAX_NUM_SUB_GROUPS: cl_uint = 0x105C;
316pub const CL_DEVICE_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS: cl_uint = 0x105D;
317
318// cl_device_fp_config - bitfield:
319pub const CL_FP_DENORM: cl_bitfield = 1 << 0;
320pub const CL_FP_INF_NAN: cl_bitfield = 1 << 1;
321pub const CL_FP_ROUND_TO_NEAREST: cl_bitfield = 1 << 2;
322pub const CL_FP_ROUND_TO_ZERO: cl_bitfield = 1 << 3;
323pub const CL_FP_ROUND_TO_INF: cl_bitfield = 1 << 4;
324pub const CL_FP_FMA: cl_bitfield = 1 << 5;
325pub const CL_FP_SOFT_FLOAT: cl_bitfield = 1 << 6;
326pub const CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT: cl_bitfield = 1 << 7;
327
328// cl_device_mem_cache_type:
329pub const CL_NONE: cl_uint = 0x0;
330pub const CL_READ_ONLY_CACHE: cl_uint = 0x1;
331pub const CL_READ_WRITE_CACHE: cl_uint = 0x2;
332
333// cl_device_local_mem_type:
334pub const CL_LOCAL: cl_uint = 0x1;
335pub const CL_GLOBAL: cl_uint = 0x2;
336
337// cl_device_exec_capabilities - bitfield:
338pub const CL_EXEC_KERNEL: cl_bitfield = 1 << 0;
339pub const CL_EXEC_NATIVE_KERNEL: cl_bitfield = 1 << 1;
340
341// cl_command_queue_properties - bitfield:
342pub const CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE: cl_bitfield = 1 << 0;
343pub const CL_QUEUE_PROFILING_ENABLE: cl_bitfield = 1 << 1;
344//###### NEW ########
345pub const CL_QUEUE_ON_DEVICE: cl_bitfield = 1 << 2;
346pub const CL_QUEUE_ON_DEVICE_DEFAULT: cl_bitfield = 1 << 3;
347
348// cl_context_info:
349pub const CL_CONTEXT_REFERENCE_COUNT: cl_uint = 0x1080;
350pub const CL_CONTEXT_DEVICES: cl_uint = 0x1081;
351pub const CL_CONTEXT_PROPERTIES: cl_uint = 0x1082;
352pub const CL_CONTEXT_NUM_DEVICES: cl_uint = 0x1083;
353
354// cl_context_info + cl_context_properties:
355pub const CL_CONTEXT_PLATFORM: cl_uint = 0x1084;
356pub const CL_CONTEXT_INTEROP_USER_SYNC: cl_uint = 0x1085;
357
358// cl_device_partition_property:
359pub const CL_DEVICE_PARTITION_EQUALLY: cl_uint = 0x1086;
360pub const CL_DEVICE_PARTITION_BY_COUNTS: cl_uint = 0x1087;
361pub const CL_DEVICE_PARTITION_BY_COUNTS_LIST_END: cl_uint = 0x0;
362pub const CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN: cl_uint = 0x1088;
363
364// cl_device_affinity_domain:
365pub const CL_DEVICE_AFFINITY_DOMAIN_NUMA: cl_bitfield = 1 << 0;
366pub const CL_DEVICE_AFFINITY_DOMAIN_L4_CACHE: cl_bitfield = 1 << 1;
367pub const CL_DEVICE_AFFINITY_DOMAIN_L3_CACHE: cl_bitfield = 1 << 2;
368pub const CL_DEVICE_AFFINITY_DOMAIN_L2_CACHE: cl_bitfield = 1 << 3;
369pub const CL_DEVICE_AFFINITY_DOMAIN_L1_CACHE: cl_bitfield = 1 << 4;
370pub const CL_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE: cl_bitfield = 1 << 5;
371
372//###### NEW ########
373// cl_device_svm_capabilities:
374pub const CL_DEVICE_SVM_COARSE_GRAIN_BUFFER: cl_bitfield = 1 << 0;
375pub const CL_DEVICE_SVM_FINE_GRAIN_BUFFER: cl_bitfield = 1 << 1;
376pub const CL_DEVICE_SVM_FINE_GRAIN_SYSTEM: cl_bitfield = 1 << 2;
377pub const CL_DEVICE_SVM_ATOMICS: cl_bitfield = 1 << 3;
378
379// cl_command_queue_info:
380pub const CL_QUEUE_CONTEXT: cl_uint = 0x1090;
381pub const CL_QUEUE_DEVICE: cl_uint = 0x1091;
382pub const CL_QUEUE_REFERENCE_COUNT: cl_uint = 0x1092;
383pub const CL_QUEUE_PROPERTIES: cl_uint = 0x1093;
384//###### NEW ########
385pub const CL_QUEUE_SIZE: cl_uint = 0x1094;
386pub const CL_QUEUE_DEVICE_DEFAULT: cl_uint = 0x1095;
387
388// cl_mem_flags and cl_svm_mem_flags - bitfield:
389pub const CL_MEM_READ_WRITE: cl_bitfield = 1 << 0;
390pub const CL_MEM_WRITE_ONLY: cl_bitfield = 1 << 1;
391pub const CL_MEM_READ_ONLY: cl_bitfield = 1 << 2;
392pub const CL_MEM_USE_HOST_PTR: cl_bitfield = 1 << 3;
393pub const CL_MEM_ALLOC_HOST_PTR: cl_bitfield = 1 << 4;
394pub const CL_MEM_COPY_HOST_PTR: cl_bitfield = 1 << 5;
395// RESERVED                                             cl_bitfield = 1 << 6;
396pub const CL_MEM_HOST_WRITE_ONLY: cl_bitfield = 1 << 7;
397pub const CL_MEM_HOST_READ_ONLY: cl_bitfield = 1 << 8;
398pub const CL_MEM_HOST_NO_ACCESS: cl_bitfield = 1 << 9;
399//###### NEW ########
400pub const CL_MEM_SVM_FINE_GRAIN_BUFFER: cl_bitfield = 1 << 10; // used by cl_svm_mem_flags only
401pub const CL_MEM_SVM_ATOMICS: cl_bitfield = 1 << 11; // used by cl_svm_mem_flags only
402pub const CL_MEM_KERNEL_READ_AND_WRITE: cl_bitfield = 1 << 12;
403
404// cl_mem_migration_flags - bitfield:
405pub const CL_MIGRATE_MEM_OBJECT_HOST: cl_bitfield = 1 << 0;
406pub const CL_MIGRATE_MEM_OBJECT_CONTENT_UNDEFINED: cl_bitfield = 1 << 1;
407
408// cl_channel_order:
409pub const CL_R: cl_uint = 0x10B0;
410pub const CL_A: cl_uint = 0x10B1;
411pub const CL_RG: cl_uint = 0x10B2;
412pub const CL_RA: cl_uint = 0x10B3;
413pub const CL_RGB: cl_uint = 0x10B4;
414pub const CL_RGBA: cl_uint = 0x10B5;
415pub const CL_BGRA: cl_uint = 0x10B6;
416pub const CL_ARGB: cl_uint = 0x10B7;
417pub const CL_INTENSITY: cl_uint = 0x10B8;
418pub const CL_LUMINANCE: cl_uint = 0x10B9;
419pub const CL_Rx: cl_uint = 0x10BA;
420pub const CL_RGx: cl_uint = 0x10BB;
421pub const CL_RGBx: cl_uint = 0x10BC;
422pub const CL_DEPTH: cl_uint = 0x10BD;
423pub const CL_DEPTH_STENCIL: cl_uint = 0x10BE;
424//###### NEW ########
425pub const CL_sRGB: cl_uint = 0x10BF;
426pub const CL_sRGBx: cl_uint = 0x10C0;
427pub const CL_sRGBA: cl_uint = 0x10C1;
428pub const CL_sBGRA: cl_uint = 0x10C2;
429pub const CL_ABGR: cl_uint = 0x10C3;
430
431// cl_channel_type:
432pub const CL_SNORM_INT8: cl_uint = 0x10D0;
433pub const CL_SNORM_INT16: cl_uint = 0x10D1;
434pub const CL_UNORM_INT8: cl_uint = 0x10D2;
435pub const CL_UNORM_INT16: cl_uint = 0x10D3;
436pub const CL_UNORM_SHORT_565: cl_uint = 0x10D4;
437pub const CL_UNORM_SHORT_555: cl_uint = 0x10D5;
438pub const CL_UNORM_INT_101010: cl_uint = 0x10D6;
439pub const CL_SIGNED_INT8: cl_uint = 0x10D7;
440pub const CL_SIGNED_INT16: cl_uint = 0x10D8;
441pub const CL_SIGNED_INT32: cl_uint = 0x10D9;
442pub const CL_UNSIGNED_INT8: cl_uint = 0x10DA;
443pub const CL_UNSIGNED_INT16: cl_uint = 0x10DB;
444pub const CL_UNSIGNED_INT32: cl_uint = 0x10DC;
445pub const CL_HALF_FLOAT: cl_uint = 0x10DD;
446pub const CL_FLOAT: cl_uint = 0x10DE;
447pub const CL_UNORM_INT24: cl_uint = 0x10DF;
448//###### NEW ########
449pub const CL_UNORM_INT_101010_2: cl_uint = 0x10E0;
450
451// cl_mem_object_type:
452pub const CL_MEM_OBJECT_BUFFER: cl_uint = 0x10F0;
453pub const CL_MEM_OBJECT_IMAGE2D: cl_uint = 0x10F1;
454pub const CL_MEM_OBJECT_IMAGE3D: cl_uint = 0x10F2;
455pub const CL_MEM_OBJECT_IMAGE2D_ARRAY: cl_uint = 0x10F3;
456pub const CL_MEM_OBJECT_IMAGE1D: cl_uint = 0x10F4;
457pub const CL_MEM_OBJECT_IMAGE1D_ARRAY: cl_uint = 0x10F5;
458pub const CL_MEM_OBJECT_IMAGE1D_BUFFER: cl_uint = 0x10F6;
459//###### NEW ########
460pub const CL_MEM_OBJECT_PIPE: cl_uint = 0x10F7;
461
462// cl_mem_info:
463pub const CL_MEM_TYPE: cl_uint = 0x1100;
464pub const CL_MEM_FLAGS: cl_uint = 0x1101;
465pub const CL_MEM_SIZE: cl_uint = 0x1102;
466pub const CL_MEM_HOST_PTR: cl_uint = 0x1103;
467pub const CL_MEM_MAP_COUNT: cl_uint = 0x1104;
468pub const CL_MEM_REFERENCE_COUNT: cl_uint = 0x1105;
469pub const CL_MEM_CONTEXT: cl_uint = 0x1106;
470pub const CL_MEM_ASSOCIATED_MEMOBJECT: cl_uint = 0x1107;
471pub const CL_MEM_OFFSET: cl_uint = 0x1108;
472//###### NEW ########
473pub const CL_MEM_USES_SVM_POINTER: cl_uint = 0x1109;
474
475// cl_image_info:
476pub const CL_IMAGE_FORMAT: cl_uint = 0x1110;
477pub const CL_IMAGE_ELEMENT_SIZE: cl_uint = 0x1111;
478pub const CL_IMAGE_ROW_PITCH: cl_uint = 0x1112;
479pub const CL_IMAGE_SLICE_PITCH: cl_uint = 0x1113;
480pub const CL_IMAGE_WIDTH: cl_uint = 0x1114;
481pub const CL_IMAGE_HEIGHT: cl_uint = 0x1115;
482pub const CL_IMAGE_DEPTH: cl_uint = 0x1116;
483pub const CL_IMAGE_ARRAY_SIZE: cl_uint = 0x1117;
484pub const CL_IMAGE_BUFFER: cl_uint = 0x1118;
485pub const CL_IMAGE_NUM_MIP_LEVELS: cl_uint = 0x1119;
486pub const CL_IMAGE_NUM_SAMPLES: cl_uint = 0x111A;
487
488//###### NEW ########
489// cl_pipe_info:
490pub const CL_PIPE_PACKET_SIZE: cl_uint = 0x1120;
491pub const CL_PIPE_MAX_PACKETS: cl_uint = 0x1121;
492
493// cl_addressing_mode:
494pub const CL_ADDRESS_NONE: cl_uint = 0x1130;
495pub const CL_ADDRESS_CLAMP_TO_EDGE: cl_uint = 0x1131;
496pub const CL_ADDRESS_CLAMP: cl_uint = 0x1132;
497pub const CL_ADDRESS_REPEAT: cl_uint = 0x1133;
498pub const CL_ADDRESS_MIRRORED_REPEAT: cl_uint = 0x1134;
499
500// cl_filter_mode:
501pub const CL_FILTER_NEAREST: cl_uint = 0x1140;
502pub const CL_FILTER_LINEAR: cl_uint = 0x1141;
503
504// cl_sampler_info:
505pub const CL_SAMPLER_REFERENCE_COUNT: cl_uint = 0x1150;
506pub const CL_SAMPLER_CONTEXT: cl_uint = 0x1151;
507pub const CL_SAMPLER_NORMALIZED_COORDS: cl_uint = 0x1152;
508pub const CL_SAMPLER_ADDRESSING_MODE: cl_uint = 0x1153;
509pub const CL_SAMPLER_FILTER_MODE: cl_uint = 0x1154;
510//###### NEW ########
511pub const CL_SAMPLER_MIP_FILTER_MODE: cl_uint = 0x1155;
512pub const CL_SAMPLER_LOD_MIN: cl_uint = 0x1156;
513pub const CL_SAMPLER_LOD_MAX: cl_uint = 0x1157;
514
515// cl_map_flags - bitfield:
516pub const CL_MAP_READ: cl_bitfield = 1 << 0;
517pub const CL_MAP_WRITE: cl_bitfield = 1 << 1;
518pub const CL_MAP_WRITE_INVALIDATE_REGION: cl_bitfield = 1 << 2;
519
520// cl_program_info:
521pub const CL_PROGRAM_REFERENCE_COUNT: cl_uint = 0x1160;
522pub const CL_PROGRAM_CONTEXT: cl_uint = 0x1161;
523pub const CL_PROGRAM_NUM_DEVICES: cl_uint = 0x1162;
524pub const CL_PROGRAM_DEVICES: cl_uint = 0x1163;
525pub const CL_PROGRAM_SOURCE: cl_uint = 0x1164;
526pub const CL_PROGRAM_BINARY_SIZES: cl_uint = 0x1165;
527pub const CL_PROGRAM_BINARIES: cl_uint = 0x1166;
528pub const CL_PROGRAM_NUM_KERNELS: cl_uint = 0x1167;
529pub const CL_PROGRAM_KERNEL_NAMES: cl_uint = 0x1168;
530//###### NEW ########
531pub const CL_PROGRAM_IL: cl_uint = 0x1169;
532
533// cl_program_build_info:
534pub const CL_PROGRAM_BUILD_STATUS: cl_uint = 0x1181;
535pub const CL_PROGRAM_BUILD_OPTIONS: cl_uint = 0x1182;
536pub const CL_PROGRAM_BUILD_LOG: cl_uint = 0x1183;
537pub const CL_PROGRAM_BINARY_TYPE: cl_uint = 0x1184;
538//###### NEW ########
539pub const CL_PROGRAM_BUILD_GLOBAL_VARIABLE_TOTAL_SIZE: cl_uint = 0x1185;
540
541// cl_program_binary_type:
542pub const CL_PROGRAM_BINARY_TYPE_NONE: cl_bitfield = 0x0;
543pub const CL_PROGRAM_BINARY_TYPE_COMPILED_OBJECT: cl_bitfield = 0x1;
544pub const CL_PROGRAM_BINARY_TYPE_LIBRARY: cl_bitfield = 0x2;
545pub const CL_PROGRAM_BINARY_TYPE_EXECUTABLE: cl_bitfield = 0x4;
546
547// cl_build_status:
548pub const CL_BUILD_SUCCESS: cl_int = 0;
549pub const CL_BUILD_NONE: cl_int = -1;
550pub const CL_BUILD_ERROR: cl_int = -2;
551pub const CL_BUILD_IN_PROGRESS: cl_int = -3;
552
553// cl_kernel_info:
554pub const CL_KERNEL_FUNCTION_NAME: cl_uint = 0x1190;
555pub const CL_KERNEL_NUM_ARGS: cl_uint = 0x1191;
556pub const CL_KERNEL_REFERENCE_COUNT: cl_uint = 0x1192;
557pub const CL_KERNEL_CONTEXT: cl_uint = 0x1193;
558pub const CL_KERNEL_PROGRAM: cl_uint = 0x1194;
559pub const CL_KERNEL_ATTRIBUTES: cl_uint = 0x1195;
560//###### NEW ########
561pub const CL_KERNEL_MAX_NUM_SUB_GROUPS: cl_uint = 0x11B9;
562pub const CL_KERNEL_COMPILE_NUM_SUB_GROUPS: cl_uint = 0x11BA;
563
564// cl_kernel_arg_info:
565pub const CL_KERNEL_ARG_ADDRESS_QUALIFIER: cl_uint = 0x1196;
566pub const CL_KERNEL_ARG_ACCESS_QUALIFIER: cl_uint = 0x1197;
567pub const CL_KERNEL_ARG_TYPE_NAME: cl_uint = 0x1198;
568pub const CL_KERNEL_ARG_TYPE_QUALIFIER: cl_uint = 0x1199;
569pub const CL_KERNEL_ARG_NAME: cl_uint = 0x119A;
570
571// cl_kernel_arg_address_qualifier:
572pub const CL_KERNEL_ARG_ADDRESS_GLOBAL: cl_uint = 0x119B;
573pub const CL_KERNEL_ARG_ADDRESS_LOCAL: cl_uint = 0x119C;
574pub const CL_KERNEL_ARG_ADDRESS_CONSTANT: cl_uint = 0x119D;
575pub const CL_KERNEL_ARG_ADDRESS_PRIVATE: cl_uint = 0x119E;
576
577// cl_kernel_arg_access_qualifier:
578pub const CL_KERNEL_ARG_ACCESS_READ_ONLY: cl_uint = 0x11A0;
579pub const CL_KERNEL_ARG_ACCESS_WRITE_ONLY: cl_uint = 0x11A1;
580pub const CL_KERNEL_ARG_ACCESS_READ_WRITE: cl_uint = 0x11A2;
581pub const CL_KERNEL_ARG_ACCESS_NONE: cl_uint = 0x11A3;
582
583// cl_kernel_arg_type_qualifer:
584pub const CL_KERNEL_ARG_TYPE_NONE: cl_bitfield = 0;
585pub const CL_KERNEL_ARG_TYPE_CONST: cl_bitfield = 1 << 0;
586pub const CL_KERNEL_ARG_TYPE_RESTRICT: cl_bitfield = 1 << 1;
587pub const CL_KERNEL_ARG_TYPE_VOLATILE: cl_bitfield = 1 << 2;
588//###### NEW ########
589pub const CL_KERNEL_ARG_TYPE_PIPE: cl_bitfield = 1 << 3;
590
591// cl_kernel_work_group_info:
592pub const CL_KERNEL_WORK_GROUP_SIZE: cl_uint = 0x11B0;
593pub const CL_KERNEL_COMPILE_WORK_GROUP_SIZE: cl_uint = 0x11B1;
594pub const CL_KERNEL_LOCAL_MEM_SIZE: cl_uint = 0x11B2;
595pub const CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE: cl_uint = 0x11B3;
596pub const CL_KERNEL_PRIVATE_MEM_SIZE: cl_uint = 0x11B4;
597pub const CL_KERNEL_GLOBAL_WORK_SIZE: cl_uint = 0x11B5;
598
599//###### NEW ########
600// cl_kernel_sub_group_info:
601pub const CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE: cl_uint = 0x2033;
602pub const CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE: cl_uint = 0x2034;
603pub const CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT: cl_uint = 0x11B8;
604
605//###### NEW ########
606// cl_kernel_exec_info:
607pub const CL_KERNEL_EXEC_INFO_SVM_PTRS: cl_uint = 0x11B6;
608pub const CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM: cl_uint = 0x11B7;
609
610// cl_event_info:
611pub const CL_EVENT_COMMAND_QUEUE: cl_uint = 0x11D0;
612pub const CL_EVENT_COMMAND_TYPE: cl_uint = 0x11D1;
613pub const CL_EVENT_REFERENCE_COUNT: cl_uint = 0x11D2;
614pub const CL_EVENT_COMMAND_EXECUTION_STATUS: cl_uint = 0x11D3;
615pub const CL_EVENT_CONTEXT: cl_uint = 0x11D4;
616
617// cl_command_type:
618pub const CL_COMMAND_NDRANGE_KERNEL: cl_uint = 0x11F0;
619pub const CL_COMMAND_TASK: cl_uint = 0x11F1;
620pub const CL_COMMAND_NATIVE_KERNEL: cl_uint = 0x11F2;
621pub const CL_COMMAND_READ_BUFFER: cl_uint = 0x11F3;
622pub const CL_COMMAND_WRITE_BUFFER: cl_uint = 0x11F4;
623pub const CL_COMMAND_COPY_BUFFER: cl_uint = 0x11F5;
624pub const CL_COMMAND_READ_IMAGE: cl_uint = 0x11F6;
625pub const CL_COMMAND_WRITE_IMAGE: cl_uint = 0x11F7;
626pub const CL_COMMAND_COPY_IMAGE: cl_uint = 0x11F8;
627pub const CL_COMMAND_COPY_IMAGE_TO_BUFFER: cl_uint = 0x11F9;
628pub const CL_COMMAND_COPY_BUFFER_TO_IMAGE: cl_uint = 0x11FA;
629pub const CL_COMMAND_MAP_BUFFER: cl_uint = 0x11FB;
630pub const CL_COMMAND_MAP_IMAGE: cl_uint = 0x11FC;
631pub const CL_COMMAND_UNMAP_MEM_OBJECT: cl_uint = 0x11FD;
632pub const CL_COMMAND_MARKER: cl_uint = 0x11FE;
633pub const CL_COMMAND_ACQUIRE_GL_OBJECTS: cl_uint = 0x11FF;
634pub const CL_COMMAND_RELEASE_GL_OBJECTS: cl_uint = 0x1200;
635pub const CL_COMMAND_READ_BUFFER_RECT: cl_uint = 0x1201;
636pub const CL_COMMAND_WRITE_BUFFER_RECT: cl_uint = 0x1202;
637pub const CL_COMMAND_COPY_BUFFER_RECT: cl_uint = 0x1203;
638pub const CL_COMMAND_USER: cl_uint = 0x1204;
639pub const CL_COMMAND_BARRIER: cl_uint = 0x1205;
640pub const CL_COMMAND_MIGRATE_MEM_OBJECTS: cl_uint = 0x1206;
641pub const CL_COMMAND_FILL_BUFFER: cl_uint = 0x1207;
642pub const CL_COMMAND_FILL_IMAGE: cl_uint = 0x1208;
643//###### NEW ########
644pub const CL_COMMAND_SVM_FREE: cl_uint = 0x1209;
645pub const CL_COMMAND_SVM_MEMCPY: cl_uint = 0x120A;
646pub const CL_COMMAND_SVM_MEMFILL: cl_uint = 0x120B;
647pub const CL_COMMAND_SVM_MAP: cl_uint = 0x120C;
648pub const CL_COMMAND_SVM_UNMAP: cl_uint = 0x120D;
649
650// command execution status:
651pub const CL_COMPLETE: cl_int = 0x0;
652pub const CL_RUNNING: cl_int = 0x1;
653pub const CL_SUBMITTED: cl_int = 0x2;
654pub const CL_QUEUED: cl_int = 0x3;
655
656// cl_buffer_create_type:
657pub const CL_BUFFER_CREATE_TYPE_REGION: cl_uint = 0x1220;
658
659// cl_profiling_info:
660pub const CL_PROFILING_COMMAND_QUEUED: cl_uint = 0x1280;
661pub const CL_PROFILING_COMMAND_SUBMIT: cl_uint = 0x1281;
662pub const CL_PROFILING_COMMAND_START: cl_uint = 0x1282;
663pub const CL_PROFILING_COMMAND_END: cl_uint = 0x1283;
664//###### NEW ########
665pub const CL_PROFILING_COMMAND_COMPLETE: cl_uint = 0x1284;
666
667//#[link_args = "-L$OPENCL_LIB -lOpenCL"]
668#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
669#[cfg_attr(target_os = "windows", link(name = "OpenCL"))]
670#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
671extern "system" {
672    // Platform API:
673    pub fn clGetPlatformIDs(
674        num_entries: cl_uint,
675        platforms: *mut cl_platform_id,
676        num_platforms: *mut cl_uint,
677    ) -> cl_int;
678
679    pub fn clGetPlatformInfo(
680        platform: cl_platform_id,
681        param_name: cl_platform_info,
682        param_value_size: size_t,
683        param_value: *mut c_void,
684        param_value_size_ret: *mut size_t,
685    ) -> cl_int;
686
687    // Device APIs:
688    pub fn clGetDeviceIDs(
689        platform: cl_platform_id,
690        device_type: cl_device_type,
691        num_entries: cl_uint,
692        devices: *mut cl_device_id,
693        num_devices: *mut cl_uint,
694    ) -> cl_int;
695
696    pub fn clGetDeviceInfo(
697        device: cl_device_id,
698        param_name: cl_device_info,
699        param_value_size: size_t,
700        param_value: *mut c_void,
701        param_value_size_ret: *mut size_t,
702    ) -> cl_int;
703
704    // extern CL_API_ENTRY cl_int CL_API_CALL
705    // clCreateSubDevices(cl_device_id                         /* in_device */,
706    //                    const cl_device_partition_property * /* properties */,
707    //                    cl_uint                              /* num_devices */,
708    //                    cl_device_id *                       /* out_devices */,
709    //                    cl_uint *                            /* num_devices_ret */) CL_API_SUFFIX__VERSION_1_2;
710    //############################### NEW 1.2 #################################
711    #[cfg(feature = "opencl_version_1_2")]
712    pub fn clCreateSubDevices(
713        in_device: cl_device_id,
714        properties: *const cl_device_partition_property,
715        num_devices: cl_uint,
716        out_devices: *mut cl_device_id,
717        num_devices_ret: *mut cl_uint,
718    ) -> cl_int;
719
720    // extern CL_API_ENTRY cl_int CL_API_CALL
721    // clRetainDevice(cl_device_id /* device */) CL_API_SUFFIX__VERSION_1_2;
722    //############################### NEW 1.2 #################################
723    #[cfg(feature = "opencl_version_1_2")]
724    pub fn clRetainDevice(device: cl_device_id) -> cl_int;
725
726    // extern CL_API_ENTRY cl_int CL_API_CALL
727    // clReleaseDevice(cl_device_id /* device */) CL_API_SUFFIX__VERSION_1_2;
728    //############################### NEW 1.2 #################################
729    #[cfg(feature = "opencl_version_1_2")]
730    pub fn clReleaseDevice(device: cl_device_id) -> cl_int;
731
732    // extern CL_API_ENTRY cl_int CL_API_CALL
733    // clSetDefaultDeviceCommandQueue(cl_context           /* context */,
734    //                                cl_device_id         /* device */,
735    //                                cl_command_queue     /* command_queue */) CL_API_SUFFIX__VERSION_2_1;
736    //############################### NEW 2.1 #################################
737    #[cfg(feature = "opencl_version_2_1")]
738    pub fn clSetDefaultDeviceCommandQueue(
739        context: cl_context,
740        device: cl_device_id,
741        command_queue: cl_command_queue,
742    ) -> cl_int;
743
744    // extern CL_API_ENTRY cl_int CL_API_CALL
745    // clGetDeviceAndHostTimer(cl_device_id    /* device */,
746    //                         cl_ulong*       /* device_timestamp */,
747    //                         cl_ulong*       /* host_timestamp */) CL_API_SUFFIX__VERSION_2_1;
748    //############################### NEW 2.1 #################################
749    #[cfg(feature = "opencl_version_2_1")]
750    pub fn clGetDeviceAndHostTimer(
751        device: cl_device_id,
752        device_timestamp: *mut cl_ulong,
753        host_timestamp: *mut cl_ulong,
754    ) -> cl_int;
755
756    // extern CL_API_ENTRY cl_int CL_API_CALL
757    // clGetHostTimer(cl_device_id /* device */,
758    //                cl_ulong *   /* host_timestamp */)  CL_API_SUFFIX__VERSION_2_1;
759    //############################### NEW 2.1 #################################
760    #[cfg(feature = "opencl_version_2_1")]
761    pub fn clGetHostTimer(device: cl_device_id, host_timestamp: *mut cl_ulong) -> cl_int;
762
763    // Context APIs:
764    pub fn clCreateContext(
765        properties: *const cl_context_properties,
766        num_devices: cl_uint,
767        devices: *const cl_device_id,
768        pfn_notify: Option<extern "C" fn(*const c_char, *const c_void, size_t, *mut c_void)>,
769        user_data: *mut c_void,
770        errcode_ret: *mut cl_int,
771    ) -> cl_context;
772
773    pub fn clCreateContextFromType(
774        properties: *const cl_context_properties,
775        device_type: cl_device_type,
776        pfn_notify: Option<extern "C" fn(*const c_char, *const c_void, size_t, *mut c_void)>,
777        user_data: *mut c_void,
778        errcode_ret: *mut cl_int,
779    ) -> cl_context;
780
781    pub fn clRetainContext(context: cl_context) -> cl_int;
782
783    pub fn clReleaseContext(context: cl_context) -> cl_int;
784
785    pub fn clGetContextInfo(
786        context: cl_context,
787        param_name: cl_context_info,
788        param_value_size: size_t,
789        param_value: *mut c_void,
790        param_value_size_ret: *mut size_t,
791    ) -> cl_int;
792
793    // Command Queue APIs
794    //########################## DEPRICATED 1.2 ##############################
795    pub fn clCreateCommandQueue(
796        context: cl_context,
797        device: cl_device_id,
798        properties: cl_command_queue_properties,
799        errcode_ret: *mut cl_int,
800    ) -> cl_command_queue;
801
802    // extern CL_API_ENTRY cl_command_queue CL_API_CALL
803    // clCreateCommandQueueWithProperties(cl_context               /* context */,
804    //                                    cl_device_id             /* device */,
805    //                                    const cl_queue_properties *    /* properties */,
806    //                                    cl_int *                 /* errcode_ret */) CL_API_SUFFIX__VERSION_2_0;
807    //############################### NEW 2.0 #################################
808    #[cfg(feature = "opencl_version_2_0")]
809    pub fn clCreateCommandQueueWithProperties(
810        context: cl_context,
811        device: cl_device_id,
812        properties: *const cl_queue_properties,
813        errcode_ret: *mut cl_int,
814    ) -> cl_command_queue;
815
816    pub fn clRetainCommandQueue(command_queue: cl_command_queue) -> cl_int;
817
818    pub fn clReleaseCommandQueue(command_queue: cl_command_queue) -> cl_int;
819
820    pub fn clGetCommandQueueInfo(
821        command_queue: cl_command_queue,
822        param_name: cl_command_queue_info,
823        param_value_size: size_t,
824        param_value: *mut c_void,
825        param_value_size_ret: *mut size_t,
826    ) -> cl_int;
827
828    // Memory Object APIs:
829    pub fn clCreateBuffer(
830        context: cl_context,
831        flags: cl_mem_flags,
832        size: size_t,
833        host_ptr: *mut c_void,
834        errcode_ret: *mut cl_int,
835    ) -> cl_mem;
836
837    pub fn clCreateSubBuffer(
838        buffer: cl_mem,
839        flags: cl_mem_flags,
840        buffer_create_type: cl_buffer_create_type,
841        buffer_create_info: *const c_void,
842        errcode_ret: *mut cl_int,
843    ) -> cl_mem;
844
845    //########################## DEPRICATED 1.1 ##############################
846    pub fn clCreateImage2D(
847        context: cl_context,
848        flags: cl_mem_flags,
849        image_format: *mut cl_image_format,
850        image_width: size_t,
851        image_depth: size_t,
852        image_slc_pitch: size_t,
853        host_ptr: *mut c_void,
854        errcode_ret: *mut cl_int,
855    ) -> cl_mem;
856
857    //########################## DEPRICATED 1.1 ##############################
858    pub fn clCreateImage3D(
859        context: cl_context,
860        flags: cl_mem_flags,
861        image_format: *mut cl_image_format,
862        image_width: size_t,
863        image_height: size_t,
864        image_depth: size_t,
865        image_row_pitch: size_t,
866        image_slc_pitch: size_t,
867        host_ptr: *mut c_void,
868        errcode_ret: *mut cl_int,
869    ) -> cl_mem;
870
871    //############################### NEW 1.2 #################################
872    #[cfg(feature = "opencl_version_1_2")]
873    pub fn clCreateImage(
874        context: cl_context,
875        flags: cl_mem_flags,
876        image_format: *const cl_image_format,
877        image_desc: *const cl_image_desc,
878        host_ptr: *mut c_void,
879        errcode_ret: *mut cl_int,
880    ) -> cl_mem;
881
882    // extern CL_API_ENTRY cl_mem CL_API_CALL
883    // clCreatePipe(cl_context                 /* context */,
884    //              cl_mem_flags               /* flags */,
885    //              cl_uint                    /* pipe_packet_size */,
886    //              cl_uint                    /* pipe_max_packets */,
887    //              const cl_pipe_properties * /* properties */,
888    //              cl_int *                   /* errcode_ret */) CL_API_SUFFIX__VERSION_2_0;
889    //############################### NEW 2.0 #################################
890    #[cfg(feature = "opencl_version_2_0")]
891    pub fn clCreatePipe(
892        context: cl_context,
893        flags: cl_mem_flags,
894        pipe_packet_size: cl_uint,
895        pipe_max_packets: cl_uint,
896        properties: *const cl_pipe_properties,
897        errcode_ret: *mut cl_int,
898    ) -> cl_mem;
899
900    pub fn clRetainMemObject(memobj: cl_mem) -> cl_int;
901
902    pub fn clReleaseMemObject(memobj: cl_mem) -> cl_int;
903
904    pub fn clGetSupportedImageFormats(
905        context: cl_context,
906        flags: cl_mem_flags,
907        image_type: cl_mem_object_type,
908        num_entries: cl_uint,
909        image_formats: *mut cl_image_format,
910        num_image_formats: *mut cl_uint,
911    ) -> cl_int;
912
913    pub fn clGetMemObjectInfo(
914        memobj: cl_mem,
915        param_name: cl_mem_info,
916        param_value_size: size_t,
917        param_value: *mut c_void,
918        param_value_size_ret: *mut size_t,
919    ) -> cl_int;
920
921    pub fn clGetImageInfo(
922        image: cl_mem,
923        param_name: cl_image_info,
924        param_value_size: size_t,
925        param_value: *mut c_void,
926        param_value_size_ret: *mut size_t,
927    ) -> cl_int;
928
929    // extern CL_API_ENTRY cl_int CL_API_CALL
930    // clGetPipeInfo(cl_mem           /* pipe */,
931    //               cl_pipe_info     /* param_name */,
932    //               size_t           /* param_value_size */,
933    //               void *           /* param_value */,
934    //               size_t *         /* param_value_size_ret */) CL_API_SUFFIX__VERSION_2_0;
935    //############################### NEW 2.0 #################################
936    #[cfg(feature = "opencl_version_2_0")]
937    pub fn clGetPipeInfo(
938        pipe: cl_mem,
939        param_name: cl_pipe_info,
940        param_value_size: size_t,
941        param_value: *mut c_void,
942        param_value_size_ret: *mut size_t,
943    ) -> cl_int;
944
945    pub fn clSetMemObjectDestructorCallback(
946        memobj: cl_mem,
947        pfn_notify: Option<extern "C" fn(cl_mem, *mut c_void)>,
948        user_data: *mut c_void,
949    ) -> cl_int;
950
951    // SVM Allocation APIs
952    // extern CL_API_ENTRY void * CL_API_CALL
953    // clSVMAlloc(cl_context       /* context */,
954    //            cl_svm_mem_flags /* flags */,
955    //            size_t           /* size */,
956    //            cl_uint          /* alignment */) CL_API_SUFFIX__VERSION_2_0;
957    //############################### NEW 2.0 #################################
958    #[cfg(feature = "opencl_version_2_0")]
959    pub fn clSVMAlloc(
960        context: cl_context,
961        flags: cl_svm_mem_flags,
962        size: size_t,
963        alignment: cl_uint,
964    ) -> *mut c_void;
965
966    // extern CL_API_ENTRY void CL_API_CALL
967    // clSVMFree(cl_context        /* context */,
968    //           void *            /* svm_pointer */) CL_API_SUFFIX__VERSION_2_0;
969    //############################### NEW 2.0 #################################
970    #[cfg(feature = "opencl_version_2_0")]
971    pub fn clSVMFree(context: cl_context, svm_pointer: *mut c_void);
972
973    // Sampler APIs:
974    pub fn clCreateSampler(
975        context: cl_context,
976        normalize_coords: cl_bool,
977        addressing_mode: cl_addressing_mode,
978        filter_mode: cl_filter_mode,
979        errcode_ret: *mut cl_int,
980    ) -> cl_sampler;
981
982    // extern CL_API_ENTRY cl_sampler CL_API_CALL
983    // clCreateSamplerWithProperties(cl_context                     /* context */,
984    //                               const cl_sampler_properties *  /* normalized_coords */,
985    //                               cl_int *                       /* errcode_ret */) CL_API_SUFFIX__VERSION_2_0;
986    //############################### NEW 2.0 #################################
987    #[cfg(feature = "opencl_version_2_0")]
988    pub fn clCreateSamplerWithProperties(
989        context: cl_context,
990        normalized_coords: *const cl_sampler_properties,
991        errcode_ret: *mut cl_int,
992    ) -> cl_sampler;
993
994    pub fn clRetainSampler(sampler: cl_sampler) -> cl_int;
995
996    pub fn clReleaseSampler(sampler: cl_sampler) -> cl_int;
997
998    pub fn clGetSamplerInfo(
999        sampler: cl_sampler,
1000        param_name: cl_sampler_info,
1001        param_value_size: size_t,
1002        param_value: *mut c_void,
1003        param_value_size_ret: *mut size_t,
1004    ) -> cl_int;
1005
1006    // Program Object APIs:
1007    pub fn clCreateProgramWithSource(
1008        context: cl_context,
1009        count: cl_uint,
1010        strings: *const *const c_char,
1011        lengths: *const size_t,
1012        errcode_ret: *mut cl_int,
1013    ) -> cl_program;
1014
1015    pub fn clCreateProgramWithBinary(
1016        context: cl_context,
1017        num_devices: cl_uint,
1018        device_list: *const cl_device_id,
1019        lengths: *const size_t,
1020        binaries: *const *const c_uchar,
1021        binary_status: *mut cl_int,
1022        errcode_ret: *mut cl_int,
1023    ) -> cl_program;
1024
1025    // extern CL_API_ENTRY cl_program CL_API_CALL
1026    // clCreateProgramWithBuiltInKernels(cl_context            /* context */,
1027    //                                  cl_uint               /* num_devices */,
1028    //                                  const cl_device_id *  /* device_list */,
1029    //                                  const char *          /* kernel_names */,
1030    //                                  cl_int *              /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2;
1031    //############################### NEW 1.2 #################################
1032    #[cfg(feature = "opencl_version_1_2")]
1033    pub fn clCreateProgramWithBuiltInKernels(
1034        context: cl_context,
1035        num_devices: cl_uint,
1036        device_list: *const cl_device_id,
1037        kernel_names: *const char,
1038        errcode_ret: *mut cl_int,
1039    ) -> cl_program;
1040
1041    // extern CL_API_ENTRY cl_program CL_API_CALL
1042    // clCreateProgramWithIL(cl_context    /* context */,
1043    //                      const void*    /* il */,
1044    //                      size_t         /* length */,
1045    //                      cl_int*        /* errcode_ret */) CL_API_SUFFIX__VERSION_2_1;
1046    //############################### NEW 2.1 #################################
1047    #[cfg(feature = "opencl_version_2_1")]
1048    pub fn clCreateProgramWithIL(
1049        context: cl_context,
1050        il: *const c_void,
1051        length: size_t,
1052        errcode_ret: *mut cl_int,
1053    ) -> cl_program;
1054
1055    pub fn clRetainProgram(program: cl_program) -> cl_int;
1056
1057    pub fn clReleaseProgram(program: cl_program) -> cl_int;
1058
1059    pub fn clBuildProgram(
1060        program: cl_program,
1061        num_devices: cl_uint,
1062        device_list: *const cl_device_id,
1063        options: *const c_char,
1064        pfn_notify: Option<extern "C" fn(cl_program, *mut c_void)>,
1065        user_data: *mut c_void,
1066    ) -> cl_int;
1067
1068    //########################## DEPRICATED 1.1 ##############################
1069    pub fn clUnloadCompiler() -> cl_int;
1070
1071    // extern CL_API_ENTRY cl_int CL_API_CALL
1072    // clCompileProgram(cl_program           /* program */,
1073    //                 cl_uint              /* num_devices */,
1074    //                 const cl_device_id * /* device_list */,
1075    //                 const char *         /* options */,
1076    //                 cl_uint              /* num_input_headers */,
1077    //                 const cl_program *   /* input_headers */,
1078    //                 const char **        /* header_include_names */,
1079    //                 void (CL_CALLBACK *  /* pfn_notify */)(cl_program /* program */, void * /* user_data */),
1080    //                 void *               /* user_data */) CL_API_SUFFIX__VERSION_1_2;
1081    //############################### NEW 1.2 #################################
1082    #[cfg(feature = "opencl_version_1_2")]
1083    pub fn clCompileProgram(
1084        program: cl_program,
1085        num_devices: cl_uint,
1086        device_list: *const cl_device_id,
1087        options: *const c_char,
1088        num_input_headers: cl_uint,
1089        input_headers: *const cl_program,
1090        header_include_names: *const *const c_char,
1091        pfn_notify: Option<extern "C" fn(program: cl_program, user_data: *mut c_void)>,
1092        user_data: *mut c_void,
1093    ) -> cl_int;
1094
1095    // extern CL_API_ENTRY cl_program CL_API_CALL
1096    // clLinkProgram(cl_context           /* context */,
1097    //               cl_uint              /* num_devices */,
1098    //               const cl_device_id * /* device_list */,
1099    //               const char *         /* options */,
1100    //               cl_uint              /* num_input_programs */,
1101    //               const cl_program *   /* input_programs */,
1102    //               void (CL_CALLBACK *  /* pfn_notify */)(cl_program /* program */, void * /* user_data */),
1103    //               void *               /* user_data */,
1104    //               cl_int *             /* errcode_ret */ ) CL_API_SUFFIX__VERSION_1_2;
1105    //############################### NEW 1.2 #################################
1106    #[cfg(feature = "opencl_version_1_2")]
1107    pub fn clLinkProgram(
1108        context: cl_context,
1109        num_devices: cl_uint,
1110        device_list: *const cl_device_id,
1111        options: *const c_char,
1112        num_input_programs: cl_uint,
1113        input_programs: *const cl_program,
1114        pfn_notify: Option<extern "C" fn(program: cl_program, user_data: *mut c_void)>,
1115        user_data: *mut c_void,
1116        errcode_ret: *mut cl_int,
1117    ) -> cl_program;
1118
1119    // extern CL_API_ENTRY cl_int CL_API_CALL
1120    // clUnloadPlatformCompiler(cl_platform_id /* platform */) CL_API_SUFFIX__VERSION_1_2;
1121    // //############################### NEW 1.2 #################################
1122    #[cfg(feature = "opencl_version_1_2")]
1123    // [DISABLED DUE TO PLATFORM INCOMPATABILITY]
1124    // pub fn clUnloadPlatformCompiler(platform: cl_platform_id) -> cl_int;
1125    pub fn clGetProgramInfo(
1126        program: cl_program,
1127        param_name: cl_program_info,
1128        param_value_size: size_t,
1129        param_value: *mut c_void,
1130        param_value_size_ret: *mut size_t,
1131    ) -> cl_int;
1132
1133    pub fn clGetProgramBuildInfo(
1134        program: cl_program,
1135        device: cl_device_id,
1136        param_name: cl_program_build_info,
1137        param_value_size: size_t,
1138        param_value: *mut c_void,
1139        param_value_size_ret: *mut size_t,
1140    ) -> cl_int;
1141
1142    // Kernel Object APIs:
1143    pub fn clCreateKernel(
1144        program: cl_program,
1145        kernel_name: *const c_char,
1146        errcode_ret: *mut cl_int,
1147    ) -> cl_kernel;
1148
1149    pub fn clCreateKernelsInProgram(
1150        program: cl_program,
1151        num_kernels: cl_uint,
1152        kernels: *mut cl_kernel,
1153        num_kernels_ret: *mut cl_uint,
1154    ) -> cl_int;
1155
1156    // extern CL_API_ENTRY cl_kernel CL_API_CALL
1157    // clCloneKernel(cl_kernel     /* source_kernel */,
1158    //               cl_int*       /* errcode_ret */) CL_API_SUFFIX__VERSION_2_1;
1159    //############################### NEW 2.1 #################################
1160    #[cfg(feature = "opencl_version_2_1")]
1161    pub fn clCloneKernel(source_kernel: cl_kernel, errcode_ret: *mut cl_int) -> cl_kernel;
1162
1163    pub fn clRetainKernel(kernel: cl_kernel) -> cl_int;
1164
1165    pub fn clReleaseKernel(kernel: cl_kernel) -> cl_int;
1166
1167    pub fn clSetKernelArg(
1168        kernel: cl_kernel,
1169        arg_index: cl_uint,
1170        arg_size: size_t,
1171        arg_value: *const c_void,
1172    ) -> cl_int;
1173
1174    // extern CL_API_ENTRY cl_int CL_API_CALL
1175    // clSetKernelArgSVMPointer(cl_kernel    /* kernel */,
1176    //                          cl_uint      /* arg_index */,
1177    //                          const void * /* arg_value */) CL_API_SUFFIX__VERSION_2_0;
1178    //############################### NEW 2.0 #################################
1179    #[cfg(feature = "opencl_version_2_0")]
1180    pub fn clSetKernelArgSVMPointer(
1181        kernel: cl_kernel,
1182        arg_index: cl_uint,
1183        arg_value: *const c_void,
1184    ) -> cl_int;
1185
1186    // extern CL_API_ENTRY cl_int CL_API_CALL
1187    // clSetKernelExecInfo(cl_kernel            /* kernel */,
1188    //                     cl_kernel_exec_info  /* param_name */,
1189    //                     size_t               /* param_value_size */,
1190    //                     const void *         /* param_value */) CL_API_SUFFIX__VERSION_2_0;
1191    //############################### NEW 2.0 #################################
1192    #[cfg(feature = "opencl_version_2_0")]
1193    pub fn clSetKernelExecInfo(
1194        kernel: cl_kernel,
1195        param_name: cl_kernel_exec_info,
1196        param_value_size: size_t,
1197        param_value: *const c_void,
1198    ) -> cl_int;
1199
1200    pub fn clGetKernelInfo(
1201        kernel: cl_kernel,
1202        param_name: cl_kernel_info,
1203        param_value_size: size_t,
1204        param_value: *mut c_void,
1205        param_value_size_ret: *mut size_t,
1206    ) -> cl_int;
1207
1208    // extern CL_API_ENTRY cl_int CL_API_CALL
1209    // clGetKernelArgInfo(cl_kernel       /* kernel */,
1210    //                   cl_uint         /* arg_indx */,
1211    //                   cl_kernel_arg_info  /* param_name */,
1212    //                   size_t          /* param_value_size */,
1213    //                   void *          /* param_value */,
1214    //                   size_t *        /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_2;
1215    //############################### NEW 1.2 #################################
1216    #[cfg(feature = "opencl_version_1_2")]
1217    pub fn clGetKernelArgInfo(
1218        kernel: cl_kernel,
1219        arg_indx: cl_uint,
1220        param_name: cl_kernel_arg_info,
1221        param_value_size: size_t,
1222        param_value: *mut c_void,
1223        param_value_size_ret: *mut size_t,
1224    ) -> cl_int;
1225
1226    pub fn clGetKernelWorkGroupInfo(
1227        kernel: cl_kernel,
1228        device: cl_device_id,
1229        param_name: cl_kernel_work_group_info,
1230        param_value_size: size_t,
1231        param_value: *mut c_void,
1232        param_value_size_ret: *mut size_t,
1233    ) -> cl_int;
1234
1235    // extern CL_API_ENTRY cl_int CL_API_CALL
1236    // clGetKernelSubGroupInfo(cl_kernel                   /* kernel */,
1237    //                         cl_device_id                /* device */,
1238    //                         cl_kernel_sub_group_info    /* param_name */,
1239    //                         size_t                      /* input_value_size */,
1240    //                         const void*                 /*input_value */,
1241    //                         size_t                      /* param_value_size */,
1242    //                         void*                       /* param_value */,
1243    //                         size_t*                     /* param_value_size_ret */ ) CL_API_SUFFIX__VERSION_2_1;
1244    //############################### NEW 2.1 #################################
1245    #[cfg(feature = "opencl_version_2_1")]
1246    pub fn clGetKernelSubGroupInfo(
1247        kernel: cl_kernel,
1248        device: cl_device_id,
1249        param_name: cl_kernel_sub_group_info,
1250        input_value_size: size_t,
1251        input_value: *const c_void,
1252        param_value_size: size_t,
1253        param_value: *mut c_void,
1254        param_value_size_ret: *mut size_t,
1255    ) -> cl_int;
1256
1257    // Event Object APIs:
1258    pub fn clWaitForEvents(num_events: cl_uint, event_list: *const cl_event) -> cl_int;
1259
1260    pub fn clGetEventInfo(
1261        event: cl_event,
1262        param_name: cl_event_info,
1263        param_value_size: size_t,
1264        param_value: *mut c_void,
1265        param_value_size_ret: *mut size_t,
1266    ) -> cl_int;
1267
1268    pub fn clCreateUserEvent(context: cl_context, errcode_ret: *mut cl_int) -> cl_event;
1269
1270    pub fn clRetainEvent(event: cl_event) -> cl_int;
1271
1272    pub fn clReleaseEvent(event: cl_event) -> cl_int;
1273
1274    pub fn clSetUserEventStatus(event: cl_event, execution_status: cl_int) -> cl_int;
1275
1276    pub fn clSetEventCallback(
1277        event: cl_event,
1278        command_exec_callback_type: cl_int,
1279        pfn_notify: Option<extern "C" fn(cl_event, cl_int, *mut c_void)>,
1280        user_data: *mut c_void,
1281    ) -> cl_int;
1282
1283    // Profiling APIs:
1284    pub fn clGetEventProfilingInfo(
1285        event: cl_event,
1286        param_name: cl_profiling_info,
1287        param_value_size: size_t,
1288        param_value: *mut c_void,
1289        param_value_size_ret: *mut size_t,
1290    ) -> cl_int;
1291
1292    // Flush and Finish APIs:
1293    pub fn clFlush(command_queue: cl_command_queue) -> cl_int;
1294
1295    pub fn clFinish(command_queue: cl_command_queue) -> cl_int;
1296
1297    // Enqueued Commands APIs:
1298    pub fn clEnqueueReadBuffer(
1299        command_queue: cl_command_queue,
1300        buffer: cl_mem,
1301        blocking_read: cl_bool,
1302        offset: size_t,
1303        cb: size_t,
1304        ptr: *mut c_void,
1305        num_events_in_wait_list: cl_uint,
1306        event_wait_list: *const cl_event,
1307        event: *mut cl_event,
1308    ) -> cl_int;
1309
1310    pub fn clEnqueueReadBufferRect(
1311        command_queue: cl_command_queue,
1312        buffer: cl_mem,
1313        blocking_read: cl_bool,
1314        buffer_origin: *const size_t,
1315        host_origin: *const size_t,
1316        region: *const size_t,
1317        buffer_row_pitch: size_t,
1318        buffer_slc_pitch: size_t,
1319        host_row_pitch: size_t,
1320        host_slc_pitch: size_t,
1321        ptr: *mut c_void,
1322        num_events_in_wait_list: cl_uint,
1323        event_wait_list: *const cl_event,
1324        event: *mut cl_event,
1325    ) -> cl_int;
1326
1327    pub fn clEnqueueWriteBuffer(
1328        command_queue: cl_command_queue,
1329        buffer: cl_mem,
1330        blocking_write: cl_bool,
1331        offset: size_t,
1332        cb: size_t,
1333        ptr: *const c_void,
1334        num_events_in_wait_list: cl_uint,
1335        event_wait_list: *const cl_event,
1336        event: *mut cl_event,
1337    ) -> cl_int;
1338
1339    pub fn clEnqueueWriteBufferRect(
1340        command_queue: cl_command_queue,
1341        buffer: cl_mem,
1342        blocking_write: cl_bool,
1343        buffer_origin: *const size_t,
1344        host_origin: *const size_t,
1345        region: *const size_t,
1346        buffer_row_pitch: size_t,
1347        buffer_slc_pitch: size_t,
1348        host_row_pitch: size_t,
1349        host_slc_pitch: size_t,
1350        ptr: *const c_void,
1351        num_events_in_wait_list: cl_uint,
1352        event_wait_list: *const cl_event,
1353        event: *mut cl_event,
1354    ) -> cl_int;
1355
1356    // extern CL_API_ENTRY cl_int CL_API_CALL
1357    // clEnqueueFillBuffer(cl_command_queue   /* command_queue */,
1358    //                 cl_mem             /* buffer */,
1359    //                 const void *       /* pattern */,
1360    //                 size_t             /* pattern_size */,
1361    //                 size_t             /* offset */,
1362    //                 size_t             /* size */,
1363    //                 cl_uint            /* num_events_in_wait_list */,
1364    //                 const cl_event *   /* event_wait_list */,
1365    //                 cl_event *         /* event */) CL_API_SUFFIX__VERSION_1_2;
1366    //############################### NEW 1.2 #################################
1367    #[cfg(feature = "opencl_version_1_2")]
1368    pub fn clEnqueueFillBuffer(
1369        command_queue: cl_command_queue,
1370        buffer: cl_mem,
1371        pattern: *const c_void,
1372        pattern_size: size_t,
1373        offset: size_t,
1374        size: size_t,
1375        num_events_in_wait_list: cl_uint,
1376        event_wait_list: *const cl_event,
1377        event: *mut cl_event,
1378    ) -> cl_int;
1379
1380    pub fn clEnqueueCopyBuffer(
1381        command_queue: cl_command_queue,
1382        src_buffer: cl_mem,
1383        dst_buffer: cl_mem,
1384        src_offset: size_t,
1385        dst_offset: size_t,
1386        cb: size_t,
1387        num_events_in_wait_list: cl_uint,
1388        event_wait_list: *const cl_event,
1389        event: *mut cl_event,
1390    ) -> cl_int;
1391
1392    pub fn clEnqueueCopyBufferRect(
1393        command_queue: cl_command_queue,
1394        src_buffer: cl_mem,
1395        dst_buffer: cl_mem,
1396        src_origin: *const size_t,
1397        dst_origin: *const size_t,
1398        region: *const size_t,
1399        src_row_pitch: size_t,
1400        src_slc_pitch: size_t,
1401        dst_row_pitch: size_t,
1402        dst_slc_pitch: size_t,
1403        num_events_in_wait_list: cl_uint,
1404        event_wait_list: *const cl_event,
1405        event: *mut cl_event,
1406    ) -> cl_int;
1407
1408    pub fn clEnqueueReadImage(
1409        command_queue: cl_command_queue,
1410        image: cl_mem,
1411        blocking_read: cl_bool,
1412        origin: *const size_t,
1413        region: *const size_t,
1414        row_pitch: size_t,
1415        slc_pitch: size_t,
1416        ptr: *mut c_void,
1417        num_events_in_wait_list: cl_uint,
1418        event_wait_list: *const cl_event,
1419        event: *mut cl_event,
1420    ) -> cl_int;
1421
1422    pub fn clEnqueueWriteImage(
1423        command_queue: cl_command_queue,
1424        image: cl_mem,
1425        blocking_write: cl_bool,
1426        origin: *const size_t,
1427        region: *const size_t,
1428        input_row_pitch: size_t,
1429        input_slc_pitch: size_t,
1430        ptr: *const c_void,
1431        num_events_in_wait_list: cl_uint,
1432        event_wait_list: *const cl_event,
1433        event: *mut cl_event,
1434    ) -> cl_int;
1435
1436    // extern CL_API_ENTRY cl_int CL_API_CALL
1437    // clEnqueueFillImage(cl_command_queue   /* command_queue */,
1438    //                   cl_mem             /* image */,
1439    //                   const void *       /* fill_color */,
1440    //                   const size_t *     /* origin[3] */,
1441    //                   const size_t *     /* region[3] */,
1442    //                   cl_uint            /* num_events_in_wait_list */,
1443    //                   const cl_event *   /* event_wait_list */,
1444    //                   cl_event *         /* event */) CL_API_SUFFIX__VERSION_1_2;
1445    //############################### NEW 1.2 #################################
1446    #[cfg(feature = "opencl_version_1_2")]
1447    pub fn clEnqueueFillImage(
1448        command_queue: cl_command_queue,
1449        image: cl_mem,
1450        fill_color: *const c_void,
1451        origin: *const size_t,
1452        region: *const size_t,
1453        num_events_in_wait_list: cl_uint,
1454        event_wait_list: *const cl_event,
1455        event: *mut cl_event,
1456    ) -> cl_int;
1457
1458    pub fn clEnqueueCopyImage(
1459        command_queue: cl_command_queue,
1460        src_image: cl_mem,
1461        dst_image: cl_mem,
1462        src_origin: *const size_t,
1463        dst_origin: *const size_t,
1464        region: *const size_t,
1465        num_events_in_wait_list: cl_uint,
1466        event_wait_list: *const cl_event,
1467        event: *mut cl_event,
1468    ) -> cl_int;
1469
1470    pub fn clEnqueueCopyImageToBuffer(
1471        command_queue: cl_command_queue,
1472        src_image: cl_mem,
1473        dst_buffer: cl_mem,
1474        src_origin: *const size_t,
1475        region: *const size_t,
1476        dst_offset: size_t,
1477        num_events_in_wait_list: cl_uint,
1478        event_wait_list: *const cl_event,
1479        event: *mut cl_event,
1480    ) -> cl_int;
1481
1482    pub fn clEnqueueCopyBufferToImage(
1483        command_queue: cl_command_queue,
1484        src_buffer: cl_mem,
1485        dst_image: cl_mem,
1486        src_offset: size_t,
1487        dst_origin: *const size_t,
1488        region: *const size_t,
1489        num_events_in_wait_list: cl_uint,
1490        event_wait_list: *const cl_event,
1491        event: *mut cl_event,
1492    ) -> cl_int;
1493
1494    pub fn clEnqueueMapBuffer(
1495        command_queue: cl_command_queue,
1496        buffer: cl_mem,
1497        blocking_map: cl_bool,
1498        map_flags: cl_map_flags,
1499        offset: size_t,
1500        size: size_t,
1501        num_events_in_wait_list: cl_uint,
1502        event_wait_list: *const cl_event,
1503        event: *mut cl_event,
1504        errorcode_ret: *mut cl_int,
1505    ) -> *mut c_void;
1506
1507    pub fn clEnqueueMapImage(
1508        command_queue: cl_command_queue,
1509        image: cl_mem,
1510        blocking_map: cl_bool,
1511        map_flags: cl_map_flags,
1512        origin: *const size_t,
1513        region: *const size_t,
1514        image_row_pitch: *mut size_t,
1515        image_slc_pitch: *mut size_t,
1516        num_events_in_wait_list: cl_uint,
1517        event_wait_list: *const cl_event,
1518        event: *mut cl_event,
1519        errorcode_ret: *mut cl_int,
1520    ) -> *mut c_void;
1521
1522    pub fn clEnqueueUnmapMemObject(
1523        command_queue: cl_command_queue,
1524        memobj: cl_mem,
1525        mapped_ptr: *mut c_void,
1526        num_events_in_wait_list: cl_uint,
1527        event_wait_list: *const cl_event,
1528        event: *mut cl_event,
1529    ) -> cl_int;
1530
1531    // extern CL_API_ENTRY cl_int CL_API_CALL
1532    // clEnqueueMigrateMemObjects(cl_command_queue       /* command_queue */,
1533    //                           cl_uint                /* num_mem_objects */,
1534    //                           const cl_mem *         /* mem_objects */,
1535    //                           cl_mem_migration_flags /* flags */,
1536    //                           cl_uint                /* num_events_in_wait_list */,
1537    //                           const cl_event *       /* event_wait_list */,
1538    //                           cl_event *             /* event */) CL_API_SUFFIX__VERSION_1_2;
1539    //############################### NEW 1.2 #################################
1540    #[cfg(feature = "opencl_version_1_2")]
1541    pub fn clEnqueueMigrateMemObjects(
1542        command_queue: cl_command_queue,
1543        num_mem_objects: cl_uint,
1544        mem_objects: *const cl_mem,
1545        flags: cl_mem_migration_flags,
1546        num_events_in_wait_list: cl_uint,
1547        event_wait_list: *const cl_event,
1548        event: *mut cl_event,
1549    ) -> cl_int;
1550
1551    pub fn clEnqueueNDRangeKernel(
1552        command_queue: cl_command_queue,
1553        kernel: cl_kernel,
1554        work_dim: cl_uint,
1555        global_work_offset: *const size_t,
1556        global_work_dims: *const size_t,
1557        local_work_dims: *const size_t,
1558        num_events_in_wait_list: cl_uint,
1559        event_wait_list: *const cl_event,
1560        event: *mut cl_event,
1561    ) -> cl_int;
1562
1563    //########################## DEPRICATED 1.2 ##############################
1564    pub fn clEnqueueTask(
1565        command_queue: cl_command_queue,
1566        kernel: cl_kernel,
1567        num_events_in_wait_list: cl_uint,
1568        event_wait_list: *const cl_event,
1569        event: *mut cl_event,
1570    ) -> cl_int;
1571
1572    pub fn clEnqueueNativeKernel(
1573        command_queue: cl_command_queue,
1574        user_func: Option<extern "C" fn(*mut c_void)>,
1575        args: *mut c_void,
1576        cb_args: size_t,
1577        num_mem_objects: cl_uint,
1578        mem_list: *const cl_mem,
1579        args_mem_loc: *const *const c_void,
1580        num_events_in_wait_list: cl_uint,
1581        event_wait_list: *const cl_event,
1582        event: *mut cl_event,
1583    ) -> cl_int;
1584
1585    //########################## DEPRICATED 1.1 ##############################
1586    pub fn clEnqueueMarker(command_queue: cl_command_queue, event: *mut cl_event) -> cl_int;
1587
1588    // extern CL_API_ENTRY cl_int CL_API_CALL
1589    // clEnqueueMarkerWithWaitList(cl_command_queue /* command_queue */,
1590    //          cl_uint           /* num_events_in_wait_list */,
1591    //          const cl_event *  /* event_wait_list */,
1592    //          cl_event *        /* event */) CL_API_SUFFIX__VERSION_1_2;
1593    //############################### NEW 1.2 #################################
1594    #[cfg(feature = "opencl_version_1_2")]
1595    pub fn clEnqueueMarkerWithWaitList(
1596        command_queue: cl_command_queue,
1597        num_events_in_wait_list: cl_uint,
1598        event_wait_list: *const cl_event,
1599        event: *mut cl_event,
1600    ) -> cl_int;
1601
1602    //########################## DEPRICATED 1.1 ##############################
1603    pub fn clEnqueueWaitForEvents(
1604        command_queue: cl_command_queue,
1605        num_events: cl_uint,
1606        event_list: *mut cl_event,
1607    ) -> cl_int;
1608
1609    // extern CL_API_ENTRY cl_int CL_API_CALL
1610    // clEnqueueBarrierWithWaitList(
1611    //          cl_command_queue
1612    //           // command_queue
1613    //          ,
1614    //          cl_uint
1615    //           // num_events_in_wait_list
1616    //          ,
1617    //          const cl_event *
1618    //           // event_wait_list
1619    //          ,
1620    //          cl_event *
1621    //           // event
1622    //      ) CL_API_SUFFIX__VERSION_1_2;
1623    //############################### NEW 1.2 #################################
1624    #[cfg(feature = "opencl_version_1_2")]
1625    pub fn clEnqueueBarrierWithWaitList(
1626        command_queue: cl_command_queue,
1627        num_events_in_wait_list: cl_uint,
1628        event_wait_list: *const cl_event,
1629        event: *mut cl_event,
1630    ) -> cl_int;
1631
1632    // extern CL_API_ENTRY cl_int CL_API_CALL
1633    // clEnqueueSVMFree(cl_command_queue  /* command_queue */,
1634    //                  cl_uint           /* num_svm_pointers */,
1635    //                  void *[]          /* svm_pointers[] */,
1636    //                  void (CL_CALLBACK * /*pfn_free_func*/)(cl_command_queue /* queue */,
1637    //                                                         cl_uint          /* num_svm_pointers */,
1638    //                                                         void *[]         /* svm_pointers[] */,
1639    //                                                         void *           /* user_data */),
1640    //                  void *            /* user_data */,
1641    //                  cl_uint           /* num_events_in_wait_list */,
1642    //                  const cl_event *  /* event_wait_list */,
1643    //                  cl_event *        /* event */) CL_API_SUFFIX__VERSION_2_0;
1644    //############################### NEW 2.0 #################################
1645    #[cfg(feature = "opencl_version_2_0")]
1646    pub fn clEnqueueSVMFree(
1647        command_queue: cl_command_queue,
1648        num_svm_pointers: cl_uint,
1649        svm_pointers: *const *const c_void,
1650        pfn_free_func: Option<
1651            extern "C" fn(
1652                queue: cl_command_queue,
1653                num_svm_pointers: cl_uint,
1654                svm_pointers: *const *const c_void,
1655                user_data: *mut c_void,
1656            ),
1657        >,
1658        user_data: *mut c_void,
1659        num_events_in_wait_list: cl_uint,
1660        event_wait_list: *const cl_event,
1661        event: *mut cl_event,
1662    ) -> cl_int;
1663
1664    // extern CL_API_ENTRY cl_int CL_API_CALL
1665    // clEnqueueSVMMemcpy(cl_command_queue  /* command_queue */,
1666    //                    cl_bool           /* blocking_copy */,
1667    //                    void *            /* dst_ptr */,
1668    //                    const void *      /* src_ptr */,
1669    //                    size_t            /* size */,
1670    //                    cl_uint           /* num_events_in_wait_list */,
1671    //                    const cl_event *  /* event_wait_list */,
1672    //                    cl_event *        /* event */) CL_API_SUFFIX__VERSION_2_0;
1673    //############################### NEW 2.0 #################################
1674    #[cfg(feature = "opencl_version_2_0")]
1675    pub fn clEnqueueSVMMemcpy(
1676        command_queue: cl_command_queue,
1677        blocking_copy: cl_bool,
1678        dst_ptr: *mut c_void,
1679        src_ptr: *const c_void,
1680        size: size_t,
1681        num_events_in_wait_list: cl_uint,
1682        event_wait_list: *const cl_event,
1683        event: *mut cl_event,
1684    ) -> cl_int;
1685
1686    // extern CL_API_ENTRY cl_int CL_API_CALL
1687    // clEnqueueSVMMemFill(cl_command_queue  /* command_queue */,
1688    //                     void *            /* svm_ptr */,
1689    //                     const void *      /* pattern */,
1690    //                     size_t            /* pattern_size */,
1691    //                     size_t            /* size */,
1692    //                     cl_uint           /* num_events_in_wait_list */,
1693    //                     const cl_event *  /* event_wait_list */,
1694    //                     cl_event *        /* event */) CL_API_SUFFIX__VERSION_2_0;
1695    //############################### NEW 2.0 #################################
1696    #[cfg(feature = "opencl_version_2_0")]
1697    pub fn clEnqueueSVMMemFill(
1698        command_queue: cl_command_queue,
1699        svm_ptr: *mut c_void,
1700        pattern: *const c_void,
1701        pattern_size: size_t,
1702        size: size_t,
1703        num_events_in_wait_list: cl_uint,
1704        event_wait_list: *const cl_event,
1705        event: *mut cl_event,
1706    ) -> cl_int;
1707
1708    // extern CL_API_ENTRY cl_int CL_API_CALL
1709    // clEnqueueSVMMap(cl_command_queue  /* command_queue */,
1710    //                 cl_bool           /* blocking_map */,
1711    //                 cl_map_flags      /* flags */,
1712    //                 void *            /* svm_ptr */,
1713    //                 size_t            /* size */,
1714    //                 cl_uint           /* num_events_in_wait_list */,
1715    //                 const cl_event *  /* event_wait_list */,
1716    //                 cl_event *        /* event */) CL_API_SUFFIX__VERSION_2_0;
1717    //############################### NEW 2.0 #################################
1718    #[cfg(feature = "opencl_version_2_0")]
1719    pub fn clEnqueueSVMMap(
1720        command_queue: cl_command_queue,
1721        blocking_map: cl_bool,
1722        flags: cl_map_flags,
1723        svm_ptr: *mut c_void,
1724        size: size_t,
1725        num_events_in_wait_list: cl_uint,
1726        event_wait_list: *const cl_event,
1727        event: *mut cl_event,
1728    ) -> cl_int;
1729
1730    // extern CL_API_ENTRY cl_int CL_API_CALL
1731    // clEnqueueSVMUnmap(cl_command_queue  /* command_queue */,
1732    //                   void *            /* svm_ptr */,
1733    //                   cl_uint           /* num_events_in_wait_list */,
1734    //                   const cl_event *  /* event_wait_list */,
1735    //                   cl_event *        /* event */) CL_API_SUFFIX__VERSION_2_0;
1736    //############################### NEW 2.0 #################################
1737    #[cfg(feature = "opencl_version_2_0")]
1738    pub fn clEnqueueSVMUnmap(
1739        command_queue: cl_command_queue,
1740        svm_ptr: *mut c_void,
1741        num_events_in_wait_list: cl_uint,
1742        event_wait_list: *const cl_event,
1743        event: *mut cl_event,
1744    ) -> cl_int;
1745
1746    // extern CL_API_ENTRY cl_int CL_API_CALL
1747    // clEnqueueSVMMigrateMem(cl_command_queue         /* command_queue */,
1748    //                        cl_uint                  /* num_svm_pointers */,
1749    //                        const void **            /* svm_pointers */,
1750    //                        const size_t *           /* sizes */,
1751    //                        cl_mem_migration_flags   /* flags */,
1752    //                        cl_uint                  /* num_events_in_wait_list */,
1753    //                        const cl_event *         /* event_wait_list */,
1754    //                        cl_event *               /* event */) CL_API_SUFFIX__VERSION_2_1;
1755    //############################### NEW 2.1 #################################
1756    #[cfg(feature = "opencl_version_2_1")]
1757    pub fn clEnqueueSVMMigrateMem(
1758        command_queue: cl_command_queue,
1759        num_svm_pointers: cl_uint,
1760        svm_pointers: *const *const c_void,
1761        sizes: *const size_t,
1762        flags: cl_mem_migration_flags,
1763        num_events_in_wait_list: cl_uint,
1764        event_wait_list: *const cl_event,
1765        event: *mut cl_event,
1766    ) -> cl_int;
1767
1768    //########################## DEPRICATED 1.1 ##############################
1769    pub fn clEnqueueBarrier(command_queue: cl_command_queue) -> cl_int;
1770
1771    //########################## DEPRICATED 1.1 ##############################
1772    // Extension function access
1773    // Returns the extension function address for the given function name,
1774    // or NULL if a valid function can not be found. The client must
1775    // check to make sure the address is not NULL, before using or
1776    // or calling the returned function address.
1777    pub fn clGetExtensionFunctionAddress(func_name: *mut c_char);
1778
1779    // extern CL_API_ENTRY void * CL_API_CALL
1780    // clGetExtensionFunctionAddressForPlatform(cl_platform_id /* platform */,
1781    //                    const char *
1782    //                     // func_name
1783    //                    ) CL_API_SUFFIX__VERSION_1_2;
1784    //############################### NEW 1.2 #################################
1785    #[cfg(feature = "opencl_version_1_2")]
1786    pub fn clGetExtensionFunctionAddressForPlatform(
1787        platform: cl_platform_id,
1788        func_name: *const c_char,
1789    ) -> *mut c_void;
1790}