opencl_sys/
cl_ext.rs

1// Copyright (c) 2022-2025 Via Technology Ltd.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//    http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//! FFI bindings for [cl_ext.h](https://github.com/KhronosGroup/OpenCL-Headers/blob/main/CL/cl_ext.h)
16//! `cl_ext.h` contains `OpenCL` extensions that don't have external (`OpenGL`, `D3D`) dependencies.
17//! `OpenCL` extensions are documented in the [OpenCL-Registry](https://github.com/KhronosGroup/OpenCL-Registry)
18
19#![allow(non_camel_case_types, non_upper_case_globals)]
20
21pub use super::cl::{
22    cl_bitfield, cl_bool, cl_channel_type, cl_command_queue, cl_command_queue_properties,
23    cl_command_type, cl_context, cl_context_info, cl_device_id, cl_device_info, cl_event,
24    cl_event_info, cl_image_desc, cl_image_format, cl_kernel, cl_kernel_exec_info, cl_kernel_info,
25    cl_kernel_sub_group_info, cl_map_flags, cl_mem, cl_mem_flags, cl_mem_info,
26    cl_mem_migration_flags, cl_mem_properties, cl_platform_id, cl_platform_info, cl_program,
27    cl_program_info, cl_properties, cl_queue_properties, cl_sampler_properties,
28};
29use super::cl_platform::{cl_int, cl_uchar, cl_uint, cl_ulong};
30
31#[allow(unused_imports)]
32use libc::{c_char, c_int, c_void, intptr_t, size_t};
33
34// cl_khr_command_buffer
35
36pub type cl_platform_command_buffer_capabilities_khr = cl_bitfield;
37pub type cl_device_command_buffer_capabilities_khr = cl_bitfield;
38pub type cl_command_buffer_khr = *mut c_void;
39pub type cl_sync_point_khr = cl_uint;
40pub type cl_command_buffer_info_khr = cl_uint;
41pub type cl_command_buffer_state_khr = cl_uint;
42pub type cl_command_buffer_properties_khr = cl_properties;
43pub type cl_command_buffer_flags_khr = cl_bitfield;
44pub type cl_command_properties_khr = cl_properties;
45pub type cl_mutable_command_khr = *mut c_void;
46
47// cl_device_info
48pub const CL_DEVICE_COMMAND_BUFFER_CAPABILITIES_KHR: cl_device_info = 0x12A9;
49pub const CL_DEVICE_COMMAND_BUFFER_SUPPORTED_QUEUE_PROPERTIES_KHR: cl_device_info = 0x129A;
50pub const CL_DEVICE_COMMAND_BUFFER_REQUIRED_QUEUE_PROPERTIES_KHR: cl_device_info = 0x12AA;
51
52// cl_device_command_buffer_capabilities_khr - bitfield
53pub const CL_COMMAND_BUFFER_CAPABILITY_KERNEL_PRINTF_KHR:
54    cl_device_command_buffer_capabilities_khr = 1 << 0;
55pub const CL_COMMAND_BUFFER_CAPABILITY_DEVICE_SIDE_ENQUEUE_KHR:
56    cl_device_command_buffer_capabilities_khr = 1 << 1;
57pub const CL_COMMAND_BUFFER_CAPABILITY_SIMULTANEOUS_USE_KHR:
58    cl_device_command_buffer_capabilities_khr = 1 << 2;
59
60// cl_command_buffer_properties_khr
61pub const CL_COMMAND_BUFFER_FLAGS_KHR: cl_command_buffer_properties_khr = 0x1293;
62
63// cl_command_buffer_flags_khr
64pub const CL_COMMAND_BUFFER_SIMULTANEOUS_USE_KHR: cl_command_buffer_flags_khr = 1 << 0;
65
66// Error codes
67pub const CL_INVALID_COMMAND_BUFFER_KHR: cl_int = -1138;
68pub const CL_INVALID_SYNC_POINT_WAIT_LIST_KHR: cl_int = -1139;
69pub const CL_INCOMPATIBLE_COMMAND_QUEUE_KHR: cl_int = -1140;
70
71// cl_command_buffer_info_khr
72pub const CL_COMMAND_BUFFER_QUEUES_KHR: cl_command_buffer_info_khr = 0x1294;
73pub const CL_COMMAND_BUFFER_NUM_QUEUES_KHR: cl_command_buffer_info_khr = 0x1295;
74pub const CL_COMMAND_BUFFER_REFERENCE_COUNT_KHR: cl_command_buffer_info_khr = 0x1296;
75pub const CL_COMMAND_BUFFER_STATE_KHR: cl_command_buffer_info_khr = 0x1297;
76pub const CL_COMMAND_BUFFER_PROPERTIES_ARRAY_KHR: cl_command_buffer_info_khr = 0x1298;
77pub const CL_COMMAND_BUFFER_CONTEXT_KHR: cl_command_buffer_info_khr = 0x1299;
78
79// cl_command_buffer_state_khr
80pub const CL_COMMAND_BUFFER_STATE_RECORDING_KHR: cl_command_buffer_state_khr = 0;
81pub const CL_COMMAND_BUFFER_STATE_EXECUTABLE_KHR: cl_command_buffer_state_khr = 1;
82pub const CL_COMMAND_BUFFER_STATE_PENDING_KHR: cl_command_buffer_state_khr = 2;
83
84// cl_command_type
85pub const CL_COMMAND_COMMAND_BUFFER_KHR: cl_command_type = 0x12A8;
86
87pub type clCreateCommandBufferKHR_t = Option<
88    unsafe extern "C" fn(
89        num_queues: cl_uint,
90        queues: *const cl_command_queue,
91        properties: *const cl_command_buffer_properties_khr,
92        errcode_ret: *mut cl_int,
93    ) -> cl_command_buffer_khr,
94>;
95pub type clCreateCommandBufferKHR_fn = clCreateCommandBufferKHR_t;
96
97pub type clFinalizeCommandBufferKHR_t =
98    Option<unsafe extern "C" fn(command_buffer: cl_command_buffer_khr) -> cl_int>;
99pub type clFinalizeCommandBufferKHR_fn = clFinalizeCommandBufferKHR_t;
100
101pub type clRetainCommandBufferKHR_t =
102    Option<unsafe extern "C" fn(command_buffer: cl_command_buffer_khr) -> cl_int>;
103pub type clRetainCommandBufferKHR_fn = clRetainCommandBufferKHR_t;
104
105pub type clReleaseCommandBufferKHR_t =
106    Option<unsafe extern "C" fn(command_buffer: cl_command_buffer_khr) -> cl_int>;
107pub type clReleaseCommandBufferKHR_fn = clReleaseCommandBufferKHR_t;
108
109pub type clEnqueueCommandBufferKHR_t = Option<
110    unsafe extern "C" fn(
111        num_queues: cl_uint,
112        queues: *mut cl_command_queue,
113        command_buffer: cl_command_buffer_khr,
114        num_events_in_wait_list: cl_uint,
115        event_wait_list: *const cl_event,
116        event: *mut cl_event,
117    ) -> cl_int,
118>;
119pub type clEnqueueCommandBufferKHR_fn = clEnqueueCommandBufferKHR_t;
120
121pub type clCommandBarrierWithWaitListKHR_t = Option<
122    unsafe extern "C" fn(
123        command_buffer: cl_command_buffer_khr,
124        command_queue: cl_command_queue,
125        properties: *const cl_command_properties_khr,
126        num_sync_points_in_wait_list: cl_uint,
127        sync_point_wait_list: *const cl_sync_point_khr,
128        sync_point: *mut cl_sync_point_khr,
129        mutable_handle: *mut cl_mutable_command_khr,
130    ) -> cl_int,
131>;
132pub type clCommandBarrierWithWaitListKHR_fn = clCommandBarrierWithWaitListKHR_t;
133
134pub type clCommandCopyBufferKHR_t = Option<
135    unsafe extern "C" fn(
136        command_buffer: cl_command_buffer_khr,
137        command_queue: cl_command_queue,
138        properties: *const cl_command_properties_khr,
139        src_buffer: cl_mem,
140        dst_buffer: cl_mem,
141        src_offset: size_t,
142        dst_offset: size_t,
143        size: size_t,
144        num_sync_points_in_wait_list: cl_uint,
145        sync_point_wait_list: *const cl_sync_point_khr,
146        sync_point: *mut cl_sync_point_khr,
147        mutable_handle: *mut cl_mutable_command_khr,
148    ) -> cl_int,
149>;
150pub type clCommandCopyBufferKHR_fn = clCommandCopyBufferKHR_t;
151
152pub type clCommandCopyBufferRectKHR_t = Option<
153    unsafe extern "C" fn(
154        command_buffer: cl_command_buffer_khr,
155        command_queue: cl_command_queue,
156        properties: *const cl_command_properties_khr,
157        src_buffer: cl_mem,
158        dst_buffer: cl_mem,
159        src_origin: *const size_t,
160        dst_origin: *const size_t,
161        region: *const size_t,
162        src_row_pitch: size_t,
163        src_slice_pitch: size_t,
164        dst_row_pitch: size_t,
165        dst_slice_pitch: size_t,
166        num_sync_points_in_wait_list: cl_uint,
167        sync_point_wait_list: *const cl_sync_point_khr,
168        sync_point: *mut cl_sync_point_khr,
169        mutable_handle: *mut cl_mutable_command_khr,
170    ) -> cl_int,
171>;
172pub type clCommandCopyBufferRectKHR_fn = clCommandCopyBufferRectKHR_t;
173
174pub type clCommandCopyBufferToImageKHR_t = Option<
175    unsafe extern "C" fn(
176        command_buffer: cl_command_buffer_khr,
177        command_queue: cl_command_queue,
178        properties: *const cl_command_properties_khr,
179        src_buffer: cl_mem,
180        dst_image: cl_mem,
181        src_offset: size_t,
182        dst_origin: *const size_t,
183        region: *const size_t,
184        num_sync_points_in_wait_list: cl_uint,
185        sync_point_wait_list: *const cl_sync_point_khr,
186        sync_point: *mut cl_sync_point_khr,
187        mutable_handle: *mut cl_mutable_command_khr,
188    ) -> cl_int,
189>;
190pub type clCommandCopyBufferToImageKHR_fn = clCommandCopyBufferToImageKHR_t;
191
192pub type clCommandCopyImageKHR_t = Option<
193    unsafe extern "C" fn(
194        command_buffer: cl_command_buffer_khr,
195        command_queue: cl_command_queue,
196        properties: *const cl_command_properties_khr,
197        src_image: cl_mem,
198        dst_image: cl_mem,
199        src_origin: *const size_t,
200        dst_origin: *const size_t,
201        region: *const size_t,
202        num_sync_points_in_wait_list: cl_uint,
203        sync_point_wait_list: *const cl_sync_point_khr,
204        sync_point: *mut cl_sync_point_khr,
205        mutable_handle: *mut cl_mutable_command_khr,
206    ) -> cl_int,
207>;
208pub type clCommandCopyImageKHR_fn = clCommandCopyImageKHR_t;
209
210pub type clCommandCopyImageToBufferKHR_t = Option<
211    unsafe extern "C" fn(
212        command_buffer: cl_command_buffer_khr,
213        command_queue: cl_command_queue,
214        properties: *const cl_command_properties_khr,
215        src_image: cl_mem,
216        dst_buffer: cl_mem,
217        src_origin: *const size_t,
218        region: *const size_t,
219        dst_offset: size_t,
220        num_sync_points_in_wait_list: cl_uint,
221        sync_point_wait_list: *const cl_sync_point_khr,
222        sync_point: *mut cl_sync_point_khr,
223        mutable_handle: *mut cl_mutable_command_khr,
224    ) -> cl_int,
225>;
226pub type clCommandCopyImageToBufferKHR_fn = clCommandCopyImageToBufferKHR_t;
227
228pub type clCommandFillBufferKHR_t = Option<
229    unsafe extern "C" fn(
230        command_buffer: cl_command_buffer_khr,
231        command_queue: cl_command_queue,
232        properties: *const cl_command_properties_khr,
233        buffer: cl_mem,
234        pattern: *const c_void,
235        pattern_size: size_t,
236        offset: size_t,
237        size: size_t,
238        num_sync_points_in_wait_list: cl_uint,
239        sync_point_wait_list: *const cl_sync_point_khr,
240        sync_point: *mut cl_sync_point_khr,
241        mutable_handle: *mut cl_mutable_command_khr,
242    ) -> cl_int,
243>;
244pub type clCommandFillBufferKHR_fn = clCommandFillBufferKHR_t;
245
246pub type clCommandFillImageKHR_t = Option<
247    unsafe extern "C" fn(
248        command_buffer: cl_command_buffer_khr,
249        command_queue: cl_command_queue,
250        properties: *const cl_command_properties_khr,
251        image: cl_mem,
252        fill_color: *const c_void,
253        origin: *const size_t,
254        region: *const size_t,
255        num_sync_points_in_wait_list: cl_uint,
256        sync_point_wait_list: *const cl_sync_point_khr,
257        sync_point: *mut cl_sync_point_khr,
258        mutable_handle: *mut cl_mutable_command_khr,
259    ) -> cl_int,
260>;
261pub type clCommandFillImageKHR_fn = clCommandFillImageKHR_t;
262
263pub type clCommandNDRangeKernelKHR_t = Option<
264    unsafe extern "C" fn(
265        command_buffer: cl_command_buffer_khr,
266        command_queue: cl_command_queue,
267        properties: *const cl_command_properties_khr,
268        kernel: cl_kernel,
269        work_dim: cl_uint,
270        global_work_offset: *const size_t,
271        global_work_size: *const size_t,
272        local_work_size: *const size_t,
273        num_sync_points_in_wait_list: cl_uint,
274        sync_point_wait_list: *const cl_sync_point_khr,
275        sync_point: *mut cl_sync_point_khr,
276        mutable_handle: *mut cl_mutable_command_khr,
277    ) -> cl_int,
278>;
279pub type clCommandNDRangeKernelKHR_fn = clCommandNDRangeKernelKHR_t;
280
281pub type clGetCommandBufferInfoKHR_t = Option<
282    unsafe extern "C" fn(
283        command_buffer: cl_command_buffer_khr,
284        param_name: cl_command_buffer_info_khr,
285        param_value_size: size_t,
286        param_value: *mut c_void,
287        param_value_size_ret: *mut size_t,
288    ) -> cl_int,
289>;
290pub type clGetCommandBufferInfoKHR_fn = clGetCommandBufferInfoKHR_t;
291
292pub type clCommandSVMMemcpyKHR_t = Option<
293    unsafe extern "C" fn(
294        command_buffer: cl_command_buffer_khr,
295        command_queue: cl_command_queue,
296        properties: *const cl_command_properties_khr,
297        dst_ptr: *mut c_void,
298        src_ptr: *const c_void,
299        size: size_t,
300        num_sync_points_in_wait_list: cl_uint,
301        sync_point_wait_list: *const cl_sync_point_khr,
302        sync_point: *mut cl_sync_point_khr,
303        mutable_handle: *mut cl_mutable_command_khr,
304    ) -> cl_int,
305>;
306pub type clCommandSVMMemcpyKHR_fn = clCommandSVMMemcpyKHR_t;
307
308pub type clCommandSVMMemFillKHR_t = Option<
309    unsafe extern "C" fn(
310        command_buffer: cl_command_buffer_khr,
311        command_queue: cl_command_queue,
312        properties: *const cl_command_properties_khr,
313        svm_ptr: *mut c_void,
314        pattern: *const c_void,
315        pattern_size: size_t,
316        size: size_t,
317        num_sync_points_in_wait_list: cl_uint,
318        sync_point_wait_list: *const cl_sync_point_khr,
319        sync_point: *mut cl_sync_point_khr,
320        mutable_handle: *mut cl_mutable_command_khr,
321    ) -> cl_int,
322>;
323pub type clCommandSVMMemFillKHR_fn = clCommandSVMMemFillKHR_t;
324
325#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
326#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
327#[cfg(feature = "cl_khr_command_buffer")]
328#[cfg(feature = "static")]
329unsafe extern "system" {
330
331    pub fn clCreateCommandBufferKHR(
332        num_queues: cl_uint,
333        queues: *const cl_command_queue,
334        properties: *const cl_command_buffer_properties_khr,
335        errcode_ret: *mut cl_int,
336    ) -> cl_command_buffer_khr;
337
338    pub fn clFinalizeCommandBufferKHR(command_buffer: cl_command_buffer_khr) -> cl_int;
339
340    pub fn clRetainCommandBufferKHR(command_buffer: cl_command_buffer_khr) -> cl_int;
341
342    pub fn clReleaseCommandBufferKHR(command_buffer: cl_command_buffer_khr) -> cl_int;
343
344    pub fn clEnqueueCommandBufferKHR(
345        num_queues: cl_uint,
346        queues: *mut cl_command_queue,
347        command_buffer: cl_command_buffer_khr,
348        num_events_in_wait_list: cl_uint,
349        event_wait_list: *const cl_event,
350        event: *mut cl_event,
351    ) -> cl_int;
352
353    pub fn clCommandBarrierWithWaitListKHR(
354        command_buffer: cl_command_buffer_khr,
355        command_queue: cl_command_queue,
356        properties: *const cl_command_properties_khr,
357        num_sync_points_in_wait_list: cl_uint,
358        sync_point_wait_list: *const cl_sync_point_khr,
359        sync_point: *mut cl_sync_point_khr,
360        mutable_handle: *mut cl_mutable_command_khr,
361    ) -> cl_int;
362
363    pub fn clCommandCopyBufferKHR(
364        command_buffer: cl_command_buffer_khr,
365        command_queue: cl_command_queue,
366        properties: *const cl_command_properties_khr,
367        src_buffer: cl_mem,
368        dst_buffer: cl_mem,
369        src_offset: size_t,
370        dst_offset: size_t,
371        size: size_t,
372        num_sync_points_in_wait_list: cl_uint,
373        sync_point_wait_list: *const cl_sync_point_khr,
374        sync_point: *mut cl_sync_point_khr,
375        mutable_handle: *mut cl_mutable_command_khr,
376    ) -> cl_int;
377
378    pub fn clCommandCopyBufferRectKHR(
379        command_buffer: cl_command_buffer_khr,
380        command_queue: cl_command_queue,
381        properties: *const cl_command_properties_khr,
382        src_buffer: cl_mem,
383        dst_buffer: cl_mem,
384        src_origin: *const size_t,
385        dst_origin: *const size_t,
386        region: *const size_t,
387        src_row_pitch: size_t,
388        src_slice_pitch: size_t,
389        dst_row_pitch: size_t,
390        dst_slice_pitch: size_t,
391        num_sync_points_in_wait_list: cl_uint,
392        sync_point_wait_list: *const cl_sync_point_khr,
393        sync_point: *mut cl_sync_point_khr,
394        mutable_handle: *mut cl_mutable_command_khr,
395    ) -> cl_int;
396
397    pub fn clCommandCopyBufferToImageKHR(
398        command_buffer: cl_command_buffer_khr,
399        command_queue: cl_command_queue,
400        properties: *const cl_command_properties_khr,
401        src_buffer: cl_mem,
402        dst_image: cl_mem,
403        src_offset: size_t,
404        dst_origin: *const size_t,
405        region: *const size_t,
406        num_sync_points_in_wait_list: cl_uint,
407        sync_point_wait_list: *const cl_sync_point_khr,
408        sync_point: *mut cl_sync_point_khr,
409        mutable_handle: *mut cl_mutable_command_khr,
410    ) -> cl_int;
411
412    pub fn clCommandCopyImageKHR(
413        command_buffer: cl_command_buffer_khr,
414        command_queue: cl_command_queue,
415        properties: *const cl_command_properties_khr,
416        src_image: cl_mem,
417        dst_image: cl_mem,
418        src_origin: *const size_t,
419        dst_origin: *const size_t,
420        region: *const size_t,
421        num_sync_points_in_wait_list: cl_uint,
422        sync_point_wait_list: *const cl_sync_point_khr,
423        sync_point: *mut cl_sync_point_khr,
424        mutable_handle: *mut cl_mutable_command_khr,
425    ) -> cl_int;
426
427    pub fn clCommandCopyImageToBufferKHR(
428        command_buffer: cl_command_buffer_khr,
429        command_queue: cl_command_queue,
430        properties: *const cl_command_properties_khr,
431        src_image: cl_mem,
432        dst_buffer: cl_mem,
433        src_origin: *const size_t,
434        region: *const size_t,
435        dst_offset: size_t,
436        num_sync_points_in_wait_list: cl_uint,
437        sync_point_wait_list: *const cl_sync_point_khr,
438        sync_point: *mut cl_sync_point_khr,
439        mutable_handle: *mut cl_mutable_command_khr,
440    ) -> cl_int;
441
442    pub fn clCommandFillBufferKHR(
443        command_buffer: cl_command_buffer_khr,
444        command_queue: cl_command_queue,
445        properties: *const cl_command_properties_khr,
446        buffer: cl_mem,
447        pattern: *const c_void,
448        pattern_size: size_t,
449        offset: size_t,
450        size: size_t,
451        num_sync_points_in_wait_list: cl_uint,
452        sync_point_wait_list: *const cl_sync_point_khr,
453        sync_point: *mut cl_sync_point_khr,
454        mutable_handle: *mut cl_mutable_command_khr,
455    ) -> cl_int;
456
457    pub fn clCommandFillImageKHR(
458        command_buffer: cl_command_buffer_khr,
459        command_queue: cl_command_queue,
460        properties: *const cl_command_properties_khr,
461        image: cl_mem,
462        fill_color: *const c_void,
463        origin: *const size_t,
464        region: *const size_t,
465        num_sync_points_in_wait_list: cl_uint,
466        sync_point_wait_list: *const cl_sync_point_khr,
467        sync_point: *mut cl_sync_point_khr,
468        mutable_handle: *mut cl_mutable_command_khr,
469    ) -> cl_int;
470
471    pub fn clCommandNDRangeKernelKHR(
472        command_buffer: cl_command_buffer_khr,
473        command_queue: cl_command_queue,
474        properties: *const cl_command_properties_khr,
475        kernel: cl_kernel,
476        work_dim: cl_uint,
477        global_work_offset: *const size_t,
478        global_work_size: *const size_t,
479        local_work_size: *const size_t,
480        num_sync_points_in_wait_list: cl_uint,
481        sync_point_wait_list: *const cl_sync_point_khr,
482        sync_point: *mut cl_sync_point_khr,
483        mutable_handle: *mut cl_mutable_command_khr,
484    ) -> cl_int;
485
486    pub fn clGetCommandBufferInfoKHR(
487        command_buffer: cl_command_buffer_khr,
488        param_name: cl_command_buffer_info_khr,
489        param_value_size: size_t,
490        param_value: *mut c_void,
491        param_value_size_ret: *mut size_t,
492    ) -> cl_int;
493
494    pub fn clCommandSVMMemcpyKHR(
495        command_buffer: cl_command_buffer_khr,
496        command_queue: cl_command_queue,
497        properties: *const cl_command_properties_khr,
498        dst_ptr: *mut c_void,
499        src_ptr: *const c_void,
500        size: size_t,
501        num_sync_points_in_wait_list: cl_uint,
502        sync_point_wait_list: *const cl_sync_point_khr,
503        sync_point: *mut cl_sync_point_khr,
504        mutable_handle: *mut cl_mutable_command_khr,
505    ) -> cl_int;
506
507    pub fn clCommandSVMMemFillKHR(
508        command_buffer: cl_command_buffer_khr,
509        command_queue: cl_command_queue,
510        properties: *const cl_command_properties_khr,
511        svm_ptr: *mut c_void,
512        pattern: *const c_void,
513        pattern_size: size_t,
514        size: size_t,
515        num_sync_points_in_wait_list: cl_uint,
516        sync_point_wait_list: *const cl_sync_point_khr,
517        sync_point: *mut cl_sync_point_khr,
518        mutable_handle: *mut cl_mutable_command_khr,
519    ) -> cl_int;
520
521}
522
523// cl_khr_command_buffer_multi_device
524
525// cl_platform_info
526pub const CL_PLATFORM_COMMAND_BUFFER_CAPABILITIES_KHR: cl_platform_info = 0x0908;
527
528// cl_platform_command_buffer_capabilities_khr
529pub const CL_COMMAND_BUFFER_PLATFORM_UNIVERSAL_SYNC_KHR:
530    cl_platform_command_buffer_capabilities_khr = 1 << 0;
531pub const CL_COMMAND_BUFFER_PLATFORM_REMAP_QUEUES_KHR: cl_platform_command_buffer_capabilities_khr =
532    1 << 1;
533pub const CL_COMMAND_BUFFER_PLATFORM_AUTOMATIC_REMAP_KHR:
534    cl_platform_command_buffer_capabilities_khr = 1 << 2;
535
536// cl_device_info
537pub const CL_DEVICE_COMMAND_BUFFER_NUM_SYNC_DEVICES_KHR: cl_device_info = 0x12AB;
538pub const CL_DEVICE_COMMAND_BUFFER_SYNC_DEVICES_KHR: cl_device_info = 0x12AC;
539
540// cl_device_command_buffer_capabilities_khr
541pub const CL_COMMAND_BUFFER_CAPABILITY_MULTIPLE_QUEUE_KHR:
542    cl_device_command_buffer_capabilities_khr = 1 << 4;
543
544// cl_command_buffer_flags_khr
545pub const CL_COMMAND_BUFFER_DEVICE_SIDE_SYNC_KHR: cl_command_buffer_flags_khr = 1 << 2;
546
547pub type clRemapCommandBufferKHR_t = Option<
548    unsafe extern "C" fn(
549        command_buffer: cl_command_buffer_khr,
550        automatic: cl_bool,
551        num_queues: cl_uint,
552        queues: *const cl_command_queue,
553        num_handles: cl_uint,
554        handles: *const cl_mutable_command_khr,
555        handles_ret: *mut cl_mutable_command_khr,
556        errcode_ret: *mut cl_int,
557    ) -> cl_command_buffer_khr,
558>;
559pub type clRemapCommandBufferKHR_fn = clRemapCommandBufferKHR_t;
560
561#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
562#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
563#[cfg(feature = "cl_khr_command_buffer_multi_device")]
564#[cfg(feature = "static")]
565unsafe extern "system" {
566
567    pub fn clRemapCommandBufferKHR(
568        command_buffer: cl_command_buffer_khr,
569        automatic: cl_bool,
570        num_queues: cl_uint,
571        queues: *const cl_command_queue,
572        num_handles: cl_uint,
573        handles: *const cl_mutable_command_khr,
574        handles_ret: *mut cl_mutable_command_khr,
575        errcode_ret: *mut cl_int,
576    ) -> cl_command_buffer_khr;
577}
578
579// cl_khr_command_buffer_mutable_dispatch
580
581pub type cl_command_buffer_update_type_khr = cl_uint;
582pub type cl_mutable_dispatch_fields_khr = cl_bitfield;
583pub type cl_mutable_command_info_khr = cl_uint;
584pub type cl_mutable_dispatch_asserts_khr = cl_bitfield;
585
586#[derive(Debug, Copy, Clone)]
587#[repr(C)]
588pub struct cl_mutable_dispatch_arg_khr {
589    pub arg_index: cl_uint,
590    pub arg_size: size_t,
591    pub arg_value: *const c_void,
592}
593
594#[derive(Debug, Copy, Clone)]
595#[repr(C)]
596pub struct cl_mutable_dispatch_exec_info_khr {
597    pub param_name: cl_uint,
598    pub param_value_size: size_t,
599    pub param_value: *const c_void,
600}
601
602#[derive(Debug, Copy, Clone)]
603#[repr(C)]
604pub struct cl_mutable_dispatch_config_khr {
605    pub command: cl_mutable_command_khr,
606    pub num_args: cl_uint,
607    pub num_svm_args: cl_uint,
608    pub num_exec_infos: cl_uint,
609    pub work_dim: cl_uint,
610    pub arg_list: *const cl_mutable_dispatch_arg_khr,
611    pub arg_svm_list: *const cl_mutable_dispatch_arg_khr,
612    pub exec_info_list: *const cl_mutable_dispatch_exec_info_khr,
613    pub global_work_offset: *const size_t,
614    pub global_work_size: *const size_t,
615    pub local_work_size: *const size_t,
616}
617
618pub const CL_COMMAND_BUFFER_MUTABLE_KHR: cl_command_buffer_flags_khr = 1 << 1;
619
620pub const CL_INVALID_MUTABLE_COMMAND_KHR: cl_int = -1141;
621
622pub const CL_DEVICE_MUTABLE_DISPATCH_CAPABILITIES_KHR: cl_device_info = 0x12B0;
623
624pub const CL_MUTABLE_DISPATCH_UPDATABLE_FIELDS_KHR: cl_command_properties_khr = 0x12B1;
625
626pub const CL_MUTABLE_DISPATCH_GLOBAL_OFFSET_KHR: cl_mutable_dispatch_fields_khr = 1 << 0;
627pub const CL_MUTABLE_DISPATCH_GLOBAL_SIZE_KHR: cl_mutable_dispatch_fields_khr = 1 << 1;
628pub const CL_MUTABLE_DISPATCH_LOCAL_SIZE_KHR: cl_mutable_dispatch_fields_khr = 1 << 2;
629pub const CL_MUTABLE_DISPATCH_ARGUMENTS_KHR: cl_mutable_dispatch_fields_khr = 1 << 3;
630pub const CL_MUTABLE_DISPATCH_EXEC_INFO_KHR: cl_mutable_dispatch_fields_khr = 1 << 4;
631
632pub const CL_MUTABLE_COMMAND_COMMAND_QUEUE_KHR: cl_mutable_command_info_khr = 0x12A0;
633pub const CL_MUTABLE_COMMAND_COMMAND_BUFFER_KHR: cl_mutable_command_info_khr = 0x12A1;
634pub const CL_MUTABLE_COMMAND_COMMAND_TYPE_KHR: cl_mutable_command_info_khr = 0x12AD;
635pub const CL_MUTABLE_COMMAND_PROPERTIES_ARRAY_KHR: cl_mutable_command_info_khr = 0x12A2;
636pub const CL_MUTABLE_DISPATCH_KERNEL_KHR: cl_mutable_command_info_khr = 0x12A3;
637pub const CL_MUTABLE_DISPATCH_DIMENSIONS_KHR: cl_mutable_command_info_khr = 0x12A4;
638pub const CL_MUTABLE_DISPATCH_GLOBAL_WORK_OFFSET_KHR: cl_mutable_command_info_khr = 0x12A5;
639pub const CL_MUTABLE_DISPATCH_GLOBAL_WORK_SIZE_KHR: cl_mutable_command_info_khr = 0x12A6;
640pub const CL_MUTABLE_DISPATCH_LOCAL_WORK_SIZE_KHR: cl_mutable_command_info_khr = 0x12A7;
641
642pub const CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR: cl_command_buffer_update_type_khr = 0;
643
644pub const CL_COMMAND_BUFFER_MUTABLE_DISPATCH_ASSERTS_KHR: cl_command_buffer_properties_khr = 0x1287;
645
646pub const CL_MUTABLE_DISPATCH_ASSERTS_KHR: cl_command_properties_khr = 0x12B8;
647
648pub const CL_MUTABLE_DISPATCH_ASSERT_NO_ADDITIONAL_WORK_GROUPS_KHR:
649    cl_mutable_dispatch_asserts_khr = 1 << 0;
650
651pub type clUpdateMutableCommandsKHR_t = Option<
652    unsafe extern "C" fn(
653        command_buffer: cl_command_buffer_khr,
654        num_configs: cl_uint,
655        config_types: *const cl_command_buffer_update_type_khr,
656        configs: *mut *const c_void,
657    ) -> cl_int,
658>;
659pub type clUpdateMutableCommandsKHR_fn = clUpdateMutableCommandsKHR_t;
660
661pub type clGetMutableCommandInfoKHR_t = Option<
662    unsafe extern "C" fn(
663        command: cl_mutable_command_khr,
664        param_name: cl_mutable_command_info_khr,
665        param_value_size: size_t,
666        param_value: *mut c_void,
667        param_value_size_ret: *mut size_t,
668    ) -> cl_int,
669>;
670pub type clGetMutableCommandInfoKHR_fn = clGetMutableCommandInfoKHR_t;
671
672#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
673#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
674#[cfg(feature = "cl_khr_command_buffer_mutable_dispatch")]
675#[cfg(feature = "static")]
676unsafe extern "system" {
677
678    pub fn clUpdateMutableCommandsKHR(
679        command_buffer: cl_command_buffer_khr,
680        num_configs: cl_uint,
681        config_types: *const cl_command_buffer_update_type_khr,
682        configs: *mut *const c_void,
683    ) -> cl_int;
684
685    pub fn clGetMutableCommandInfoKHR(
686        command: cl_mutable_command_khr,
687        param_name: cl_mutable_command_info_khr,
688        param_value_size: size_t,
689        param_value: *mut c_void,
690        param_value_size_ret: *mut size_t,
691    ) -> cl_int;
692}
693
694// cl_khr_fp64 extension
695
696// #if CL_TARGET_OPENCL_VERSION <= 110
697pub const CL_DEVICE_DOUBLE_FP_CONFIG: cl_device_info = 0x1032;
698// #endif
699// cl_khr_fp16 extension
700pub const CL_DEVICE_HALF_FP_CONFIG: cl_device_info = 0x1033;
701
702pub type clSetMemObjectDestructorAPPLE_t = Option<
703    unsafe extern "C" fn(
704        memobj: cl_mem,
705        pfn_notify: ::core::option::Option<
706            unsafe extern "C" fn(memobj: cl_mem, user_data: *mut c_void),
707        >,
708        user_data: *mut c_void,
709    ) -> cl_int,
710>;
711pub type clSetMemObjectDestructorAPPLE_fn = clSetMemObjectDestructorAPPLE_t;
712
713pub type clLogMessagesToSystemLogAPPLE_t = Option<
714    unsafe extern "C" fn(
715        errstr: *const c_char,
716        private_info: *const c_void,
717        cb: size_t,
718        user_data: *mut c_void,
719    ),
720>;
721pub type clLogMessagesToSystemLogAPPLE_fn = clLogMessagesToSystemLogAPPLE_t;
722
723pub type clLogMessagesToStdoutAPPLE_t = Option<
724    unsafe extern "C" fn(
725        errstr: *const c_char,
726        private_info: *const c_void,
727        cb: size_t,
728        user_data: *mut c_void,
729    ),
730>;
731pub type clLogMessagesToStdoutAPPLE_fn = clLogMessagesToStdoutAPPLE_t;
732
733pub type clLogMessagesToStderrAPPLE_t = Option<
734    unsafe extern "C" fn(
735        errstr: *const c_char,
736        private_info: *const c_void,
737        cb: size_t,
738        user_data: *mut c_void,
739    ),
740>;
741pub type clLogMessagesToStderrAPPLE_fn = clLogMessagesToStderrAPPLE_t;
742
743#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
744#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
745#[cfg(feature = "static")]
746unsafe extern "system" {
747
748    /* Memory object destruction
749     *
750     * Apple extension for use to manage externally allocated buffers used with cl_mem objects with CL_MEM_USE_HOST_PTR
751     *
752     * Registers a user callback function that will be called when the memory object is deleted and its resources
753     * freed. Each call to clSetMemObjectCallbackFn registers the specified user callback function on a callback
754     * stack associated with memobj. The registered user callback functions are called in the reverse order in
755     * which they were registered. The user callback functions are called and then the memory object is deleted
756     * and its resources freed. This provides a mechanism for the application (and libraries) using memobj to be
757     * notified when the memory referenced by host_ptr, specified when the memory object is created and used as
758     * the storage bits for the memory object, can be reused or freed.
759     *
760     * The application may not call CL api's with the cl_mem object passed to the pfn_notify.
761     *
762     * Please check for the "cl_APPLE_SetMemObjectDestructor" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS)
763     * before using.
764     */
765    #[cfg(feature = "cl_apple_setmemobjectdestructor")]
766    pub fn clSetMemObjectDestructorAPPLE(
767        memobj: cl_mem,
768        pfn_notify: Option<unsafe extern "C" fn(memobj: cl_mem, user_data: *mut c_void)>,
769        user_data: *mut c_void,
770    ) -> cl_int;
771
772    /* Context Logging Functions
773     *
774     * The next three convenience functions are intended to be used as the pfn_notify parameter to clCreateContext().
775     * Please check for the "cl_APPLE_ContextLoggingFunctions" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS)
776     * before using.
777     *
778     * clLogMessagesToSystemLog forwards on all log messages to the Apple System Logger
779     */
780    #[cfg(feature = "cl_apple_contextloggingfunctions")]
781    pub fn clLogMessagesToSystemLogAPPLE(
782        errstr: *const c_char,
783        private_info: *const c_void,
784        cb: size_t,
785        user_data: *mut c_void,
786    );
787
788    // clLogMessagesToStdout sends all log messages to the file descriptor stdout
789    #[cfg(feature = "cl_apple_contextloggingfunctions")]
790    pub fn clLogMessagesToStdoutAPPLE(
791        errstr: *const c_char,
792        private_info: *const c_void,
793        cb: size_t,
794        user_data: *mut c_void,
795    );
796
797    // clLogMessagesToStderr sends all log messages to the file descriptor stderr
798    #[cfg(feature = "cl_apple_contextloggingfunctions")]
799    pub fn clLogMessagesToStderrAPPLE(
800        errstr: *const c_char,
801        private_info: *const c_void,
802        cb: size_t,
803        user_data: *mut c_void,
804    );
805
806}
807
808// cl_khr_icd extension
809
810pub const CL_PLATFORM_ICD_SUFFIX_KHR: cl_platform_info = 0x0920;
811
812// Additional Error Codes
813pub const CL_PLATFORM_NOT_FOUND_KHR: cl_int = -1001;
814
815pub type clIcdGetPlatformIDsKHR_t = Option<
816    unsafe extern "C" fn(
817        num_entries: cl_uint,
818        platforms: *mut cl_platform_id,
819        num_platforms: *mut cl_uint,
820    ) -> cl_int,
821>;
822pub type clIcdGetPlatformIDsKHR_fn = clIcdGetPlatformIDsKHR_t;
823
824pub type clIcdGetFunctionAddressForPlatformKHR_t =
825    Option<unsafe extern "C" fn(platform: cl_platform_id, func_name: *const c_char) -> *mut c_void>;
826pub type clIcdGetFunctionAddressForPlatformKHR_fn = clIcdGetFunctionAddressForPlatformKHR_t;
827
828pub type clIcdSetPlatformDispatchDataKHR_t =
829    Option<unsafe extern "C" fn(platform: cl_platform_id, dispatch_data: *mut c_void) -> cl_int>;
830pub type clIcdSetPlatformDispatchDataKHR_fn = clIcdSetPlatformDispatchDataKHR_t;
831
832#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
833#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
834#[cfg(feature = "cl_khr_icd")]
835#[cfg(feature = "static")]
836unsafe extern "system" {
837    pub fn clIcdGetPlatformIDsKHR(
838        num_entries: cl_uint,
839        platforms: *mut cl_platform_id,
840        num_platforms: *mut cl_uint,
841    ) -> cl_int;
842
843    pub fn clIcdGetFunctionAddressForPlatformKHR(
844        platform: cl_platform_id,
845        func_name: *const c_char,
846    ) -> *mut c_void;
847
848    pub fn clIcdSetPlatformDispatchDataKHR(
849        platform: cl_platform_id,
850        dispatch_data: *mut c_void,
851    ) -> cl_int;
852}
853
854// cl_khr_il_program extension
855
856/// New property to clGetDeviceInfo for retrieving supported intermediate languages.
857pub const CL_DEVICE_IL_VERSION_KHR: cl_device_info = 0x105B;
858
859/// New property to clGetProgramInfo for retrieving for retrieving the IL of a program.
860pub const CL_PROGRAM_IL_KHR: cl_program_info = 0x1169;
861
862pub type clCreateProgramWithILKHR_t = Option<
863    unsafe extern "C" fn(
864        context: cl_context,
865        il: *const c_void,
866        length: size_t,
867        errcode_ret: *mut cl_int,
868    ) -> cl_program,
869>;
870pub type clCreateProgramWithILKHR_fn = clCreateProgramWithILKHR_t;
871
872#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
873#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
874#[cfg(feature = "cl_khr_il_program")]
875#[cfg(feature = "static")]
876unsafe extern "system" {
877    pub fn clCreateProgramWithILKHR(
878        context: cl_context,
879        il: *const c_void,
880        length: size_t,
881        errcode_ret: *mut cl_int,
882    ) -> cl_program;
883}
884
885/* Extension: cl_khr_image2d_from_buffer
886 *
887 * This extension allows a 2D image to be created from a cl_mem buffer without
888 * a copy. The type associated with a 2D image created from a buffer in an
889 * OpenCL program is image2d_t. Both the sampler and sampler-less read_image
890 * built-in functions are supported for 2D images and 2D images created from
891 * a buffer.  Similarly, the write_image built-ins are also supported for 2D
892 * images created from a buffer.
893 *
894 * When the 2D image from buffer is created, the client must specify the
895 * width, height, image format (i.e. channel order and channel data type)
896 * and optionally the row pitch.
897 *
898 * The pitch specified must be a multiple of
899 * CL_DEVICE_IMAGE_PITCH_ALIGNMENT_KHR pixels.
900 * The base address of the buffer must be aligned to
901 * CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT_KHR pixels.
902 */
903
904pub const CL_DEVICE_IMAGE_PITCH_ALIGNMENT_KHR: cl_device_info = 0x104A;
905pub const CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT_KHR: cl_device_info = 0x104B;
906
907// cl_khr_initialize_memory extension
908pub const CL_CONTEXT_MEMORY_INITIALIZE_KHR: cl_uint = 0x2030;
909
910// cl_context_memory_initialize_khr
911pub type cl_context_memory_initialize_khr = cl_bitfield;
912pub const CL_CONTEXT_MEMORY_INITIALIZE_LOCAL_KHR: cl_context_memory_initialize_khr = 1 << 0;
913pub const CL_CONTEXT_MEMORY_INITIALIZE_PRIVATE_KHR: cl_context_memory_initialize_khr = 1 << 1;
914
915// cl_khr_terminate_context extension
916pub const CL_CONTEXT_TERMINATED_KHR: cl_int = -1121;
917
918pub const CL_DEVICE_TERMINATE_CAPABILITY_KHR: cl_uint = 0x2031;
919pub const CL_CONTEXT_TERMINATE_KHR: cl_uint = 0x2032;
920
921pub type clTerminateContextKHR_t = Option<unsafe extern "C" fn(context: cl_context) -> cl_int>;
922pub type clTerminateContextKHR_fn = clTerminateContextKHR_t;
923
924#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
925#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
926#[cfg(feature = "cl_khr_terminate_context")]
927#[cfg(feature = "static")]
928unsafe extern "system" {
929    pub fn clTerminateContextKHR(context: cl_context) -> cl_int;
930}
931
932/*
933 * Extension: cl_khr_spir
934 *
935 * This extension adds support to create an OpenCL program object from a
936 * Standard Portable Intermediate Representation (SPIR) instance
937 */
938
939pub const CL_DEVICE_SPIR_VERSIONS: cl_uint = 0x40E0;
940pub const CL_PROGRAM_BINARY_TYPE_INTERMEDIATE: cl_uint = 0x40E1;
941
942// cl_khr_create_command_queue extension
943pub type cl_queue_properties_khr = cl_properties;
944
945pub type clCreateCommandQueueWithPropertiesKHR_t = ::core::option::Option<
946    unsafe extern "C" fn(
947        context: cl_context,
948        device: cl_device_id,
949        properties: *const cl_queue_properties_khr,
950        errcode_ret: *mut cl_int,
951    ) -> cl_command_queue,
952>;
953pub type clCreateCommandQueueWithPropertiesKHR_fn = clCreateCommandQueueWithPropertiesKHR_t;
954
955#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
956#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
957#[cfg(feature = "cl_khr_create_command_queue")]
958#[cfg(feature = "static")]
959unsafe extern "system" {
960    pub fn clCreateCommandQueueWithPropertiesKHR(
961        context: cl_context,
962        device: cl_device_id,
963        properties: *const cl_queue_properties_khr,
964        errcode_ret: *mut cl_int,
965    ) -> cl_command_queue;
966}
967
968// cl_nv_device_attribute_query extension
969
970pub type cl_nv_device_attribute_query = cl_uint;
971pub const CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV: cl_nv_device_attribute_query = 0x4000;
972pub const CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV: cl_nv_device_attribute_query = 0x4001;
973pub const CL_DEVICE_REGISTERS_PER_BLOCK_NV: cl_nv_device_attribute_query = 0x4002;
974pub const CL_DEVICE_WARP_SIZE_NV: cl_nv_device_attribute_query = 0x4003;
975pub const CL_DEVICE_GPU_OVERLAP_NV: cl_nv_device_attribute_query = 0x4004;
976pub const CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV: cl_nv_device_attribute_query = 0x4005;
977pub const CL_DEVICE_INTEGRATED_MEMORY_NV: cl_nv_device_attribute_query = 0x4006;
978
979// undocumented tokens for clGetDeviceInfo, see: https://anteru.net/blog/2014/associating-opencl-device-ids-with-gpus/
980pub const CL_DEVICE_PCI_BUS_ID_NV: cl_nv_device_attribute_query = 0x4008;
981pub const CL_DEVICE_PCI_SLOT_ID_NV: cl_nv_device_attribute_query = 0x4009;
982
983#[derive(Debug, Clone, Default)]
984#[repr(C)]
985pub struct cl_amd_device_topology {
986    r#type: u32,
987    unused: [u8; 17],
988    pub bus: u8,
989    pub device: u8,
990    pub function: u8,
991}
992
993// cl_amd_device_attribute_query
994pub type cl_amd_device_attribute_query = cl_uint;
995
996pub const CL_DEVICE_PROFILING_TIMER_OFFSET_AMD: cl_amd_device_attribute_query = 0x4036;
997pub const CL_DEVICE_TOPOLOGY_AMD: cl_amd_device_attribute_query = 0x4037;
998pub const CL_DEVICE_BOARD_NAME_AMD: cl_amd_device_attribute_query = 0x4038;
999pub const CL_DEVICE_GLOBAL_FREE_MEMORY_AMD: cl_amd_device_attribute_query = 0x4039;
1000pub const CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD: cl_amd_device_attribute_query = 0x4040;
1001pub const CL_DEVICE_SIMD_WIDTH_AMD: cl_amd_device_attribute_query = 0x4041;
1002pub const CL_DEVICE_SIMD_INSTRUCTION_WIDTH_AMD: cl_amd_device_attribute_query = 0x4042;
1003pub const CL_DEVICE_WAVEFRONT_WIDTH_AMD: cl_amd_device_attribute_query = 0x4043;
1004pub const CL_DEVICE_GLOBAL_MEM_CHANNELS_AMD: cl_amd_device_attribute_query = 0x4044;
1005pub const CL_DEVICE_GLOBAL_MEM_CHANNEL_BANKS_AMD: cl_amd_device_attribute_query = 0x4045;
1006pub const CL_DEVICE_GLOBAL_MEM_CHANNEL_BANK_WIDTH_AMD: cl_amd_device_attribute_query = 0x4046;
1007pub const CL_DEVICE_LOCAL_MEM_SIZE_PER_COMPUTE_UNIT_AMD: cl_amd_device_attribute_query = 0x4047;
1008pub const CL_DEVICE_LOCAL_MEM_BANKS_AMD: cl_amd_device_attribute_query = 0x4048;
1009pub const CL_DEVICE_THREAD_TRACE_SUPPORTED_AMD: cl_amd_device_attribute_query = 0x4049;
1010pub const CL_DEVICE_GFXIP_MAJOR_AMD: cl_amd_device_attribute_query = 0x404A;
1011pub const CL_DEVICE_GFXIP_MINOR_AMD: cl_amd_device_attribute_query = 0x404B;
1012pub const CL_DEVICE_AVAILABLE_ASYNC_QUEUES_AMD: cl_amd_device_attribute_query = 0x404C;
1013pub const CL_DEVICE_PREFERRED_WORK_GROUP_SIZE_AMD: cl_amd_device_attribute_query = 0x4030;
1014pub const CL_DEVICE_MAX_WORK_GROUP_SIZE_AMD: cl_amd_device_attribute_query = 0x4031;
1015pub const CL_DEVICE_PREFERRED_CONSTANT_BUFFER_SIZE_AMD: cl_amd_device_attribute_query = 0x4033;
1016pub const CL_DEVICE_PCIE_ID_AMD: cl_amd_device_attribute_query = 0x4034;
1017
1018// cl_arm_printf extension
1019pub const CL_PRINTF_CALLBACK_ARM: cl_uint = 0x40B0;
1020pub const CL_PRINTF_BUFFERSIZE_ARM: cl_uint = 0x40B1;
1021
1022// cl_ext_device_fission extension
1023
1024// cl_device_partition_property_ext
1025pub type cl_device_partition_property_ext = cl_ulong;
1026
1027pub type clReleaseDeviceEXT_t = Option<unsafe extern "C" fn(device: cl_device_id) -> cl_int>;
1028pub type clReleaseDeviceEXT_fn = clReleaseDeviceEXT_t;
1029
1030pub type clRetainDeviceEXT_t = Option<unsafe extern "C" fn(device: cl_device_id) -> cl_int>;
1031pub type clRetainDeviceEXT_fn = clRetainDeviceEXT_t;
1032
1033pub type clCreateSubDevicesEXT_t = Option<
1034    unsafe extern "C" fn(
1035        in_device: cl_device_id,
1036        properties: *const cl_device_partition_property_ext,
1037        num_entries: cl_uint,
1038        out_devices: *mut cl_device_id,
1039        num_devices: *mut cl_uint,
1040    ) -> cl_int,
1041>;
1042pub type clCreateSubDevicesEXT_fn = clCreateSubDevicesEXT_t;
1043
1044#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
1045#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
1046#[cfg(feature = "cl_ext_device_fission")]
1047#[cfg(feature = "static")]
1048unsafe extern "system" {
1049    pub fn clReleaseDeviceEXT(device: cl_device_id) -> cl_int;
1050
1051    pub fn clRetainDeviceEXT(device: cl_device_id) -> cl_int;
1052
1053    pub fn clCreateSubDevicesEXT(
1054        in_device: cl_device_id,
1055        properties: *const cl_device_partition_property_ext,
1056        num_entries: cl_uint,
1057        out_devices: *mut cl_device_id,
1058        num_devices: *mut cl_uint,
1059    ) -> cl_int;
1060}
1061
1062// cl_device_partition_property_ext
1063pub const CL_DEVICE_PARTITION_EQUALLY_EXT: cl_device_partition_property_ext = 0x4050;
1064pub const CL_DEVICE_PARTITION_BY_COUNTS_EXT: cl_device_partition_property_ext = 0x4051;
1065pub const CL_DEVICE_PARTITION_BY_NAMES_EXT: cl_device_partition_property_ext = 0x4052;
1066pub const CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN_EXT: cl_device_partition_property_ext = 0x4053;
1067
1068// clDeviceGetInfo selectors
1069pub const CL_DEVICE_PARENT_DEVICE_EXT: cl_device_info = 0x4054;
1070pub const CL_DEVICE_PARTITION_TYPES_EXT: cl_device_info = 0x4055;
1071pub const CL_DEVICE_AFFINITY_DOMAINS_EXT: cl_device_info = 0x4056;
1072pub const CL_DEVICE_REFERENCE_COUNT_EXT: cl_device_info = 0x4057;
1073pub const CL_DEVICE_PARTITION_STYLE_EXT: cl_device_info = 0x4058;
1074
1075// error codes
1076pub const CL_DEVICE_PARTITION_FAILED_EXT: cl_int = -1057;
1077pub const CL_INVALID_PARTITION_COUNT_EXT: cl_int = -1058;
1078pub const CL_INVALID_PARTITION_NAME_EXT: cl_int = -1059;
1079
1080// CL_AFFINITY_DOMAINs
1081pub const CL_AFFINITY_DOMAIN_L1_CACHE_EXT: cl_uint = 0x1;
1082pub const CL_AFFINITY_DOMAIN_L2_CACHE_EXT: cl_uint = 0x2;
1083pub const CL_AFFINITY_DOMAIN_L3_CACHE_EXT: cl_uint = 0x3;
1084pub const CL_AFFINITY_DOMAIN_L4_CACHE_EXT: cl_uint = 0x4;
1085pub const CL_AFFINITY_DOMAIN_NUMA_EXT: cl_uint = 0x10;
1086pub const CL_AFFINITY_DOMAIN_NEXT_FISSIONABLE_EXT: cl_uint = 0x100;
1087
1088// cl_device_partition_property_ext list terminators
1089pub const CL_PROPERTIES_LIST_END_EXT: cl_device_partition_property_ext = 0;
1090pub const CL_PARTITION_BY_COUNTS_LIST_END_EXT: cl_device_partition_property_ext = 0;
1091pub const CL_PARTITION_BY_NAMES_LIST_END_EXT: cl_device_partition_property_ext = 0xFFFF_FFFF;
1092
1093// cl_ext_migrate_memobject extension definitions
1094
1095pub type cl_mem_migration_flags_ext = cl_bitfield;
1096pub const CL_MIGRATE_MEM_OBJECT_HOST_EXT: cl_mem_migration_flags_ext = 0x1;
1097pub const CL_COMMAND_MIGRATE_MEM_OBJECT_EXT: cl_mem_migration_flags_ext = 0x4040;
1098
1099pub type clEnqueueMigrateMemObjectEXT_t = Option<
1100    unsafe extern "C" fn(
1101        command_queue: cl_command_queue,
1102        num_mem_objects: cl_uint,
1103        mem_objects: *const cl_mem,
1104        flags: cl_mem_migration_flags_ext,
1105        num_events_in_wait_list: cl_uint,
1106        event_wait_list: *const cl_event,
1107        event: *mut cl_event,
1108    ) -> cl_int,
1109>;
1110pub type clEnqueueMigrateMemObjectEXT_fn = clEnqueueMigrateMemObjectEXT_t;
1111
1112#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
1113#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
1114#[cfg(feature = "cl_ext_migrate_memobject")]
1115#[cfg(feature = "static")]
1116unsafe extern "system" {
1117    pub fn clEnqueueMigrateMemObjectEXT(
1118        command_queue: cl_command_queue,
1119        num_mem_objects: cl_uint,
1120        mem_objects: *const cl_mem,
1121        flags: cl_mem_migration_flags_ext,
1122        num_events_in_wait_list: cl_uint,
1123        event_wait_list: *const cl_event,
1124        event: *mut cl_event,
1125    ) -> cl_int;
1126}
1127
1128// cl_ext_cxx_for_opencl extension
1129pub const CL_DEVICE_CXX_FOR_OPENCL_NUMERIC_VERSION_EXT: cl_uint = 0x4230;
1130
1131// cl_qcom_ext_host_ptr extension
1132pub type cl_qcom_ext_host_ptr = cl_uint;
1133pub const CL_MEM_EXT_HOST_PTR_QCOM: cl_qcom_ext_host_ptr = 1 << 29;
1134
1135pub const CL_DEVICE_EXT_MEM_PADDING_IN_BYTES_QCOM: cl_qcom_ext_host_ptr = 0x40A0;
1136pub const CL_DEVICE_PAGE_SIZE_QCOM: cl_qcom_ext_host_ptr = 0x40A1;
1137pub const CL_IMAGE_ROW_ALIGNMENT_QCOM: cl_qcom_ext_host_ptr = 0x40A2;
1138pub const CL_IMAGE_SLICE_ALIGNMENT_QCOM: cl_qcom_ext_host_ptr = 0x40A3;
1139pub const CL_MEM_HOST_UNCACHED_QCOM: cl_qcom_ext_host_ptr = 0x40A4;
1140pub const CL_MEM_HOST_WRITEBACK_QCOM: cl_qcom_ext_host_ptr = 0x40A5;
1141pub const CL_MEM_HOST_WRITETHROUGH_QCOM: cl_qcom_ext_host_ptr = 0x40A6;
1142pub const CL_MEM_HOST_WRITE_COMBINING_QCOM: cl_qcom_ext_host_ptr = 0x40A7;
1143
1144pub type cl_image_pitch_info_qcom = cl_uint;
1145
1146pub type clGetDeviceImageInfoQCOM_t = Option<
1147    unsafe extern "C" fn(
1148        device: cl_device_id,
1149        image_width: size_t,
1150        image_height: size_t,
1151        image_format: *const cl_image_format,
1152        param_name: cl_image_pitch_info_qcom,
1153        param_value_size: size_t,
1154        param_value: *mut c_void,
1155        param_value_size_ret: *mut size_t,
1156    ) -> cl_int,
1157>;
1158pub type clGetDeviceImageInfoQCOM_fn = clGetDeviceImageInfoQCOM_t;
1159
1160#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
1161#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
1162#[cfg(feature = "cl_qcom_ext_host_ptr")]
1163#[cfg(feature = "static")]
1164unsafe extern "system" {
1165    pub fn clGetDeviceImageInfoQCOM(
1166        device: cl_device_id,
1167        image_width: size_t,
1168        image_height: size_t,
1169        image_format: *const cl_image_format,
1170        param_name: cl_image_pitch_info_qcom,
1171        param_value_size: size_t,
1172        param_value: *mut c_void,
1173        param_value_size_ret: *mut size_t,
1174    ) -> cl_int;
1175}
1176
1177#[derive(Debug, Copy, Clone, Default)]
1178#[repr(C)]
1179pub struct cl_mem_ext_host_ptr {
1180    pub allocation_type: cl_uint,
1181    pub host_cache_policy: cl_uint,
1182}
1183
1184// cl_qcom_ext_host_ptr_iocoherent extension
1185// Cache policy specifying io-coherence
1186pub const CL_MEM_HOST_IOCOHERENT_QCOM: cl_qcom_ext_host_ptr = 0x40A9;
1187
1188// cl_qcom_ion_host_ptr extension
1189pub const CL_MEM_ION_HOST_PTR_QCOM: cl_qcom_ext_host_ptr = 0x40A8;
1190
1191#[derive(Debug)]
1192#[repr(C)]
1193pub struct cl_mem_ion_host_ptr {
1194    pub ext_host_ptr: cl_mem_ext_host_ptr,
1195    pub ion_filedesc: cl_int,
1196    pub ion_hostptr: *mut c_void,
1197}
1198
1199//cl_qcom_android_native_buffer_host_ptr extension
1200pub const CL_MEM_ANDROID_NATIVE_BUFFER_HOST_PTR_QCOM: cl_qcom_ext_host_ptr = 0x40C6;
1201
1202#[repr(C)]
1203#[derive(Debug, Copy, Clone)]
1204pub struct cl_mem_android_native_buffer_host_ptr {
1205    pub ext_host_ptr: cl_mem_ext_host_ptr,
1206    pub anb_ptr: *mut c_void,
1207}
1208
1209// cl_img_yuv_image extension
1210pub const CL_NV21_IMG: cl_channel_type = 0x40D0;
1211pub const CL_YV12_IMG: cl_channel_type = 0x40D1;
1212
1213// cl_img_cached_allocations extension
1214pub const CL_MEM_USE_UNCACHED_CPU_MEMORY_IMG: cl_mem_flags = 1 << 26;
1215pub const CL_MEM_USE_CACHED_CPU_MEMORY_IMG: cl_mem_flags = 1 << 27;
1216
1217// cl_img_use_gralloc_ptr extension
1218pub const CL_MEM_USE_GRALLOC_PTR_IMG: cl_mem_flags = 1 << 28;
1219
1220// To be used by clGetEventInfo:
1221pub const CL_COMMAND_ACQUIRE_GRALLOC_OBJECTS_IMG: cl_event_info = 0x40D2;
1222pub const CL_COMMAND_RELEASE_GRALLOC_OBJECTS_IMG: cl_event_info = 0x40D3;
1223
1224// Error codes from clEnqueueAcquireGrallocObjectsIMG and clEnqueueReleaseGrallocObjectsIMG
1225pub const CL_GRALLOC_RESOURCE_NOT_ACQUIRED_IMG: cl_int = 0x40D4;
1226pub const CL_INVALID_GRALLOC_OBJECT_IMG: cl_int = 0x40D5;
1227
1228pub type clEnqueueAcquireGrallocObjectsIMG_t = Option<
1229    unsafe extern "C" fn(
1230        command_queue: cl_command_queue,
1231        num_objects: cl_uint,
1232        mem_objects: *const cl_mem,
1233        num_events_in_wait_list: cl_uint,
1234        event_wait_list: *const cl_event,
1235        event: *mut cl_event,
1236    ) -> cl_int,
1237>;
1238pub type clEnqueueAcquireGrallocObjectsIMG_fn = clEnqueueAcquireGrallocObjectsIMG_t;
1239
1240pub type clEnqueueReleaseGrallocObjectsIMG_t = Option<
1241    unsafe extern "C" fn(
1242        command_queue: cl_command_queue,
1243        num_objects: cl_uint,
1244        mem_objects: *const cl_mem,
1245        num_events_in_wait_list: cl_uint,
1246        event_wait_list: *const cl_event,
1247        event: *mut cl_event,
1248    ) -> cl_int,
1249>;
1250pub type clEnqueueReleaseGrallocObjectsIMG_fn = clEnqueueReleaseGrallocObjectsIMG_t;
1251
1252#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
1253#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
1254#[cfg(feature = "cl_img_use_gralloc_ptr")]
1255#[cfg(feature = "static")]
1256unsafe extern "system" {
1257    pub fn clEnqueueAcquireGrallocObjectsIMG(
1258        command_queue: cl_command_queue,
1259        num_objects: cl_uint,
1260        mem_objects: *const cl_mem,
1261        num_events_in_wait_list: cl_uint,
1262        event_wait_list: *const cl_event,
1263        event: *mut cl_event,
1264    ) -> cl_int;
1265
1266    pub fn clEnqueueReleaseGrallocObjectsIMG(
1267        command_queue: cl_command_queue,
1268        num_objects: cl_uint,
1269        mem_objects: *const cl_mem,
1270        num_events_in_wait_list: cl_uint,
1271        event_wait_list: *const cl_event,
1272        event: *mut cl_event,
1273    ) -> cl_int;
1274}
1275
1276// cl_img_generate_mipmap extension
1277pub type cl_mipmap_filter_mode_img = cl_uint;
1278
1279// To be used by clEnqueueGenerateMipmapIMG
1280pub const CL_MIPMAP_FILTER_ANY_IMG: cl_mipmap_filter_mode_img = 0x0;
1281pub const CL_MIPMAP_FILTER_BOX_IMG: cl_mipmap_filter_mode_img = 0x1;
1282
1283// To be used by clGetEventInfo
1284pub const CL_COMMAND_GENERATE_MIPMAP_IMG: cl_event_info = 0x40D6;
1285
1286pub type clEnqueueGenerateMipmapIMG_t = Option<
1287    unsafe extern "C" fn(
1288        command_queue: cl_command_queue,
1289        src_image: cl_mem,
1290        dst_image: cl_mem,
1291        mipmap_filter_mode: cl_mipmap_filter_mode_img,
1292        array_region: *const size_t,
1293        mip_region: *const size_t,
1294        num_events_in_wait_list: cl_uint,
1295        event_wait_list: *const cl_event,
1296        event: *mut cl_event,
1297    ) -> cl_int,
1298>;
1299pub type clEnqueueGenerateMipmapIMG_fn = clEnqueueGenerateMipmapIMG_t;
1300
1301#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
1302#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
1303#[cfg(feature = "cl_img_generate_mipmap")]
1304#[cfg(feature = "static")]
1305unsafe extern "system" {
1306    pub fn clEnqueueGenerateMipmapIMG(
1307        command_queue: cl_command_queue,
1308        src_image: cl_mem,
1309        dst_image: cl_mem,
1310        mipmap_filter_mode: cl_mipmap_filter_mode_img,
1311        array_region: *const size_t,
1312        mip_region: *const size_t,
1313        num_events_in_wait_list: cl_uint,
1314        event_wait_list: *const cl_event,
1315        event: *mut cl_event,
1316    ) -> cl_int;
1317}
1318
1319// cl_img_mem_properties extension
1320// To be used by clCreateBufferWithProperties
1321pub const CL_MEM_ALLOC_FLAGS_IMG: cl_properties = 0x40D7;
1322
1323// To be used wiith the CL_MEM_ALLOC_FLAGS_IMG property
1324pub type cl_mem_alloc_flags_img = cl_bitfield;
1325
1326// To be used with cl_mem_alloc_flags_img
1327pub const CL_MEM_ALLOC_RELAX_REQUIREMENTS_IMG: cl_mem_alloc_flags_img = 1 << 0;
1328pub const CL_MEM_ALLOC_GPU_WRITE_COMBINE_IMG: cl_mem_alloc_flags_img = 1 << 1;
1329pub const CL_MEM_ALLOC_GPU_CACHED_IMG: cl_mem_alloc_flags_img = 1 << 2;
1330pub const CL_MEM_ALLOC_CPU_LOCAL_IMG: cl_mem_alloc_flags_img = 1 << 3;
1331pub const CL_MEM_ALLOC_GPU_LOCAL_IMG: cl_mem_alloc_flags_img = 1 << 4;
1332pub const CL_MEM_ALLOC_GPU_PRIVATE_IMG: cl_mem_alloc_flags_img = 1 << 5;
1333
1334pub const CL_DEVICE_MEMORY_CAPABILITIES_IMG: cl_device_info = 0x40D8;
1335
1336// cl_khr_subgroups extension
1337pub const CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR: cl_kernel_sub_group_info = 0x2033;
1338pub const CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE_KHR: cl_kernel_sub_group_info = 0x2034;
1339
1340pub type clGetKernelSubGroupInfoKHR_t = Option<
1341    unsafe extern "C" fn(
1342        in_kernel: cl_kernel,
1343        in_device: cl_device_id,
1344        param_name: cl_kernel_sub_group_info,
1345        input_value_size: size_t,
1346        input_value: *const c_void,
1347        param_value_size: size_t,
1348        param_value: *mut c_void,
1349        param_value_size_ret: *mut size_t,
1350    ) -> cl_int,
1351>;
1352pub type clGetKernelSubGroupInfoKHR_fn = clGetKernelSubGroupInfoKHR_t;
1353
1354#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
1355#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
1356#[cfg(feature = "cl_khr_subgroups")]
1357#[cfg(feature = "static")]
1358unsafe extern "system" {
1359    pub fn clGetKernelSubGroupInfoKHR(
1360        in_kernel: cl_kernel,
1361        in_device: cl_device_id,
1362        param_name: cl_kernel_sub_group_info,
1363        input_value_size: size_t,
1364        input_value: *const c_void,
1365        param_value_size: size_t,
1366        param_value: *mut c_void,
1367        param_value_size_ret: *mut size_t,
1368    ) -> cl_int;
1369}
1370
1371// cl_khr_mipmap_image extension
1372
1373// cl_sampler_properties
1374pub const CL_SAMPLER_MIP_FILTER_MODE_KHR: cl_sampler_properties = 0x1155;
1375pub const CL_SAMPLER_LOD_MIN_KHR: cl_sampler_properties = 0x1156;
1376pub const CL_SAMPLER_LOD_MAX_KHR: cl_sampler_properties = 0x1157;
1377
1378// cl_khr_priority_hints extension
1379pub type cl_queue_priority_khr = cl_uint;
1380
1381// cl_command_queue_properties
1382pub const CL_QUEUE_PRIORITY_KHR: cl_command_queue_properties = 0x1096;
1383
1384// cl_queue_priority_khr
1385pub const CL_QUEUE_PRIORITY_HIGH_KHR: cl_queue_priority_khr = 1 << 0;
1386pub const CL_QUEUE_PRIORITY_MED_KHR: cl_queue_priority_khr = 1 << 1;
1387pub const CL_QUEUE_PRIORITY_LOW_KHR: cl_queue_priority_khr = 1 << 2;
1388
1389// cl_khr_throttle_hints extension
1390pub type cl_queue_throttle_khr = cl_uint;
1391
1392// cl_command_queue_properties
1393pub const CL_QUEUE_THROTTLE_KHR: cl_command_queue_properties = 0x1097;
1394
1395// cl_queue_throttle_khr
1396pub const CL_QUEUE_THROTTLE_HIGH_KHR: cl_queue_throttle_khr = 1 << 0;
1397pub const CL_QUEUE_THROTTLE_MED_KHR: cl_queue_throttle_khr = 1 << 1;
1398pub const CL_QUEUE_THROTTLE_LOW_KHR: cl_queue_throttle_khr = 1 << 2;
1399
1400// cl_khr_subgroup_named_barrier
1401
1402// cl_device_info
1403pub const CL_DEVICE_MAX_NAMED_BARRIER_COUNT_KHR: cl_device_info = 0x2035;
1404
1405// cl_khr_extended_versioning
1406pub type cl_version_khr = cl_uint;
1407
1408pub const CL_VERSION_MAJOR_BITS_KHR: cl_version_khr = 10;
1409pub const CL_VERSION_MINOR_BITS_KHR: cl_version_khr = 10;
1410pub const CL_VERSION_PATCH_BITS_KHR: cl_version_khr = 12;
1411
1412pub const CL_VERSION_MAJOR_MASK_KHR: cl_version_khr = (1 << CL_VERSION_MAJOR_BITS_KHR) - 1;
1413pub const CL_VERSION_MINOR_MASK_KHR: cl_version_khr = (1 << CL_VERSION_MINOR_BITS_KHR) - 1;
1414pub const CL_VERSION_PATCH_MASK_KHR: cl_version_khr = (1 << CL_VERSION_PATCH_BITS_KHR) - 1;
1415
1416#[inline]
1417#[must_use]
1418pub const fn version_major_khr(version: cl_version_khr) -> cl_version_khr {
1419    version >> (CL_VERSION_MINOR_BITS_KHR + CL_VERSION_PATCH_BITS_KHR)
1420}
1421
1422#[inline]
1423#[must_use]
1424pub const fn version_minor_khr(version: cl_version_khr) -> cl_version_khr {
1425    (version >> CL_VERSION_PATCH_BITS_KHR) & CL_VERSION_MINOR_MASK_KHR
1426}
1427
1428#[inline]
1429#[must_use]
1430pub const fn version_patch_khr(version: cl_version_khr) -> cl_version_khr {
1431    version & CL_VERSION_PATCH_MASK_KHR
1432}
1433
1434#[inline]
1435#[must_use]
1436pub const fn make_version_khr(
1437    major: cl_version_khr,
1438    minor: cl_version_khr,
1439    patch: cl_version_khr,
1440) -> cl_version_khr {
1441    ((major & CL_VERSION_MAJOR_MASK_KHR) << (CL_VERSION_MINOR_BITS_KHR + CL_VERSION_PATCH_BITS_KHR))
1442        | ((minor & CL_VERSION_MINOR_MASK_KHR) << CL_VERSION_PATCH_BITS_KHR)
1443        | (patch & CL_VERSION_PATCH_MASK_KHR)
1444}
1445
1446pub const CL_NAME_VERSION_MAX_NAME_SIZE_KHR: size_t = 64;
1447
1448#[repr(C)]
1449#[derive(Debug, Copy, Clone)]
1450pub struct cl_name_version_khr {
1451    pub version: cl_version_khr,
1452    pub name: [cl_uchar; CL_NAME_VERSION_MAX_NAME_SIZE_KHR],
1453}
1454
1455// cl_platform_info
1456pub const CL_PLATFORM_NUMERIC_VERSION_KHR: cl_platform_info = 0x0906;
1457pub const CL_PLATFORM_EXTENSIONS_WITH_VERSION_KHR: cl_platform_info = 0x0907;
1458
1459// cl_device_info
1460pub const CL_DEVICE_NUMERIC_VERSION_KHR: cl_device_info = 0x105E;
1461pub const CL_DEVICE_OPENCL_C_NUMERIC_VERSION_KHR: cl_device_info = 0x105F;
1462pub const CL_DEVICE_EXTENSIONS_WITH_VERSION_KHR: cl_device_info = 0x1060;
1463pub const CL_DEVICE_ILS_WITH_VERSION_KHR: cl_device_info = 0x1061;
1464pub const CL_DEVICE_BUILT_IN_KERNELS_WITH_VERSION_KHR: cl_device_info = 0x1062;
1465
1466// cl_khr_device_uuid extension
1467
1468pub const CL_UUID_SIZE_KHR: size_t = 16;
1469pub const CL_LUID_SIZE_KHR: size_t = 8;
1470
1471pub const CL_DEVICE_UUID_KHR: cl_device_info = 0x106A;
1472pub const CL_DRIVER_UUID_KHR: cl_device_info = 0x106B;
1473pub const CL_DEVICE_LUID_VALID_KHR: cl_device_info = 0x106C;
1474pub const CL_DEVICE_LUID_KHR: cl_device_info = 0x106D;
1475pub const CL_DEVICE_NODE_MASK_KHR: cl_device_info = 0x106E;
1476
1477// cl_khr_pci_bus_info
1478#[repr(C)]
1479#[derive(Debug, Clone, Default)]
1480pub struct cl_device_pci_bus_info_khr {
1481    pub pci_domain: cl_uint,
1482    pub pci_bus: cl_uint,
1483    pub pci_device: cl_uint,
1484    pub pci_function: cl_uint,
1485}
1486
1487// cl_device_info
1488pub const CL_DEVICE_PCI_BUS_INFO_KHR: cl_device_info = 0x410F;
1489
1490// cl_khr_suggested_local_work_size
1491
1492pub type clGetKernelSuggestedLocalWorkSizeKHR_t = Option<
1493    unsafe extern "C" fn(
1494        command_queue: cl_command_queue,
1495        kernel: cl_kernel,
1496        work_dim: cl_uint,
1497        global_work_offset: *const size_t,
1498        global_work_size: *const size_t,
1499        suggested_local_work_size: *mut size_t,
1500    ) -> cl_int,
1501>;
1502pub type clGetKernelSuggestedLocalWorkSizeKHR_fn = clGetKernelSuggestedLocalWorkSizeKHR_t;
1503
1504#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
1505#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
1506#[cfg(feature = "cl_khr_suggested_local_work_size")]
1507#[cfg(feature = "static")]
1508unsafe extern "system" {
1509    pub fn clGetKernelSuggestedLocalWorkSizeKHR(
1510        command_queue: cl_command_queue,
1511        kernel: cl_kernel,
1512        work_dim: cl_uint,
1513        global_work_offset: *const size_t,
1514        global_work_size: *const size_t,
1515        suggested_local_work_size: *mut size_t,
1516    ) -> cl_int;
1517}
1518
1519// cl_khr_integer_dot_product
1520
1521pub type cl_device_integer_dot_product_capabilities_khr = cl_bitfield;
1522// cl_device_integer_dot_product_capabilities_khr
1523pub const CL_DEVICE_INTEGER_DOT_PRODUCT_INPUT_4x8BIT_PACKED_KHR:
1524    cl_device_integer_dot_product_capabilities_khr = 1 << 0;
1525pub const CL_DEVICE_INTEGER_DOT_PRODUCT_INPUT_4x8BIT_KHR:
1526    cl_device_integer_dot_product_capabilities_khr = 1 << 1;
1527
1528#[repr(C)]
1529#[derive(Debug, Clone, Default)]
1530pub struct cl_device_integer_dot_product_acceleration_properties_khr {
1531    pub signed_accelerated: cl_bool,
1532    pub unsigned_accelerated: cl_bool,
1533    pub mixed_signedness_accelerated: cl_bool,
1534    pub accumulating_saturating_signed_accelerated: cl_bool,
1535    pub accumulating_saturating_unsigned_accelerated: cl_bool,
1536    pub accumulating_saturating_mixed_signedness_accelerated: cl_bool,
1537}
1538
1539// cl_device_info
1540pub const CL_DEVICE_INTEGER_DOT_PRODUCT_CAPABILITIES_KHR: cl_device_info = 0x1073;
1541pub const CL_DEVICE_INTEGER_DOT_PRODUCT_ACCELERATION_PROPERTIES_8BIT_KHR: cl_device_info = 0x1074;
1542pub const CL_DEVICE_INTEGER_DOT_PRODUCT_ACCELERATION_PROPERTIES_4x8BIT_PACKED_KHR: cl_device_info =
1543    0x1075;
1544
1545// cl_khr_external_memory
1546
1547pub type cl_external_memory_handle_type_khr = cl_uint;
1548
1549// cl_platform_info
1550pub const CL_PLATFORM_EXTERNAL_MEMORY_IMPORT_HANDLE_TYPES_KHR: cl_platform_info = 0x2044;
1551
1552// cl_device_info
1553pub const CL_DEVICE_EXTERNAL_MEMORY_IMPORT_HANDLE_TYPES_KHR: cl_device_info = 0x204F;
1554pub const CL_DEVICE_EXTERNAL_MEMORY_IMPORT_ASSUME_LINEAR_IMAGES_HANDLE_TYPES_KHR: cl_device_info =
1555    0x2052;
1556
1557// cl_mem_properties
1558pub const CL_MEM_DEVICE_HANDLE_LIST_KHR: cl_ulong = 0x2051;
1559pub const CL_MEM_DEVICE_HANDLE_LIST_END_KHR: cl_ulong = 0;
1560
1561// cl_command_type
1562pub const CL_COMMAND_ACQUIRE_EXTERNAL_MEM_OBJECTS_KHR: cl_command_type = 0x2047;
1563pub const CL_COMMAND_RELEASE_EXTERNAL_MEM_OBJECTS_KHR: cl_command_type = 0x2048;
1564
1565pub type clEnqueueAcquireExternalMemObjectsKHR_t = Option<
1566    unsafe extern "C" fn(
1567        command_queue: cl_command_queue,
1568        num_mem_objects: cl_uint,
1569        mem_objects: *const cl_mem,
1570        num_events_in_wait_list: cl_uint,
1571        event_wait_list: *const cl_event,
1572        event: *mut cl_event,
1573    ) -> cl_int,
1574>;
1575pub type clEnqueueAcquireExternalMemObjectsKHR_fn = clEnqueueAcquireExternalMemObjectsKHR_t;
1576
1577pub type clEnqueueReleaseExternalMemObjectsKHR_t = Option<
1578    unsafe extern "C" fn(
1579        command_queue: cl_command_queue,
1580        num_mem_objects: cl_uint,
1581        mem_objects: *const cl_mem,
1582        num_events_in_wait_list: cl_uint,
1583        event_wait_list: *const cl_event,
1584        event: *mut cl_event,
1585    ) -> cl_int,
1586>;
1587pub type clEnqueueReleaseExternalMemObjectsKHR_fn = clEnqueueReleaseExternalMemObjectsKHR_t;
1588
1589#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
1590#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
1591#[cfg(feature = "cl_khr_external_memory")]
1592#[cfg(feature = "static")]
1593unsafe extern "system" {
1594    pub fn clEnqueueAcquireExternalMemObjectsKHR(
1595        command_queue: cl_command_queue,
1596        num_mem_objects: cl_uint,
1597        mem_objects: *const cl_mem,
1598        num_events_in_wait_list: cl_uint,
1599        event_wait_list: *const cl_event,
1600        event: *mut cl_event,
1601    ) -> cl_int;
1602
1603    pub fn clEnqueueReleaseExternalMemObjectsKHR(
1604        command_queue: cl_command_queue,
1605        num_mem_objects: cl_uint,
1606        mem_objects: *const cl_mem,
1607        num_events_in_wait_list: cl_uint,
1608        event_wait_list: *const cl_event,
1609        event: *mut cl_event,
1610    ) -> cl_int;
1611}
1612
1613// cl_khr_external_memory_dma_buf
1614
1615// cl_external_memory_handle_type_khr
1616pub const CL_EXTERNAL_MEMORY_HANDLE_DMA_BUF_KHR: cl_external_memory_handle_type_khr = 0x2067;
1617
1618// cl_khr_external_memory_dx
1619
1620// cl_khr_external_memory_opaque_fd
1621
1622// cl_external_memory_handle_type_khr
1623pub const CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_FD_KHR: cl_external_memory_handle_type_khr = 0x2060;
1624
1625// cl_khr_external_memory_win32
1626
1627// cl_external_memory_handle_type_khr
1628pub const CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_KHR: cl_external_memory_handle_type_khr = 0x2061;
1629pub const CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_KMT_KHR: cl_external_memory_handle_type_khr =
1630    0x2062;
1631
1632// cl_khr_external_semaphore
1633pub type cl_semaphore_khr = *mut c_void;
1634pub type cl_external_semaphore_handle_type_khr = cl_uint;
1635pub type cl_semaphore_properties_khr = cl_properties;
1636
1637// cl_platform_info
1638pub const CL_PLATFORM_SEMAPHORE_IMPORT_HANDLE_TYPES_KHR: cl_platform_info = 0x2037;
1639pub const CL_PLATFORM_SEMAPHORE_EXPORT_HANDLE_TYPES_KHR: cl_platform_info = 0x2038;
1640
1641// cl_device_info
1642pub const CL_DEVICE_SEMAPHORE_IMPORT_HANDLE_TYPES_KHR: cl_device_info = 0x204D;
1643pub const CL_DEVICE_SEMAPHORE_EXPORT_HANDLE_TYPES_KHR: cl_device_info = 0x204E;
1644
1645// cl_semaphore_properties_khr
1646pub const CL_SEMAPHORE_EXPORT_HANDLE_TYPES_KHR: cl_semaphore_properties_khr = 0x203F;
1647pub const CL_SEMAPHORE_EXPORT_HANDLE_TYPES_LIST_END_KHR: cl_semaphore_properties_khr = 0;
1648
1649// cl_semaphore_info_khr
1650pub const CL_SEMAPHORE_EXPORTABLE_KHR: u32 = 0x2054;
1651
1652pub type clGetSemaphoreHandleForTypeKHR_t = Option<
1653    unsafe extern "C" fn(
1654        sema_object: cl_semaphore_khr,
1655        device: cl_device_id,
1656        handle_type: cl_external_semaphore_handle_type_khr,
1657        handle_size: size_t,
1658        handle_ptr: *mut c_void,
1659        handle_size_ret: *mut size_t,
1660    ) -> cl_int,
1661>;
1662pub type clGetSemaphoreHandleForTypeKHR_fn = clGetSemaphoreHandleForTypeKHR_t;
1663
1664#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
1665#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
1666#[cfg(feature = "cl_khr_external_semaphore")]
1667#[cfg(feature = "static")]
1668unsafe extern "system" {
1669    pub fn clGetSemaphoreHandleForTypeKHR(
1670        sema_object: cl_semaphore_khr,
1671        device: cl_device_id,
1672        handle_type: cl_external_semaphore_handle_type_khr,
1673        handle_size: size_t,
1674        handle_ptr: *mut c_void,
1675        handle_size_ret: *mut size_t,
1676    ) -> cl_int;
1677}
1678
1679// cl_khr_external_semaphore_dx_fence
1680
1681// cl_external_semaphore_handle_type_khr
1682pub const CL_SEMAPHORE_HANDLE_D3D12_FENCE_KHR: cl_external_semaphore_handle_type_khr = 0x2059;
1683
1684// cl_khr_external_semaphore_opaque_fd
1685pub const CL_SEMAPHORE_HANDLE_OPAQUE_FD_KHR: cl_external_semaphore_handle_type_khr = 0x2055;
1686
1687// cl_khr_external_semaphore_sync_fd
1688
1689pub type cl_semaphore_reimport_properties_khr = cl_properties;
1690
1691pub const CL_SEMAPHORE_HANDLE_SYNC_FD_KHR: cl_external_semaphore_handle_type_khr = 0x2058;
1692
1693pub type clReImportSemaphoreSyncFdKHR_t = Option<
1694    unsafe extern "C" fn(
1695        sema_object: cl_semaphore_khr,
1696        reimport_props: *mut cl_semaphore_reimport_properties_khr,
1697        fd: c_int,
1698    ) -> cl_int,
1699>;
1700pub type clReImportSemaphoreSyncFdKHR_fn = clReImportSemaphoreSyncFdKHR_t;
1701
1702#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
1703#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
1704#[cfg(feature = "cl_khr_external_semaphore_sync_fd")]
1705#[cfg(feature = "static")]
1706unsafe extern "system" {
1707    pub fn clReImportSemaphoreSyncFdKHR(
1708        sema_object: cl_semaphore_khr,
1709        reimport_props: *mut cl_semaphore_reimport_properties_khr,
1710        fd: c_int,
1711    ) -> cl_int;
1712}
1713
1714// cl_khr_external_semaphore_win32
1715pub const CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KHR: cl_external_semaphore_handle_type_khr = 0x2056;
1716pub const CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KMT_KHR: cl_external_semaphore_handle_type_khr = 0x2057;
1717pub const CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_NAME_KHR: cl_external_semaphore_handle_type_khr = 0x2058;
1718
1719// cl_khr_semaphore
1720
1721// pub type cl_semaphore_properties_khr = cl_properties; defined above
1722pub type cl_semaphore_info_khr = cl_uint;
1723pub type cl_semaphore_type_khr = cl_uint;
1724pub type cl_semaphore_payload_khr = cl_ulong;
1725
1726// cl_semaphore_type
1727pub const CL_SEMAPHORE_TYPE_BINARY_KHR: cl_semaphore_type_khr = 1;
1728
1729// cl_platform_info
1730pub const CL_PLATFORM_SEMAPHORE_TYPES_KHR: cl_platform_info = 0x2036;
1731
1732// cl_device_info
1733pub const CL_DEVICE_SEMAPHORE_TYPES_KHR: cl_device_info = 0x204C;
1734
1735// cl_semaphore_info_khr
1736pub const CL_SEMAPHORE_CONTEXT_KHR: cl_semaphore_info_khr = 0x2039;
1737pub const CL_SEMAPHORE_REFERENCE_COUNT_KHR: cl_semaphore_info_khr = 0x203A;
1738pub const CL_SEMAPHORE_PROPERTIES_KHR: cl_semaphore_info_khr = 0x203B;
1739pub const CL_SEMAPHORE_PAYLOAD_KHR: cl_semaphore_info_khr = 0x203C;
1740
1741// cl_semaphore_info_khr or cl_semaphore_properties_khr
1742pub const CL_SEMAPHORE_TYPE_KHR: cl_semaphore_info_khr = 0x203D;
1743pub const CL_SEMAPHORE_DEVICE_HANDLE_LIST_KHR: cl_semaphore_info_khr = 0x2053;
1744pub const CL_SEMAPHORE_DEVICE_HANDLE_LIST_END_KHR: cl_semaphore_info_khr = 0;
1745
1746// cl_command_type
1747pub const CL_COMMAND_SEMAPHORE_WAIT_KHR: cl_command_type = 0x2042;
1748pub const CL_COMMAND_SEMAPHORE_SIGNAL_KHR: cl_command_type = 0x2043;
1749
1750// Error codes
1751pub const CL_INVALID_SEMAPHORE_KHR: cl_int = -1142;
1752
1753pub type clCreateSemaphoreWithPropertiesKHR_t = Option<
1754    unsafe extern "C" fn(
1755        context: cl_context,
1756        sema_props: *const cl_semaphore_properties_khr,
1757        errcode_ret: *mut cl_int,
1758    ) -> cl_semaphore_khr,
1759>;
1760pub type clCreateSemaphoreWithPropertiesKHR_fn = clCreateSemaphoreWithPropertiesKHR_t;
1761
1762pub type clEnqueueWaitSemaphoresKHR_t = Option<
1763    unsafe extern "C" fn(
1764        command_queue: cl_command_queue,
1765        num_sema_objects: cl_uint,
1766        sema_objects: *const cl_semaphore_khr,
1767        sema_payload_list: *const cl_semaphore_payload_khr,
1768        num_events_in_wait_list: cl_uint,
1769        event_wait_list: *const cl_event,
1770        event: *mut cl_event,
1771    ) -> cl_int,
1772>;
1773pub type clEnqueueWaitSemaphoresKHR_fn = clEnqueueWaitSemaphoresKHR_t;
1774
1775pub type clEnqueueSignalSemaphoresKHR_t = Option<
1776    unsafe extern "C" fn(
1777        command_queue: cl_command_queue,
1778        num_sema_objects: cl_uint,
1779        sema_objects: *const cl_semaphore_khr,
1780        sema_payload_list: *const cl_semaphore_payload_khr,
1781        num_events_in_wait_list: cl_uint,
1782        event_wait_list: *const cl_event,
1783        event: *mut cl_event,
1784    ) -> cl_int,
1785>;
1786pub type clEnqueueSignalSemaphoresKHR_fn = clEnqueueSignalSemaphoresKHR_t;
1787
1788pub type clGetSemaphoreInfoKHR_t = Option<
1789    unsafe extern "C" fn(
1790        sema_object: cl_semaphore_khr,
1791        param_name: cl_semaphore_info_khr,
1792        param_value_size: size_t,
1793        param_value: *mut c_void,
1794        param_value_size_ret: *mut size_t,
1795    ) -> cl_int,
1796>;
1797pub type clGetSemaphoreInfoKHR_fn = clGetSemaphoreInfoKHR_t;
1798
1799pub type clReleaseSemaphoreKHR_t =
1800    Option<unsafe extern "C" fn(sema_object: cl_semaphore_khr) -> cl_int>;
1801pub type clReleaseSemaphoreKHR_fn = clReleaseSemaphoreKHR_t;
1802
1803pub type clRetainSemaphoreKHR_t =
1804    Option<unsafe extern "C" fn(sema_object: cl_semaphore_khr) -> cl_int>;
1805pub type clRetainSemaphoreKHR_fn = clRetainSemaphoreKHR_t;
1806
1807#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
1808#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
1809#[cfg(feature = "cl_khr_semaphore")]
1810#[cfg(feature = "static")]
1811unsafe extern "system" {
1812    pub fn clCreateSemaphoreWithPropertiesKHR(
1813        context: cl_context,
1814        sema_props: *const cl_semaphore_properties_khr,
1815        errcode_ret: *mut cl_int,
1816    ) -> cl_semaphore_khr;
1817
1818    pub fn clEnqueueWaitSemaphoresKHR(
1819        command_queue: cl_command_queue,
1820        num_sema_objects: cl_uint,
1821        sema_objects: *const cl_semaphore_khr,
1822        sema_payload_list: *const cl_semaphore_payload_khr,
1823        num_events_in_wait_list: cl_uint,
1824        event_wait_list: *const cl_event,
1825        event: *mut cl_event,
1826    ) -> cl_int;
1827
1828    pub fn clEnqueueSignalSemaphoresKHR(
1829        command_queue: cl_command_queue,
1830        num_sema_objects: cl_uint,
1831        sema_objects: *const cl_semaphore_khr,
1832        sema_payload_list: *const cl_semaphore_payload_khr,
1833        num_events_in_wait_list: cl_uint,
1834        event_wait_list: *const cl_event,
1835        event: *mut cl_event,
1836    ) -> cl_int;
1837
1838    pub fn clGetSemaphoreInfoKHR(
1839        sema_object: cl_semaphore_khr,
1840        param_name: cl_semaphore_info_khr,
1841        param_value_size: size_t,
1842        param_value: *mut c_void,
1843        param_value_size_ret: *mut size_t,
1844    ) -> cl_int;
1845
1846    pub fn clReleaseSemaphoreKHR(sema_object: cl_semaphore_khr) -> cl_int;
1847
1848    pub fn clRetainSemaphoreKHR(sema_object: cl_semaphore_khr) -> cl_int;
1849}
1850
1851// cl_arm_import_memory extension
1852
1853pub type cl_import_properties_arm = intptr_t;
1854
1855/// Default and valid properties name for `cl_arm_import_memory`
1856pub const CL_IMPORT_TYPE_ARM: cl_import_properties_arm = 0x40B2;
1857
1858/// Host process memory type default value for `CL_IMPORT_TYPE_ARM` property
1859pub const CL_IMPORT_TYPE_HOST_ARM: cl_import_properties_arm = 0x40B3;
1860
1861/// DMA BUF memory type value for `CL_IMPORT_TYPE_ARM` property
1862pub const CL_IMPORT_TYPE_DMA_BUF_ARM: cl_import_properties_arm = 0x40B4;
1863
1864/// Protected memory property
1865pub const CL_IMPORT_TYPE_PROTECTED_ARM: cl_import_properties_arm = 0x40B5;
1866
1867/// Android hardware buffer type value for `CL_IMPORT_TYPE_ARM` property
1868pub const CL_IMPORT_TYPE_ANDROID_HARDWARE_BUFFER_ARM: cl_import_properties_arm = 0x41E2;
1869
1870/// Data consistency with host property
1871pub const CL_IMPORT_DMA_BUF_DATA_CONSISTENCY_WITH_HOST_ARM: cl_import_properties_arm = 0x41E3;
1872
1873/// Index of plane in a multiplanar hardware buffer
1874pub const CL_IMPORT_ANDROID_HARDWARE_BUFFER_PLANE_INDEX_ARM: cl_import_properties_arm = 0x41EF;
1875
1876/// Index of layer in a multilayer hardware buffer
1877pub const CL_IMPORT_ANDROID_HARDWARE_BUFFER_LAYER_INDEX_ARM: cl_import_properties_arm = 0x41F0;
1878
1879/// Import memory size value to indicate a size for the whole buffer.
1880pub const CL_IMPORT_MEMORY_WHOLE_ALLOCATION_ARM: cl_import_properties_arm =
1881    cl_import_properties_arm::MAX;
1882
1883/* This extension adds a new function that allows for direct memory import into
1884 * OpenCL via the clImportMemoryARM function.
1885 *
1886 * Memory imported through this interface will be mapped into the device's page
1887 * tables directly, providing zero copy access. It will never fall back to copy
1888 * operations and aliased buffers.
1889 *
1890 * Types of memory supported for import are specified as additional extension
1891 * strings.
1892 *
1893 * This extension produces cl_mem allocations which are compatible with all other
1894 * users of cl_mem in the standard API.
1895 *
1896 * This extension maps pages with the same properties as the normal buffer creation
1897 * function clCreateBuffer.
1898 */
1899
1900pub type clImportMemoryARM_t = Option<
1901    unsafe extern "C" fn(
1902        context: cl_context,
1903        flags: cl_mem_flags,
1904        properties: *const cl_import_properties_arm,
1905        memory: *mut c_void,
1906        size: size_t,
1907        errcode_ret: *mut cl_int,
1908    ) -> cl_mem,
1909>;
1910pub type clImportMemoryARM_fn = clImportMemoryARM_t;
1911
1912#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
1913#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
1914#[cfg(feature = "cl_arm_import_memory")]
1915#[cfg(feature = "static")]
1916unsafe extern "system" {
1917    pub fn clImportMemoryARM(
1918        context: cl_context,
1919        flags: cl_mem_flags,
1920        properties: *const cl_import_properties_arm,
1921        memory: *mut c_void,
1922        size: size_t,
1923        errcode_ret: *mut cl_int,
1924    ) -> cl_mem;
1925}
1926
1927// cl_arm_shared_virtual_memory extension
1928
1929// Used by clGetDeviceInfo
1930pub const CL_DEVICE_SVM_CAPABILITIES_ARM: cl_device_info = 0x40B6;
1931
1932// Used by clGetMemObjectInfo
1933pub const CL_MEM_USES_SVM_POINTER_ARM: cl_mem_info = 0x40B7;
1934
1935// Used by clSetKernelExecInfoARM:
1936pub type cl_kernel_exec_info_arm = cl_uint;
1937pub const CL_KERNEL_EXEC_INFO_SVM_PTRS_ARM: cl_kernel_exec_info_arm = 0x40B8;
1938pub const CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM_ARM: cl_kernel_exec_info_arm = 0x40B9;
1939
1940// To be used by clGetEventInfo:
1941pub const CL_COMMAND_SVM_FREE_ARM: cl_event_info = 0x40BA;
1942pub const CL_COMMAND_SVM_MEMCPY_ARM: cl_event_info = 0x40BB;
1943pub const CL_COMMAND_SVM_MEMFILL_ARM: cl_event_info = 0x40BC;
1944pub const CL_COMMAND_SVM_MAP_ARM: cl_event_info = 0x40BD;
1945pub const CL_COMMAND_SVM_UNMAP_ARM: cl_event_info = 0x40BF;
1946
1947// Flag values returned by clGetDeviceInfo with CL_DEVICE_SVM_CAPABILITIES_ARM as the param_name.
1948pub type cl_device_svm_capabilities_arm = cl_bitfield;
1949pub const CL_DEVICE_SVM_COARSE_GRAIN_BUFFER_ARM: cl_device_svm_capabilities_arm = 1 << 0;
1950pub const CL_DEVICE_SVM_FINE_GRAIN_BUFFER_ARM: cl_device_svm_capabilities_arm = 1 << 1;
1951pub const CL_DEVICE_SVM_FINE_GRAIN_SYSTEM_ARM: cl_device_svm_capabilities_arm = 1 << 2;
1952pub const CL_DEVICE_SVM_ATOMICS_ARM: cl_device_svm_capabilities_arm = 1 << 3;
1953
1954// Flag values used by clSVMAllocARM:
1955pub type cl_svm_mem_flags_arm = cl_bitfield;
1956pub const CL_MEM_SVM_FINE_GRAIN_BUFFER_ARM: cl_svm_mem_flags_arm = 1 << 10;
1957pub const CL_MEM_SVM_ATOMICS_ARM: cl_svm_mem_flags_arm = 1 << 11;
1958
1959pub type clSVMAllocARM_t = Option<
1960    unsafe extern "C" fn(
1961        context: cl_context,
1962        flags: cl_svm_mem_flags_arm,
1963        size: size_t,
1964        alignment: cl_uint,
1965    ) -> *mut c_void,
1966>;
1967pub type clSVMAllocARM_fn = clSVMAllocARM_t;
1968
1969pub type clSVMFreeARM_t =
1970    Option<unsafe extern "C" fn(context: cl_context, svm_pointer: *mut c_void)>;
1971pub type clSVMFreeARM_fn = clSVMFreeARM_t;
1972
1973pub type clEnqueueSVMFreeARM_t = Option<
1974    unsafe extern "C" fn(
1975        command_queue: cl_command_queue,
1976        num_svm_pointers: cl_uint,
1977        svm_pointers: *mut *mut c_void,
1978        pfn_free_func: Option<
1979            unsafe extern "C" fn(
1980                queue: cl_command_queue,
1981                num_svm_pointers: cl_uint,
1982                svm_pointers: *mut *mut c_void,
1983                user_data: *mut c_void,
1984            ),
1985        >,
1986        user_data: *mut c_void,
1987        num_events_in_wait_list: cl_uint,
1988        event_wait_list: *const cl_event,
1989        event: *mut cl_event,
1990    ) -> cl_int,
1991>;
1992pub type clEnqueueSVMFreeARM_fn = clEnqueueSVMFreeARM_t;
1993
1994pub type clEnqueueSVMMemcpyARM_t = Option<
1995    unsafe extern "C" fn(
1996        command_queue: cl_command_queue,
1997        blocking_copy: cl_bool,
1998        dst_ptr: *mut c_void,
1999        src_ptr: *const c_void,
2000        size: size_t,
2001        num_events_in_wait_list: cl_uint,
2002        event_wait_list: *const cl_event,
2003        event: *mut cl_event,
2004    ) -> cl_int,
2005>;
2006pub type clEnqueueSVMMemcpyARM_fn = clEnqueueSVMMemcpyARM_t;
2007
2008pub type clEnqueueSVMMemFillARM_t = Option<
2009    unsafe extern "C" fn(
2010        command_queue: cl_command_queue,
2011        svm_ptr: *mut c_void,
2012        pattern: *const c_void,
2013        pattern_size: size_t,
2014        size: size_t,
2015        num_events_in_wait_list: cl_uint,
2016        event_wait_list: *const cl_event,
2017        event: *mut cl_event,
2018    ) -> cl_int,
2019>;
2020pub type clEnqueueSVMMemFillARM_fn = clEnqueueSVMMemFillARM_t;
2021
2022pub type clEnqueueSVMMapARM_t = Option<
2023    unsafe extern "C" fn(
2024        command_queue: cl_command_queue,
2025        blocking_map: cl_bool,
2026        flags: cl_map_flags,
2027        svm_ptr: *mut c_void,
2028        size: size_t,
2029        num_events_in_wait_list: cl_uint,
2030        event_wait_list: *const cl_event,
2031        event: *mut cl_event,
2032    ) -> cl_int,
2033>;
2034pub type clEnqueueSVMMapARM_fn = clEnqueueSVMMapARM_t;
2035
2036pub type clEnqueueSVMUnmapARM_t = Option<
2037    unsafe extern "C" fn(
2038        command_queue: cl_command_queue,
2039        svm_ptr: *mut c_void,
2040        num_events_in_wait_list: cl_uint,
2041        event_wait_list: *const cl_event,
2042        event: *mut cl_event,
2043    ) -> cl_int,
2044>;
2045pub type clEnqueueSVMUnmapARM_fn = clEnqueueSVMUnmapARM_t;
2046
2047pub type clSetKernelArgSVMPointerARM_t = Option<
2048    unsafe extern "C" fn(kernel: cl_kernel, arg_index: cl_uint, arg_value: *const c_void) -> cl_int,
2049>;
2050pub type clSetKernelArgSVMPointerARM_fn = clSetKernelArgSVMPointerARM_t;
2051
2052pub type clSetKernelExecInfoARM_t = Option<
2053    unsafe extern "C" fn(
2054        kernel: cl_kernel,
2055        param_name: cl_kernel_exec_info_arm,
2056        param_value_size: size_t,
2057        param_value: *const c_void,
2058    ) -> cl_int,
2059>;
2060pub type clSetKernelExecInfoARM_fn = clSetKernelExecInfoARM_t;
2061
2062#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
2063#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
2064#[cfg(feature = "cl_arm_shared_virtual_memory")]
2065#[cfg(feature = "static")]
2066unsafe extern "system" {
2067    pub fn clSVMAllocARM(
2068        context: cl_context,
2069        flags: cl_svm_mem_flags_arm,
2070        size: size_t,
2071        alignment: cl_uint,
2072    ) -> *mut c_void;
2073
2074    pub fn clSVMFreeARM(context: cl_context, svm_pointer: *mut c_void);
2075
2076    pub fn clEnqueueSVMFreeARM(
2077        command_queue: cl_command_queue,
2078        num_svm_pointers: cl_uint,
2079        svm_pointers: *mut *mut c_void,
2080        pfn_free_func: Option<
2081            unsafe extern "C" fn(
2082                queue: cl_command_queue,
2083                num_svm_pointers: cl_uint,
2084                svm_pointers: *mut *mut c_void,
2085                user_data: *mut c_void,
2086            ),
2087        >,
2088        user_data: *mut c_void,
2089        num_events_in_wait_list: cl_uint,
2090        event_wait_list: *const cl_event,
2091        event: *mut cl_event,
2092    ) -> cl_int;
2093
2094    pub fn clEnqueueSVMMemcpyARM(
2095        command_queue: cl_command_queue,
2096        blocking_copy: cl_bool,
2097        dst_ptr: *mut c_void,
2098        src_ptr: *const c_void,
2099        size: size_t,
2100        num_events_in_wait_list: cl_uint,
2101        event_wait_list: *const cl_event,
2102        event: *mut cl_event,
2103    ) -> cl_int;
2104
2105    pub fn clEnqueueSVMMemFillARM(
2106        command_queue: cl_command_queue,
2107        svm_ptr: *mut c_void,
2108        pattern: *const c_void,
2109        pattern_size: size_t,
2110        size: size_t,
2111        num_events_in_wait_list: cl_uint,
2112        event_wait_list: *const cl_event,
2113        event: *mut cl_event,
2114    ) -> cl_int;
2115
2116    pub fn clEnqueueSVMMapARM(
2117        command_queue: cl_command_queue,
2118        blocking_map: cl_bool,
2119        flags: cl_map_flags,
2120        svm_ptr: *mut c_void,
2121        size: size_t,
2122        num_events_in_wait_list: cl_uint,
2123        event_wait_list: *const cl_event,
2124        event: *mut cl_event,
2125    ) -> cl_int;
2126
2127    pub fn clEnqueueSVMUnmapARM(
2128        command_queue: cl_command_queue,
2129        svm_ptr: *mut c_void,
2130        num_events_in_wait_list: cl_uint,
2131        event_wait_list: *const cl_event,
2132        event: *mut cl_event,
2133    ) -> cl_int;
2134
2135    pub fn clSetKernelArgSVMPointerARM(
2136        kernel: cl_kernel,
2137        arg_index: cl_uint,
2138        arg_value: *const c_void,
2139    ) -> cl_int;
2140
2141    pub fn clSetKernelExecInfoARM(
2142        kernel: cl_kernel,
2143        param_name: cl_kernel_exec_info_arm,
2144        param_value_size: size_t,
2145        param_value: *const c_void,
2146    ) -> cl_int;
2147}
2148
2149// cl_arm_get_core_id extension
2150// #ifdef CL_VERSION_1_2
2151pub const CL_DEVICE_COMPUTE_UNITS_BITFIELD_ARM: cl_device_info = 0x40BF;
2152// #endif
2153
2154// cl_arm_job_slot_selection
2155// cl_device_info
2156pub const CL_DEVICE_JOB_SLOTS_ARM: cl_device_info = 0x41E0;
2157// cl_command_queue_properties
2158pub const CL_QUEUE_JOB_SLOT_ARM: cl_command_queue_properties = 0x41E1;
2159
2160// cl_arm_scheduling_controls
2161
2162// cl_device_info
2163pub const CL_DEVICE_SCHEDULING_CONTROLS_CAPABILITIES_ARM: cl_device_info = 0x41E4;
2164
2165pub type cl_device_scheduling_controls_capabilities_arm = cl_bitfield;
2166pub const CL_DEVICE_SCHEDULING_KERNEL_BATCHING_ARM: cl_device_scheduling_controls_capabilities_arm =
2167    1 << 0;
2168pub const CL_DEVICE_SCHEDULING_WORKGROUP_BATCH_SIZE_ARM:
2169    cl_device_scheduling_controls_capabilities_arm = 1 << 1;
2170pub const CL_DEVICE_SCHEDULING_WORKGROUP_BATCH_SIZE_MODIFIER_ARM:
2171    cl_device_scheduling_controls_capabilities_arm = 1 << 2;
2172pub const CL_DEVICE_SCHEDULING_DEFERRED_FLUSH_ARM: cl_device_scheduling_controls_capabilities_arm =
2173    1 << 3;
2174pub const CL_DEVICE_SCHEDULING_REGISTER_ALLOCATION_ARM:
2175    cl_device_scheduling_controls_capabilities_arm = 1 << 4;
2176pub const CL_DEVICE_SCHEDULING_WARP_THROTTLING_ARM: cl_device_scheduling_controls_capabilities_arm =
2177    1 << 5;
2178pub const CL_DEVICE_SCHEDULING_COMPUTE_UNIT_BATCH_QUEUE_SIZE_ARM:
2179    cl_device_scheduling_controls_capabilities_arm = 1 << 6;
2180pub const CL_DEVICE_SCHEDULING_COMPUTE_UNIT_LIMIT_ARM:
2181    cl_device_scheduling_controls_capabilities_arm = 1 << 7;
2182
2183pub const CL_DEVICE_SUPPORTED_REGISTER_ALLOCATIONS_ARM: cl_device_info = 0x41EB;
2184pub const CL_DEVICE_MAX_WARP_COUNT_ARM: cl_device_info = 0x41EA;
2185
2186pub const CL_KERNEL_MAX_WARP_COUNT_ARM: cl_kernel_info = 0x41E9;
2187
2188pub const CL_KERNEL_EXEC_INFO_WORKGROUP_BATCH_SIZE_ARM: cl_kernel_exec_info = 0x41E5;
2189pub const CL_KERNEL_EXEC_INFO_WORKGROUP_BATCH_SIZE_MODIFIER_ARM: cl_kernel_exec_info = 0x41E6;
2190pub const CL_KERNEL_EXEC_INFO_WARP_COUNT_LIMIT_ARM: cl_kernel_exec_info = 0x41E8;
2191pub const CL_KERNEL_EXEC_INFO_COMPUTE_UNIT_MAX_QUEUED_BATCHES_ARM: cl_kernel_exec_info = 0x41F1;
2192
2193pub const CL_QUEUE_KERNEL_BATCHING_ARM: cl_queue_properties = 0x41E7;
2194pub const CL_QUEUE_DEFERRED_FLUSH_ARM: cl_queue_properties = 0x41EC;
2195pub const CL_QUEUE_COMPUTE_UNIT_LIMIT_ARM: cl_queue_properties = 0x41F3;
2196
2197// cl_arm_controlled_kernel_termination
2198
2199// Error code to indicate kernel terminated with failure
2200pub const CL_COMMAND_TERMINATED_ITSELF_WITH_FAILURE_ARM: cl_int = -1108;
2201
2202// cl_device_info
2203pub const CL_DEVICE_CONTROLLED_TERMINATION_CAPABILITIES_ARM: cl_device_info = 0x41EE;
2204
2205// Bit fields for controlled termination feature query
2206pub type cl_device_controlled_termination_capabilities_arm = cl_bitfield;
2207pub const CL_DEVICE_CONTROLLED_TERMINATION_SUCCESS_ARM:
2208    cl_device_controlled_termination_capabilities_arm = 1 << 0;
2209pub const CL_DEVICE_CONTROLLED_TERMINATION_FAILURE_ARM:
2210    cl_device_controlled_termination_capabilities_arm = 1 << 1;
2211pub const CL_DEVICE_CONTROLLED_TERMINATION_QUERY_ARM:
2212    cl_device_controlled_termination_capabilities_arm = 1 << 2;
2213
2214// cl_event_info
2215pub const CL_EVENT_COMMAND_TERMINATION_REASON_ARM: cl_event_info = 0x41ED;
2216
2217// Values returned for event termination reason query
2218pub type cl_command_termination_reason_arm = cl_uint;
2219pub const CL_COMMAND_TERMINATION_COMPLETION_ARM: cl_command_termination_reason_arm = 0;
2220pub const CL_COMMAND_TERMINATION_CONTROLLED_SUCCESS_ARM: cl_command_termination_reason_arm = 1;
2221pub const CL_COMMAND_TERMINATION_CONTROLLED_FAILURE_ARM: cl_command_termination_reason_arm = 2;
2222pub const CL_COMMAND_TERMINATION_ERROR_ARM: cl_command_termination_reason_arm = 3;
2223
2224// cl_arm_protected_memory_allocation
2225pub const CL_MEM_PROTECTED_ALLOC_ARM: cl_bitfield = 1 << 36;
2226
2227// cl_intel_exec_by_local_thread extension
2228pub const CL_QUEUE_THREAD_LOCAL_EXEC_ENABLE_INTEL: cl_bitfield = 1 << 31;
2229
2230// cl_intel_device_attribute_query
2231pub type cl_device_feature_capabilities_intel = cl_bitfield;
2232pub const CL_DEVICE_FEATURE_FLAG_DP4A_INTEL: cl_device_feature_capabilities_intel = 1 << 0;
2233pub const CL_DEVICE_FEATURE_FLAG_DPAS_INTEL: cl_device_feature_capabilities_intel = 1 << 1;
2234
2235// cl_device_info
2236pub const CL_DEVICE_IP_VERSION_INTEL: cl_device_info = 0x4250;
2237pub const CL_DEVICE_ID_INTEL: cl_device_info = 0x4251;
2238pub const CL_DEVICE_NUM_SLICES_INTEL: cl_device_info = 0x4252;
2239pub const CL_DEVICE_NUM_SUB_SLICES_PER_SLICE_INTEL: cl_device_info = 0x4253;
2240pub const CL_DEVICE_NUM_EUS_PER_SUB_SLICE_INTEL: cl_device_info = 0x4254;
2241pub const CL_DEVICE_NUM_THREADS_PER_EU_INTEL: cl_device_info = 0x4255;
2242pub const CL_DEVICE_FEATURE_CAPABILITIES_INTEL: cl_device_info = 0x4256;
2243
2244// cl_intel_device_partition_by_names extension
2245
2246pub const CL_DEVICE_PARTITION_BY_NAMES_INTEL: cl_device_info = 0x4052;
2247pub const CL_PARTITION_BY_NAMES_LIST_END_INTEL: cl_int = -1;
2248
2249// cl_intel_accelerator extension
2250// cl_intel_motion_estimation extension
2251// cl_intel_advanced_motion_estimation extension
2252
2253pub type cl_accelerator_intel = *mut c_void;
2254pub type cl_accelerator_type_intel = cl_uint;
2255pub type cl_accelerator_info_intel = cl_uint;
2256
2257#[repr(C)]
2258#[derive(Debug, Copy, Clone, Default)]
2259pub struct cl_motion_estimation_desc_intel {
2260    pub mb_block_type: cl_uint,
2261    pub subpixel_mode: cl_uint,
2262    pub sad_adjust_mode: cl_uint,
2263    pub search_path_type: cl_uint,
2264}
2265
2266// error codes
2267pub const CL_INVALID_ACCELERATOR_INTEL: cl_int = -1094;
2268pub const CL_INVALID_ACCELERATOR_TYPE_INTEL: cl_int = -1095;
2269pub const CL_INVALID_ACCELERATOR_DESCRIPTOR_INTEL: cl_int = -1096;
2270pub const CL_ACCELERATOR_TYPE_NOT_SUPPORTED_INTEL: cl_int = -1097;
2271
2272// cl_accelerator_type_intel
2273pub const CL_ACCELERATOR_TYPE_MOTION_ESTIMATION_INTEL: cl_accelerator_type_intel = 0x0;
2274
2275// cl_accelerator_info_intel
2276pub const CL_ACCELERATOR_DESCRIPTOR_INTEL: cl_accelerator_info_intel = 0x4090;
2277pub const CL_ACCELERATOR_REFERENCE_COUNT_INTEL: cl_accelerator_info_intel = 0x4091;
2278pub const CL_ACCELERATOR_CONTEXT_INTEL: cl_accelerator_info_intel = 0x4092;
2279pub const CL_ACCELERATOR_TYPE_INTEL: cl_accelerator_info_intel = 0x4093;
2280
2281// cl_motion_detect_desc_intel flags
2282pub type cl_motion_detect_desc_intel = cl_uint;
2283pub const CL_ME_MB_TYPE_16x16_INTEL: cl_motion_detect_desc_intel = 0x0;
2284pub const CL_ME_MB_TYPE_8x8_INTEL: cl_motion_detect_desc_intel = 0x1;
2285pub const CL_ME_MB_TYPE_4x4_INTEL: cl_motion_detect_desc_intel = 0x2;
2286
2287pub const CL_ME_SUBPIXEL_MODE_INTEGER_INTEL: cl_motion_detect_desc_intel = 0x0;
2288pub const CL_ME_SUBPIXEL_MODE_HPEL_INTEL: cl_motion_detect_desc_intel = 0x1;
2289pub const CL_ME_SUBPIXEL_MODE_QPEL_INTEL: cl_motion_detect_desc_intel = 0x2;
2290
2291pub const CL_ME_SAD_ADJUST_MODE_NONE_INTEL: cl_motion_detect_desc_intel = 0x0;
2292pub const CL_ME_SAD_ADJUST_MODE_HAAR_INTEL: cl_motion_detect_desc_intel = 0x1;
2293
2294pub const CL_ME_SEARCH_PATH_RADIUS_2_2_INTEL: cl_motion_detect_desc_intel = 0x0;
2295pub const CL_ME_SEARCH_PATH_RADIUS_4_4_INTEL: cl_motion_detect_desc_intel = 0x1;
2296pub const CL_ME_SEARCH_PATH_RADIUS_16_12_INTEL: cl_motion_detect_desc_intel = 0x5;
2297
2298pub const CL_ME_SKIP_BLOCK_TYPE_16x16_INTEL: cl_motion_detect_desc_intel = 0x0;
2299pub const CL_ME_CHROMA_INTRA_PREDICT_ENABLED_INTEL: cl_motion_detect_desc_intel = 0x1;
2300pub const CL_ME_LUMA_INTRA_PREDICT_ENABLED_INTEL: cl_motion_detect_desc_intel = 0x2;
2301pub const CL_ME_SKIP_BLOCK_TYPE_8x8_INTEL: cl_motion_detect_desc_intel = 0x4;
2302
2303pub const CL_ME_FORWARD_INPUT_MODE_INTEL: cl_motion_detect_desc_intel = 0x1;
2304pub const CL_ME_BACKWARD_INPUT_MODE_INTEL: cl_motion_detect_desc_intel = 0x2;
2305pub const CL_ME_BIDIRECTION_INPUT_MODE_INTEL: cl_motion_detect_desc_intel = 0x3;
2306
2307pub const CL_ME_BIDIR_WEIGHT_QUARTER_INTEL: cl_motion_detect_desc_intel = 16;
2308pub const CL_ME_BIDIR_WEIGHT_THIRD_INTEL: cl_motion_detect_desc_intel = 21;
2309pub const CL_ME_BIDIR_WEIGHT_HALF_INTEL: cl_motion_detect_desc_intel = 32;
2310pub const CL_ME_BIDIR_WEIGHT_TWO_THIRD_INTEL: cl_motion_detect_desc_intel = 43;
2311pub const CL_ME_BIDIR_WEIGHT_THREE_QUARTER_INTEL: cl_motion_detect_desc_intel = 48;
2312
2313pub const CL_ME_COST_PENALTY_NONE_INTEL: cl_motion_detect_desc_intel = 0x0;
2314pub const CL_ME_COST_PENALTY_LOW_INTEL: cl_motion_detect_desc_intel = 0x1;
2315pub const CL_ME_COST_PENALTY_NORMAL_INTEL: cl_motion_detect_desc_intel = 0x2;
2316pub const CL_ME_COST_PENALTY_HIGH_INTEL: cl_motion_detect_desc_intel = 0x3;
2317
2318pub const CL_ME_COST_PRECISION_QPEL_INTEL: cl_motion_detect_desc_intel = 0x0;
2319pub const CL_ME_COST_PRECISION_HPEL_INTEL: cl_motion_detect_desc_intel = 0x1;
2320pub const CL_ME_COST_PRECISION_PEL_INTEL: cl_motion_detect_desc_intel = 0x2;
2321pub const CL_ME_COST_PRECISION_DPEL_INTEL: cl_motion_detect_desc_intel = 0x3;
2322
2323pub const CL_ME_LUMA_PREDICTOR_MODE_VERTICAL_INTEL: cl_motion_detect_desc_intel = 0x0;
2324pub const CL_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_INTEL: cl_motion_detect_desc_intel = 0x1;
2325pub const CL_ME_LUMA_PREDICTOR_MODE_DC_INTEL: cl_motion_detect_desc_intel = 0x2;
2326pub const CL_ME_LUMA_PREDICTOR_MODE_DIAGONAL_DOWN_LEFT_INTEL: cl_motion_detect_desc_intel = 0x3;
2327
2328pub const CL_ME_LUMA_PREDICTOR_MODE_DIAGONAL_DOWN_RIGHT_INTEL: cl_motion_detect_desc_intel = 0x4;
2329pub const CL_ME_LUMA_PREDICTOR_MODE_PLANE_INTEL: cl_motion_detect_desc_intel = 0x4;
2330pub const CL_ME_LUMA_PREDICTOR_MODE_VERTICAL_RIGHT_INTEL: cl_motion_detect_desc_intel = 0x5;
2331pub const CL_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_DOWN_INTEL: cl_motion_detect_desc_intel = 0x6;
2332pub const CL_ME_LUMA_PREDICTOR_MODE_VERTICAL_LEFT_INTEL: cl_motion_detect_desc_intel = 0x7;
2333pub const CL_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_UP_INTEL: cl_motion_detect_desc_intel = 0x8;
2334
2335pub const CL_ME_CHROMA_PREDICTOR_MODE_DC_INTEL: cl_motion_detect_desc_intel = 0x0;
2336pub const CL_ME_CHROMA_PREDICTOR_MODE_HORIZONTAL_INTEL: cl_motion_detect_desc_intel = 0x1;
2337pub const CL_ME_CHROMA_PREDICTOR_MODE_VERTICAL_INTEL: cl_motion_detect_desc_intel = 0x2;
2338pub const CL_ME_CHROMA_PREDICTOR_MODE_PLANE_INTEL: cl_motion_detect_desc_intel = 0x3;
2339
2340// cl_device_info
2341pub const CL_DEVICE_ME_VERSION_INTEL: cl_device_info = 0x407E;
2342
2343pub const CL_ME_VERSION_LEGACY_INTEL: cl_uint = 0x0;
2344pub const CL_ME_VERSION_ADVANCED_VER_1_INTEL: cl_uint = 0x1;
2345pub const CL_ME_VERSION_ADVANCED_VER_2_INTEL: cl_uint = 0x2;
2346
2347pub type clCreateAcceleratorINTEL_t = Option<
2348    unsafe extern "C" fn(
2349        context: cl_context,
2350        accelerator_type: cl_accelerator_type_intel,
2351        descriptor_size: size_t,
2352        descriptor: *const c_void,
2353        errcode_ret: *mut cl_int,
2354    ) -> cl_accelerator_intel,
2355>;
2356pub type clCreateAcceleratorINTEL_fn = clCreateAcceleratorINTEL_t;
2357
2358pub type clGetAcceleratorInfoINTEL_t = Option<
2359    unsafe extern "C" fn(
2360        accelerator: cl_accelerator_intel,
2361        param_name: cl_accelerator_info_intel,
2362        param_value_size: size_t,
2363        param_value: *mut c_void,
2364        param_value_size_ret: *mut size_t,
2365    ) -> cl_int,
2366>;
2367pub type clGetAcceleratorInfoINTEL_fn = clGetAcceleratorInfoINTEL_t;
2368
2369pub type clRetainAcceleratorINTEL_t =
2370    Option<unsafe extern "C" fn(accelerator: cl_accelerator_intel) -> cl_int>;
2371pub type clRetainAcceleratorINTEL_fn = clRetainAcceleratorINTEL_t;
2372
2373pub type clReleaseAcceleratorINTEL_t =
2374    Option<unsafe extern "C" fn(accelerator: cl_accelerator_intel) -> cl_int>;
2375pub type clReleaseAcceleratorINTEL_fn = clReleaseAcceleratorINTEL_t;
2376
2377#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
2378#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
2379#[cfg(feature = "cl_intel_accelerator")]
2380#[cfg(feature = "static")]
2381unsafe extern "system" {
2382    pub fn clCreateAcceleratorINTEL(
2383        context: cl_context,
2384        accelerator_type: cl_accelerator_type_intel,
2385        descriptor_size: size_t,
2386        descriptor: *const c_void,
2387        errcode_ret: *mut cl_int,
2388    ) -> cl_accelerator_intel;
2389
2390    pub fn clGetAcceleratorInfoINTEL(
2391        accelerator: cl_accelerator_intel,
2392        param_name: cl_accelerator_info_intel,
2393        param_value_size: size_t,
2394        param_value: *mut c_void,
2395        param_value_size_ret: *mut size_t,
2396    ) -> cl_int;
2397
2398    pub fn clRetainAcceleratorINTEL(accelerator: cl_accelerator_intel) -> cl_int;
2399
2400    pub fn clReleaseAcceleratorINTEL(accelerator: cl_accelerator_intel) -> cl_int;
2401}
2402
2403// cl_intel_simultaneous_sharing extension
2404pub const CL_DEVICE_SIMULTANEOUS_INTEROPS_INTEL: cl_uint = 0x4104;
2405pub const CL_DEVICE_NUM_SIMULTANEOUS_INTEROPS_INTEL: cl_uint = 0x4105;
2406
2407// cl_intel_egl_image_yuv extension
2408pub const CL_EGL_YUV_PLANE_INTEL: cl_uint = 0x4107;
2409
2410// cl_intel_packed_yuv extension
2411pub const CL_YUYV_INTEL: cl_uint = 0x4076;
2412pub const CL_UYVY_INTEL: cl_uint = 0x4077;
2413pub const CL_YVYU_INTEL: cl_uint = 0x4078;
2414pub const CL_VYUY_INTEL: cl_uint = 0x4079;
2415
2416// cl_intel_required_subgroup_size extension
2417pub const CL_DEVICE_SUB_GROUP_SIZES_INTEL: cl_uint = 0x4108;
2418pub const CL_KERNEL_SPILL_MEM_SIZE_INTEL: cl_uint = 0x4109;
2419pub const CL_KERNEL_COMPILE_SUB_GROUP_SIZE_INTEL: cl_uint = 0x410A;
2420
2421// cl_intel_driver_diagnostics extension
2422pub const CL_CONTEXT_SHOW_DIAGNOSTICS_INTEL: cl_uint = 0x4106;
2423
2424pub type cl_diagnostic_verbose_level_intel = cl_bitfield;
2425pub const CL_CONTEXT_DIAGNOSTICS_LEVEL_ALL_INTEL: cl_diagnostic_verbose_level_intel = 0xff;
2426pub const CL_CONTEXT_DIAGNOSTICS_LEVEL_GOOD_INTEL: cl_diagnostic_verbose_level_intel = 1;
2427pub const CL_CONTEXT_DIAGNOSTICS_LEVEL_BAD_INTEL: cl_diagnostic_verbose_level_intel = 1 << 1;
2428pub const CL_CONTEXT_DIAGNOSTICS_LEVEL_NEUTRAL_INTEL: cl_diagnostic_verbose_level_intel = 1 << 2;
2429
2430// cl_intel_planar_yuv extension
2431pub const CL_NV12_INTEL: cl_uint = 0x410E;
2432
2433pub const CL_MEM_NO_ACCESS_INTEL: cl_uint = 1 << 24;
2434pub const CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL: cl_uint = 1 << 25;
2435
2436pub const CL_DEVICE_PLANAR_YUV_MAX_WIDTH_INTEL: cl_uint = 0x417E;
2437pub const CL_DEVICE_PLANAR_YUV_MAX_HEIGHT_INTEL: cl_uint = 0x417F;
2438
2439// cl_intel_device_side_avc_motion_estimation extension
2440pub type cl_intel_avc_motion_estimation = cl_uint;
2441
2442pub const CL_DEVICE_AVC_ME_VERSION_INTEL: cl_uint = 0x410B;
2443pub const CL_DEVICE_AVC_ME_SUPPORTS_TEXTURE_SAMPLER_USE_INTEL: cl_uint = 0x410C;
2444pub const CL_DEVICE_AVC_ME_SUPPORTS_PREEMPTION_INTEL: cl_uint = 0x410D;
2445
2446pub const CL_AVC_ME_VERSION_0_INTEL: cl_intel_avc_motion_estimation = 0x0; // No support.
2447pub const CL_AVC_ME_VERSION_1_INTEL: cl_intel_avc_motion_estimation = 0x1; // First supported version.
2448
2449pub const CL_AVC_ME_MAJOR_16x16_INTEL: cl_intel_avc_motion_estimation = 0x0;
2450pub const CL_AVC_ME_MAJOR_16x8_INTEL: cl_intel_avc_motion_estimation = 0x1;
2451pub const CL_AVC_ME_MAJOR_8x16_INTEL: cl_intel_avc_motion_estimation = 0x2;
2452pub const CL_AVC_ME_MAJOR_8x8_INTEL: cl_intel_avc_motion_estimation = 0x3;
2453
2454pub const CL_AVC_ME_MINOR_8x8_INTEL: cl_intel_avc_motion_estimation = 0x0;
2455pub const CL_AVC_ME_MINOR_8x4_INTEL: cl_intel_avc_motion_estimation = 0x1;
2456pub const CL_AVC_ME_MINOR_4x8_INTEL: cl_intel_avc_motion_estimation = 0x2;
2457pub const CL_AVC_ME_MINOR_4x4_INTEL: cl_intel_avc_motion_estimation = 0x3;
2458
2459pub const CL_AVC_ME_MAJOR_FORWARD_INTEL: cl_intel_avc_motion_estimation = 0x0;
2460pub const CL_AVC_ME_MAJOR_BACKWARD_INTEL: cl_intel_avc_motion_estimation = 0x1;
2461pub const CL_AVC_ME_MAJOR_BIDIRECTIONAL_INTEL: cl_intel_avc_motion_estimation = 0x2;
2462
2463pub const CL_AVC_ME_PARTITION_MASK_ALL_INTEL: cl_intel_avc_motion_estimation = 0x0;
2464pub const CL_AVC_ME_PARTITION_MASK_16x16_INTEL: cl_intel_avc_motion_estimation = 0x7E;
2465pub const CL_AVC_ME_PARTITION_MASK_16x8_INTEL: cl_intel_avc_motion_estimation = 0x7D;
2466pub const CL_AVC_ME_PARTITION_MASK_8x16_INTEL: cl_intel_avc_motion_estimation = 0x7B;
2467pub const CL_AVC_ME_PARTITION_MASK_8x8_INTEL: cl_intel_avc_motion_estimation = 0x77;
2468pub const CL_AVC_ME_PARTITION_MASK_8x4_INTEL: cl_intel_avc_motion_estimation = 0x6F;
2469pub const CL_AVC_ME_PARTITION_MASK_4x8_INTEL: cl_intel_avc_motion_estimation = 0x5F;
2470pub const CL_AVC_ME_PARTITION_MASK_4x4_INTEL: cl_intel_avc_motion_estimation = 0x3F;
2471
2472pub const CL_AVC_ME_SEARCH_WINDOW_EXHAUSTIVE_INTEL: cl_intel_avc_motion_estimation = 0x0;
2473pub const CL_AVC_ME_SEARCH_WINDOW_SMALL_INTEL: cl_intel_avc_motion_estimation = 0x1;
2474pub const CL_AVC_ME_SEARCH_WINDOW_TINY_INTEL: cl_intel_avc_motion_estimation = 0x2;
2475pub const CL_AVC_ME_SEARCH_WINDOW_EXTRA_TINY_INTEL: cl_intel_avc_motion_estimation = 0x3;
2476pub const CL_AVC_ME_SEARCH_WINDOW_DIAMOND_INTEL: cl_intel_avc_motion_estimation = 0x4;
2477pub const CL_AVC_ME_SEARCH_WINDOW_LARGE_DIAMOND_INTEL: cl_intel_avc_motion_estimation = 0x5;
2478pub const CL_AVC_ME_SEARCH_WINDOW_RESERVED0_INTEL: cl_intel_avc_motion_estimation = 0x6;
2479pub const CL_AVC_ME_SEARCH_WINDOW_RESERVED1_INTEL: cl_intel_avc_motion_estimation = 0x7;
2480pub const CL_AVC_ME_SEARCH_WINDOW_CUSTOM_INTEL: cl_intel_avc_motion_estimation = 0x8;
2481pub const CL_AVC_ME_SEARCH_WINDOW_16x12_RADIUS_INTEL: cl_intel_avc_motion_estimation = 0x9;
2482pub const CL_AVC_ME_SEARCH_WINDOW_4x4_RADIUS_INTEL: cl_intel_avc_motion_estimation = 0x2;
2483pub const CL_AVC_ME_SEARCH_WINDOW_2x2_RADIUS_INTEL: cl_intel_avc_motion_estimation = 0xa;
2484
2485pub const CL_AVC_ME_SAD_ADJUST_MODE_NONE_INTEL: cl_intel_avc_motion_estimation = 0x0;
2486pub const CL_AVC_ME_SAD_ADJUST_MODE_HAAR_INTEL: cl_intel_avc_motion_estimation = 0x2;
2487
2488pub const CL_AVC_ME_SUBPIXEL_MODE_INTEGER_INTEL: cl_intel_avc_motion_estimation = 0x0;
2489pub const CL_AVC_ME_SUBPIXEL_MODE_HPEL_INTEL: cl_intel_avc_motion_estimation = 0x1;
2490pub const CL_AVC_ME_SUBPIXEL_MODE_QPEL_INTEL: cl_intel_avc_motion_estimation = 0x3;
2491
2492pub const CL_AVC_ME_COST_PRECISION_QPEL_INTEL: cl_intel_avc_motion_estimation = 0x0;
2493pub const CL_AVC_ME_COST_PRECISION_HPEL_INTEL: cl_intel_avc_motion_estimation = 0x1;
2494pub const CL_AVC_ME_COST_PRECISION_PEL_INTEL: cl_intel_avc_motion_estimation = 0x2;
2495pub const CL_AVC_ME_COST_PRECISION_DPEL_INTEL: cl_intel_avc_motion_estimation = 0x3;
2496
2497pub const CL_AVC_ME_BIDIR_WEIGHT_QUARTER_INTEL: cl_intel_avc_motion_estimation = 0x10;
2498pub const CL_AVC_ME_BIDIR_WEIGHT_THIRD_INTEL: cl_intel_avc_motion_estimation = 0x15;
2499pub const CL_AVC_ME_BIDIR_WEIGHT_HALF_INTEL: cl_intel_avc_motion_estimation = 0x20;
2500pub const CL_AVC_ME_BIDIR_WEIGHT_TWO_THIRD_INTEL: cl_intel_avc_motion_estimation = 0x2B;
2501pub const CL_AVC_ME_BIDIR_WEIGHT_THREE_QUARTER_INTEL: cl_intel_avc_motion_estimation = 0x30;
2502
2503pub const CL_AVC_ME_BORDER_REACHED_LEFT_INTEL: cl_intel_avc_motion_estimation = 0x0;
2504pub const CL_AVC_ME_BORDER_REACHED_RIGHT_INTEL: cl_intel_avc_motion_estimation = 0x2;
2505pub const CL_AVC_ME_BORDER_REACHED_TOP_INTEL: cl_intel_avc_motion_estimation = 0x4;
2506pub const CL_AVC_ME_BORDER_REACHED_BOTTOM_INTEL: cl_intel_avc_motion_estimation = 0x8;
2507
2508pub const CL_AVC_ME_SKIP_BLOCK_PARTITION_16x16_INTEL: cl_intel_avc_motion_estimation = 0x0;
2509pub const CL_AVC_ME_SKIP_BLOCK_PARTITION_8x8_INTEL: cl_intel_avc_motion_estimation = 0x4000;
2510
2511pub const CL_AVC_ME_SKIP_BLOCK_16x16_FORWARD_ENABLE_INTEL: cl_intel_avc_motion_estimation =
2512    0x1 << 24;
2513pub const CL_AVC_ME_SKIP_BLOCK_16x16_BACKWARD_ENABLE_INTEL: cl_intel_avc_motion_estimation =
2514    0x2 << 24;
2515pub const CL_AVC_ME_SKIP_BLOCK_16x16_DUAL_ENABLE_INTEL: cl_intel_avc_motion_estimation = 0x3 << 24;
2516pub const CL_AVC_ME_SKIP_BLOCK_8x8_FORWARD_ENABLE_INTEL: cl_intel_avc_motion_estimation =
2517    0x55 << 24;
2518pub const CL_AVC_ME_SKIP_BLOCK_8x8_BACKWARD_ENABLE_INTEL: cl_intel_avc_motion_estimation =
2519    0xAA << 24;
2520pub const CL_AVC_ME_SKIP_BLOCK_8x8_DUAL_ENABLE_INTEL: cl_intel_avc_motion_estimation = 0xFF << 24;
2521pub const CL_AVC_ME_SKIP_BLOCK_8x8_0_FORWARD_ENABLE_INTEL: cl_intel_avc_motion_estimation =
2522    0x1 << 24;
2523pub const CL_AVC_ME_SKIP_BLOCK_8x8_0_BACKWARD_ENABLE_INTEL: cl_intel_avc_motion_estimation =
2524    0x2 << 24;
2525pub const CL_AVC_ME_SKIP_BLOCK_8x8_1_FORWARD_ENABLE_INTEL: cl_intel_avc_motion_estimation =
2526    0x1 << 26;
2527pub const CL_AVC_ME_SKIP_BLOCK_8x8_1_BACKWARD_ENABLE_INTEL: cl_intel_avc_motion_estimation =
2528    0x2 << 26;
2529pub const CL_AVC_ME_SKIP_BLOCK_8x8_2_FORWARD_ENABLE_INTEL: cl_intel_avc_motion_estimation =
2530    0x1 << 28;
2531pub const CL_AVC_ME_SKIP_BLOCK_8x8_2_BACKWARD_ENABLE_INTEL: cl_intel_avc_motion_estimation =
2532    0x2 << 28;
2533pub const CL_AVC_ME_SKIP_BLOCK_8x8_3_FORWARD_ENABLE_INTEL: cl_intel_avc_motion_estimation =
2534    0x1 << 30;
2535pub const CL_AVC_ME_SKIP_BLOCK_8x8_3_BACKWARD_ENABLE_INTEL: cl_intel_avc_motion_estimation =
2536    0x2 << 30;
2537
2538pub const CL_AVC_ME_BLOCK_BASED_SKIP_4x4_INTEL: cl_intel_avc_motion_estimation = 0x00;
2539pub const CL_AVC_ME_BLOCK_BASED_SKIP_8x8_INTEL: cl_intel_avc_motion_estimation = 0x80;
2540
2541pub const CL_AVC_ME_INTRA_16x16_INTEL: cl_intel_avc_motion_estimation = 0x0;
2542pub const CL_AVC_ME_INTRA_8x8_INTEL: cl_intel_avc_motion_estimation = 0x1;
2543pub const CL_AVC_ME_INTRA_4x4_INTEL: cl_intel_avc_motion_estimation = 0x2;
2544
2545pub const CL_AVC_ME_INTRA_LUMA_PARTITION_MASK_16x16_INTEL: cl_intel_avc_motion_estimation = 0x6;
2546pub const CL_AVC_ME_INTRA_LUMA_PARTITION_MASK_8x8_INTEL: cl_intel_avc_motion_estimation = 0x5;
2547pub const CL_AVC_ME_INTRA_LUMA_PARTITION_MASK_4x4_INTEL: cl_intel_avc_motion_estimation = 0x3;
2548
2549pub const CL_AVC_ME_INTRA_NEIGHBOR_LEFT_MASK_ENABLE_INTEL: cl_intel_avc_motion_estimation = 0x60;
2550pub const CL_AVC_ME_INTRA_NEIGHBOR_UPPER_MASK_ENABLE_INTEL: cl_intel_avc_motion_estimation = 0x10;
2551pub const CL_AVC_ME_INTRA_NEIGHBOR_UPPER_RIGHT_MASK_ENABLE_INTEL: cl_intel_avc_motion_estimation =
2552    0x8;
2553pub const CL_AVC_ME_INTRA_NEIGHBOR_UPPER_LEFT_MASK_ENABLE_INTEL: cl_intel_avc_motion_estimation =
2554    0x4;
2555
2556pub const CL_AVC_ME_LUMA_PREDICTOR_MODE_VERTICAL_INTEL: cl_intel_avc_motion_estimation = 0x0;
2557pub const CL_AVC_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_INTEL: cl_intel_avc_motion_estimation = 0x1;
2558pub const CL_AVC_ME_LUMA_PREDICTOR_MODE_DC_INTEL: cl_intel_avc_motion_estimation = 0x2;
2559pub const CL_AVC_ME_LUMA_PREDICTOR_MODE_DIAGONAL_DOWN_LEFT_INTEL: cl_intel_avc_motion_estimation =
2560    0x3;
2561pub const CL_AVC_ME_LUMA_PREDICTOR_MODE_DIAGONAL_DOWN_RIGHT_INTEL: cl_intel_avc_motion_estimation =
2562    0x4;
2563pub const CL_AVC_ME_LUMA_PREDICTOR_MODE_PLANE_INTEL: cl_intel_avc_motion_estimation = 0x4;
2564pub const CL_AVC_ME_LUMA_PREDICTOR_MODE_VERTICAL_RIGHT_INTEL: cl_intel_avc_motion_estimation = 0x5;
2565pub const CL_AVC_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_DOWN_INTEL: cl_intel_avc_motion_estimation = 0x6;
2566pub const CL_AVC_ME_LUMA_PREDICTOR_MODE_VERTICAL_LEFT_INTEL: cl_intel_avc_motion_estimation = 0x7;
2567pub const CL_AVC_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_UP_INTEL: cl_intel_avc_motion_estimation = 0x8;
2568pub const CL_AVC_ME_CHROMA_PREDICTOR_MODE_DC_INTEL: cl_intel_avc_motion_estimation = 0x0;
2569pub const CL_AVC_ME_CHROMA_PREDICTOR_MODE_HORIZONTAL_INTEL: cl_intel_avc_motion_estimation = 0x1;
2570pub const CL_AVC_ME_CHROMA_PREDICTOR_MODE_VERTICAL_INTEL: cl_intel_avc_motion_estimation = 0x2;
2571pub const CL_AVC_ME_CHROMA_PREDICTOR_MODE_PLANE_INTEL: cl_intel_avc_motion_estimation = 0x3;
2572
2573pub const CL_AVC_ME_FRAME_FORWARD_INTEL: cl_intel_avc_motion_estimation = 0x1;
2574pub const CL_AVC_ME_FRAME_BACKWARD_INTEL: cl_intel_avc_motion_estimation = 0x2;
2575pub const CL_AVC_ME_FRAME_DUAL_INTEL: cl_intel_avc_motion_estimation = 0x3;
2576
2577pub const CL_AVC_ME_SLICE_TYPE_PRED_INTEL: cl_intel_avc_motion_estimation = 0x0;
2578pub const CL_AVC_ME_SLICE_TYPE_BPRED_INTEL: cl_intel_avc_motion_estimation = 0x1;
2579pub const CL_AVC_ME_SLICE_TYPE_INTRA_INTEL: cl_intel_avc_motion_estimation = 0x2;
2580
2581pub const CL_AVC_ME_INTERLACED_SCAN_TOP_FIELD_INTEL: cl_intel_avc_motion_estimation = 0x0;
2582pub const CL_AVC_ME_INTERLACED_SCAN_BOTTOM_FIELD_INTEL: cl_intel_avc_motion_estimation = 0x1;
2583
2584// cl_intel_unified_shared_memory extension
2585pub type cl_device_unified_shared_memory_capabilities_intel = cl_bitfield;
2586pub type cl_mem_properties_intel = cl_properties;
2587pub type cl_mem_alloc_flags_intel = cl_bitfield;
2588pub type cl_mem_info_intel = cl_uint;
2589pub type cl_unified_shared_memory_type_intel = cl_uint;
2590pub type cl_mem_advice_intel = cl_uint;
2591
2592// cl_device_info
2593pub const CL_DEVICE_HOST_MEM_CAPABILITIES_INTEL: cl_device_info = 0x4190;
2594pub const CL_DEVICE_DEVICE_MEM_CAPABILITIES_INTEL: cl_device_info = 0x4191;
2595pub const CL_DEVICE_SINGLE_DEVICE_SHARED_MEM_CAPABILITIES_INTEL: cl_device_info = 0x4192;
2596pub const CL_DEVICE_CROSS_DEVICE_SHARED_MEM_CAPABILITIES_INTEL: cl_device_info = 0x4193;
2597pub const CL_DEVICE_SHARED_SYSTEM_MEM_CAPABILITIES_INTEL: cl_device_info = 0x4194;
2598
2599// cl_device_unified_shared_memory_capabilities_intel - bitfield
2600pub const CL_UNIFIED_SHARED_MEMORY_ACCESS_INTEL:
2601    cl_device_unified_shared_memory_capabilities_intel = 1 << 0;
2602pub const CL_UNIFIED_SHARED_MEMORY_ATOMIC_ACCESS_INTEL:
2603    cl_device_unified_shared_memory_capabilities_intel = 1 << 1;
2604pub const CL_UNIFIED_SHARED_MEMORY_CONCURRENT_ACCESS_INTEL:
2605    cl_device_unified_shared_memory_capabilities_intel = 1 << 2;
2606pub const CL_UNIFIED_SHARED_MEMORY_CONCURRENT_ATOMIC_ACCESS_INTEL:
2607    cl_device_unified_shared_memory_capabilities_intel = 1 << 3;
2608
2609pub const CL_MEM_ALLOC_FLAGS_INTEL: cl_mem_properties_intel = 0x4195;
2610
2611// cl_mem_alloc_flags_intel - bitfield
2612pub const CL_MEM_ALLOC_WRITE_COMBINED_INTEL: cl_mem_alloc_flags_intel = 1 << 0;
2613pub const CL_MEM_ALLOC_INITIAL_PLACEMENT_DEVICE_INTEL: cl_mem_alloc_flags_intel = 1 << 1;
2614pub const CL_MEM_ALLOC_INITIAL_PLACEMENT_HOST_INTEL: cl_mem_alloc_flags_intel = 1 << 2;
2615
2616// cl_mem_alloc_info_intel
2617pub const CL_MEM_ALLOC_TYPE_INTEL: cl_mem_info_intel = 0x419A;
2618pub const CL_MEM_ALLOC_BASE_PTR_INTEL: cl_mem_info_intel = 0x419B;
2619pub const CL_MEM_ALLOC_SIZE_INTEL: cl_mem_info_intel = 0x419C;
2620pub const CL_MEM_ALLOC_DEVICE_INTEL: cl_mem_info_intel = 0x419D;
2621
2622// cl_unified_shared_memory_type_intel
2623pub const CL_MEM_TYPE_UNKNOWN_INTEL: cl_unified_shared_memory_type_intel = 0x4196;
2624pub const CL_MEM_TYPE_HOST_INTEL: cl_unified_shared_memory_type_intel = 0x4197;
2625pub const CL_MEM_TYPE_DEVICE_INTEL: cl_unified_shared_memory_type_intel = 0x4198;
2626pub const CL_MEM_TYPE_SHARED_INTEL: cl_unified_shared_memory_type_intel = 0x4199;
2627
2628// cl_kernel_exec_info
2629pub const CL_KERNEL_EXEC_INFO_INDIRECT_HOST_ACCESS_INTEL: cl_kernel_exec_info = 0x4200;
2630pub const CL_KERNEL_EXEC_INFO_INDIRECT_DEVICE_ACCESS_INTEL: cl_kernel_exec_info = 0x4201;
2631pub const CL_KERNEL_EXEC_INFO_INDIRECT_SHARED_ACCESS_INTEL: cl_kernel_exec_info = 0x4202;
2632pub const CL_KERNEL_EXEC_INFO_USM_PTRS_INTEL: cl_kernel_exec_info = 0x4203;
2633
2634// cl_command_type
2635pub const CL_COMMAND_MEMFILL_INTEL: cl_command_type = 0x4204;
2636pub const CL_COMMAND_MEMCPY_INTEL: cl_command_type = 0x4205;
2637pub const CL_COMMAND_MIGRATEMEM_INTEL: cl_command_type = 0x4206;
2638pub const CL_COMMAND_MEMADVISE_INTEL: cl_command_type = 0x4207;
2639
2640pub type clHostMemAllocINTEL_t = Option<
2641    unsafe extern "C" fn(
2642        context: cl_context,
2643        properties: *const cl_mem_properties_intel,
2644        size: size_t,
2645        alignment: cl_uint,
2646        errcode_ret: *mut cl_int,
2647    ) -> *mut c_void,
2648>;
2649pub type clHostMemAllocINTEL_fn = clHostMemAllocINTEL_t;
2650
2651pub type clDeviceMemAllocINTEL_t = Option<
2652    unsafe extern "C" fn(
2653        context: cl_context,
2654        device: cl_device_id,
2655        properties: *const cl_mem_properties_intel,
2656        size: size_t,
2657        alignment: cl_uint,
2658        errcode_ret: *mut cl_int,
2659    ) -> *mut c_void,
2660>;
2661pub type clDeviceMemAllocINTEL_fn = clDeviceMemAllocINTEL_t;
2662
2663pub type clSharedMemAllocINTEL_t = Option<
2664    unsafe extern "C" fn(
2665        context: cl_context,
2666        device: cl_device_id,
2667        properties: *const cl_mem_properties_intel,
2668        size: size_t,
2669        alignment: cl_uint,
2670        errcode_ret: *mut cl_int,
2671    ) -> *mut c_void,
2672>;
2673pub type clSharedMemAllocINTEL_fn = clSharedMemAllocINTEL_t;
2674
2675pub type clMemFreeINTEL_t =
2676    Option<unsafe extern "C" fn(context: cl_context, ptr: *mut c_void) -> cl_int>;
2677pub type clMemFreeINTEL_fn = clMemFreeINTEL_t;
2678
2679pub type clMemBlockingFreeINTEL_t =
2680    Option<unsafe extern "C" fn(context: cl_context, ptr: *mut c_void) -> cl_int>;
2681pub type clMemBlockingFreeINTEL_fn = clMemBlockingFreeINTEL_t;
2682
2683pub type clGetMemAllocInfoINTEL_t = Option<
2684    unsafe extern "C" fn(
2685        context: cl_context,
2686        ptr: *const c_void,
2687        param_name: cl_mem_info_intel,
2688        param_value_size: size_t,
2689        param_value: *mut c_void,
2690        param_value_size_ret: *mut size_t,
2691    ) -> cl_int,
2692>;
2693pub type clGetMemAllocInfoINTEL_fn = clGetMemAllocInfoINTEL_t;
2694
2695pub type clSetKernelArgMemPointerINTEL_t = Option<
2696    unsafe extern "C" fn(kernel: cl_kernel, arg_index: cl_uint, arg_value: *const c_void) -> cl_int,
2697>;
2698pub type clSetKernelArgMemPointerINTEL_fn = clSetKernelArgMemPointerINTEL_t;
2699
2700pub type clEnqueueMemFillINTEL_t = Option<
2701    unsafe extern "C" fn(
2702        command_queue: cl_command_queue,
2703        dst_ptr: *mut c_void,
2704        pattern: *const c_void,
2705        pattern_size: size_t,
2706        size: size_t,
2707        num_events_in_wait_list: cl_uint,
2708        event_wait_list: *const cl_event,
2709        event: *mut cl_event,
2710    ) -> cl_int,
2711>;
2712pub type clEnqueueMemFillINTEL_fn = clEnqueueMemFillINTEL_t;
2713
2714pub type clEnqueueMemcpyINTEL_t = Option<
2715    unsafe extern "C" fn(
2716        command_queue: cl_command_queue,
2717        blocking: cl_bool,
2718        dst_ptr: *mut c_void,
2719        src_ptr: *const c_void,
2720        size: size_t,
2721        num_events_in_wait_list: cl_uint,
2722        event_wait_list: *const cl_event,
2723        event: *mut cl_event,
2724    ) -> cl_int,
2725>;
2726pub type clEnqueueMemcpyINTEL_fn = clEnqueueMemcpyINTEL_t;
2727
2728pub type clEnqueueMemAdviseINTEL_t = Option<
2729    unsafe extern "C" fn(
2730        command_queue: cl_command_queue,
2731        ptr: *const c_void,
2732        size: size_t,
2733        advice: cl_mem_advice_intel,
2734        num_events_in_wait_list: cl_uint,
2735        event_wait_list: *const cl_event,
2736        event: *mut cl_event,
2737    ) -> cl_int,
2738>;
2739pub type clEnqueueMemAdviseINTEL_fn = clEnqueueMemAdviseINTEL_t;
2740
2741pub type clEnqueueMigrateMemINTEL_t = Option<
2742    unsafe extern "C" fn(
2743        command_queue: cl_command_queue,
2744        ptr: *const c_void,
2745        size: size_t,
2746        flags: cl_mem_migration_flags,
2747        num_events_in_wait_list: cl_uint,
2748        event_wait_list: *const cl_event,
2749        event: *mut cl_event,
2750    ) -> cl_int,
2751>;
2752pub type clEnqueueMigrateMemINTEL_fn = clEnqueueMigrateMemINTEL_t;
2753
2754pub type clEnqueueMemsetINTEL_t = Option<
2755    unsafe extern "C" fn(
2756        command_queue: cl_command_queue,
2757        dst_ptr: *mut c_void,
2758        value: cl_int,
2759        size: size_t,
2760        num_events_in_wait_list: cl_uint,
2761        event_wait_list: *const cl_event,
2762        event: *mut cl_event,
2763    ) -> cl_int,
2764>;
2765pub type clEnqueueMemsetINTEL_fn = clEnqueueMemsetINTEL_t;
2766
2767#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
2768#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
2769#[cfg(feature = "cl_intel_unified_shared_memory")]
2770#[cfg(feature = "static")]
2771unsafe extern "system" {
2772    pub fn clHostMemAllocINTEL(
2773        context: cl_context,
2774        properties: *const cl_mem_properties_intel,
2775        size: size_t,
2776        alignment: cl_uint,
2777        errcode_ret: *mut cl_int,
2778    ) -> *mut c_void;
2779
2780    pub fn clDeviceMemAllocINTEL(
2781        context: cl_context,
2782        device: cl_device_id,
2783        properties: *const cl_mem_properties_intel,
2784        size: size_t,
2785        alignment: cl_uint,
2786        errcode_ret: *mut cl_int,
2787    ) -> *mut c_void;
2788
2789    pub fn clSharedMemAllocINTEL(
2790        context: cl_context,
2791        device: cl_device_id,
2792        properties: *const cl_mem_properties_intel,
2793        size: size_t,
2794        alignment: cl_uint,
2795        errcode_ret: *mut cl_int,
2796    ) -> *mut c_void;
2797
2798    pub fn clMemFreeINTEL(context: cl_context, ptr: *mut c_void) -> cl_int;
2799
2800    pub fn clMemBlockingFreeINTEL(context: cl_context, ptr: *mut c_void) -> cl_int;
2801
2802    pub fn clGetMemAllocInfoINTEL(
2803        context: cl_context,
2804        ptr: *const c_void,
2805        param_name: cl_mem_info_intel,
2806        param_value_size: size_t,
2807        param_value: *mut c_void,
2808        param_value_size_ret: *mut size_t,
2809    ) -> cl_int;
2810
2811    pub fn clSetKernelArgMemPointerINTEL(
2812        kernel: cl_kernel,
2813        arg_index: cl_uint,
2814        arg_value: *const c_void,
2815    ) -> cl_int;
2816
2817    pub fn clEnqueueMemFillINTEL(
2818        command_queue: cl_command_queue,
2819        dst_ptr: *mut c_void,
2820        pattern: *const c_void,
2821        pattern_size: size_t,
2822        size: size_t,
2823        num_events_in_wait_list: cl_uint,
2824        event_wait_list: *const cl_event,
2825        event: *mut cl_event,
2826    ) -> cl_int;
2827
2828    pub fn clEnqueueMemcpyINTEL(
2829        command_queue: cl_command_queue,
2830        blocking: cl_bool,
2831        dst_ptr: *mut c_void,
2832        src_ptr: *const c_void,
2833        size: size_t,
2834        num_events_in_wait_list: cl_uint,
2835        event_wait_list: *const cl_event,
2836        event: *mut cl_event,
2837    ) -> cl_int;
2838
2839    pub fn clEnqueueMemAdviseINTEL(
2840        command_queue: cl_command_queue,
2841        ptr: *const c_void,
2842        size: size_t,
2843        advice: cl_mem_advice_intel,
2844        num_events_in_wait_list: cl_uint,
2845        event_wait_list: *const cl_event,
2846        event: *mut cl_event,
2847    ) -> cl_int;
2848
2849    pub fn clEnqueueMigrateMemINTEL(
2850        command_queue: cl_command_queue,
2851        ptr: *const c_void,
2852        size: size_t,
2853        flags: cl_mem_migration_flags,
2854        num_events_in_wait_list: cl_uint,
2855        event_wait_list: *const cl_event,
2856        event: *mut cl_event,
2857    ) -> cl_int;
2858
2859    pub fn clEnqueueMemsetINTEL(
2860        command_queue: cl_command_queue,
2861        dst_ptr: *mut c_void,
2862        value: cl_int,
2863        size: size_t,
2864        num_events_in_wait_list: cl_uint,
2865        event_wait_list: *const cl_event,
2866        event: *mut cl_event,
2867    ) -> cl_int;
2868}
2869
2870// cl_intel_mem_alloc_buffer_location
2871
2872// cl_mem_properties_intel
2873pub const CL_MEM_ALLOC_BUFFER_LOCATION_INTEL: cl_mem_properties_intel = 0x419E;
2874
2875// cl_intel_create_buffer_with_properties extension
2876
2877pub type clCreateBufferWithPropertiesINTEL_t = Option<
2878    unsafe extern "C" fn(
2879        context: cl_context,
2880        properties: *const cl_mem_properties_intel,
2881        flags: cl_mem_flags,
2882        size: size_t,
2883        host_ptr: *mut c_void,
2884        errcode_ret: *mut cl_int,
2885    ) -> cl_mem,
2886>;
2887pub type clCreateBufferWithPropertiesINTEL_fn = clCreateBufferWithPropertiesINTEL_t;
2888
2889#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
2890#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
2891#[cfg(feature = "cl_intel_create_buffer_with_properties")]
2892#[cfg(feature = "static")]
2893unsafe extern "system" {
2894
2895    pub fn clCreateBufferWithPropertiesINTEL(
2896        context: cl_context,
2897        properties: *const cl_mem_properties_intel,
2898        flags: cl_mem_flags,
2899        size: size_t,
2900        host_ptr: *mut c_void,
2901        errcode_ret: *mut cl_int,
2902    ) -> cl_mem;
2903}
2904
2905// cl_intel_program_scope_host_pipe
2906
2907// clGetEventInfo response when param_name is CL_EVENT_COMMAND_TYPE
2908pub const CL_COMMAND_READ_HOST_PIPE_INTEL: cl_uint = 0x4214;
2909pub const CL_COMMAND_WRITE_HOST_PIPE_INTEL: cl_uint = 0x4215;
2910
2911// clGetProgramInfo param_name
2912pub const CL_PROGRAM_NUM_HOST_PIPES_INTEL: cl_program_info = 0x4216;
2913pub const CL_PROGRAM_HOST_PIPE_NAMES_INTEL: cl_program_info = 0x4217;
2914
2915pub type clEnqueueReadHostPipeINTEL_t = Option<
2916    unsafe extern "C" fn(
2917        command_queue: cl_command_queue,
2918        program: cl_program,
2919        pipe_symbol: *const c_char,
2920        blocking_read: cl_bool,
2921        ptr: *mut c_void,
2922        size: size_t,
2923        num_events_in_wait_list: cl_uint,
2924        event_wait_list: *const cl_event,
2925        event: *mut cl_event,
2926    ) -> cl_int,
2927>;
2928pub type clEnqueueReadHostPipeINTEL_fn = clEnqueueReadHostPipeINTEL_t;
2929
2930pub type clEnqueueWriteHostPipeINTEL_t = Option<
2931    unsafe extern "C" fn(
2932        command_queue: cl_command_queue,
2933        program: cl_program,
2934        pipe_symbol: *const c_char,
2935        blocking_write: cl_bool,
2936        ptr: *const c_void,
2937        size: size_t,
2938        num_events_in_wait_list: cl_uint,
2939        event_wait_list: *const cl_event,
2940        event: *mut cl_event,
2941    ) -> cl_int,
2942>;
2943pub type clEnqueueWriteHostPipeINTEL_fn = clEnqueueWriteHostPipeINTEL_t;
2944
2945#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
2946#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
2947#[cfg(feature = "cl_intel_program_scope_host_pipe")]
2948#[cfg(feature = "static")]
2949unsafe extern "system" {
2950
2951    pub fn clEnqueueReadHostPipeINTEL(
2952        queue: cl_command_queue,
2953        program: cl_program,
2954        pipe_symbol: *const c_char,
2955        blocking_read: cl_bool,
2956        ptr: *mut c_void,
2957        size: size_t,
2958        num_events_in_wait_list: cl_uint,
2959        event_wait_list: *const cl_event,
2960        event: *mut cl_event,
2961    ) -> cl_int;
2962
2963    pub fn clEnqueueWriteHostPipeINTEL(
2964        queue: cl_command_queue,
2965        program: cl_program,
2966        pipe_symbol: *const c_char,
2967        blocking_write: cl_bool,
2968        ptr: *const c_void,
2969        size: size_t,
2970        num_events_in_wait_list: cl_uint,
2971        event_wait_list: *const cl_event,
2972        event: *mut cl_event,
2973    ) -> cl_int;
2974}
2975
2976// cl_intel_mem_channel_property extension
2977
2978pub const CL_MEM_CHANNEL_INTEL: cl_uint = 0x4213;
2979
2980// cl_intel_mem_force_host_memory
2981
2982// cl_mem_flags
2983pub const CL_MEM_FORCE_HOST_MEMORY_INTEL: cl_mem_flags = 1 << 20;
2984
2985// cl_intel_command_queue_families
2986
2987pub type cl_command_queue_capabilities_intel = cl_bitfield;
2988
2989pub const CL_QUEUE_FAMILY_MAX_NAME_SIZE_INTEL: size_t = 64;
2990
2991#[repr(C)]
2992#[derive(Debug, Copy, Clone)]
2993pub struct cl_queue_family_properties_intel {
2994    pub properties: cl_command_queue_properties,
2995    pub capabilities: cl_command_queue_capabilities_intel,
2996    pub count: cl_uint,
2997    pub name: [cl_uchar; CL_QUEUE_FAMILY_MAX_NAME_SIZE_INTEL],
2998}
2999
3000// cl_device_info
3001pub const CL_DEVICE_QUEUE_FAMILY_PROPERTIES_INTEL: cl_device_info = 0x418B;
3002
3003// cl_queue_properties
3004pub const CL_QUEUE_FAMILY_INTEL: cl_queue_properties = 0x418C;
3005pub const CL_QUEUE_INDEX_INTEL: cl_queue_properties = 0x418D;
3006
3007// cl_command_queue_capabilities_intel
3008pub const CL_QUEUE_DEFAULT_CAPABILITIES_INTEL: cl_command_queue_capabilities_intel = 0;
3009pub const CL_QUEUE_CAPABILITY_CREATE_SINGLE_QUEUE_EVENTS_INTEL:
3010    cl_command_queue_capabilities_intel = 1 << 0;
3011pub const CL_QUEUE_CAPABILITY_CREATE_CROSS_QUEUE_EVENTS_INTEL: cl_command_queue_capabilities_intel =
3012    1 << 1;
3013pub const CL_QUEUE_CAPABILITY_SINGLE_QUEUE_EVENT_WAIT_LIST_INTEL:
3014    cl_command_queue_capabilities_intel = 1 << 2;
3015pub const CL_QUEUE_CAPABILITY_CROSS_QUEUE_EVENT_WAIT_LIST_INTEL:
3016    cl_command_queue_capabilities_intel = 1 << 3;
3017pub const CL_QUEUE_CAPABILITY_TRANSFER_BUFFER_INTEL: cl_command_queue_capabilities_intel = 1 << 8;
3018pub const CL_QUEUE_CAPABILITY_TRANSFER_BUFFER_RECT_INTEL: cl_command_queue_capabilities_intel =
3019    1 << 9;
3020pub const CL_QUEUE_CAPABILITY_MAP_BUFFER_INTEL: cl_command_queue_capabilities_intel = 1 << 10;
3021pub const CL_QUEUE_CAPABILITY_FILL_BUFFER_INTEL: cl_command_queue_capabilities_intel = 1 << 11;
3022pub const CL_QUEUE_CAPABILITY_TRANSFER_IMAGE_INTEL: cl_command_queue_capabilities_intel = 1 << 12;
3023pub const CL_QUEUE_CAPABILITY_MAP_IMAGE_INTEL: cl_command_queue_capabilities_intel = 1 << 13;
3024pub const CL_QUEUE_CAPABILITY_FILL_IMAGE_INTEL: cl_command_queue_capabilities_intel = 1 << 14;
3025pub const CL_QUEUE_CAPABILITY_TRANSFER_BUFFER_IMAGE_INTEL: cl_command_queue_capabilities_intel =
3026    1 << 15;
3027pub const CL_QUEUE_CAPABILITY_TRANSFER_IMAGE_BUFFER_INTEL: cl_command_queue_capabilities_intel =
3028    1 << 16;
3029pub const CL_QUEUE_CAPABILITY_MARKER_INTEL: cl_command_queue_capabilities_intel = 1 << 24;
3030pub const CL_QUEUE_CAPABILITY_BARRIER_INTEL: cl_command_queue_capabilities_intel = 1 << 25;
3031pub const CL_QUEUE_CAPABILITY_KERNEL_INTEL: cl_command_queue_capabilities_intel = 1 << 26;
3032
3033// cl_intel_queue_no_sync_operations
3034pub const CL_QUEUE_NO_SYNC_OPERATIONS_INTEL: cl_command_queue_properties = 1 << 29;
3035
3036// cl_ext_image_requirements_info
3037
3038pub type cl_image_requirements_info_ext = cl_uint;
3039
3040pub const CL_IMAGE_REQUIREMENTS_ROW_PITCH_ALIGNMENT_EXT: cl_image_requirements_info_ext = 0x1290;
3041pub const CL_IMAGE_REQUIREMENTS_BASE_ADDRESS_ALIGNMENT_EXT: cl_image_requirements_info_ext = 0x1292;
3042pub const CL_IMAGE_REQUIREMENTS_SIZE_EXT: cl_image_requirements_info_ext = 0x12B2;
3043pub const CL_IMAGE_REQUIREMENTS_MAX_WIDTH_EXT: cl_image_requirements_info_ext = 0x12B3;
3044pub const CL_IMAGE_REQUIREMENTS_MAX_HEIGHT_EXT: cl_image_requirements_info_ext = 0x12B4;
3045pub const CL_IMAGE_REQUIREMENTS_MAX_DEPTH_EXT: cl_image_requirements_info_ext = 0x12B5;
3046pub const CL_IMAGE_REQUIREMENTS_MAX_ARRAY_SIZE_EXT: cl_image_requirements_info_ext = 0x12B6;
3047
3048pub type clGetImageRequirementsInfoEXT_t = Option<
3049    unsafe extern "C" fn(
3050        context: cl_context,
3051        properties: *const cl_mem_properties,
3052        flags: cl_mem_flags,
3053        image_format: *const cl_image_format,
3054        image_desc: *const cl_image_desc,
3055        param_name: cl_image_requirements_info_ext,
3056        param_value_size: size_t,
3057        param_value: *mut c_void,
3058        param_value_size_ret: *mut size_t,
3059    ) -> cl_int,
3060>;
3061pub type clGetImageRequirementsInfoEXT_fn = clGetImageRequirementsInfoEXT_t;
3062
3063#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
3064#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
3065#[cfg(feature = "cl_ext_image_requirements_info")]
3066#[cfg(feature = "static")]
3067unsafe extern "system" {
3068
3069    pub fn clGetImageRequirementsInfoEXT(
3070        context: cl_context,
3071        properties: *const cl_mem_properties,
3072        flags: cl_mem_flags,
3073        image_format: *const cl_image_format,
3074        image_desc: *const cl_image_desc,
3075        param_name: cl_image_requirements_info_ext,
3076        param_value_size: size_t,
3077        param_value: *mut c_void,
3078        param_value_size_ret: *mut size_t,
3079    ) -> cl_int;
3080}
3081
3082// cl_ext_image_from_buffer
3083
3084pub const CL_IMAGE_REQUIREMENTS_SLICE_PITCH_ALIGNMENT_EXT: cl_image_requirements_info_ext = 0x1291;
3085
3086// cl_loader_info
3087
3088pub type cl_icdl_info = cl_uint;
3089
3090pub type clGetICDLoaderInfoOCLICD_t = Option<
3091    unsafe extern "C" fn(
3092        param_name: cl_icdl_info,
3093        param_value_size: size_t,
3094        param_value: *mut c_void,
3095        param_value_size_ret: *mut size_t,
3096    ) -> cl_int,
3097>;
3098pub type clGetICDLoaderInfoOCLICD_fn = clGetICDLoaderInfoOCLICD_t;
3099
3100#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
3101#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
3102#[cfg(feature = "cl_loader_info")]
3103#[cfg(feature = "static")]
3104unsafe extern "system" {
3105    pub fn clGetICDLoaderInfoOCLICD(
3106        param_name: cl_icdl_info,
3107        param_value_size: size_t,
3108        param_value: *mut c_void,
3109        param_value_size_ret: *mut size_t,
3110    ) -> cl_int;
3111}
3112
3113// cl_pocl_content_size
3114
3115pub type cl_device_fp_atomic_capabilities_ext = cl_bitfield;
3116
3117pub type clSetContentSizeBufferPoCL_t =
3118    Option<unsafe extern "C" fn(buffer: cl_mem, content_size_buffer: cl_mem) -> cl_int>;
3119pub type clSetContentSizeBufferPoCL_fn = clSetContentSizeBufferPoCL_t;
3120
3121#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
3122#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
3123#[cfg(feature = "cl_pocl_content_size")]
3124#[cfg(feature = "static")]
3125unsafe extern "system" {
3126    pub fn clSetContentSizeBufferPoCL(buffer: cl_mem, content_size_buffer: cl_mem) -> cl_int;
3127}
3128
3129// cl_ext_image_raw10_raw12
3130
3131pub const CL_UNSIGNED_INT_RAW10_EXT: cl_uint = 0x10E3;
3132pub const CL_UNSIGNED_INT_RAW12_EXT: cl_uint = 0x10E4;
3133
3134// cl_khr_kernel_clock
3135
3136pub const CL_DEVICE_KERNEL_CLOCK_CAPABILITIES_KHR: cl_device_info = 0x1076;
3137
3138pub type cl_device_kernel_clock_capabilities_khr = cl_bitfield;
3139
3140pub const CL_DEVICE_KERNEL_CLOCK_SCOPE_DEVICE_KHR: cl_device_kernel_clock_capabilities_khr = 1 << 0;
3141pub const CL_DEVICE_KERNEL_CLOCK_SCOPE_WORK_GROUP_KHR: cl_device_kernel_clock_capabilities_khr =
3142    1 << 1;
3143pub const CL_DEVICE_KERNEL_CLOCK_SCOPE_SUB_GROUP_KHR: cl_device_kernel_clock_capabilities_khr =
3144    1 << 2;
3145
3146// cl_ext_buffer_device_address
3147
3148pub type cl_mem_device_address_ext = cl_ulong;
3149pub type clSetKernelArgDevicePointerEXT_t = Option<
3150    unsafe extern "C" fn(
3151        kernel: cl_kernel,
3152        arg_index: cl_uint,
3153        arg_value: cl_mem_device_address_ext,
3154    ) -> cl_int,
3155>;
3156
3157pub type clSetKernelArgDevicePointerEXT_fn = clSetKernelArgDevicePointerEXT_t;
3158
3159#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
3160#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
3161#[cfg(feature = "cl_ext_buffer_device_address")]
3162#[cfg(feature = "static")]
3163unsafe extern "system" {
3164    pub fn clSetKernelArgDevicePointerEXT(
3165        kernel: cl_kernel,
3166        arg_index: cl_uint,
3167        arg_value: cl_mem_device_address_ext,
3168    ) -> cl_int;
3169}
3170
3171pub const CL_MEM_DEVICE_PRIVATE_ADDRESS_EXT: cl_mem_properties = 0x5000;
3172pub const CL_MEM_DEVICE_ADDRESS_EXT: cl_mem_info = 0x5001;
3173pub const CL_KERNEL_EXEC_INFO_DEVICE_PTRS_EXT: cl_kernel_exec_info = 0x5002;
3174
3175// cl_ext_image_unorm_int_2_101010
3176
3177pub const CL_UNORM_INT_2_101010_EXT: cl_channel_type = 0x10E5;
3178
3179// cl_ext_immutable_memory_objects
3180
3181pub const CL_MEM_IMMUTABLE_EXT: cl_mem_flags = 1 << 6;
3182
3183// cl_img_cancel_command
3184
3185pub const CL_CANCELLED_IMG: cl_int = -1126;
3186
3187pub type clCancelCommandsIMG_t =
3188    Option<unsafe extern "C" fn(event_list: *const cl_event, num_events_in_list: usize) -> cl_int>;
3189pub type clCancelCommandsIMG_fn = clCancelCommandsIMG_t;
3190
3191#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
3192#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
3193#[cfg(feature = "cl_img_cancel_command")]
3194#[cfg(feature = "static")]
3195unsafe extern "system" {
3196    pub fn clCancelCommandsIMG(event_list: *const cl_event, num_events_in_list: usize) -> cl_int;
3197}
3198
3199// cl_qcom_perf_hint
3200
3201pub type cl_perf_hint_qcom = cl_uint;
3202
3203pub const CL_PERF_HINT_HIGH_QCOM: cl_perf_hint_qcom = 0x40C3;
3204pub const CL_PERF_HINT_NORMAL_QCOM: cl_perf_hint_qcom = 0x40C4;
3205pub const CL_PERF_HINT_LOW_QCOM: cl_perf_hint_qcom = 0x40C5;
3206
3207pub const CL_CONTEXT_PERF_HINT_QCOM: cl_context_info = 0x40C2;
3208
3209pub type clSetPerfHintQCOM_t =
3210    Option<unsafe extern "C" fn(context: cl_context, perf_hint: cl_perf_hint_qcom) -> cl_int>;
3211pub type clSetPerfHintQCOM_fn = clSetPerfHintQCOM_t;
3212
3213#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
3214#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
3215#[cfg(feature = "cl_qcom_perf_hint")]
3216#[cfg(feature = "static")]
3217unsafe extern "system" {
3218    pub fn clSetPerfHintQCOM(context: cl_context, perf_hint: cl_perf_hint_qcom) -> cl_int;
3219}
3220
3221#[cfg(test)]
3222mod tests {
3223    use super::*;
3224
3225    #[test]
3226    #[allow(deref_nullptr)]
3227    fn bindgen_test_layout_cl_mem_ext_host_ptr() {
3228        assert_eq!(
3229            ::core::mem::size_of::<cl_mem_ext_host_ptr>(),
3230            8usize,
3231            concat!("Size of: ", stringify!(cl_mem_ext_host_ptr))
3232        );
3233        assert_eq!(
3234            ::core::mem::align_of::<cl_mem_ext_host_ptr>(),
3235            4usize,
3236            concat!("Alignment of ", stringify!(cl_mem_ext_host_ptr))
3237        );
3238        assert_eq!(
3239            ::core::mem::offset_of!(cl_mem_ext_host_ptr, allocation_type),
3240            0usize,
3241            concat!(
3242                "Offset of field: ",
3243                stringify!(cl_mem_ext_host_ptr),
3244                "::",
3245                stringify!(allocation_type)
3246            )
3247        );
3248        assert_eq!(
3249            ::core::mem::offset_of!(cl_mem_ext_host_ptr, host_cache_policy),
3250            4usize,
3251            concat!(
3252                "Offset of field: ",
3253                stringify!(cl_mem_ext_host_ptr),
3254                "::",
3255                stringify!(host_cache_policy)
3256            )
3257        );
3258    }
3259
3260    #[test]
3261    #[allow(deref_nullptr)]
3262    fn bindgen_test_layout_cl_mem_ion_host_ptr() {
3263        assert_eq!(
3264            ::core::mem::size_of::<cl_mem_ion_host_ptr>(),
3265            24usize,
3266            concat!("Size of: ", stringify!(cl_mem_ion_host_ptr))
3267        );
3268        assert_eq!(
3269            ::core::mem::align_of::<cl_mem_ion_host_ptr>(),
3270            8usize,
3271            concat!("Alignment of ", stringify!(cl_mem_ion_host_ptr))
3272        );
3273        assert_eq!(
3274            ::core::mem::offset_of!(cl_mem_ion_host_ptr, ext_host_ptr),
3275            0usize,
3276            concat!(
3277                "Offset of field: ",
3278                stringify!(cl_mem_ion_host_ptr),
3279                "::",
3280                stringify!(ext_host_ptr)
3281            )
3282        );
3283        assert_eq!(
3284            ::core::mem::offset_of!(cl_mem_ion_host_ptr, ion_filedesc),
3285            8usize,
3286            concat!(
3287                "Offset of field: ",
3288                stringify!(cl_mem_ion_host_ptr),
3289                "::",
3290                stringify!(ion_filedesc)
3291            )
3292        );
3293        assert_eq!(
3294            ::core::mem::offset_of!(cl_mem_ion_host_ptr, ion_hostptr),
3295            16usize,
3296            concat!(
3297                "Offset of field: ",
3298                stringify!(cl_mem_ion_host_ptr),
3299                "::",
3300                stringify!(ion_hostptr)
3301            )
3302        );
3303    }
3304
3305    #[test]
3306    #[allow(deref_nullptr)]
3307    fn bindgen_test_layout_cl_mem_android_native_buffer_host_ptr() {
3308        assert_eq!(
3309            ::core::mem::size_of::<cl_mem_android_native_buffer_host_ptr>(),
3310            16usize,
3311            concat!(
3312                "Size of: ",
3313                stringify!(cl_mem_android_native_buffer_host_ptr)
3314            )
3315        );
3316        assert_eq!(
3317            ::core::mem::align_of::<cl_mem_android_native_buffer_host_ptr>(),
3318            8usize,
3319            concat!(
3320                "Alignment of ",
3321                stringify!(cl_mem_android_native_buffer_host_ptr)
3322            )
3323        );
3324        assert_eq!(
3325            ::core::mem::offset_of!(cl_mem_android_native_buffer_host_ptr, ext_host_ptr),
3326            0usize,
3327            concat!(
3328                "Offset of field: ",
3329                stringify!(cl_mem_android_native_buffer_host_ptr),
3330                "::",
3331                stringify!(ext_host_ptr)
3332            )
3333        );
3334        assert_eq!(
3335            ::core::mem::offset_of!(cl_mem_android_native_buffer_host_ptr, anb_ptr),
3336            8usize,
3337            concat!(
3338                "Offset of field: ",
3339                stringify!(cl_mem_android_native_buffer_host_ptr),
3340                "::",
3341                stringify!(anb_ptr)
3342            )
3343        );
3344    }
3345
3346    #[test]
3347    #[allow(deref_nullptr)]
3348    fn bindgen_test_layout_cl_name_version_khr() {
3349        assert_eq!(
3350            ::core::mem::size_of::<cl_name_version_khr>(),
3351            68usize,
3352            concat!("Size of: ", stringify!(cl_name_version_khr))
3353        );
3354        assert_eq!(
3355            ::core::mem::align_of::<cl_name_version_khr>(),
3356            4usize,
3357            concat!("Alignment of ", stringify!(cl_name_version_khr))
3358        );
3359        assert_eq!(
3360            ::core::mem::offset_of!(cl_name_version_khr, version),
3361            0usize,
3362            concat!(
3363                "Offset of field: ",
3364                stringify!(cl_name_version_khr),
3365                "::",
3366                stringify!(version)
3367            )
3368        );
3369        assert_eq!(
3370            ::core::mem::offset_of!(cl_name_version_khr, name),
3371            4usize,
3372            concat!(
3373                "Offset of field: ",
3374                stringify!(cl_name_version_khr),
3375                "::",
3376                stringify!(name)
3377            )
3378        );
3379    }
3380
3381    #[test]
3382    #[allow(deref_nullptr)]
3383    fn bindgen_test_layout_cl_device_pci_bus_info_khr() {
3384        assert_eq!(
3385            ::core::mem::size_of::<cl_device_pci_bus_info_khr>(),
3386            16usize,
3387            concat!("Size of: ", stringify!(cl_device_pci_bus_info_khr))
3388        );
3389        assert_eq!(
3390            ::core::mem::align_of::<cl_device_pci_bus_info_khr>(),
3391            4usize,
3392            concat!("Alignment of ", stringify!(cl_device_pci_bus_info_khr))
3393        );
3394        assert_eq!(
3395            ::core::mem::offset_of!(cl_device_pci_bus_info_khr, pci_domain),
3396            0usize,
3397            concat!(
3398                "Offset of field: ",
3399                stringify!(cl_device_pci_bus_info_khr),
3400                "::",
3401                stringify!(pci_domain)
3402            )
3403        );
3404        assert_eq!(
3405            ::core::mem::offset_of!(cl_device_pci_bus_info_khr, pci_bus),
3406            4usize,
3407            concat!(
3408                "Offset of field: ",
3409                stringify!(cl_device_pci_bus_info_khr),
3410                "::",
3411                stringify!(pci_bus)
3412            )
3413        );
3414        assert_eq!(
3415            ::core::mem::offset_of!(cl_device_pci_bus_info_khr, pci_device),
3416            8usize,
3417            concat!(
3418                "Offset of field: ",
3419                stringify!(cl_device_pci_bus_info_khr),
3420                "::",
3421                stringify!(pci_device)
3422            )
3423        );
3424        assert_eq!(
3425            ::core::mem::offset_of!(cl_device_pci_bus_info_khr, pci_function),
3426            12usize,
3427            concat!(
3428                "Offset of field: ",
3429                stringify!(cl_device_pci_bus_info_khr),
3430                "::",
3431                stringify!(pci_function)
3432            )
3433        );
3434    }
3435
3436    #[test]
3437    #[allow(deref_nullptr)]
3438    fn bindgen_test_layout_cl_device_integer_dot_product_acceleration_properties_khr() {
3439        assert_eq!(
3440            ::core::mem::size_of::<cl_device_integer_dot_product_acceleration_properties_khr>(),
3441            24usize,
3442            concat!(
3443                "Size of: ",
3444                stringify!(cl_device_integer_dot_product_acceleration_properties_khr)
3445            )
3446        );
3447        assert_eq!(
3448            ::core::mem::align_of::<cl_device_integer_dot_product_acceleration_properties_khr>(),
3449            4usize,
3450            concat!(
3451                "Alignment of ",
3452                stringify!(cl_device_integer_dot_product_acceleration_properties_khr)
3453            )
3454        );
3455        assert_eq!(
3456            ::core::mem::offset_of!(
3457                cl_device_integer_dot_product_acceleration_properties_khr,
3458                signed_accelerated
3459            ),
3460            0usize,
3461            concat!(
3462                "Offset of field: ",
3463                stringify!(cl_device_integer_dot_product_acceleration_properties_khr),
3464                "::",
3465                stringify!(signed_accelerated)
3466            )
3467        );
3468        assert_eq!(
3469            ::core::mem::offset_of!(
3470                cl_device_integer_dot_product_acceleration_properties_khr,
3471                unsigned_accelerated
3472            ),
3473            4usize,
3474            concat!(
3475                "Offset of field: ",
3476                stringify!(cl_device_integer_dot_product_acceleration_properties_khr),
3477                "::",
3478                stringify!(unsigned_accelerated)
3479            )
3480        );
3481        assert_eq!(
3482            ::core::mem::offset_of!(
3483                cl_device_integer_dot_product_acceleration_properties_khr,
3484                mixed_signedness_accelerated
3485            ),
3486            8usize,
3487            concat!(
3488                "Offset of field: ",
3489                stringify!(cl_device_integer_dot_product_acceleration_properties_khr),
3490                "::",
3491                stringify!(mixed_signedness_accelerated)
3492            )
3493        );
3494        assert_eq!(
3495            ::core::mem::offset_of!(
3496                cl_device_integer_dot_product_acceleration_properties_khr,
3497                accumulating_saturating_signed_accelerated
3498            ),
3499            12usize,
3500            concat!(
3501                "Offset of field: ",
3502                stringify!(cl_device_integer_dot_product_acceleration_properties_khr),
3503                "::",
3504                stringify!(accumulating_saturating_signed_accelerated)
3505            )
3506        );
3507        assert_eq!(
3508            ::core::mem::offset_of!(
3509                cl_device_integer_dot_product_acceleration_properties_khr,
3510                accumulating_saturating_unsigned_accelerated
3511            ),
3512            16usize,
3513            concat!(
3514                "Offset of field: ",
3515                stringify!(cl_device_integer_dot_product_acceleration_properties_khr),
3516                "::",
3517                stringify!(accumulating_saturating_unsigned_accelerated)
3518            )
3519        );
3520        assert_eq!(
3521            ::core::mem::offset_of!(
3522                cl_device_integer_dot_product_acceleration_properties_khr,
3523                accumulating_saturating_mixed_signedness_accelerated
3524            ),
3525            20usize,
3526            concat!(
3527                "Offset of field: ",
3528                stringify!(cl_device_integer_dot_product_acceleration_properties_khr),
3529                "::",
3530                stringify!(accumulating_saturating_mixed_signedness_accelerated)
3531            )
3532        );
3533    }
3534
3535    #[test]
3536    #[allow(deref_nullptr)]
3537    fn bindgen_test_layout_cl_motion_estimation_desc_intel() {
3538        assert_eq!(
3539            ::core::mem::size_of::<cl_motion_estimation_desc_intel>(),
3540            16usize,
3541            concat!("Size of: ", stringify!(cl_motion_estimation_desc_intel))
3542        );
3543        assert_eq!(
3544            ::core::mem::align_of::<cl_motion_estimation_desc_intel>(),
3545            4usize,
3546            concat!("Alignment of ", stringify!(cl_motion_estimation_desc_intel))
3547        );
3548        assert_eq!(
3549            ::core::mem::offset_of!(cl_motion_estimation_desc_intel, mb_block_type),
3550            0usize,
3551            concat!(
3552                "Offset of field: ",
3553                stringify!(cl_motion_estimation_desc_intel),
3554                "::",
3555                stringify!(mb_block_type)
3556            )
3557        );
3558        assert_eq!(
3559            ::core::mem::offset_of!(cl_motion_estimation_desc_intel, subpixel_mode),
3560            4usize,
3561            concat!(
3562                "Offset of field: ",
3563                stringify!(cl_motion_estimation_desc_intel),
3564                "::",
3565                stringify!(subpixel_mode)
3566            )
3567        );
3568        assert_eq!(
3569            ::core::mem::offset_of!(cl_motion_estimation_desc_intel, sad_adjust_mode),
3570            8usize,
3571            concat!(
3572                "Offset of field: ",
3573                stringify!(cl_motion_estimation_desc_intel),
3574                "::",
3575                stringify!(sad_adjust_mode)
3576            )
3577        );
3578        assert_eq!(
3579            ::core::mem::offset_of!(cl_motion_estimation_desc_intel, search_path_type),
3580            12usize,
3581            concat!(
3582                "Offset of field: ",
3583                stringify!(cl_motion_estimation_desc_intel),
3584                "::",
3585                stringify!(search_path_type)
3586            )
3587        );
3588    }
3589
3590    #[test]
3591    #[allow(deref_nullptr)]
3592    fn bindgen_test_layout_cl_queue_family_properties_intel() {
3593        assert_eq!(
3594            ::core::mem::size_of::<cl_queue_family_properties_intel>(),
3595            88usize,
3596            concat!("Size of: ", stringify!(cl_queue_family_properties_intel))
3597        );
3598        assert_eq!(
3599            ::core::mem::align_of::<cl_queue_family_properties_intel>(),
3600            8usize,
3601            concat!(
3602                "Alignment of ",
3603                stringify!(cl_queue_family_properties_intel)
3604            )
3605        );
3606        assert_eq!(
3607            ::core::mem::offset_of!(cl_queue_family_properties_intel, properties),
3608            0usize,
3609            concat!(
3610                "Offset of field: ",
3611                stringify!(cl_queue_family_properties_intel),
3612                "::",
3613                stringify!(properties)
3614            )
3615        );
3616        assert_eq!(
3617            ::core::mem::offset_of!(cl_queue_family_properties_intel, capabilities),
3618            8usize,
3619            concat!(
3620                "Offset of field: ",
3621                stringify!(cl_queue_family_properties_intel),
3622                "::",
3623                stringify!(capabilities)
3624            )
3625        );
3626        assert_eq!(
3627            ::core::mem::offset_of!(cl_queue_family_properties_intel, count),
3628            16usize,
3629            concat!(
3630                "Offset of field: ",
3631                stringify!(cl_queue_family_properties_intel),
3632                "::",
3633                stringify!(count)
3634            )
3635        );
3636        assert_eq!(
3637            ::core::mem::offset_of!(cl_queue_family_properties_intel, name),
3638            20usize,
3639            concat!(
3640                "Offset of field: ",
3641                stringify!(cl_queue_family_properties_intel),
3642                "::",
3643                stringify!(name)
3644            )
3645        );
3646    }
3647}