opencl_sys/
cl_ext.rs

1// Copyright (c) 2022-2023 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_device_id, cl_device_info, cl_event, cl_event_info,
24    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")]
329extern "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")]
565extern "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")]
676extern "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")]
746extern "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
824#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
825#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
826#[cfg(feature = "cl_khr_icd")]
827#[cfg(feature = "static")]
828extern "system" {
829    pub fn clIcdGetPlatformIDsKHR(
830        num_entries: cl_uint,
831        platforms: *mut cl_platform_id,
832        num_platforms: *mut cl_uint,
833    ) -> cl_int;
834}
835
836// cl_khr_il_program extension
837
838/// New property to clGetDeviceInfo for retrieving supported intermediate languages.
839pub const CL_DEVICE_IL_VERSION_KHR: cl_device_info = 0x105B;
840
841/// New property to clGetProgramInfo for retrieving for retrieving the IL of a program.
842pub const CL_PROGRAM_IL_KHR: cl_program_info = 0x1169;
843
844pub type clCreateProgramWithILKHR_t = Option<
845    unsafe extern "C" fn(
846        context: cl_context,
847        il: *const c_void,
848        length: size_t,
849        errcode_ret: *mut cl_int,
850    ) -> cl_program,
851>;
852pub type clCreateProgramWithILKHR_fn = clCreateProgramWithILKHR_t;
853
854#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
855#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
856#[cfg(feature = "cl_khr_il_program")]
857#[cfg(feature = "static")]
858extern "system" {
859    pub fn clCreateProgramWithILKHR(
860        context: cl_context,
861        il: *const c_void,
862        length: size_t,
863        errcode_ret: *mut cl_int,
864    ) -> cl_program;
865}
866
867/* Extension: cl_khr_image2d_from_buffer
868 *
869 * This extension allows a 2D image to be created from a cl_mem buffer without
870 * a copy. The type associated with a 2D image created from a buffer in an
871 * OpenCL program is image2d_t. Both the sampler and sampler-less read_image
872 * built-in functions are supported for 2D images and 2D images created from
873 * a buffer.  Similarly, the write_image built-ins are also supported for 2D
874 * images created from a buffer.
875 *
876 * When the 2D image from buffer is created, the client must specify the
877 * width, height, image format (i.e. channel order and channel data type)
878 * and optionally the row pitch.
879 *
880 * The pitch specified must be a multiple of
881 * CL_DEVICE_IMAGE_PITCH_ALIGNMENT_KHR pixels.
882 * The base address of the buffer must be aligned to
883 * CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT_KHR pixels.
884 */
885
886pub const CL_DEVICE_IMAGE_PITCH_ALIGNMENT_KHR: cl_device_info = 0x104A;
887pub const CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT_KHR: cl_device_info = 0x104B;
888
889// cl_khr_initialize_memory extension
890pub const CL_CONTEXT_MEMORY_INITIALIZE_KHR: cl_uint = 0x2030;
891
892// cl_context_memory_initialize_khr
893pub type cl_context_memory_initialize_khr = cl_bitfield;
894pub const CL_CONTEXT_MEMORY_INITIALIZE_LOCAL_KHR: cl_context_memory_initialize_khr = 1 << 0;
895pub const CL_CONTEXT_MEMORY_INITIALIZE_PRIVATE_KHR: cl_context_memory_initialize_khr = 1 << 1;
896
897// cl_khr_terminate_context extension
898pub const CL_CONTEXT_TERMINATED_KHR: cl_int = -1121;
899
900pub const CL_DEVICE_TERMINATE_CAPABILITY_KHR: cl_uint = 0x2031;
901pub const CL_CONTEXT_TERMINATE_KHR: cl_uint = 0x2032;
902
903pub type clTerminateContextKHR_t = Option<unsafe extern "C" fn(context: cl_context) -> cl_int>;
904pub type clTerminateContextKHR_fn = clTerminateContextKHR_t;
905
906#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
907#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
908#[cfg(feature = "cl_khr_terminate_context")]
909#[cfg(feature = "static")]
910extern "system" {
911    pub fn clTerminateContextKHR(context: cl_context) -> cl_int;
912}
913
914/*
915 * Extension: cl_khr_spir
916 *
917 * This extension adds support to create an OpenCL program object from a
918 * Standard Portable Intermediate Representation (SPIR) instance
919 */
920
921pub const CL_DEVICE_SPIR_VERSIONS: cl_uint = 0x40E0;
922pub const CL_PROGRAM_BINARY_TYPE_INTERMEDIATE: cl_uint = 0x40E1;
923
924// cl_khr_create_command_queue extension
925pub type cl_queue_properties_khr = cl_properties;
926
927pub type clCreateCommandQueueWithPropertiesKHR_t = ::core::option::Option<
928    unsafe extern "C" fn(
929        context: cl_context,
930        device: cl_device_id,
931        properties: *const cl_queue_properties_khr,
932        errcode_ret: *mut cl_int,
933    ) -> cl_command_queue,
934>;
935pub type clCreateCommandQueueWithPropertiesKHR_fn = clCreateCommandQueueWithPropertiesKHR_t;
936
937#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
938#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
939#[cfg(feature = "cl_khr_create_command_queue")]
940#[cfg(feature = "static")]
941extern "system" {
942    pub fn clCreateCommandQueueWithPropertiesKHR(
943        context: cl_context,
944        device: cl_device_id,
945        properties: *const cl_queue_properties_khr,
946        errcode_ret: *mut cl_int,
947    ) -> cl_command_queue;
948}
949
950// cl_nv_device_attribute_query extension
951
952pub type cl_nv_device_attribute_query = cl_uint;
953pub const CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV: cl_nv_device_attribute_query = 0x4000;
954pub const CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV: cl_nv_device_attribute_query = 0x4001;
955pub const CL_DEVICE_REGISTERS_PER_BLOCK_NV: cl_nv_device_attribute_query = 0x4002;
956pub const CL_DEVICE_WARP_SIZE_NV: cl_nv_device_attribute_query = 0x4003;
957pub const CL_DEVICE_GPU_OVERLAP_NV: cl_nv_device_attribute_query = 0x4004;
958pub const CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV: cl_nv_device_attribute_query = 0x4005;
959pub const CL_DEVICE_INTEGRATED_MEMORY_NV: cl_nv_device_attribute_query = 0x4006;
960
961// undocumented tokens for clGetDeviceInfo, see: https://anteru.net/blog/2014/associating-opencl-device-ids-with-gpus/
962pub const CL_DEVICE_PCI_BUS_ID_NV: cl_nv_device_attribute_query = 0x4008;
963pub const CL_DEVICE_PCI_SLOT_ID_NV: cl_nv_device_attribute_query = 0x4009;
964
965#[derive(Debug, Clone, Default)]
966#[repr(C)]
967pub struct cl_amd_device_topology {
968    r#type: u32,
969    unused: [u8; 17],
970    pub bus: u8,
971    pub device: u8,
972    pub function: u8,
973}
974
975// cl_amd_device_attribute_query
976pub type cl_amd_device_attribute_query = cl_uint;
977
978pub const CL_DEVICE_PROFILING_TIMER_OFFSET_AMD: cl_amd_device_attribute_query = 0x4036;
979pub const CL_DEVICE_TOPOLOGY_AMD: cl_amd_device_attribute_query = 0x4037;
980pub const CL_DEVICE_BOARD_NAME_AMD: cl_amd_device_attribute_query = 0x4038;
981pub const CL_DEVICE_GLOBAL_FREE_MEMORY_AMD: cl_amd_device_attribute_query = 0x4039;
982pub const CL_DEVICE_SIMD_PER_COMPUTE_UNIT_AMD: cl_amd_device_attribute_query = 0x4040;
983pub const CL_DEVICE_SIMD_WIDTH_AMD: cl_amd_device_attribute_query = 0x4041;
984pub const CL_DEVICE_SIMD_INSTRUCTION_WIDTH_AMD: cl_amd_device_attribute_query = 0x4042;
985pub const CL_DEVICE_WAVEFRONT_WIDTH_AMD: cl_amd_device_attribute_query = 0x4043;
986pub const CL_DEVICE_GLOBAL_MEM_CHANNELS_AMD: cl_amd_device_attribute_query = 0x4044;
987pub const CL_DEVICE_GLOBAL_MEM_CHANNEL_BANKS_AMD: cl_amd_device_attribute_query = 0x4045;
988pub const CL_DEVICE_GLOBAL_MEM_CHANNEL_BANK_WIDTH_AMD: cl_amd_device_attribute_query = 0x4046;
989pub const CL_DEVICE_LOCAL_MEM_SIZE_PER_COMPUTE_UNIT_AMD: cl_amd_device_attribute_query = 0x4047;
990pub const CL_DEVICE_LOCAL_MEM_BANKS_AMD: cl_amd_device_attribute_query = 0x4048;
991pub const CL_DEVICE_THREAD_TRACE_SUPPORTED_AMD: cl_amd_device_attribute_query = 0x4049;
992pub const CL_DEVICE_GFXIP_MAJOR_AMD: cl_amd_device_attribute_query = 0x404A;
993pub const CL_DEVICE_GFXIP_MINOR_AMD: cl_amd_device_attribute_query = 0x404B;
994pub const CL_DEVICE_AVAILABLE_ASYNC_QUEUES_AMD: cl_amd_device_attribute_query = 0x404C;
995pub const CL_DEVICE_PREFERRED_WORK_GROUP_SIZE_AMD: cl_amd_device_attribute_query = 0x4030;
996pub const CL_DEVICE_MAX_WORK_GROUP_SIZE_AMD: cl_amd_device_attribute_query = 0x4031;
997pub const CL_DEVICE_PREFERRED_CONSTANT_BUFFER_SIZE_AMD: cl_amd_device_attribute_query = 0x4033;
998pub const CL_DEVICE_PCIE_ID_AMD: cl_amd_device_attribute_query = 0x4034;
999
1000// cl_arm_printf extension
1001pub const CL_PRINTF_CALLBACK_ARM: cl_uint = 0x40B0;
1002pub const CL_PRINTF_BUFFERSIZE_ARM: cl_uint = 0x40B1;
1003
1004// cl_ext_device_fission extension
1005
1006// cl_device_partition_property_ext
1007pub type cl_device_partition_property_ext = cl_ulong;
1008
1009pub type clReleaseDeviceEXT_t = Option<unsafe extern "C" fn(device: cl_device_id) -> cl_int>;
1010pub type clReleaseDeviceEXT_fn = clReleaseDeviceEXT_t;
1011
1012pub type clRetainDeviceEXT_t = Option<unsafe extern "C" fn(device: cl_device_id) -> cl_int>;
1013pub type clRetainDeviceEXT_fn = clRetainDeviceEXT_t;
1014
1015pub type clCreateSubDevicesEXT_t = Option<
1016    unsafe extern "C" fn(
1017        in_device: cl_device_id,
1018        properties: *const cl_device_partition_property_ext,
1019        num_entries: cl_uint,
1020        out_devices: *mut cl_device_id,
1021        num_devices: *mut cl_uint,
1022    ) -> cl_int,
1023>;
1024pub type clCreateSubDevicesEXT_fn = clCreateSubDevicesEXT_t;
1025
1026#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
1027#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
1028#[cfg(feature = "cl_ext_device_fission")]
1029#[cfg(feature = "static")]
1030extern "system" {
1031    pub fn clReleaseDeviceEXT(device: cl_device_id) -> cl_int;
1032
1033    pub fn clRetainDeviceEXT(device: cl_device_id) -> cl_int;
1034
1035    pub fn clCreateSubDevicesEXT(
1036        in_device: cl_device_id,
1037        properties: *const cl_device_partition_property_ext,
1038        num_entries: cl_uint,
1039        out_devices: *mut cl_device_id,
1040        num_devices: *mut cl_uint,
1041    ) -> cl_int;
1042}
1043
1044// cl_device_partition_property_ext
1045pub const CL_DEVICE_PARTITION_EQUALLY_EXT: cl_device_partition_property_ext = 0x4050;
1046pub const CL_DEVICE_PARTITION_BY_COUNTS_EXT: cl_device_partition_property_ext = 0x4051;
1047pub const CL_DEVICE_PARTITION_BY_NAMES_EXT: cl_device_partition_property_ext = 0x4052;
1048pub const CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN_EXT: cl_device_partition_property_ext = 0x4053;
1049
1050// clDeviceGetInfo selectors
1051pub const CL_DEVICE_PARENT_DEVICE_EXT: cl_device_info = 0x4054;
1052pub const CL_DEVICE_PARTITION_TYPES_EXT: cl_device_info = 0x4055;
1053pub const CL_DEVICE_AFFINITY_DOMAINS_EXT: cl_device_info = 0x4056;
1054pub const CL_DEVICE_REFERENCE_COUNT_EXT: cl_device_info = 0x4057;
1055pub const CL_DEVICE_PARTITION_STYLE_EXT: cl_device_info = 0x4058;
1056
1057// error codes
1058pub const CL_DEVICE_PARTITION_FAILED_EXT: cl_int = -1057;
1059pub const CL_INVALID_PARTITION_COUNT_EXT: cl_int = -1058;
1060pub const CL_INVALID_PARTITION_NAME_EXT: cl_int = -1059;
1061
1062// CL_AFFINITY_DOMAINs
1063pub const CL_AFFINITY_DOMAIN_L1_CACHE_EXT: cl_uint = 0x1;
1064pub const CL_AFFINITY_DOMAIN_L2_CACHE_EXT: cl_uint = 0x2;
1065pub const CL_AFFINITY_DOMAIN_L3_CACHE_EXT: cl_uint = 0x3;
1066pub const CL_AFFINITY_DOMAIN_L4_CACHE_EXT: cl_uint = 0x4;
1067pub const CL_AFFINITY_DOMAIN_NUMA_EXT: cl_uint = 0x10;
1068pub const CL_AFFINITY_DOMAIN_NEXT_FISSIONABLE_EXT: cl_uint = 0x100;
1069
1070// cl_device_partition_property_ext list terminators
1071pub const CL_PROPERTIES_LIST_END_EXT: cl_device_partition_property_ext = 0;
1072pub const CL_PARTITION_BY_COUNTS_LIST_END_EXT: cl_device_partition_property_ext = 0;
1073pub const CL_PARTITION_BY_NAMES_LIST_END_EXT: cl_device_partition_property_ext = 0xFFFF_FFFF;
1074
1075// cl_ext_migrate_memobject extension definitions
1076
1077pub type cl_mem_migration_flags_ext = cl_bitfield;
1078pub const CL_MIGRATE_MEM_OBJECT_HOST_EXT: cl_mem_migration_flags_ext = 0x1;
1079pub const CL_COMMAND_MIGRATE_MEM_OBJECT_EXT: cl_mem_migration_flags_ext = 0x4040;
1080
1081pub type clEnqueueMigrateMemObjectEXT_t = Option<
1082    unsafe extern "C" fn(
1083        command_queue: cl_command_queue,
1084        num_mem_objects: cl_uint,
1085        mem_objects: *const cl_mem,
1086        flags: cl_mem_migration_flags_ext,
1087        num_events_in_wait_list: cl_uint,
1088        event_wait_list: *const cl_event,
1089        event: *mut cl_event,
1090    ) -> cl_int,
1091>;
1092pub type clEnqueueMigrateMemObjectEXT_fn = clEnqueueMigrateMemObjectEXT_t;
1093
1094#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
1095#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
1096#[cfg(feature = "cl_ext_migrate_memobject")]
1097#[cfg(feature = "static")]
1098extern "system" {
1099    pub fn clEnqueueMigrateMemObjectEXT(
1100        command_queue: cl_command_queue,
1101        num_mem_objects: cl_uint,
1102        mem_objects: *const cl_mem,
1103        flags: cl_mem_migration_flags_ext,
1104        num_events_in_wait_list: cl_uint,
1105        event_wait_list: *const cl_event,
1106        event: *mut cl_event,
1107    ) -> cl_int;
1108}
1109
1110// cl_ext_cxx_for_opencl extension
1111pub const CL_DEVICE_CXX_FOR_OPENCL_NUMERIC_VERSION_EXT: cl_uint = 0x4230;
1112
1113// cl_qcom_ext_host_ptr extension
1114pub type cl_qcom_ext_host_ptr = cl_uint;
1115pub const CL_MEM_EXT_HOST_PTR_QCOM: cl_qcom_ext_host_ptr = 1 << 29;
1116
1117pub const CL_DEVICE_EXT_MEM_PADDING_IN_BYTES_QCOM: cl_qcom_ext_host_ptr = 0x40A0;
1118pub const CL_DEVICE_PAGE_SIZE_QCOM: cl_qcom_ext_host_ptr = 0x40A1;
1119pub const CL_IMAGE_ROW_ALIGNMENT_QCOM: cl_qcom_ext_host_ptr = 0x40A2;
1120pub const CL_IMAGE_SLICE_ALIGNMENT_QCOM: cl_qcom_ext_host_ptr = 0x40A3;
1121pub const CL_MEM_HOST_UNCACHED_QCOM: cl_qcom_ext_host_ptr = 0x40A4;
1122pub const CL_MEM_HOST_WRITEBACK_QCOM: cl_qcom_ext_host_ptr = 0x40A5;
1123pub const CL_MEM_HOST_WRITETHROUGH_QCOM: cl_qcom_ext_host_ptr = 0x40A6;
1124pub const CL_MEM_HOST_WRITE_COMBINING_QCOM: cl_qcom_ext_host_ptr = 0x40A7;
1125
1126pub type cl_image_pitch_info_qcom = cl_uint;
1127
1128pub type clGetDeviceImageInfoQCOM_t = Option<
1129    unsafe extern "C" fn(
1130        device: cl_device_id,
1131        image_width: size_t,
1132        image_height: size_t,
1133        image_format: *const cl_image_format,
1134        param_name: cl_image_pitch_info_qcom,
1135        param_value_size: size_t,
1136        param_value: *mut c_void,
1137        param_value_size_ret: *mut size_t,
1138    ) -> cl_int,
1139>;
1140pub type clGetDeviceImageInfoQCOM_fn = clGetDeviceImageInfoQCOM_t;
1141
1142#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
1143#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
1144#[cfg(feature = "cl_qcom_ext_host_ptr")]
1145#[cfg(feature = "static")]
1146extern "system" {
1147    pub fn clGetDeviceImageInfoQCOM(
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}
1158
1159#[derive(Debug, Copy, Clone, Default)]
1160#[repr(C)]
1161pub struct cl_mem_ext_host_ptr {
1162    pub allocation_type: cl_uint,
1163    pub host_cache_policy: cl_uint,
1164}
1165
1166// cl_qcom_ext_host_ptr_iocoherent extension
1167// Cache policy specifying io-coherence
1168pub const CL_MEM_HOST_IOCOHERENT_QCOM: cl_qcom_ext_host_ptr = 0x40A9;
1169
1170// cl_qcom_ion_host_ptr extension
1171pub const CL_MEM_ION_HOST_PTR_QCOM: cl_qcom_ext_host_ptr = 0x40A8;
1172
1173#[derive(Debug)]
1174#[repr(C)]
1175pub struct cl_mem_ion_host_ptr {
1176    pub ext_host_ptr: cl_mem_ext_host_ptr,
1177    pub ion_filedesc: cl_int,
1178    pub ion_hostptr: *mut c_void,
1179}
1180
1181//cl_qcom_android_native_buffer_host_ptr extension
1182pub const CL_MEM_ANDROID_NATIVE_BUFFER_HOST_PTR_QCOM: cl_qcom_ext_host_ptr = 0x40C6;
1183
1184#[repr(C)]
1185#[derive(Debug, Copy, Clone)]
1186pub struct cl_mem_android_native_buffer_host_ptr {
1187    pub ext_host_ptr: cl_mem_ext_host_ptr,
1188    pub anb_ptr: *mut c_void,
1189}
1190
1191// cl_img_yuv_image extension
1192pub const CL_NV21_IMG: cl_channel_type = 0x40D0;
1193pub const CL_YV12_IMG: cl_channel_type = 0x40D1;
1194
1195// cl_img_cached_allocations extension
1196pub const CL_MEM_USE_UNCACHED_CPU_MEMORY_IMG: cl_mem_flags = 1 << 26;
1197pub const CL_MEM_USE_CACHED_CPU_MEMORY_IMG: cl_mem_flags = 1 << 27;
1198
1199// cl_img_use_gralloc_ptr extension
1200pub const CL_MEM_USE_GRALLOC_PTR_IMG: cl_mem_flags = 1 << 28;
1201
1202// To be used by clGetEventInfo:
1203pub const CL_COMMAND_ACQUIRE_GRALLOC_OBJECTS_IMG: cl_event_info = 0x40D2;
1204pub const CL_COMMAND_RELEASE_GRALLOC_OBJECTS_IMG: cl_event_info = 0x40D3;
1205
1206// Error codes from clEnqueueAcquireGrallocObjectsIMG and clEnqueueReleaseGrallocObjectsIMG
1207pub const CL_GRALLOC_RESOURCE_NOT_ACQUIRED_IMG: cl_int = 0x40D4;
1208pub const CL_INVALID_GRALLOC_OBJECT_IMG: cl_int = 0x40D5;
1209
1210pub type clEnqueueAcquireGrallocObjectsIMG_t = Option<
1211    unsafe extern "C" fn(
1212        command_queue: cl_command_queue,
1213        num_objects: cl_uint,
1214        mem_objects: *const cl_mem,
1215        num_events_in_wait_list: cl_uint,
1216        event_wait_list: *const cl_event,
1217        event: *mut cl_event,
1218    ) -> cl_int,
1219>;
1220pub type clEnqueueAcquireGrallocObjectsIMG_fn = clEnqueueAcquireGrallocObjectsIMG_t;
1221
1222pub type clEnqueueReleaseGrallocObjectsIMG_t = Option<
1223    unsafe extern "C" fn(
1224        command_queue: cl_command_queue,
1225        num_objects: cl_uint,
1226        mem_objects: *const cl_mem,
1227        num_events_in_wait_list: cl_uint,
1228        event_wait_list: *const cl_event,
1229        event: *mut cl_event,
1230    ) -> cl_int,
1231>;
1232pub type clEnqueueReleaseGrallocObjectsIMG_fn = clEnqueueReleaseGrallocObjectsIMG_t;
1233
1234#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
1235#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
1236#[cfg(feature = "cl_img_use_gralloc_ptr")]
1237#[cfg(feature = "static")]
1238extern "system" {
1239    pub fn clEnqueueAcquireGrallocObjectsIMG(
1240        command_queue: cl_command_queue,
1241        num_objects: cl_uint,
1242        mem_objects: *const cl_mem,
1243        num_events_in_wait_list: cl_uint,
1244        event_wait_list: *const cl_event,
1245        event: *mut cl_event,
1246    ) -> cl_int;
1247
1248    pub fn clEnqueueReleaseGrallocObjectsIMG(
1249        command_queue: cl_command_queue,
1250        num_objects: cl_uint,
1251        mem_objects: *const cl_mem,
1252        num_events_in_wait_list: cl_uint,
1253        event_wait_list: *const cl_event,
1254        event: *mut cl_event,
1255    ) -> cl_int;
1256}
1257
1258// cl_img_generate_mipmap extension
1259pub type cl_mipmap_filter_mode_img = cl_uint;
1260
1261// To be used by clEnqueueGenerateMipmapIMG
1262pub const CL_MIPMAP_FILTER_ANY_IMG: cl_mipmap_filter_mode_img = 0x0;
1263pub const CL_MIPMAP_FILTER_BOX_IMG: cl_mipmap_filter_mode_img = 0x1;
1264
1265// To be used by clGetEventInfo
1266pub const CL_COMMAND_GENERATE_MIPMAP_IMG: cl_event_info = 0x40D6;
1267
1268pub type clEnqueueGenerateMipmapIMG_t = Option<
1269    unsafe extern "C" fn(
1270        command_queue: cl_command_queue,
1271        src_image: cl_mem,
1272        dst_image: cl_mem,
1273        mipmap_filter_mode: cl_mipmap_filter_mode_img,
1274        array_region: *const size_t,
1275        mip_region: *const size_t,
1276        num_events_in_wait_list: cl_uint,
1277        event_wait_list: *const cl_event,
1278        event: *mut cl_event,
1279    ) -> cl_int,
1280>;
1281pub type clEnqueueGenerateMipmapIMG_fn = clEnqueueGenerateMipmapIMG_t;
1282
1283#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
1284#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
1285#[cfg(feature = "cl_img_generate_mipmap")]
1286#[cfg(feature = "static")]
1287extern "system" {
1288    pub fn clEnqueueGenerateMipmapIMG(
1289        command_queue: cl_command_queue,
1290        src_image: cl_mem,
1291        dst_image: cl_mem,
1292        mipmap_filter_mode: cl_mipmap_filter_mode_img,
1293        array_region: *const size_t,
1294        mip_region: *const size_t,
1295        num_events_in_wait_list: cl_uint,
1296        event_wait_list: *const cl_event,
1297        event: *mut cl_event,
1298    ) -> cl_int;
1299}
1300
1301// cl_img_mem_properties extension
1302// To be used by clCreateBufferWithProperties
1303pub const CL_MEM_ALLOC_FLAGS_IMG: cl_properties = 0x40D7;
1304
1305// To be used wiith the CL_MEM_ALLOC_FLAGS_IMG property
1306pub type cl_mem_alloc_flags_img = cl_bitfield;
1307
1308// To be used with cl_mem_alloc_flags_img
1309pub const CL_MEM_ALLOC_RELAX_REQUIREMENTS_IMG: cl_mem_alloc_flags_img = 1 << 0;
1310pub const CL_MEM_ALLOC_GPU_WRITE_COMBINE_IMG: cl_mem_alloc_flags_img = 1 << 1;
1311pub const CL_MEM_ALLOC_GPU_CACHED_IMG: cl_mem_alloc_flags_img = 1 << 2;
1312pub const CL_MEM_ALLOC_CPU_LOCAL_IMG: cl_mem_alloc_flags_img = 1 << 3;
1313pub const CL_MEM_ALLOC_GPU_LOCAL_IMG: cl_mem_alloc_flags_img = 1 << 4;
1314pub const CL_MEM_ALLOC_GPU_PRIVATE_IMG: cl_mem_alloc_flags_img = 1 << 5;
1315
1316pub const CL_DEVICE_MEMORY_CAPABILITIES_IMG: cl_device_info = 0x40D8;
1317
1318// cl_khr_subgroups extension
1319pub const CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE_KHR: cl_kernel_sub_group_info = 0x2033;
1320pub const CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE_KHR: cl_kernel_sub_group_info = 0x2034;
1321
1322pub type clGetKernelSubGroupInfoKHR_t = Option<
1323    unsafe extern "C" fn(
1324        in_kernel: cl_kernel,
1325        in_device: cl_device_id,
1326        param_name: cl_kernel_sub_group_info,
1327        input_value_size: size_t,
1328        input_value: *const c_void,
1329        param_value_size: size_t,
1330        param_value: *mut c_void,
1331        param_value_size_ret: *mut size_t,
1332    ) -> cl_int,
1333>;
1334pub type clGetKernelSubGroupInfoKHR_fn = clGetKernelSubGroupInfoKHR_t;
1335
1336#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
1337#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
1338#[cfg(feature = "cl_khr_subgroups")]
1339#[cfg(feature = "static")]
1340extern "system" {
1341    pub fn clGetKernelSubGroupInfoKHR(
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}
1352
1353// cl_khr_mipmap_image extension
1354
1355// cl_sampler_properties
1356pub const CL_SAMPLER_MIP_FILTER_MODE_KHR: cl_sampler_properties = 0x1155;
1357pub const CL_SAMPLER_LOD_MIN_KHR: cl_sampler_properties = 0x1156;
1358pub const CL_SAMPLER_LOD_MAX_KHR: cl_sampler_properties = 0x1157;
1359
1360// cl_khr_priority_hints extension
1361pub type cl_queue_priority_khr = cl_uint;
1362
1363// cl_command_queue_properties
1364pub const CL_QUEUE_PRIORITY_KHR: cl_command_queue_properties = 0x1096;
1365
1366// cl_queue_priority_khr
1367pub const CL_QUEUE_PRIORITY_HIGH_KHR: cl_queue_priority_khr = 1 << 0;
1368pub const CL_QUEUE_PRIORITY_MED_KHR: cl_queue_priority_khr = 1 << 1;
1369pub const CL_QUEUE_PRIORITY_LOW_KHR: cl_queue_priority_khr = 1 << 2;
1370
1371// cl_khr_throttle_hints extension
1372pub type cl_queue_throttle_khr = cl_uint;
1373
1374// cl_command_queue_properties
1375pub const CL_QUEUE_THROTTLE_KHR: cl_command_queue_properties = 0x1097;
1376
1377// cl_queue_throttle_khr
1378pub const CL_QUEUE_THROTTLE_HIGH_KHR: cl_queue_throttle_khr = 1 << 0;
1379pub const CL_QUEUE_THROTTLE_MED_KHR: cl_queue_throttle_khr = 1 << 1;
1380pub const CL_QUEUE_THROTTLE_LOW_KHR: cl_queue_throttle_khr = 1 << 2;
1381
1382// cl_khr_subgroup_named_barrier
1383
1384// cl_device_info
1385pub const CL_DEVICE_MAX_NAMED_BARRIER_COUNT_KHR: cl_device_info = 0x2035;
1386
1387// cl_khr_extended_versioning
1388pub type cl_version_khr = cl_uint;
1389
1390pub const CL_VERSION_MAJOR_BITS_KHR: cl_version_khr = 10;
1391pub const CL_VERSION_MINOR_BITS_KHR: cl_version_khr = 10;
1392pub const CL_VERSION_PATCH_BITS_KHR: cl_version_khr = 12;
1393
1394pub const CL_VERSION_MAJOR_MASK_KHR: cl_version_khr = (1 << CL_VERSION_MAJOR_BITS_KHR) - 1;
1395pub const CL_VERSION_MINOR_MASK_KHR: cl_version_khr = (1 << CL_VERSION_MINOR_BITS_KHR) - 1;
1396pub const CL_VERSION_PATCH_MASK_KHR: cl_version_khr = (1 << CL_VERSION_PATCH_BITS_KHR) - 1;
1397
1398#[inline]
1399#[must_use]
1400pub const fn version_major_khr(version: cl_version_khr) -> cl_version_khr {
1401    version >> (CL_VERSION_MINOR_BITS_KHR + CL_VERSION_PATCH_BITS_KHR)
1402}
1403
1404#[inline]
1405#[must_use]
1406pub const fn version_minor_khr(version: cl_version_khr) -> cl_version_khr {
1407    (version >> CL_VERSION_PATCH_BITS_KHR) & CL_VERSION_MINOR_MASK_KHR
1408}
1409
1410#[inline]
1411#[must_use]
1412pub const fn version_patch_khr(version: cl_version_khr) -> cl_version_khr {
1413    version & CL_VERSION_PATCH_MASK_KHR
1414}
1415
1416#[inline]
1417#[must_use]
1418pub const fn make_version_khr(
1419    major: cl_version_khr,
1420    minor: cl_version_khr,
1421    patch: cl_version_khr,
1422) -> cl_version_khr {
1423    ((major & CL_VERSION_MAJOR_MASK_KHR) << (CL_VERSION_MINOR_BITS_KHR + CL_VERSION_PATCH_BITS_KHR))
1424        | ((minor & CL_VERSION_MINOR_MASK_KHR) << CL_VERSION_PATCH_BITS_KHR)
1425        | (patch & CL_VERSION_PATCH_MASK_KHR)
1426}
1427
1428pub const CL_NAME_VERSION_MAX_NAME_SIZE_KHR: size_t = 64;
1429
1430#[repr(C)]
1431#[derive(Debug, Copy, Clone)]
1432pub struct cl_name_version_khr {
1433    pub version: cl_version_khr,
1434    pub name: [cl_uchar; CL_NAME_VERSION_MAX_NAME_SIZE_KHR],
1435}
1436
1437// cl_platform_info
1438pub const CL_PLATFORM_NUMERIC_VERSION_KHR: cl_platform_info = 0x0906;
1439pub const CL_PLATFORM_EXTENSIONS_WITH_VERSION_KHR: cl_platform_info = 0x0907;
1440
1441// cl_device_info
1442pub const CL_DEVICE_NUMERIC_VERSION_KHR: cl_device_info = 0x105E;
1443pub const CL_DEVICE_OPENCL_C_NUMERIC_VERSION_KHR: cl_device_info = 0x105F;
1444pub const CL_DEVICE_EXTENSIONS_WITH_VERSION_KHR: cl_device_info = 0x1060;
1445pub const CL_DEVICE_ILS_WITH_VERSION_KHR: cl_device_info = 0x1061;
1446pub const CL_DEVICE_BUILT_IN_KERNELS_WITH_VERSION_KHR: cl_device_info = 0x1062;
1447
1448// cl_khr_device_uuid extension
1449
1450pub const CL_UUID_SIZE_KHR: size_t = 16;
1451pub const CL_LUID_SIZE_KHR: size_t = 8;
1452
1453pub const CL_DEVICE_UUID_KHR: cl_device_info = 0x106A;
1454pub const CL_DRIVER_UUID_KHR: cl_device_info = 0x106B;
1455pub const CL_DEVICE_LUID_VALID_KHR: cl_device_info = 0x106C;
1456pub const CL_DEVICE_LUID_KHR: cl_device_info = 0x106D;
1457pub const CL_DEVICE_NODE_MASK_KHR: cl_device_info = 0x106E;
1458
1459// cl_khr_pci_bus_info
1460#[repr(C)]
1461#[derive(Debug, Clone, Default)]
1462pub struct cl_device_pci_bus_info_khr {
1463    pub pci_domain: cl_uint,
1464    pub pci_bus: cl_uint,
1465    pub pci_device: cl_uint,
1466    pub pci_function: cl_uint,
1467}
1468
1469// cl_device_info
1470pub const CL_DEVICE_PCI_BUS_INFO_KHR: cl_device_info = 0x410F;
1471
1472// cl_khr_suggested_local_work_size
1473
1474pub type clGetKernelSuggestedLocalWorkSizeKHR_t = Option<
1475    unsafe extern "C" fn(
1476        command_queue: cl_command_queue,
1477        kernel: cl_kernel,
1478        work_dim: cl_uint,
1479        global_work_offset: *const size_t,
1480        global_work_size: *const size_t,
1481        suggested_local_work_size: *mut size_t,
1482    ) -> cl_int,
1483>;
1484pub type clGetKernelSuggestedLocalWorkSizeKHR_fn = clGetKernelSuggestedLocalWorkSizeKHR_t;
1485
1486#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
1487#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
1488#[cfg(feature = "cl_khr_suggested_local_work_size")]
1489#[cfg(feature = "static")]
1490extern "system" {
1491    pub fn clGetKernelSuggestedLocalWorkSizeKHR(
1492        command_queue: cl_command_queue,
1493        kernel: cl_kernel,
1494        work_dim: cl_uint,
1495        global_work_offset: *const size_t,
1496        global_work_size: *const size_t,
1497        suggested_local_work_size: *mut size_t,
1498    ) -> cl_int;
1499}
1500
1501// cl_khr_integer_dot_product
1502
1503pub type cl_device_integer_dot_product_capabilities_khr = cl_bitfield;
1504// cl_device_integer_dot_product_capabilities_khr
1505pub const CL_DEVICE_INTEGER_DOT_PRODUCT_INPUT_4x8BIT_PACKED_KHR:
1506    cl_device_integer_dot_product_capabilities_khr = 1 << 0;
1507pub const CL_DEVICE_INTEGER_DOT_PRODUCT_INPUT_4x8BIT_KHR:
1508    cl_device_integer_dot_product_capabilities_khr = 1 << 1;
1509
1510#[repr(C)]
1511#[derive(Debug, Clone, Default)]
1512pub struct cl_device_integer_dot_product_acceleration_properties_khr {
1513    pub signed_accelerated: cl_bool,
1514    pub unsigned_accelerated: cl_bool,
1515    pub mixed_signedness_accelerated: cl_bool,
1516    pub accumulating_saturating_signed_accelerated: cl_bool,
1517    pub accumulating_saturating_unsigned_accelerated: cl_bool,
1518    pub accumulating_saturating_mixed_signedness_accelerated: cl_bool,
1519}
1520
1521// cl_device_info
1522pub const CL_DEVICE_INTEGER_DOT_PRODUCT_CAPABILITIES_KHR: cl_device_info = 0x1073;
1523pub const CL_DEVICE_INTEGER_DOT_PRODUCT_ACCELERATION_PROPERTIES_8BIT_KHR: cl_device_info = 0x1074;
1524pub const CL_DEVICE_INTEGER_DOT_PRODUCT_ACCELERATION_PROPERTIES_4x8BIT_PACKED_KHR: cl_device_info =
1525    0x1075;
1526
1527// cl_khr_external_memory
1528
1529pub type cl_external_memory_handle_type_khr = cl_uint;
1530
1531// cl_platform_info
1532pub const CL_PLATFORM_EXTERNAL_MEMORY_IMPORT_HANDLE_TYPES_KHR: cl_platform_info = 0x2044;
1533
1534// cl_device_info
1535pub const CL_DEVICE_EXTERNAL_MEMORY_IMPORT_HANDLE_TYPES_KHR: cl_device_info = 0x204F;
1536pub const CL_DEVICE_EXTERNAL_MEMORY_IMPORT_ASSUME_LINEAR_IMAGES_HANDLE_TYPES_KHR: cl_device_info =
1537    0x2052;
1538
1539// cl_mem_properties
1540pub const CL_MEM_DEVICE_HANDLE_LIST_KHR: cl_ulong = 0x2051;
1541pub const CL_MEM_DEVICE_HANDLE_LIST_END_KHR: cl_ulong = 0;
1542
1543// cl_command_type
1544pub const CL_COMMAND_ACQUIRE_EXTERNAL_MEM_OBJECTS_KHR: cl_command_type = 0x2047;
1545pub const CL_COMMAND_RELEASE_EXTERNAL_MEM_OBJECTS_KHR: cl_command_type = 0x2048;
1546
1547pub type clEnqueueAcquireExternalMemObjectsKHR_t = Option<
1548    unsafe extern "C" fn(
1549        command_queue: cl_command_queue,
1550        num_mem_objects: cl_uint,
1551        mem_objects: *const cl_mem,
1552        num_events_in_wait_list: cl_uint,
1553        event_wait_list: *const cl_event,
1554        event: *mut cl_event,
1555    ) -> cl_int,
1556>;
1557pub type clEnqueueAcquireExternalMemObjectsKHR_fn = clEnqueueAcquireExternalMemObjectsKHR_t;
1558
1559pub type clEnqueueReleaseExternalMemObjectsKHR_t = Option<
1560    unsafe extern "C" fn(
1561        command_queue: cl_command_queue,
1562        num_mem_objects: cl_uint,
1563        mem_objects: *const cl_mem,
1564        num_events_in_wait_list: cl_uint,
1565        event_wait_list: *const cl_event,
1566        event: *mut cl_event,
1567    ) -> cl_int,
1568>;
1569pub type clEnqueueReleaseExternalMemObjectsKHR_fn = clEnqueueReleaseExternalMemObjectsKHR_t;
1570
1571#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
1572#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
1573#[cfg(feature = "cl_khr_external_memory")]
1574#[cfg(feature = "static")]
1575extern "system" {
1576    pub fn clEnqueueAcquireExternalMemObjectsKHR(
1577        command_queue: cl_command_queue,
1578        num_mem_objects: cl_uint,
1579        mem_objects: *const cl_mem,
1580        num_events_in_wait_list: cl_uint,
1581        event_wait_list: *const cl_event,
1582        event: *mut cl_event,
1583    ) -> cl_int;
1584
1585    pub fn clEnqueueReleaseExternalMemObjectsKHR(
1586        command_queue: cl_command_queue,
1587        num_mem_objects: cl_uint,
1588        mem_objects: *const cl_mem,
1589        num_events_in_wait_list: cl_uint,
1590        event_wait_list: *const cl_event,
1591        event: *mut cl_event,
1592    ) -> cl_int;
1593}
1594
1595// cl_khr_external_memory_dma_buf
1596
1597// cl_external_memory_handle_type_khr
1598pub const CL_EXTERNAL_MEMORY_HANDLE_DMA_BUF_KHR: cl_external_memory_handle_type_khr = 0x2067;
1599
1600// cl_khr_external_memory_dx
1601
1602// cl_khr_external_memory_opaque_fd
1603
1604// cl_external_memory_handle_type_khr
1605pub const CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_FD_KHR: cl_external_memory_handle_type_khr = 0x2060;
1606
1607// cl_khr_external_memory_win32
1608
1609// cl_external_memory_handle_type_khr
1610pub const CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_KHR: cl_external_memory_handle_type_khr = 0x2061;
1611pub const CL_EXTERNAL_MEMORY_HANDLE_OPAQUE_WIN32_KMT_KHR: cl_external_memory_handle_type_khr =
1612    0x2062;
1613
1614// cl_khr_external_semaphore
1615pub type cl_semaphore_khr = *mut c_void;
1616pub type cl_external_semaphore_handle_type_khr = cl_uint;
1617pub type cl_semaphore_properties_khr = cl_properties;
1618
1619// cl_platform_info
1620pub const CL_PLATFORM_SEMAPHORE_IMPORT_HANDLE_TYPES_KHR: cl_platform_info = 0x2037;
1621pub const CL_PLATFORM_SEMAPHORE_EXPORT_HANDLE_TYPES_KHR: cl_platform_info = 0x2038;
1622
1623// cl_device_info
1624pub const CL_DEVICE_SEMAPHORE_IMPORT_HANDLE_TYPES_KHR: cl_device_info = 0x204D;
1625pub const CL_DEVICE_SEMAPHORE_EXPORT_HANDLE_TYPES_KHR: cl_device_info = 0x204E;
1626
1627// cl_semaphore_properties_khr
1628pub const CL_SEMAPHORE_EXPORT_HANDLE_TYPES_KHR: cl_semaphore_properties_khr = 0x203F;
1629pub const CL_SEMAPHORE_EXPORT_HANDLE_TYPES_LIST_END_KHR: cl_semaphore_properties_khr = 0;
1630
1631// cl_semaphore_info_khr
1632pub const CL_SEMAPHORE_EXPORTABLE_KHR: u32 = 0x2054;
1633
1634pub type clGetSemaphoreHandleForTypeKHR_t = Option<
1635    unsafe extern "C" fn(
1636        sema_object: cl_semaphore_khr,
1637        device: cl_device_id,
1638        handle_type: cl_external_semaphore_handle_type_khr,
1639        handle_size: size_t,
1640        handle_ptr: *mut c_void,
1641        handle_size_ret: *mut size_t,
1642    ) -> cl_int,
1643>;
1644pub type clGetSemaphoreHandleForTypeKHR_fn = clGetSemaphoreHandleForTypeKHR_t;
1645
1646#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
1647#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
1648#[cfg(feature = "cl_khr_external_semaphore")]
1649#[cfg(feature = "static")]
1650extern "system" {
1651    pub fn clGetSemaphoreHandleForTypeKHR(
1652        sema_object: cl_semaphore_khr,
1653        device: cl_device_id,
1654        handle_type: cl_external_semaphore_handle_type_khr,
1655        handle_size: size_t,
1656        handle_ptr: *mut c_void,
1657        handle_size_ret: *mut size_t,
1658    ) -> cl_int;
1659}
1660
1661// cl_khr_external_semaphore_dx_fence
1662
1663// cl_external_semaphore_handle_type_khr
1664pub const CL_SEMAPHORE_HANDLE_D3D12_FENCE_KHR: cl_external_semaphore_handle_type_khr = 0x2059;
1665
1666// cl_khr_external_semaphore_opaque_fd
1667pub const CL_SEMAPHORE_HANDLE_OPAQUE_FD_KHR: cl_external_semaphore_handle_type_khr = 0x2055;
1668
1669// cl_khr_external_semaphore_sync_fd
1670
1671pub type cl_semaphore_reimport_properties_khr = cl_properties;
1672
1673pub const CL_SEMAPHORE_HANDLE_SYNC_FD_KHR: cl_external_semaphore_handle_type_khr = 0x2058;
1674
1675pub type clReImportSemaphoreSyncFdKHR_t = Option<
1676    unsafe extern "C" fn(
1677        sema_object: cl_semaphore_khr,
1678        reimport_props: *mut cl_semaphore_reimport_properties_khr,
1679        fd: c_int,
1680    ) -> cl_int,
1681>;
1682pub type clReImportSemaphoreSyncFdKHR_fn = clReImportSemaphoreSyncFdKHR_t;
1683
1684#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
1685#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
1686#[cfg(feature = "cl_khr_external_semaphore_sync_fd")]
1687#[cfg(feature = "static")]
1688extern "system" {
1689    pub fn clReImportSemaphoreSyncFdKHR(
1690        sema_object: cl_semaphore_khr,
1691        reimport_props: *mut cl_semaphore_reimport_properties_khr,
1692        fd: c_int,
1693    ) -> cl_int;
1694}
1695
1696// cl_khr_external_semaphore_win32
1697pub const CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KHR: cl_external_semaphore_handle_type_khr = 0x2056;
1698pub const CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_KMT_KHR: cl_external_semaphore_handle_type_khr = 0x2057;
1699pub const CL_SEMAPHORE_HANDLE_OPAQUE_WIN32_NAME_KHR: cl_external_semaphore_handle_type_khr = 0x2058;
1700
1701// cl_khr_semaphore
1702
1703// pub type cl_semaphore_properties_khr = cl_properties; defined above
1704pub type cl_semaphore_info_khr = cl_uint;
1705pub type cl_semaphore_type_khr = cl_uint;
1706pub type cl_semaphore_payload_khr = cl_ulong;
1707
1708// cl_semaphore_type
1709pub const CL_SEMAPHORE_TYPE_BINARY_KHR: cl_semaphore_type_khr = 1;
1710
1711// cl_platform_info
1712pub const CL_PLATFORM_SEMAPHORE_TYPES_KHR: cl_platform_info = 0x2036;
1713
1714// cl_device_info
1715pub const CL_DEVICE_SEMAPHORE_TYPES_KHR: cl_device_info = 0x204C;
1716
1717// cl_semaphore_info_khr
1718pub const CL_SEMAPHORE_CONTEXT_KHR: cl_semaphore_info_khr = 0x2039;
1719pub const CL_SEMAPHORE_REFERENCE_COUNT_KHR: cl_semaphore_info_khr = 0x203A;
1720pub const CL_SEMAPHORE_PROPERTIES_KHR: cl_semaphore_info_khr = 0x203B;
1721pub const CL_SEMAPHORE_PAYLOAD_KHR: cl_semaphore_info_khr = 0x203C;
1722
1723// cl_semaphore_info_khr or cl_semaphore_properties_khr
1724pub const CL_SEMAPHORE_TYPE_KHR: cl_semaphore_info_khr = 0x203D;
1725pub const CL_SEMAPHORE_DEVICE_HANDLE_LIST_KHR: cl_semaphore_info_khr = 0x2053;
1726pub const CL_SEMAPHORE_DEVICE_HANDLE_LIST_END_KHR: cl_semaphore_info_khr = 0;
1727
1728// cl_command_type
1729pub const CL_COMMAND_SEMAPHORE_WAIT_KHR: cl_command_type = 0x2042;
1730pub const CL_COMMAND_SEMAPHORE_SIGNAL_KHR: cl_command_type = 0x2043;
1731
1732// Error codes
1733pub const CL_INVALID_SEMAPHORE_KHR: cl_int = -1142;
1734
1735pub type clCreateSemaphoreWithPropertiesKHR_t = Option<
1736    unsafe extern "C" fn(
1737        context: cl_context,
1738        sema_props: *const cl_semaphore_properties_khr,
1739        errcode_ret: *mut cl_int,
1740    ) -> cl_semaphore_khr,
1741>;
1742pub type clCreateSemaphoreWithPropertiesKHR_fn = clCreateSemaphoreWithPropertiesKHR_t;
1743
1744pub type clEnqueueWaitSemaphoresKHR_t = Option<
1745    unsafe extern "C" fn(
1746        command_queue: cl_command_queue,
1747        num_sema_objects: cl_uint,
1748        sema_objects: *const cl_semaphore_khr,
1749        sema_payload_list: *const cl_semaphore_payload_khr,
1750        num_events_in_wait_list: cl_uint,
1751        event_wait_list: *const cl_event,
1752        event: *mut cl_event,
1753    ) -> cl_int,
1754>;
1755pub type clEnqueueWaitSemaphoresKHR_fn = clEnqueueWaitSemaphoresKHR_t;
1756
1757pub type clEnqueueSignalSemaphoresKHR_t = Option<
1758    unsafe extern "C" fn(
1759        command_queue: cl_command_queue,
1760        num_sema_objects: cl_uint,
1761        sema_objects: *const cl_semaphore_khr,
1762        sema_payload_list: *const cl_semaphore_payload_khr,
1763        num_events_in_wait_list: cl_uint,
1764        event_wait_list: *const cl_event,
1765        event: *mut cl_event,
1766    ) -> cl_int,
1767>;
1768pub type clEnqueueSignalSemaphoresKHR_fn = clEnqueueSignalSemaphoresKHR_t;
1769
1770pub type clGetSemaphoreInfoKHR_t = Option<
1771    unsafe extern "C" fn(
1772        sema_object: cl_semaphore_khr,
1773        param_name: cl_semaphore_info_khr,
1774        param_value_size: size_t,
1775        param_value: *mut c_void,
1776        param_value_size_ret: *mut size_t,
1777    ) -> cl_int,
1778>;
1779pub type clGetSemaphoreInfoKHR_fn = clGetSemaphoreInfoKHR_t;
1780
1781pub type clReleaseSemaphoreKHR_t =
1782    Option<unsafe extern "C" fn(sema_object: cl_semaphore_khr) -> cl_int>;
1783pub type clReleaseSemaphoreKHR_fn = clReleaseSemaphoreKHR_t;
1784
1785pub type clRetainSemaphoreKHR_t =
1786    Option<unsafe extern "C" fn(sema_object: cl_semaphore_khr) -> cl_int>;
1787pub type clRetainSemaphoreKHR_fn = clRetainSemaphoreKHR_t;
1788
1789#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
1790#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
1791#[cfg(feature = "cl_khr_semaphore")]
1792#[cfg(feature = "static")]
1793extern "system" {
1794    pub fn clCreateSemaphoreWithPropertiesKHR(
1795        context: cl_context,
1796        sema_props: *const cl_semaphore_properties_khr,
1797        errcode_ret: *mut cl_int,
1798    ) -> cl_semaphore_khr;
1799
1800    pub fn clEnqueueWaitSemaphoresKHR(
1801        command_queue: cl_command_queue,
1802        num_sema_objects: cl_uint,
1803        sema_objects: *const cl_semaphore_khr,
1804        sema_payload_list: *const cl_semaphore_payload_khr,
1805        num_events_in_wait_list: cl_uint,
1806        event_wait_list: *const cl_event,
1807        event: *mut cl_event,
1808    ) -> cl_int;
1809
1810    pub fn clEnqueueSignalSemaphoresKHR(
1811        command_queue: cl_command_queue,
1812        num_sema_objects: cl_uint,
1813        sema_objects: *const cl_semaphore_khr,
1814        sema_payload_list: *const cl_semaphore_payload_khr,
1815        num_events_in_wait_list: cl_uint,
1816        event_wait_list: *const cl_event,
1817        event: *mut cl_event,
1818    ) -> cl_int;
1819
1820    pub fn clGetSemaphoreInfoKHR(
1821        sema_object: cl_semaphore_khr,
1822        param_name: cl_semaphore_info_khr,
1823        param_value_size: size_t,
1824        param_value: *mut c_void,
1825        param_value_size_ret: *mut size_t,
1826    ) -> cl_int;
1827
1828    pub fn clReleaseSemaphoreKHR(sema_object: cl_semaphore_khr) -> cl_int;
1829
1830    pub fn clRetainSemaphoreKHR(sema_object: cl_semaphore_khr) -> cl_int;
1831}
1832
1833// cl_arm_import_memory extension
1834
1835pub type cl_import_properties_arm = intptr_t;
1836
1837/// Default and valid properties name for `cl_arm_import_memory`
1838pub const CL_IMPORT_TYPE_ARM: cl_import_properties_arm = 0x40B2;
1839
1840/// Host process memory type default value for `CL_IMPORT_TYPE_ARM` property
1841pub const CL_IMPORT_TYPE_HOST_ARM: cl_import_properties_arm = 0x40B3;
1842
1843/// DMA BUF memory type value for `CL_IMPORT_TYPE_ARM` property
1844pub const CL_IMPORT_TYPE_DMA_BUF_ARM: cl_import_properties_arm = 0x40B4;
1845
1846/// Protected memory property
1847pub const CL_IMPORT_TYPE_PROTECTED_ARM: cl_import_properties_arm = 0x40B5;
1848
1849/// Android hardware buffer type value for `CL_IMPORT_TYPE_ARM` property
1850pub const CL_IMPORT_TYPE_ANDROID_HARDWARE_BUFFER_ARM: cl_import_properties_arm = 0x41E2;
1851
1852/// Data consistency with host property
1853pub const CL_IMPORT_DMA_BUF_DATA_CONSISTENCY_WITH_HOST_ARM: cl_import_properties_arm = 0x41E3;
1854
1855/// Index of plane in a multiplanar hardware buffer
1856pub const CL_IMPORT_ANDROID_HARDWARE_BUFFER_PLANE_INDEX_ARM: cl_import_properties_arm = 0x41EF;
1857
1858/// Index of layer in a multilayer hardware buffer
1859pub const CL_IMPORT_ANDROID_HARDWARE_BUFFER_LAYER_INDEX_ARM: cl_import_properties_arm = 0x41F0;
1860
1861/// Import memory size value to indicate a size for the whole buffer.
1862pub const CL_IMPORT_MEMORY_WHOLE_ALLOCATION_ARM: cl_import_properties_arm =
1863    cl_import_properties_arm::MAX;
1864
1865/* This extension adds a new function that allows for direct memory import into
1866 * OpenCL via the clImportMemoryARM function.
1867 *
1868 * Memory imported through this interface will be mapped into the device's page
1869 * tables directly, providing zero copy access. It will never fall back to copy
1870 * operations and aliased buffers.
1871 *
1872 * Types of memory supported for import are specified as additional extension
1873 * strings.
1874 *
1875 * This extension produces cl_mem allocations which are compatible with all other
1876 * users of cl_mem in the standard API.
1877 *
1878 * This extension maps pages with the same properties as the normal buffer creation
1879 * function clCreateBuffer.
1880 */
1881
1882pub type clImportMemoryARM_t = Option<
1883    unsafe extern "C" fn(
1884        context: cl_context,
1885        flags: cl_mem_flags,
1886        properties: *const cl_import_properties_arm,
1887        memory: *mut c_void,
1888        size: size_t,
1889        errcode_ret: *mut cl_int,
1890    ) -> cl_mem,
1891>;
1892pub type clImportMemoryARM_fn = clImportMemoryARM_t;
1893
1894#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
1895#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
1896#[cfg(feature = "cl_arm_import_memory")]
1897#[cfg(feature = "static")]
1898extern "system" {
1899    pub fn clImportMemoryARM(
1900        context: cl_context,
1901        flags: cl_mem_flags,
1902        properties: *const cl_import_properties_arm,
1903        memory: *mut c_void,
1904        size: size_t,
1905        errcode_ret: *mut cl_int,
1906    ) -> cl_mem;
1907}
1908
1909// cl_arm_shared_virtual_memory extension
1910
1911// Used by clGetDeviceInfo
1912pub const CL_DEVICE_SVM_CAPABILITIES_ARM: cl_device_info = 0x40B6;
1913
1914// Used by clGetMemObjectInfo
1915pub const CL_MEM_USES_SVM_POINTER_ARM: cl_mem_info = 0x40B7;
1916
1917// Used by clSetKernelExecInfoARM:
1918pub type cl_kernel_exec_info_arm = cl_uint;
1919pub const CL_KERNEL_EXEC_INFO_SVM_PTRS_ARM: cl_kernel_exec_info_arm = 0x40B8;
1920pub const CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM_ARM: cl_kernel_exec_info_arm = 0x40B9;
1921
1922// To be used by clGetEventInfo:
1923pub const CL_COMMAND_SVM_FREE_ARM: cl_event_info = 0x40BA;
1924pub const CL_COMMAND_SVM_MEMCPY_ARM: cl_event_info = 0x40BB;
1925pub const CL_COMMAND_SVM_MEMFILL_ARM: cl_event_info = 0x40BC;
1926pub const CL_COMMAND_SVM_MAP_ARM: cl_event_info = 0x40BD;
1927pub const CL_COMMAND_SVM_UNMAP_ARM: cl_event_info = 0x40BF;
1928
1929// Flag values returned by clGetDeviceInfo with CL_DEVICE_SVM_CAPABILITIES_ARM as the param_name.
1930pub type cl_device_svm_capabilities_arm = cl_bitfield;
1931pub const CL_DEVICE_SVM_COARSE_GRAIN_BUFFER_ARM: cl_device_svm_capabilities_arm = 1 << 0;
1932pub const CL_DEVICE_SVM_FINE_GRAIN_BUFFER_ARM: cl_device_svm_capabilities_arm = 1 << 1;
1933pub const CL_DEVICE_SVM_FINE_GRAIN_SYSTEM_ARM: cl_device_svm_capabilities_arm = 1 << 2;
1934pub const CL_DEVICE_SVM_ATOMICS_ARM: cl_device_svm_capabilities_arm = 1 << 3;
1935
1936// Flag values used by clSVMAllocARM:
1937pub type cl_svm_mem_flags_arm = cl_bitfield;
1938pub const CL_MEM_SVM_FINE_GRAIN_BUFFER_ARM: cl_svm_mem_flags_arm = 1 << 10;
1939pub const CL_MEM_SVM_ATOMICS_ARM: cl_svm_mem_flags_arm = 1 << 11;
1940
1941pub type clSVMAllocARM_t = Option<
1942    unsafe extern "C" fn(
1943        context: cl_context,
1944        flags: cl_svm_mem_flags_arm,
1945        size: size_t,
1946        alignment: cl_uint,
1947    ) -> *mut c_void,
1948>;
1949pub type clSVMAllocARM_fn = clSVMAllocARM_t;
1950
1951pub type clSVMFreeARM_t =
1952    Option<unsafe extern "C" fn(context: cl_context, svm_pointer: *mut c_void)>;
1953pub type clSVMFreeARM_fn = clSVMFreeARM_t;
1954
1955pub type clEnqueueSVMFreeARM_t = Option<
1956    unsafe extern "C" fn(
1957        command_queue: cl_command_queue,
1958        num_svm_pointers: cl_uint,
1959        svm_pointers: *mut *mut c_void,
1960        pfn_free_func: Option<
1961            unsafe extern "C" fn(
1962                queue: cl_command_queue,
1963                num_svm_pointers: cl_uint,
1964                svm_pointers: *mut *mut c_void,
1965                user_data: *mut c_void,
1966            ),
1967        >,
1968        user_data: *mut c_void,
1969        num_events_in_wait_list: cl_uint,
1970        event_wait_list: *const cl_event,
1971        event: *mut cl_event,
1972    ) -> cl_int,
1973>;
1974pub type clEnqueueSVMFreeARM_fn = clEnqueueSVMFreeARM_t;
1975
1976pub type clEnqueueSVMMemcpyARM_t = Option<
1977    unsafe extern "C" fn(
1978        command_queue: cl_command_queue,
1979        blocking_copy: cl_bool,
1980        dst_ptr: *mut c_void,
1981        src_ptr: *const c_void,
1982        size: size_t,
1983        num_events_in_wait_list: cl_uint,
1984        event_wait_list: *const cl_event,
1985        event: *mut cl_event,
1986    ) -> cl_int,
1987>;
1988pub type clEnqueueSVMMemcpyARM_fn = clEnqueueSVMMemcpyARM_t;
1989
1990pub type clEnqueueSVMMemFillARM_t = Option<
1991    unsafe extern "C" fn(
1992        command_queue: cl_command_queue,
1993        svm_ptr: *mut c_void,
1994        pattern: *const c_void,
1995        pattern_size: size_t,
1996        size: size_t,
1997        num_events_in_wait_list: cl_uint,
1998        event_wait_list: *const cl_event,
1999        event: *mut cl_event,
2000    ) -> cl_int,
2001>;
2002pub type clEnqueueSVMMemFillARM_fn = clEnqueueSVMMemFillARM_t;
2003
2004pub type clEnqueueSVMMapARM_t = Option<
2005    unsafe extern "C" fn(
2006        command_queue: cl_command_queue,
2007        blocking_map: cl_bool,
2008        flags: cl_map_flags,
2009        svm_ptr: *mut c_void,
2010        size: size_t,
2011        num_events_in_wait_list: cl_uint,
2012        event_wait_list: *const cl_event,
2013        event: *mut cl_event,
2014    ) -> cl_int,
2015>;
2016pub type clEnqueueSVMMapARM_fn = clEnqueueSVMMapARM_t;
2017
2018pub type clEnqueueSVMUnmapARM_t = Option<
2019    unsafe extern "C" fn(
2020        command_queue: cl_command_queue,
2021        svm_ptr: *mut c_void,
2022        num_events_in_wait_list: cl_uint,
2023        event_wait_list: *const cl_event,
2024        event: *mut cl_event,
2025    ) -> cl_int,
2026>;
2027pub type clEnqueueSVMUnmapARM_fn = clEnqueueSVMUnmapARM_t;
2028
2029pub type clSetKernelArgSVMPointerARM_t = Option<
2030    unsafe extern "C" fn(kernel: cl_kernel, arg_index: cl_uint, arg_value: *const c_void) -> cl_int,
2031>;
2032pub type clSetKernelArgSVMPointerARM_fn = clSetKernelArgSVMPointerARM_t;
2033
2034pub type clSetKernelExecInfoARM_t = Option<
2035    unsafe extern "C" fn(
2036        kernel: cl_kernel,
2037        param_name: cl_kernel_exec_info_arm,
2038        param_value_size: size_t,
2039        param_value: *const c_void,
2040    ) -> cl_int,
2041>;
2042pub type clSetKernelExecInfoARM_fn = clSetKernelExecInfoARM_t;
2043
2044#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
2045#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
2046#[cfg(feature = "cl_arm_shared_virtual_memory")]
2047#[cfg(feature = "static")]
2048extern "system" {
2049    pub fn clSVMAllocARM(
2050        context: cl_context,
2051        flags: cl_svm_mem_flags_arm,
2052        size: size_t,
2053        alignment: cl_uint,
2054    ) -> *mut c_void;
2055
2056    pub fn clSVMFreeARM(context: cl_context, svm_pointer: *mut c_void);
2057
2058    pub fn clEnqueueSVMFreeARM(
2059        command_queue: cl_command_queue,
2060        num_svm_pointers: cl_uint,
2061        svm_pointers: *mut *mut c_void,
2062        pfn_free_func: Option<
2063            unsafe extern "C" fn(
2064                queue: cl_command_queue,
2065                num_svm_pointers: cl_uint,
2066                svm_pointers: *mut *mut c_void,
2067                user_data: *mut c_void,
2068            ),
2069        >,
2070        user_data: *mut c_void,
2071        num_events_in_wait_list: cl_uint,
2072        event_wait_list: *const cl_event,
2073        event: *mut cl_event,
2074    ) -> cl_int;
2075
2076    pub fn clEnqueueSVMMemcpyARM(
2077        command_queue: cl_command_queue,
2078        blocking_copy: cl_bool,
2079        dst_ptr: *mut c_void,
2080        src_ptr: *const c_void,
2081        size: size_t,
2082        num_events_in_wait_list: cl_uint,
2083        event_wait_list: *const cl_event,
2084        event: *mut cl_event,
2085    ) -> cl_int;
2086
2087    pub fn clEnqueueSVMMemFillARM(
2088        command_queue: cl_command_queue,
2089        svm_ptr: *mut c_void,
2090        pattern: *const c_void,
2091        pattern_size: size_t,
2092        size: size_t,
2093        num_events_in_wait_list: cl_uint,
2094        event_wait_list: *const cl_event,
2095        event: *mut cl_event,
2096    ) -> cl_int;
2097
2098    pub fn clEnqueueSVMMapARM(
2099        command_queue: cl_command_queue,
2100        blocking_map: cl_bool,
2101        flags: cl_map_flags,
2102        svm_ptr: *mut c_void,
2103        size: size_t,
2104        num_events_in_wait_list: cl_uint,
2105        event_wait_list: *const cl_event,
2106        event: *mut cl_event,
2107    ) -> cl_int;
2108
2109    pub fn clEnqueueSVMUnmapARM(
2110        command_queue: cl_command_queue,
2111        svm_ptr: *mut c_void,
2112        num_events_in_wait_list: cl_uint,
2113        event_wait_list: *const cl_event,
2114        event: *mut cl_event,
2115    ) -> cl_int;
2116
2117    pub fn clSetKernelArgSVMPointerARM(
2118        kernel: cl_kernel,
2119        arg_index: cl_uint,
2120        arg_value: *const c_void,
2121    ) -> cl_int;
2122
2123    pub fn clSetKernelExecInfoARM(
2124        kernel: cl_kernel,
2125        param_name: cl_kernel_exec_info_arm,
2126        param_value_size: size_t,
2127        param_value: *const c_void,
2128    ) -> cl_int;
2129}
2130
2131// cl_arm_get_core_id extension
2132// #ifdef CL_VERSION_1_2
2133pub const CL_DEVICE_COMPUTE_UNITS_BITFIELD_ARM: cl_device_info = 0x40BF;
2134// #endif
2135
2136// cl_arm_job_slot_selection
2137// cl_device_info
2138pub const CL_DEVICE_JOB_SLOTS_ARM: cl_device_info = 0x41E0;
2139// cl_command_queue_properties
2140pub const CL_QUEUE_JOB_SLOT_ARM: cl_command_queue_properties = 0x41E1;
2141
2142// cl_arm_scheduling_controls
2143
2144// cl_device_info
2145pub const CL_DEVICE_SCHEDULING_CONTROLS_CAPABILITIES_ARM: cl_device_info = 0x41E4;
2146
2147pub type cl_device_scheduling_controls_capabilities_arm = cl_bitfield;
2148pub const CL_DEVICE_SCHEDULING_KERNEL_BATCHING_ARM: cl_device_scheduling_controls_capabilities_arm =
2149    1 << 0;
2150pub const CL_DEVICE_SCHEDULING_WORKGROUP_BATCH_SIZE_ARM:
2151    cl_device_scheduling_controls_capabilities_arm = 1 << 1;
2152pub const CL_DEVICE_SCHEDULING_WORKGROUP_BATCH_SIZE_MODIFIER_ARM:
2153    cl_device_scheduling_controls_capabilities_arm = 1 << 2;
2154pub const CL_DEVICE_SCHEDULING_DEFERRED_FLUSH_ARM: cl_device_scheduling_controls_capabilities_arm =
2155    1 << 3;
2156pub const CL_DEVICE_SCHEDULING_REGISTER_ALLOCATION_ARM:
2157    cl_device_scheduling_controls_capabilities_arm = 1 << 4;
2158pub const CL_DEVICE_SCHEDULING_WARP_THROTTLING_ARM: cl_device_scheduling_controls_capabilities_arm =
2159    1 << 5;
2160pub const CL_DEVICE_SCHEDULING_COMPUTE_UNIT_BATCH_QUEUE_SIZE_ARM:
2161    cl_device_scheduling_controls_capabilities_arm = 1 << 6;
2162pub const CL_DEVICE_SCHEDULING_COMPUTE_UNIT_LIMIT_ARM:
2163    cl_device_scheduling_controls_capabilities_arm = 1 << 7;
2164
2165pub const CL_DEVICE_SUPPORTED_REGISTER_ALLOCATIONS_ARM: cl_device_info = 0x41EB;
2166pub const CL_DEVICE_MAX_WARP_COUNT_ARM: cl_device_info = 0x41EA;
2167
2168pub const CL_KERNEL_MAX_WARP_COUNT_ARM: cl_kernel_info = 0x41E9;
2169
2170pub const CL_KERNEL_EXEC_INFO_WORKGROUP_BATCH_SIZE_ARM: cl_kernel_exec_info = 0x41E5;
2171pub const CL_KERNEL_EXEC_INFO_WORKGROUP_BATCH_SIZE_MODIFIER_ARM: cl_kernel_exec_info = 0x41E6;
2172pub const CL_KERNEL_EXEC_INFO_WARP_COUNT_LIMIT_ARM: cl_kernel_exec_info = 0x41E8;
2173pub const CL_KERNEL_EXEC_INFO_COMPUTE_UNIT_MAX_QUEUED_BATCHES_ARM: cl_kernel_exec_info = 0x41F1;
2174
2175pub const CL_QUEUE_KERNEL_BATCHING_ARM: cl_queue_properties = 0x41E7;
2176pub const CL_QUEUE_DEFERRED_FLUSH_ARM: cl_queue_properties = 0x41EC;
2177pub const CL_QUEUE_COMPUTE_UNIT_LIMIT_ARM: cl_queue_properties = 0x41F3;
2178
2179// cl_arm_controlled_kernel_termination
2180
2181// Error code to indicate kernel terminated with failure
2182pub const CL_COMMAND_TERMINATED_ITSELF_WITH_FAILURE_ARM: cl_int = -1108;
2183
2184// cl_device_info
2185pub const CL_DEVICE_CONTROLLED_TERMINATION_CAPABILITIES_ARM: cl_device_info = 0x41EE;
2186
2187// Bit fields for controlled termination feature query
2188pub type cl_device_controlled_termination_capabilities_arm = cl_bitfield;
2189pub const CL_DEVICE_CONTROLLED_TERMINATION_SUCCESS_ARM:
2190    cl_device_controlled_termination_capabilities_arm = 1 << 0;
2191pub const CL_DEVICE_CONTROLLED_TERMINATION_FAILURE_ARM:
2192    cl_device_controlled_termination_capabilities_arm = 1 << 1;
2193pub const CL_DEVICE_CONTROLLED_TERMINATION_QUERY_ARM:
2194    cl_device_controlled_termination_capabilities_arm = 1 << 2;
2195
2196// cl_event_info
2197pub const CL_EVENT_COMMAND_TERMINATION_REASON_ARM: cl_event_info = 0x41ED;
2198
2199// Values returned for event termination reason query
2200pub type cl_command_termination_reason_arm = cl_uint;
2201pub const CL_COMMAND_TERMINATION_COMPLETION_ARM: cl_command_termination_reason_arm = 0;
2202pub const CL_COMMAND_TERMINATION_CONTROLLED_SUCCESS_ARM: cl_command_termination_reason_arm = 1;
2203pub const CL_COMMAND_TERMINATION_CONTROLLED_FAILURE_ARM: cl_command_termination_reason_arm = 2;
2204pub const CL_COMMAND_TERMINATION_ERROR_ARM: cl_command_termination_reason_arm = 3;
2205
2206// cl_arm_protected_memory_allocation
2207pub const CL_MEM_PROTECTED_ALLOC_ARM: cl_bitfield = 1 << 36;
2208
2209// cl_intel_exec_by_local_thread extension
2210pub const CL_QUEUE_THREAD_LOCAL_EXEC_ENABLE_INTEL: cl_bitfield = 1 << 31;
2211
2212// cl_intel_device_attribute_query
2213pub type cl_device_feature_capabilities_intel = cl_bitfield;
2214pub const CL_DEVICE_FEATURE_FLAG_DP4A_INTEL: cl_device_feature_capabilities_intel = 1 << 0;
2215pub const CL_DEVICE_FEATURE_FLAG_DPAS_INTEL: cl_device_feature_capabilities_intel = 1 << 1;
2216
2217// cl_device_info
2218pub const CL_DEVICE_IP_VERSION_INTEL: cl_device_info = 0x4250;
2219pub const CL_DEVICE_ID_INTEL: cl_device_info = 0x4251;
2220pub const CL_DEVICE_NUM_SLICES_INTEL: cl_device_info = 0x4252;
2221pub const CL_DEVICE_NUM_SUB_SLICES_PER_SLICE_INTEL: cl_device_info = 0x4253;
2222pub const CL_DEVICE_NUM_EUS_PER_SUB_SLICE_INTEL: cl_device_info = 0x4254;
2223pub const CL_DEVICE_NUM_THREADS_PER_EU_INTEL: cl_device_info = 0x4255;
2224pub const CL_DEVICE_FEATURE_CAPABILITIES_INTEL: cl_device_info = 0x4256;
2225
2226// cl_intel_device_partition_by_names extension
2227
2228pub const CL_DEVICE_PARTITION_BY_NAMES_INTEL: cl_device_info = 0x4052;
2229pub const CL_PARTITION_BY_NAMES_LIST_END_INTEL: cl_int = -1;
2230
2231// cl_intel_accelerator extension
2232// cl_intel_motion_estimation extension
2233// cl_intel_advanced_motion_estimation extension
2234
2235pub type cl_accelerator_intel = *mut c_void;
2236pub type cl_accelerator_type_intel = cl_uint;
2237pub type cl_accelerator_info_intel = cl_uint;
2238
2239#[repr(C)]
2240#[derive(Debug, Copy, Clone, Default)]
2241pub struct cl_motion_estimation_desc_intel {
2242    pub mb_block_type: cl_uint,
2243    pub subpixel_mode: cl_uint,
2244    pub sad_adjust_mode: cl_uint,
2245    pub search_path_type: cl_uint,
2246}
2247
2248// error codes
2249pub const CL_INVALID_ACCELERATOR_INTEL: cl_int = -1094;
2250pub const CL_INVALID_ACCELERATOR_TYPE_INTEL: cl_int = -1095;
2251pub const CL_INVALID_ACCELERATOR_DESCRIPTOR_INTEL: cl_int = -1096;
2252pub const CL_ACCELERATOR_TYPE_NOT_SUPPORTED_INTEL: cl_int = -1097;
2253
2254// cl_accelerator_type_intel
2255pub const CL_ACCELERATOR_TYPE_MOTION_ESTIMATION_INTEL: cl_accelerator_type_intel = 0x0;
2256
2257// cl_accelerator_info_intel
2258pub const CL_ACCELERATOR_DESCRIPTOR_INTEL: cl_accelerator_info_intel = 0x4090;
2259pub const CL_ACCELERATOR_REFERENCE_COUNT_INTEL: cl_accelerator_info_intel = 0x4091;
2260pub const CL_ACCELERATOR_CONTEXT_INTEL: cl_accelerator_info_intel = 0x4092;
2261pub const CL_ACCELERATOR_TYPE_INTEL: cl_accelerator_info_intel = 0x4093;
2262
2263// cl_motion_detect_desc_intel flags
2264pub type cl_motion_detect_desc_intel = cl_uint;
2265pub const CL_ME_MB_TYPE_16x16_INTEL: cl_motion_detect_desc_intel = 0x0;
2266pub const CL_ME_MB_TYPE_8x8_INTEL: cl_motion_detect_desc_intel = 0x1;
2267pub const CL_ME_MB_TYPE_4x4_INTEL: cl_motion_detect_desc_intel = 0x2;
2268
2269pub const CL_ME_SUBPIXEL_MODE_INTEGER_INTEL: cl_motion_detect_desc_intel = 0x0;
2270pub const CL_ME_SUBPIXEL_MODE_HPEL_INTEL: cl_motion_detect_desc_intel = 0x1;
2271pub const CL_ME_SUBPIXEL_MODE_QPEL_INTEL: cl_motion_detect_desc_intel = 0x2;
2272
2273pub const CL_ME_SAD_ADJUST_MODE_NONE_INTEL: cl_motion_detect_desc_intel = 0x0;
2274pub const CL_ME_SAD_ADJUST_MODE_HAAR_INTEL: cl_motion_detect_desc_intel = 0x1;
2275
2276pub const CL_ME_SEARCH_PATH_RADIUS_2_2_INTEL: cl_motion_detect_desc_intel = 0x0;
2277pub const CL_ME_SEARCH_PATH_RADIUS_4_4_INTEL: cl_motion_detect_desc_intel = 0x1;
2278pub const CL_ME_SEARCH_PATH_RADIUS_16_12_INTEL: cl_motion_detect_desc_intel = 0x5;
2279
2280pub const CL_ME_SKIP_BLOCK_TYPE_16x16_INTEL: cl_motion_detect_desc_intel = 0x0;
2281pub const CL_ME_CHROMA_INTRA_PREDICT_ENABLED_INTEL: cl_motion_detect_desc_intel = 0x1;
2282pub const CL_ME_LUMA_INTRA_PREDICT_ENABLED_INTEL: cl_motion_detect_desc_intel = 0x2;
2283pub const CL_ME_SKIP_BLOCK_TYPE_8x8_INTEL: cl_motion_detect_desc_intel = 0x4;
2284
2285pub const CL_ME_FORWARD_INPUT_MODE_INTEL: cl_motion_detect_desc_intel = 0x1;
2286pub const CL_ME_BACKWARD_INPUT_MODE_INTEL: cl_motion_detect_desc_intel = 0x2;
2287pub const CL_ME_BIDIRECTION_INPUT_MODE_INTEL: cl_motion_detect_desc_intel = 0x3;
2288
2289pub const CL_ME_BIDIR_WEIGHT_QUARTER_INTEL: cl_motion_detect_desc_intel = 16;
2290pub const CL_ME_BIDIR_WEIGHT_THIRD_INTEL: cl_motion_detect_desc_intel = 21;
2291pub const CL_ME_BIDIR_WEIGHT_HALF_INTEL: cl_motion_detect_desc_intel = 32;
2292pub const CL_ME_BIDIR_WEIGHT_TWO_THIRD_INTEL: cl_motion_detect_desc_intel = 43;
2293pub const CL_ME_BIDIR_WEIGHT_THREE_QUARTER_INTEL: cl_motion_detect_desc_intel = 48;
2294
2295pub const CL_ME_COST_PENALTY_NONE_INTEL: cl_motion_detect_desc_intel = 0x0;
2296pub const CL_ME_COST_PENALTY_LOW_INTEL: cl_motion_detect_desc_intel = 0x1;
2297pub const CL_ME_COST_PENALTY_NORMAL_INTEL: cl_motion_detect_desc_intel = 0x2;
2298pub const CL_ME_COST_PENALTY_HIGH_INTEL: cl_motion_detect_desc_intel = 0x3;
2299
2300pub const CL_ME_COST_PRECISION_QPEL_INTEL: cl_motion_detect_desc_intel = 0x0;
2301pub const CL_ME_COST_PRECISION_HPEL_INTEL: cl_motion_detect_desc_intel = 0x1;
2302pub const CL_ME_COST_PRECISION_PEL_INTEL: cl_motion_detect_desc_intel = 0x2;
2303pub const CL_ME_COST_PRECISION_DPEL_INTEL: cl_motion_detect_desc_intel = 0x3;
2304
2305pub const CL_ME_LUMA_PREDICTOR_MODE_VERTICAL_INTEL: cl_motion_detect_desc_intel = 0x0;
2306pub const CL_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_INTEL: cl_motion_detect_desc_intel = 0x1;
2307pub const CL_ME_LUMA_PREDICTOR_MODE_DC_INTEL: cl_motion_detect_desc_intel = 0x2;
2308pub const CL_ME_LUMA_PREDICTOR_MODE_DIAGONAL_DOWN_LEFT_INTEL: cl_motion_detect_desc_intel = 0x3;
2309
2310pub const CL_ME_LUMA_PREDICTOR_MODE_DIAGONAL_DOWN_RIGHT_INTEL: cl_motion_detect_desc_intel = 0x4;
2311pub const CL_ME_LUMA_PREDICTOR_MODE_PLANE_INTEL: cl_motion_detect_desc_intel = 0x4;
2312pub const CL_ME_LUMA_PREDICTOR_MODE_VERTICAL_RIGHT_INTEL: cl_motion_detect_desc_intel = 0x5;
2313pub const CL_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_DOWN_INTEL: cl_motion_detect_desc_intel = 0x6;
2314pub const CL_ME_LUMA_PREDICTOR_MODE_VERTICAL_LEFT_INTEL: cl_motion_detect_desc_intel = 0x7;
2315pub const CL_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_UP_INTEL: cl_motion_detect_desc_intel = 0x8;
2316
2317pub const CL_ME_CHROMA_PREDICTOR_MODE_DC_INTEL: cl_motion_detect_desc_intel = 0x0;
2318pub const CL_ME_CHROMA_PREDICTOR_MODE_HORIZONTAL_INTEL: cl_motion_detect_desc_intel = 0x1;
2319pub const CL_ME_CHROMA_PREDICTOR_MODE_VERTICAL_INTEL: cl_motion_detect_desc_intel = 0x2;
2320pub const CL_ME_CHROMA_PREDICTOR_MODE_PLANE_INTEL: cl_motion_detect_desc_intel = 0x3;
2321
2322// cl_device_info
2323pub const CL_DEVICE_ME_VERSION_INTEL: cl_device_info = 0x407E;
2324
2325pub const CL_ME_VERSION_LEGACY_INTEL: cl_uint = 0x0;
2326pub const CL_ME_VERSION_ADVANCED_VER_1_INTEL: cl_uint = 0x1;
2327pub const CL_ME_VERSION_ADVANCED_VER_2_INTEL: cl_uint = 0x2;
2328
2329pub type clCreateAcceleratorINTEL_t = Option<
2330    unsafe extern "C" fn(
2331        context: cl_context,
2332        accelerator_type: cl_accelerator_type_intel,
2333        descriptor_size: size_t,
2334        descriptor: *const c_void,
2335        errcode_ret: *mut cl_int,
2336    ) -> cl_accelerator_intel,
2337>;
2338pub type clCreateAcceleratorINTEL_fn = clCreateAcceleratorINTEL_t;
2339
2340pub type clGetAcceleratorInfoINTEL_t = Option<
2341    unsafe extern "C" fn(
2342        accelerator: cl_accelerator_intel,
2343        param_name: cl_accelerator_info_intel,
2344        param_value_size: size_t,
2345        param_value: *mut c_void,
2346        param_value_size_ret: *mut size_t,
2347    ) -> cl_int,
2348>;
2349pub type clGetAcceleratorInfoINTEL_fn = clGetAcceleratorInfoINTEL_t;
2350
2351pub type clRetainAcceleratorINTEL_t =
2352    Option<unsafe extern "C" fn(accelerator: cl_accelerator_intel) -> cl_int>;
2353pub type clRetainAcceleratorINTEL_fn = clRetainAcceleratorINTEL_t;
2354
2355pub type clReleaseAcceleratorINTEL_t =
2356    Option<unsafe extern "C" fn(accelerator: cl_accelerator_intel) -> cl_int>;
2357pub type clReleaseAcceleratorINTEL_fn = clReleaseAcceleratorINTEL_t;
2358
2359#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
2360#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
2361#[cfg(feature = "cl_intel_accelerator")]
2362#[cfg(feature = "static")]
2363extern "system" {
2364    pub fn clCreateAcceleratorINTEL(
2365        context: cl_context,
2366        accelerator_type: cl_accelerator_type_intel,
2367        descriptor_size: size_t,
2368        descriptor: *const c_void,
2369        errcode_ret: *mut cl_int,
2370    ) -> cl_accelerator_intel;
2371
2372    pub fn clGetAcceleratorInfoINTEL(
2373        accelerator: cl_accelerator_intel,
2374        param_name: cl_accelerator_info_intel,
2375        param_value_size: size_t,
2376        param_value: *mut c_void,
2377        param_value_size_ret: *mut size_t,
2378    ) -> cl_int;
2379
2380    pub fn clRetainAcceleratorINTEL(accelerator: cl_accelerator_intel) -> cl_int;
2381
2382    pub fn clReleaseAcceleratorINTEL(accelerator: cl_accelerator_intel) -> cl_int;
2383}
2384
2385// cl_intel_simultaneous_sharing extension
2386pub const CL_DEVICE_SIMULTANEOUS_INTEROPS_INTEL: cl_uint = 0x4104;
2387pub const CL_DEVICE_NUM_SIMULTANEOUS_INTEROPS_INTEL: cl_uint = 0x4105;
2388
2389// cl_intel_egl_image_yuv extension
2390pub const CL_EGL_YUV_PLANE_INTEL: cl_uint = 0x4107;
2391
2392// cl_intel_packed_yuv extension
2393pub const CL_YUYV_INTEL: cl_uint = 0x4076;
2394pub const CL_UYVY_INTEL: cl_uint = 0x4077;
2395pub const CL_YVYU_INTEL: cl_uint = 0x4078;
2396pub const CL_VYUY_INTEL: cl_uint = 0x4079;
2397
2398// cl_intel_required_subgroup_size extension
2399pub const CL_DEVICE_SUB_GROUP_SIZES_INTEL: cl_uint = 0x4108;
2400pub const CL_KERNEL_SPILL_MEM_SIZE_INTEL: cl_uint = 0x4109;
2401pub const CL_KERNEL_COMPILE_SUB_GROUP_SIZE_INTEL: cl_uint = 0x410A;
2402
2403// cl_intel_driver_diagnostics extension
2404pub const CL_CONTEXT_SHOW_DIAGNOSTICS_INTEL: cl_uint = 0x4106;
2405
2406pub type cl_diagnostic_verbose_level_intel = cl_bitfield;
2407pub const CL_CONTEXT_DIAGNOSTICS_LEVEL_ALL_INTEL: cl_diagnostic_verbose_level_intel = 0xff;
2408pub const CL_CONTEXT_DIAGNOSTICS_LEVEL_GOOD_INTEL: cl_diagnostic_verbose_level_intel = 1;
2409pub const CL_CONTEXT_DIAGNOSTICS_LEVEL_BAD_INTEL: cl_diagnostic_verbose_level_intel = 1 << 1;
2410pub const CL_CONTEXT_DIAGNOSTICS_LEVEL_NEUTRAL_INTEL: cl_diagnostic_verbose_level_intel = 1 << 2;
2411
2412// cl_intel_planar_yuv extension
2413pub const CL_NV12_INTEL: cl_uint = 0x410E;
2414
2415pub const CL_MEM_NO_ACCESS_INTEL: cl_uint = 1 << 24;
2416pub const CL_MEM_ACCESS_FLAGS_UNRESTRICTED_INTEL: cl_uint = 1 << 25;
2417
2418pub const CL_DEVICE_PLANAR_YUV_MAX_WIDTH_INTEL: cl_uint = 0x417E;
2419pub const CL_DEVICE_PLANAR_YUV_MAX_HEIGHT_INTEL: cl_uint = 0x417F;
2420
2421// cl_intel_device_side_avc_motion_estimation extension
2422pub type cl_intel_avc_motion_estimation = cl_uint;
2423
2424pub const CL_DEVICE_AVC_ME_VERSION_INTEL: cl_uint = 0x410B;
2425pub const CL_DEVICE_AVC_ME_SUPPORTS_TEXTURE_SAMPLER_USE_INTEL: cl_uint = 0x410C;
2426pub const CL_DEVICE_AVC_ME_SUPPORTS_PREEMPTION_INTEL: cl_uint = 0x410D;
2427
2428pub const CL_AVC_ME_VERSION_0_INTEL: cl_intel_avc_motion_estimation = 0x0; // No support.
2429pub const CL_AVC_ME_VERSION_1_INTEL: cl_intel_avc_motion_estimation = 0x1; // First supported version.
2430
2431pub const CL_AVC_ME_MAJOR_16x16_INTEL: cl_intel_avc_motion_estimation = 0x0;
2432pub const CL_AVC_ME_MAJOR_16x8_INTEL: cl_intel_avc_motion_estimation = 0x1;
2433pub const CL_AVC_ME_MAJOR_8x16_INTEL: cl_intel_avc_motion_estimation = 0x2;
2434pub const CL_AVC_ME_MAJOR_8x8_INTEL: cl_intel_avc_motion_estimation = 0x3;
2435
2436pub const CL_AVC_ME_MINOR_8x8_INTEL: cl_intel_avc_motion_estimation = 0x0;
2437pub const CL_AVC_ME_MINOR_8x4_INTEL: cl_intel_avc_motion_estimation = 0x1;
2438pub const CL_AVC_ME_MINOR_4x8_INTEL: cl_intel_avc_motion_estimation = 0x2;
2439pub const CL_AVC_ME_MINOR_4x4_INTEL: cl_intel_avc_motion_estimation = 0x3;
2440
2441pub const CL_AVC_ME_MAJOR_FORWARD_INTEL: cl_intel_avc_motion_estimation = 0x0;
2442pub const CL_AVC_ME_MAJOR_BACKWARD_INTEL: cl_intel_avc_motion_estimation = 0x1;
2443pub const CL_AVC_ME_MAJOR_BIDIRECTIONAL_INTEL: cl_intel_avc_motion_estimation = 0x2;
2444
2445pub const CL_AVC_ME_PARTITION_MASK_ALL_INTEL: cl_intel_avc_motion_estimation = 0x0;
2446pub const CL_AVC_ME_PARTITION_MASK_16x16_INTEL: cl_intel_avc_motion_estimation = 0x7E;
2447pub const CL_AVC_ME_PARTITION_MASK_16x8_INTEL: cl_intel_avc_motion_estimation = 0x7D;
2448pub const CL_AVC_ME_PARTITION_MASK_8x16_INTEL: cl_intel_avc_motion_estimation = 0x7B;
2449pub const CL_AVC_ME_PARTITION_MASK_8x8_INTEL: cl_intel_avc_motion_estimation = 0x77;
2450pub const CL_AVC_ME_PARTITION_MASK_8x4_INTEL: cl_intel_avc_motion_estimation = 0x6F;
2451pub const CL_AVC_ME_PARTITION_MASK_4x8_INTEL: cl_intel_avc_motion_estimation = 0x5F;
2452pub const CL_AVC_ME_PARTITION_MASK_4x4_INTEL: cl_intel_avc_motion_estimation = 0x3F;
2453
2454pub const CL_AVC_ME_SEARCH_WINDOW_EXHAUSTIVE_INTEL: cl_intel_avc_motion_estimation = 0x0;
2455pub const CL_AVC_ME_SEARCH_WINDOW_SMALL_INTEL: cl_intel_avc_motion_estimation = 0x1;
2456pub const CL_AVC_ME_SEARCH_WINDOW_TINY_INTEL: cl_intel_avc_motion_estimation = 0x2;
2457pub const CL_AVC_ME_SEARCH_WINDOW_EXTRA_TINY_INTEL: cl_intel_avc_motion_estimation = 0x3;
2458pub const CL_AVC_ME_SEARCH_WINDOW_DIAMOND_INTEL: cl_intel_avc_motion_estimation = 0x4;
2459pub const CL_AVC_ME_SEARCH_WINDOW_LARGE_DIAMOND_INTEL: cl_intel_avc_motion_estimation = 0x5;
2460pub const CL_AVC_ME_SEARCH_WINDOW_RESERVED0_INTEL: cl_intel_avc_motion_estimation = 0x6;
2461pub const CL_AVC_ME_SEARCH_WINDOW_RESERVED1_INTEL: cl_intel_avc_motion_estimation = 0x7;
2462pub const CL_AVC_ME_SEARCH_WINDOW_CUSTOM_INTEL: cl_intel_avc_motion_estimation = 0x8;
2463pub const CL_AVC_ME_SEARCH_WINDOW_16x12_RADIUS_INTEL: cl_intel_avc_motion_estimation = 0x9;
2464pub const CL_AVC_ME_SEARCH_WINDOW_4x4_RADIUS_INTEL: cl_intel_avc_motion_estimation = 0x2;
2465pub const CL_AVC_ME_SEARCH_WINDOW_2x2_RADIUS_INTEL: cl_intel_avc_motion_estimation = 0xa;
2466
2467pub const CL_AVC_ME_SAD_ADJUST_MODE_NONE_INTEL: cl_intel_avc_motion_estimation = 0x0;
2468pub const CL_AVC_ME_SAD_ADJUST_MODE_HAAR_INTEL: cl_intel_avc_motion_estimation = 0x2;
2469
2470pub const CL_AVC_ME_SUBPIXEL_MODE_INTEGER_INTEL: cl_intel_avc_motion_estimation = 0x0;
2471pub const CL_AVC_ME_SUBPIXEL_MODE_HPEL_INTEL: cl_intel_avc_motion_estimation = 0x1;
2472pub const CL_AVC_ME_SUBPIXEL_MODE_QPEL_INTEL: cl_intel_avc_motion_estimation = 0x3;
2473
2474pub const CL_AVC_ME_COST_PRECISION_QPEL_INTEL: cl_intel_avc_motion_estimation = 0x0;
2475pub const CL_AVC_ME_COST_PRECISION_HPEL_INTEL: cl_intel_avc_motion_estimation = 0x1;
2476pub const CL_AVC_ME_COST_PRECISION_PEL_INTEL: cl_intel_avc_motion_estimation = 0x2;
2477pub const CL_AVC_ME_COST_PRECISION_DPEL_INTEL: cl_intel_avc_motion_estimation = 0x3;
2478
2479pub const CL_AVC_ME_BIDIR_WEIGHT_QUARTER_INTEL: cl_intel_avc_motion_estimation = 0x10;
2480pub const CL_AVC_ME_BIDIR_WEIGHT_THIRD_INTEL: cl_intel_avc_motion_estimation = 0x15;
2481pub const CL_AVC_ME_BIDIR_WEIGHT_HALF_INTEL: cl_intel_avc_motion_estimation = 0x20;
2482pub const CL_AVC_ME_BIDIR_WEIGHT_TWO_THIRD_INTEL: cl_intel_avc_motion_estimation = 0x2B;
2483pub const CL_AVC_ME_BIDIR_WEIGHT_THREE_QUARTER_INTEL: cl_intel_avc_motion_estimation = 0x30;
2484
2485pub const CL_AVC_ME_BORDER_REACHED_LEFT_INTEL: cl_intel_avc_motion_estimation = 0x0;
2486pub const CL_AVC_ME_BORDER_REACHED_RIGHT_INTEL: cl_intel_avc_motion_estimation = 0x2;
2487pub const CL_AVC_ME_BORDER_REACHED_TOP_INTEL: cl_intel_avc_motion_estimation = 0x4;
2488pub const CL_AVC_ME_BORDER_REACHED_BOTTOM_INTEL: cl_intel_avc_motion_estimation = 0x8;
2489
2490pub const CL_AVC_ME_SKIP_BLOCK_PARTITION_16x16_INTEL: cl_intel_avc_motion_estimation = 0x0;
2491pub const CL_AVC_ME_SKIP_BLOCK_PARTITION_8x8_INTEL: cl_intel_avc_motion_estimation = 0x4000;
2492
2493pub const CL_AVC_ME_SKIP_BLOCK_16x16_FORWARD_ENABLE_INTEL: cl_intel_avc_motion_estimation =
2494    0x1 << 24;
2495pub const CL_AVC_ME_SKIP_BLOCK_16x16_BACKWARD_ENABLE_INTEL: cl_intel_avc_motion_estimation =
2496    0x2 << 24;
2497pub const CL_AVC_ME_SKIP_BLOCK_16x16_DUAL_ENABLE_INTEL: cl_intel_avc_motion_estimation = 0x3 << 24;
2498pub const CL_AVC_ME_SKIP_BLOCK_8x8_FORWARD_ENABLE_INTEL: cl_intel_avc_motion_estimation =
2499    0x55 << 24;
2500pub const CL_AVC_ME_SKIP_BLOCK_8x8_BACKWARD_ENABLE_INTEL: cl_intel_avc_motion_estimation =
2501    0xAA << 24;
2502pub const CL_AVC_ME_SKIP_BLOCK_8x8_DUAL_ENABLE_INTEL: cl_intel_avc_motion_estimation = 0xFF << 24;
2503pub const CL_AVC_ME_SKIP_BLOCK_8x8_0_FORWARD_ENABLE_INTEL: cl_intel_avc_motion_estimation =
2504    0x1 << 24;
2505pub const CL_AVC_ME_SKIP_BLOCK_8x8_0_BACKWARD_ENABLE_INTEL: cl_intel_avc_motion_estimation =
2506    0x2 << 24;
2507pub const CL_AVC_ME_SKIP_BLOCK_8x8_1_FORWARD_ENABLE_INTEL: cl_intel_avc_motion_estimation =
2508    0x1 << 26;
2509pub const CL_AVC_ME_SKIP_BLOCK_8x8_1_BACKWARD_ENABLE_INTEL: cl_intel_avc_motion_estimation =
2510    0x2 << 26;
2511pub const CL_AVC_ME_SKIP_BLOCK_8x8_2_FORWARD_ENABLE_INTEL: cl_intel_avc_motion_estimation =
2512    0x1 << 28;
2513pub const CL_AVC_ME_SKIP_BLOCK_8x8_2_BACKWARD_ENABLE_INTEL: cl_intel_avc_motion_estimation =
2514    0x2 << 28;
2515pub const CL_AVC_ME_SKIP_BLOCK_8x8_3_FORWARD_ENABLE_INTEL: cl_intel_avc_motion_estimation =
2516    0x1 << 30;
2517pub const CL_AVC_ME_SKIP_BLOCK_8x8_3_BACKWARD_ENABLE_INTEL: cl_intel_avc_motion_estimation =
2518    0x2 << 30;
2519
2520pub const CL_AVC_ME_BLOCK_BASED_SKIP_4x4_INTEL: cl_intel_avc_motion_estimation = 0x00;
2521pub const CL_AVC_ME_BLOCK_BASED_SKIP_8x8_INTEL: cl_intel_avc_motion_estimation = 0x80;
2522
2523pub const CL_AVC_ME_INTRA_16x16_INTEL: cl_intel_avc_motion_estimation = 0x0;
2524pub const CL_AVC_ME_INTRA_8x8_INTEL: cl_intel_avc_motion_estimation = 0x1;
2525pub const CL_AVC_ME_INTRA_4x4_INTEL: cl_intel_avc_motion_estimation = 0x2;
2526
2527pub const CL_AVC_ME_INTRA_LUMA_PARTITION_MASK_16x16_INTEL: cl_intel_avc_motion_estimation = 0x6;
2528pub const CL_AVC_ME_INTRA_LUMA_PARTITION_MASK_8x8_INTEL: cl_intel_avc_motion_estimation = 0x5;
2529pub const CL_AVC_ME_INTRA_LUMA_PARTITION_MASK_4x4_INTEL: cl_intel_avc_motion_estimation = 0x3;
2530
2531pub const CL_AVC_ME_INTRA_NEIGHBOR_LEFT_MASK_ENABLE_INTEL: cl_intel_avc_motion_estimation = 0x60;
2532pub const CL_AVC_ME_INTRA_NEIGHBOR_UPPER_MASK_ENABLE_INTEL: cl_intel_avc_motion_estimation = 0x10;
2533pub const CL_AVC_ME_INTRA_NEIGHBOR_UPPER_RIGHT_MASK_ENABLE_INTEL: cl_intel_avc_motion_estimation =
2534    0x8;
2535pub const CL_AVC_ME_INTRA_NEIGHBOR_UPPER_LEFT_MASK_ENABLE_INTEL: cl_intel_avc_motion_estimation =
2536    0x4;
2537
2538pub const CL_AVC_ME_LUMA_PREDICTOR_MODE_VERTICAL_INTEL: cl_intel_avc_motion_estimation = 0x0;
2539pub const CL_AVC_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_INTEL: cl_intel_avc_motion_estimation = 0x1;
2540pub const CL_AVC_ME_LUMA_PREDICTOR_MODE_DC_INTEL: cl_intel_avc_motion_estimation = 0x2;
2541pub const CL_AVC_ME_LUMA_PREDICTOR_MODE_DIAGONAL_DOWN_LEFT_INTEL: cl_intel_avc_motion_estimation =
2542    0x3;
2543pub const CL_AVC_ME_LUMA_PREDICTOR_MODE_DIAGONAL_DOWN_RIGHT_INTEL: cl_intel_avc_motion_estimation =
2544    0x4;
2545pub const CL_AVC_ME_LUMA_PREDICTOR_MODE_PLANE_INTEL: cl_intel_avc_motion_estimation = 0x4;
2546pub const CL_AVC_ME_LUMA_PREDICTOR_MODE_VERTICAL_RIGHT_INTEL: cl_intel_avc_motion_estimation = 0x5;
2547pub const CL_AVC_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_DOWN_INTEL: cl_intel_avc_motion_estimation = 0x6;
2548pub const CL_AVC_ME_LUMA_PREDICTOR_MODE_VERTICAL_LEFT_INTEL: cl_intel_avc_motion_estimation = 0x7;
2549pub const CL_AVC_ME_LUMA_PREDICTOR_MODE_HORIZONTAL_UP_INTEL: cl_intel_avc_motion_estimation = 0x8;
2550pub const CL_AVC_ME_CHROMA_PREDICTOR_MODE_DC_INTEL: cl_intel_avc_motion_estimation = 0x0;
2551pub const CL_AVC_ME_CHROMA_PREDICTOR_MODE_HORIZONTAL_INTEL: cl_intel_avc_motion_estimation = 0x1;
2552pub const CL_AVC_ME_CHROMA_PREDICTOR_MODE_VERTICAL_INTEL: cl_intel_avc_motion_estimation = 0x2;
2553pub const CL_AVC_ME_CHROMA_PREDICTOR_MODE_PLANE_INTEL: cl_intel_avc_motion_estimation = 0x3;
2554
2555pub const CL_AVC_ME_FRAME_FORWARD_INTEL: cl_intel_avc_motion_estimation = 0x1;
2556pub const CL_AVC_ME_FRAME_BACKWARD_INTEL: cl_intel_avc_motion_estimation = 0x2;
2557pub const CL_AVC_ME_FRAME_DUAL_INTEL: cl_intel_avc_motion_estimation = 0x3;
2558
2559pub const CL_AVC_ME_SLICE_TYPE_PRED_INTEL: cl_intel_avc_motion_estimation = 0x0;
2560pub const CL_AVC_ME_SLICE_TYPE_BPRED_INTEL: cl_intel_avc_motion_estimation = 0x1;
2561pub const CL_AVC_ME_SLICE_TYPE_INTRA_INTEL: cl_intel_avc_motion_estimation = 0x2;
2562
2563pub const CL_AVC_ME_INTERLACED_SCAN_TOP_FIELD_INTEL: cl_intel_avc_motion_estimation = 0x0;
2564pub const CL_AVC_ME_INTERLACED_SCAN_BOTTOM_FIELD_INTEL: cl_intel_avc_motion_estimation = 0x1;
2565
2566// cl_intel_unified_shared_memory extension
2567pub type cl_device_unified_shared_memory_capabilities_intel = cl_bitfield;
2568pub type cl_mem_properties_intel = cl_properties;
2569pub type cl_mem_alloc_flags_intel = cl_bitfield;
2570pub type cl_mem_info_intel = cl_uint;
2571pub type cl_unified_shared_memory_type_intel = cl_uint;
2572pub type cl_mem_advice_intel = cl_uint;
2573
2574// cl_device_info
2575pub const CL_DEVICE_HOST_MEM_CAPABILITIES_INTEL: cl_device_info = 0x4190;
2576pub const CL_DEVICE_DEVICE_MEM_CAPABILITIES_INTEL: cl_device_info = 0x4191;
2577pub const CL_DEVICE_SINGLE_DEVICE_SHARED_MEM_CAPABILITIES_INTEL: cl_device_info = 0x4192;
2578pub const CL_DEVICE_CROSS_DEVICE_SHARED_MEM_CAPABILITIES_INTEL: cl_device_info = 0x4193;
2579pub const CL_DEVICE_SHARED_SYSTEM_MEM_CAPABILITIES_INTEL: cl_device_info = 0x4194;
2580
2581// cl_device_unified_shared_memory_capabilities_intel - bitfield
2582pub const CL_UNIFIED_SHARED_MEMORY_ACCESS_INTEL:
2583    cl_device_unified_shared_memory_capabilities_intel = 1 << 0;
2584pub const CL_UNIFIED_SHARED_MEMORY_ATOMIC_ACCESS_INTEL:
2585    cl_device_unified_shared_memory_capabilities_intel = 1 << 1;
2586pub const CL_UNIFIED_SHARED_MEMORY_CONCURRENT_ACCESS_INTEL:
2587    cl_device_unified_shared_memory_capabilities_intel = 1 << 2;
2588pub const CL_UNIFIED_SHARED_MEMORY_CONCURRENT_ATOMIC_ACCESS_INTEL:
2589    cl_device_unified_shared_memory_capabilities_intel = 1 << 3;
2590
2591pub const CL_MEM_ALLOC_FLAGS_INTEL: cl_mem_properties_intel = 0x4195;
2592
2593// cl_mem_alloc_flags_intel - bitfield
2594pub const CL_MEM_ALLOC_WRITE_COMBINED_INTEL: cl_mem_alloc_flags_intel = 1 << 0;
2595pub const CL_MEM_ALLOC_INITIAL_PLACEMENT_DEVICE_INTEL: cl_mem_alloc_flags_intel = 1 << 1;
2596pub const CL_MEM_ALLOC_INITIAL_PLACEMENT_HOST_INTEL: cl_mem_alloc_flags_intel = 1 << 2;
2597
2598// cl_mem_alloc_info_intel
2599pub const CL_MEM_ALLOC_TYPE_INTEL: cl_mem_info_intel = 0x419A;
2600pub const CL_MEM_ALLOC_BASE_PTR_INTEL: cl_mem_info_intel = 0x419B;
2601pub const CL_MEM_ALLOC_SIZE_INTEL: cl_mem_info_intel = 0x419C;
2602pub const CL_MEM_ALLOC_DEVICE_INTEL: cl_mem_info_intel = 0x419D;
2603
2604// cl_unified_shared_memory_type_intel
2605pub const CL_MEM_TYPE_UNKNOWN_INTEL: cl_unified_shared_memory_type_intel = 0x4196;
2606pub const CL_MEM_TYPE_HOST_INTEL: cl_unified_shared_memory_type_intel = 0x4197;
2607pub const CL_MEM_TYPE_DEVICE_INTEL: cl_unified_shared_memory_type_intel = 0x4198;
2608pub const CL_MEM_TYPE_SHARED_INTEL: cl_unified_shared_memory_type_intel = 0x4199;
2609
2610// cl_kernel_exec_info
2611pub const CL_KERNEL_EXEC_INFO_INDIRECT_HOST_ACCESS_INTEL: cl_kernel_exec_info = 0x4200;
2612pub const CL_KERNEL_EXEC_INFO_INDIRECT_DEVICE_ACCESS_INTEL: cl_kernel_exec_info = 0x4201;
2613pub const CL_KERNEL_EXEC_INFO_INDIRECT_SHARED_ACCESS_INTEL: cl_kernel_exec_info = 0x4202;
2614pub const CL_KERNEL_EXEC_INFO_USM_PTRS_INTEL: cl_kernel_exec_info = 0x4203;
2615
2616// cl_command_type
2617pub const CL_COMMAND_MEMFILL_INTEL: cl_command_type = 0x4204;
2618pub const CL_COMMAND_MEMCPY_INTEL: cl_command_type = 0x4205;
2619pub const CL_COMMAND_MIGRATEMEM_INTEL: cl_command_type = 0x4206;
2620pub const CL_COMMAND_MEMADVISE_INTEL: cl_command_type = 0x4207;
2621
2622pub type clHostMemAllocINTEL_t = Option<
2623    unsafe extern "C" fn(
2624        context: cl_context,
2625        properties: *const cl_mem_properties_intel,
2626        size: size_t,
2627        alignment: cl_uint,
2628        errcode_ret: *mut cl_int,
2629    ) -> *mut c_void,
2630>;
2631pub type clHostMemAllocINTEL_fn = clHostMemAllocINTEL_t;
2632
2633pub type clDeviceMemAllocINTEL_t = Option<
2634    unsafe extern "C" fn(
2635        context: cl_context,
2636        device: cl_device_id,
2637        properties: *const cl_mem_properties_intel,
2638        size: size_t,
2639        alignment: cl_uint,
2640        errcode_ret: *mut cl_int,
2641    ) -> *mut c_void,
2642>;
2643pub type clDeviceMemAllocINTEL_fn = clDeviceMemAllocINTEL_t;
2644
2645pub type clSharedMemAllocINTEL_t = Option<
2646    unsafe extern "C" fn(
2647        context: cl_context,
2648        device: cl_device_id,
2649        properties: *const cl_mem_properties_intel,
2650        size: size_t,
2651        alignment: cl_uint,
2652        errcode_ret: *mut cl_int,
2653    ) -> *mut c_void,
2654>;
2655pub type clSharedMemAllocINTEL_fn = clSharedMemAllocINTEL_t;
2656
2657pub type clMemFreeINTEL_t =
2658    Option<unsafe extern "C" fn(context: cl_context, ptr: *mut c_void) -> cl_int>;
2659pub type clMemFreeINTEL_fn = clMemFreeINTEL_t;
2660
2661pub type clMemBlockingFreeINTEL_t =
2662    Option<unsafe extern "C" fn(context: cl_context, ptr: *mut c_void) -> cl_int>;
2663pub type clMemBlockingFreeINTEL_fn = clMemBlockingFreeINTEL_t;
2664
2665pub type clGetMemAllocInfoINTEL_t = Option<
2666    unsafe extern "C" fn(
2667        context: cl_context,
2668        ptr: *const c_void,
2669        param_name: cl_mem_info_intel,
2670        param_value_size: size_t,
2671        param_value: *mut c_void,
2672        param_value_size_ret: *mut size_t,
2673    ) -> cl_int,
2674>;
2675pub type clGetMemAllocInfoINTEL_fn = clGetMemAllocInfoINTEL_t;
2676
2677pub type clSetKernelArgMemPointerINTEL_t = Option<
2678    unsafe extern "C" fn(kernel: cl_kernel, arg_index: cl_uint, arg_value: *const c_void) -> cl_int,
2679>;
2680pub type clSetKernelArgMemPointerINTEL_fn = clSetKernelArgMemPointerINTEL_t;
2681
2682pub type clEnqueueMemFillINTEL_t = Option<
2683    unsafe extern "C" fn(
2684        command_queue: cl_command_queue,
2685        dst_ptr: *mut c_void,
2686        pattern: *const c_void,
2687        pattern_size: size_t,
2688        size: size_t,
2689        num_events_in_wait_list: cl_uint,
2690        event_wait_list: *const cl_event,
2691        event: *mut cl_event,
2692    ) -> cl_int,
2693>;
2694pub type clEnqueueMemFillINTEL_fn = clEnqueueMemFillINTEL_t;
2695
2696pub type clEnqueueMemcpyINTEL_t = Option<
2697    unsafe extern "C" fn(
2698        command_queue: cl_command_queue,
2699        blocking: cl_bool,
2700        dst_ptr: *mut c_void,
2701        src_ptr: *const c_void,
2702        size: size_t,
2703        num_events_in_wait_list: cl_uint,
2704        event_wait_list: *const cl_event,
2705        event: *mut cl_event,
2706    ) -> cl_int,
2707>;
2708pub type clEnqueueMemcpyINTEL_fn = clEnqueueMemcpyINTEL_t;
2709
2710pub type clEnqueueMemAdviseINTEL_t = Option<
2711    unsafe extern "C" fn(
2712        command_queue: cl_command_queue,
2713        ptr: *const c_void,
2714        size: size_t,
2715        advice: cl_mem_advice_intel,
2716        num_events_in_wait_list: cl_uint,
2717        event_wait_list: *const cl_event,
2718        event: *mut cl_event,
2719    ) -> cl_int,
2720>;
2721pub type clEnqueueMemAdviseINTEL_fn = clEnqueueMemAdviseINTEL_t;
2722
2723pub type clEnqueueMigrateMemINTEL_t = Option<
2724    unsafe extern "C" fn(
2725        command_queue: cl_command_queue,
2726        ptr: *const c_void,
2727        size: size_t,
2728        flags: cl_mem_migration_flags,
2729        num_events_in_wait_list: cl_uint,
2730        event_wait_list: *const cl_event,
2731        event: *mut cl_event,
2732    ) -> cl_int,
2733>;
2734pub type clEnqueueMigrateMemINTEL_fn = clEnqueueMigrateMemINTEL_t;
2735
2736pub type clEnqueueMemsetINTEL_t = Option<
2737    unsafe extern "C" fn(
2738        command_queue: cl_command_queue,
2739        dst_ptr: *mut c_void,
2740        value: cl_int,
2741        size: size_t,
2742        num_events_in_wait_list: cl_uint,
2743        event_wait_list: *const cl_event,
2744        event: *mut cl_event,
2745    ) -> cl_int,
2746>;
2747pub type clEnqueueMemsetINTEL_fn = clEnqueueMemsetINTEL_t;
2748
2749#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
2750#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
2751#[cfg(feature = "cl_intel_unified_shared_memory")]
2752#[cfg(feature = "static")]
2753extern "system" {
2754    pub fn clHostMemAllocINTEL(
2755        context: cl_context,
2756        properties: *const cl_mem_properties_intel,
2757        size: size_t,
2758        alignment: cl_uint,
2759        errcode_ret: *mut cl_int,
2760    ) -> *mut c_void;
2761
2762    pub fn clDeviceMemAllocINTEL(
2763        context: cl_context,
2764        device: cl_device_id,
2765        properties: *const cl_mem_properties_intel,
2766        size: size_t,
2767        alignment: cl_uint,
2768        errcode_ret: *mut cl_int,
2769    ) -> *mut c_void;
2770
2771    pub fn clSharedMemAllocINTEL(
2772        context: cl_context,
2773        device: cl_device_id,
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 clMemFreeINTEL(context: cl_context, ptr: *mut c_void) -> cl_int;
2781
2782    pub fn clMemBlockingFreeINTEL(context: cl_context, ptr: *mut c_void) -> cl_int;
2783
2784    pub fn clGetMemAllocInfoINTEL(
2785        context: cl_context,
2786        ptr: *const c_void,
2787        param_name: cl_mem_info_intel,
2788        param_value_size: size_t,
2789        param_value: *mut c_void,
2790        param_value_size_ret: *mut size_t,
2791    ) -> cl_int;
2792
2793    pub fn clSetKernelArgMemPointerINTEL(
2794        kernel: cl_kernel,
2795        arg_index: cl_uint,
2796        arg_value: *const c_void,
2797    ) -> cl_int;
2798
2799    pub fn clEnqueueMemFillINTEL(
2800        command_queue: cl_command_queue,
2801        dst_ptr: *mut c_void,
2802        pattern: *const c_void,
2803        pattern_size: size_t,
2804        size: size_t,
2805        num_events_in_wait_list: cl_uint,
2806        event_wait_list: *const cl_event,
2807        event: *mut cl_event,
2808    ) -> cl_int;
2809
2810    pub fn clEnqueueMemcpyINTEL(
2811        command_queue: cl_command_queue,
2812        blocking: cl_bool,
2813        dst_ptr: *mut c_void,
2814        src_ptr: *const c_void,
2815        size: size_t,
2816        num_events_in_wait_list: cl_uint,
2817        event_wait_list: *const cl_event,
2818        event: *mut cl_event,
2819    ) -> cl_int;
2820
2821    pub fn clEnqueueMemAdviseINTEL(
2822        command_queue: cl_command_queue,
2823        ptr: *const c_void,
2824        size: size_t,
2825        advice: cl_mem_advice_intel,
2826        num_events_in_wait_list: cl_uint,
2827        event_wait_list: *const cl_event,
2828        event: *mut cl_event,
2829    ) -> cl_int;
2830
2831    pub fn clEnqueueMigrateMemINTEL(
2832        command_queue: cl_command_queue,
2833        ptr: *const c_void,
2834        size: size_t,
2835        flags: cl_mem_migration_flags,
2836        num_events_in_wait_list: cl_uint,
2837        event_wait_list: *const cl_event,
2838        event: *mut cl_event,
2839    ) -> cl_int;
2840
2841    pub fn clEnqueueMemsetINTEL(
2842        command_queue: cl_command_queue,
2843        dst_ptr: *mut c_void,
2844        value: cl_int,
2845        size: size_t,
2846        num_events_in_wait_list: cl_uint,
2847        event_wait_list: *const cl_event,
2848        event: *mut cl_event,
2849    ) -> cl_int;
2850}
2851
2852// cl_intel_mem_alloc_buffer_location
2853
2854// cl_mem_properties_intel
2855pub const CL_MEM_ALLOC_BUFFER_LOCATION_INTEL: cl_mem_properties_intel = 0x419E;
2856
2857// cl_intel_create_buffer_with_properties extension
2858
2859pub type clCreateBufferWithPropertiesINTEL_t = Option<
2860    unsafe extern "C" fn(
2861        context: cl_context,
2862        properties: *const cl_mem_properties_intel,
2863        flags: cl_mem_flags,
2864        size: size_t,
2865        host_ptr: *mut c_void,
2866        errcode_ret: *mut cl_int,
2867    ) -> cl_mem,
2868>;
2869pub type clCreateBufferWithPropertiesINTEL_fn = clCreateBufferWithPropertiesINTEL_t;
2870
2871#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
2872#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
2873#[cfg(feature = "cl_intel_create_buffer_with_properties")]
2874#[cfg(feature = "static")]
2875extern "system" {
2876
2877    pub fn clCreateBufferWithPropertiesINTEL(
2878        context: cl_context,
2879        properties: *const cl_mem_properties_intel,
2880        flags: cl_mem_flags,
2881        size: size_t,
2882        host_ptr: *mut c_void,
2883        errcode_ret: *mut cl_int,
2884    ) -> cl_mem;
2885}
2886
2887// cl_intel_program_scope_host_pipe
2888
2889// clGetEventInfo response when param_name is CL_EVENT_COMMAND_TYPE
2890pub const CL_COMMAND_READ_HOST_PIPE_INTEL: cl_uint = 0x4214;
2891pub const CL_COMMAND_WRITE_HOST_PIPE_INTEL: cl_uint = 0x4215;
2892
2893// clGetProgramInfo param_name
2894pub const CL_PROGRAM_NUM_HOST_PIPES_INTEL: cl_program_info = 0x4216;
2895pub const CL_PROGRAM_HOST_PIPE_NAMES_INTEL: cl_program_info = 0x4217;
2896
2897pub type clEnqueueReadHostPipeINTEL_t = Option<
2898    unsafe extern "C" fn(
2899        command_queue: cl_command_queue,
2900        program: cl_program,
2901        pipe_symbol: *const c_char,
2902        blocking_read: cl_bool,
2903        ptr: *mut c_void,
2904        size: size_t,
2905        num_events_in_wait_list: cl_uint,
2906        event_wait_list: *const cl_event,
2907        event: *mut cl_event,
2908    ) -> cl_int,
2909>;
2910pub type clEnqueueReadHostPipeINTEL_fn = clEnqueueReadHostPipeINTEL_t;
2911
2912pub type clEnqueueWriteHostPipeINTEL_t = Option<
2913    unsafe extern "C" fn(
2914        command_queue: cl_command_queue,
2915        program: cl_program,
2916        pipe_symbol: *const c_char,
2917        blocking_write: cl_bool,
2918        ptr: *const c_void,
2919        size: size_t,
2920        num_events_in_wait_list: cl_uint,
2921        event_wait_list: *const cl_event,
2922        event: *mut cl_event,
2923    ) -> cl_int,
2924>;
2925pub type clEnqueueWriteHostPipeINTEL_fn = clEnqueueWriteHostPipeINTEL_t;
2926
2927#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
2928#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
2929#[cfg(feature = "cl_intel_program_scope_host_pipe")]
2930#[cfg(feature = "static")]
2931extern "system" {
2932
2933    pub fn clEnqueueReadHostPipeINTEL(
2934        queue: cl_command_queue,
2935        program: cl_program,
2936        pipe_symbol: *const c_char,
2937        blocking_read: cl_bool,
2938        ptr: *mut c_void,
2939        size: size_t,
2940        num_events_in_wait_list: cl_uint,
2941        event_wait_list: *const cl_event,
2942        event: *mut cl_event,
2943    ) -> cl_int;
2944
2945    pub fn clEnqueueWriteHostPipeINTEL(
2946        queue: cl_command_queue,
2947        program: cl_program,
2948        pipe_symbol: *const c_char,
2949        blocking_write: cl_bool,
2950        ptr: *const c_void,
2951        size: size_t,
2952        num_events_in_wait_list: cl_uint,
2953        event_wait_list: *const cl_event,
2954        event: *mut cl_event,
2955    ) -> cl_int;
2956}
2957
2958// cl_intel_mem_channel_property extension
2959
2960pub const CL_MEM_CHANNEL_INTEL: cl_uint = 0x4213;
2961
2962// cl_intel_mem_force_host_memory
2963
2964// cl_mem_flags
2965pub const CL_MEM_FORCE_HOST_MEMORY_INTEL: cl_mem_flags = 1 << 20;
2966
2967// cl_intel_command_queue_families
2968
2969pub type cl_command_queue_capabilities_intel = cl_bitfield;
2970
2971pub const CL_QUEUE_FAMILY_MAX_NAME_SIZE_INTEL: size_t = 64;
2972
2973#[repr(C)]
2974#[derive(Debug, Copy, Clone)]
2975pub struct cl_queue_family_properties_intel {
2976    pub properties: cl_command_queue_properties,
2977    pub capabilities: cl_command_queue_capabilities_intel,
2978    pub count: cl_uint,
2979    pub name: [cl_uchar; CL_QUEUE_FAMILY_MAX_NAME_SIZE_INTEL],
2980}
2981
2982// cl_device_info
2983pub const CL_DEVICE_QUEUE_FAMILY_PROPERTIES_INTEL: cl_device_info = 0x418B;
2984
2985// cl_queue_properties
2986pub const CL_QUEUE_FAMILY_INTEL: cl_queue_properties = 0x418C;
2987pub const CL_QUEUE_INDEX_INTEL: cl_queue_properties = 0x418D;
2988
2989// cl_command_queue_capabilities_intel
2990pub const CL_QUEUE_DEFAULT_CAPABILITIES_INTEL: cl_command_queue_capabilities_intel = 0;
2991pub const CL_QUEUE_CAPABILITY_CREATE_SINGLE_QUEUE_EVENTS_INTEL:
2992    cl_command_queue_capabilities_intel = 1 << 0;
2993pub const CL_QUEUE_CAPABILITY_CREATE_CROSS_QUEUE_EVENTS_INTEL: cl_command_queue_capabilities_intel =
2994    1 << 1;
2995pub const CL_QUEUE_CAPABILITY_SINGLE_QUEUE_EVENT_WAIT_LIST_INTEL:
2996    cl_command_queue_capabilities_intel = 1 << 2;
2997pub const CL_QUEUE_CAPABILITY_CROSS_QUEUE_EVENT_WAIT_LIST_INTEL:
2998    cl_command_queue_capabilities_intel = 1 << 3;
2999pub const CL_QUEUE_CAPABILITY_TRANSFER_BUFFER_INTEL: cl_command_queue_capabilities_intel = 1 << 8;
3000pub const CL_QUEUE_CAPABILITY_TRANSFER_BUFFER_RECT_INTEL: cl_command_queue_capabilities_intel =
3001    1 << 9;
3002pub const CL_QUEUE_CAPABILITY_MAP_BUFFER_INTEL: cl_command_queue_capabilities_intel = 1 << 10;
3003pub const CL_QUEUE_CAPABILITY_FILL_BUFFER_INTEL: cl_command_queue_capabilities_intel = 1 << 11;
3004pub const CL_QUEUE_CAPABILITY_TRANSFER_IMAGE_INTEL: cl_command_queue_capabilities_intel = 1 << 12;
3005pub const CL_QUEUE_CAPABILITY_MAP_IMAGE_INTEL: cl_command_queue_capabilities_intel = 1 << 13;
3006pub const CL_QUEUE_CAPABILITY_FILL_IMAGE_INTEL: cl_command_queue_capabilities_intel = 1 << 14;
3007pub const CL_QUEUE_CAPABILITY_TRANSFER_BUFFER_IMAGE_INTEL: cl_command_queue_capabilities_intel =
3008    1 << 15;
3009pub const CL_QUEUE_CAPABILITY_TRANSFER_IMAGE_BUFFER_INTEL: cl_command_queue_capabilities_intel =
3010    1 << 16;
3011pub const CL_QUEUE_CAPABILITY_MARKER_INTEL: cl_command_queue_capabilities_intel = 1 << 24;
3012pub const CL_QUEUE_CAPABILITY_BARRIER_INTEL: cl_command_queue_capabilities_intel = 1 << 25;
3013pub const CL_QUEUE_CAPABILITY_KERNEL_INTEL: cl_command_queue_capabilities_intel = 1 << 26;
3014
3015// cl_intel_queue_no_sync_operations
3016pub const CL_QUEUE_NO_SYNC_OPERATIONS_INTEL: cl_command_queue_properties = 1 << 29;
3017
3018// cl_ext_image_requirements_info
3019
3020pub type cl_image_requirements_info_ext = cl_uint;
3021
3022pub const CL_IMAGE_REQUIREMENTS_ROW_PITCH_ALIGNMENT_EXT: cl_image_requirements_info_ext = 0x1290;
3023pub const CL_IMAGE_REQUIREMENTS_BASE_ADDRESS_ALIGNMENT_EXT: cl_image_requirements_info_ext = 0x1292;
3024pub const CL_IMAGE_REQUIREMENTS_SIZE_EXT: cl_image_requirements_info_ext = 0x12B2;
3025pub const CL_IMAGE_REQUIREMENTS_MAX_WIDTH_EXT: cl_image_requirements_info_ext = 0x12B3;
3026pub const CL_IMAGE_REQUIREMENTS_MAX_HEIGHT_EXT: cl_image_requirements_info_ext = 0x12B4;
3027pub const CL_IMAGE_REQUIREMENTS_MAX_DEPTH_EXT: cl_image_requirements_info_ext = 0x12B5;
3028pub const CL_IMAGE_REQUIREMENTS_MAX_ARRAY_SIZE_EXT: cl_image_requirements_info_ext = 0x12B6;
3029
3030pub type clGetImageRequirementsInfoEXT_t = Option<
3031    unsafe extern "C" fn(
3032        context: cl_context,
3033        properties: *const cl_mem_properties,
3034        flags: cl_mem_flags,
3035        image_format: *const cl_image_format,
3036        image_desc: *const cl_image_desc,
3037        param_name: cl_image_requirements_info_ext,
3038        param_value_size: size_t,
3039        param_value: *mut c_void,
3040        param_value_size_ret: *mut size_t,
3041    ) -> cl_int,
3042>;
3043pub type clGetImageRequirementsInfoEXT_fn = clGetImageRequirementsInfoEXT_t;
3044
3045#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
3046#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
3047#[cfg(feature = "cl_ext_image_requirements_info")]
3048#[cfg(feature = "static")]
3049extern "system" {
3050
3051    pub fn clGetImageRequirementsInfoEXT(
3052        context: cl_context,
3053        properties: *const cl_mem_properties,
3054        flags: cl_mem_flags,
3055        image_format: *const cl_image_format,
3056        image_desc: *const cl_image_desc,
3057        param_name: cl_image_requirements_info_ext,
3058        param_value_size: size_t,
3059        param_value: *mut c_void,
3060        param_value_size_ret: *mut size_t,
3061    ) -> cl_int;
3062}
3063
3064// cl_ext_image_from_buffer
3065
3066pub const CL_IMAGE_REQUIREMENTS_SLICE_PITCH_ALIGNMENT_EXT: cl_image_requirements_info_ext = 0x1291;
3067
3068// cl_loader_info
3069
3070pub type cl_icdl_info = cl_uint;
3071
3072pub type clGetICDLoaderInfoOCLICD_t = Option<
3073    unsafe extern "C" fn(
3074        param_name: cl_icdl_info,
3075        param_value_size: size_t,
3076        param_value: *mut c_void,
3077        param_value_size_ret: *mut size_t,
3078    ) -> cl_int,
3079>;
3080pub type clGetICDLoaderInfoOCLICD_fn = clGetICDLoaderInfoOCLICD_t;
3081
3082#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
3083#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
3084#[cfg(feature = "cl_loader_info")]
3085#[cfg(feature = "static")]
3086extern "system" {
3087    pub fn clGetICDLoaderInfoOCLICD(
3088        param_name: cl_icdl_info,
3089        param_value_size: size_t,
3090        param_value: *mut c_void,
3091        param_value_size_ret: *mut size_t,
3092    ) -> cl_int;
3093}
3094
3095// cl_pocl_content_size
3096
3097pub type cl_device_fp_atomic_capabilities_ext = cl_bitfield;
3098
3099pub type clSetContentSizeBufferPoCL_t =
3100    Option<unsafe extern "C" fn(buffer: cl_mem, content_size_buffer: cl_mem) -> cl_int>;
3101pub type clSetContentSizeBufferPoCL_fn = clSetContentSizeBufferPoCL_t;
3102
3103#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
3104#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
3105#[cfg(feature = "cl_pocl_content_size")]
3106#[cfg(feature = "static")]
3107extern "system" {
3108    pub fn clSetContentSizeBufferPoCL(buffer: cl_mem, content_size_buffer: cl_mem) -> cl_int;
3109}
3110
3111// cl_ext_image_raw10_raw12
3112
3113pub const CL_UNSIGNED_INT_RAW10_EXT: cl_uint = 0x10E3;
3114pub const CL_UNSIGNED_INT_RAW12_EXT: cl_uint = 0x10E4;
3115
3116// cl_khr_kernel_clock
3117
3118pub const CL_DEVICE_KERNEL_CLOCK_CAPABILITIES_KHR: cl_device_info = 0x1076;
3119
3120pub type cl_device_kernel_clock_capabilities_khr = cl_bitfield;
3121
3122pub const CL_DEVICE_KERNEL_CLOCK_SCOPE_DEVICE_KHR: cl_device_kernel_clock_capabilities_khr = 1 << 0;
3123pub const CL_DEVICE_KERNEL_CLOCK_SCOPE_WORK_GROUP_KHR: cl_device_kernel_clock_capabilities_khr =
3124    1 << 1;
3125pub const CL_DEVICE_KERNEL_CLOCK_SCOPE_SUB_GROUP_KHR: cl_device_kernel_clock_capabilities_khr =
3126    1 << 2;
3127
3128// cl_ext_image_unorm_int_2_101010
3129
3130pub const CL_UNORM_INT_2_101010_EXT: cl_channel_type = 0x10E5;
3131
3132// cl_img_cancel_command
3133
3134pub const CL_CANCELLED_IMG: cl_int = -1126;
3135
3136pub type clCancelCommandsIMG_t =
3137    Option<unsafe extern "C" fn(event_list: *const cl_event, num_events_in_list: usize) -> cl_int>;
3138pub type clCancelCommandsIMG_fn = clCancelCommandsIMG_t;
3139
3140#[cfg_attr(not(target_os = "macos"), link(name = "OpenCL"))]
3141#[cfg_attr(target_os = "macos", link(name = "OpenCL", kind = "framework"))]
3142#[cfg(feature = "cl_img_cancel_command")]
3143#[cfg(feature = "static")]
3144extern "C" {
3145    pub fn clCancelCommandsIMG(event_list: *const cl_event, num_events_in_list: usize) -> cl_int;
3146}
3147
3148#[cfg(test)]
3149mod tests {
3150    use super::*;
3151
3152    #[test]
3153    #[allow(deref_nullptr)]
3154    fn bindgen_test_layout_cl_mem_ext_host_ptr() {
3155        assert_eq!(
3156            ::core::mem::size_of::<cl_mem_ext_host_ptr>(),
3157            8usize,
3158            concat!("Size of: ", stringify!(cl_mem_ext_host_ptr))
3159        );
3160        assert_eq!(
3161            ::core::mem::align_of::<cl_mem_ext_host_ptr>(),
3162            4usize,
3163            concat!("Alignment of ", stringify!(cl_mem_ext_host_ptr))
3164        );
3165        assert_eq!(
3166            unsafe {
3167                &(*(::core::ptr::null::<cl_mem_ext_host_ptr>())).allocation_type as *const _
3168                    as usize
3169            },
3170            0usize,
3171            concat!(
3172                "Offset of field: ",
3173                stringify!(cl_mem_ext_host_ptr),
3174                "::",
3175                stringify!(allocation_type)
3176            )
3177        );
3178        assert_eq!(
3179            unsafe {
3180                &(*(::core::ptr::null::<cl_mem_ext_host_ptr>())).host_cache_policy as *const _
3181                    as usize
3182            },
3183            4usize,
3184            concat!(
3185                "Offset of field: ",
3186                stringify!(cl_mem_ext_host_ptr),
3187                "::",
3188                stringify!(host_cache_policy)
3189            )
3190        );
3191    }
3192
3193    #[test]
3194    #[allow(deref_nullptr)]
3195    fn bindgen_test_layout_cl_mem_ion_host_ptr() {
3196        assert_eq!(
3197            ::core::mem::size_of::<cl_mem_ion_host_ptr>(),
3198            24usize,
3199            concat!("Size of: ", stringify!(cl_mem_ion_host_ptr))
3200        );
3201        assert_eq!(
3202            ::core::mem::align_of::<cl_mem_ion_host_ptr>(),
3203            8usize,
3204            concat!("Alignment of ", stringify!(cl_mem_ion_host_ptr))
3205        );
3206        assert_eq!(
3207            unsafe {
3208                &(*(::core::ptr::null::<cl_mem_ion_host_ptr>())).ext_host_ptr as *const _ as usize
3209            },
3210            0usize,
3211            concat!(
3212                "Offset of field: ",
3213                stringify!(cl_mem_ion_host_ptr),
3214                "::",
3215                stringify!(ext_host_ptr)
3216            )
3217        );
3218        assert_eq!(
3219            unsafe {
3220                &(*(::core::ptr::null::<cl_mem_ion_host_ptr>())).ion_filedesc as *const _ as usize
3221            },
3222            8usize,
3223            concat!(
3224                "Offset of field: ",
3225                stringify!(cl_mem_ion_host_ptr),
3226                "::",
3227                stringify!(ion_filedesc)
3228            )
3229        );
3230        assert_eq!(
3231            unsafe {
3232                &(*(::core::ptr::null::<cl_mem_ion_host_ptr>())).ion_hostptr as *const _ as usize
3233            },
3234            16usize,
3235            concat!(
3236                "Offset of field: ",
3237                stringify!(cl_mem_ion_host_ptr),
3238                "::",
3239                stringify!(ion_hostptr)
3240            )
3241        );
3242    }
3243
3244    #[test]
3245    #[allow(deref_nullptr)]
3246    fn bindgen_test_layout_cl_mem_android_native_buffer_host_ptr() {
3247        assert_eq!(
3248            ::core::mem::size_of::<cl_mem_android_native_buffer_host_ptr>(),
3249            16usize,
3250            concat!(
3251                "Size of: ",
3252                stringify!(cl_mem_android_native_buffer_host_ptr)
3253            )
3254        );
3255        assert_eq!(
3256            ::core::mem::align_of::<cl_mem_android_native_buffer_host_ptr>(),
3257            8usize,
3258            concat!(
3259                "Alignment of ",
3260                stringify!(cl_mem_android_native_buffer_host_ptr)
3261            )
3262        );
3263        assert_eq!(
3264            unsafe {
3265                &(*(::core::ptr::null::<cl_mem_android_native_buffer_host_ptr>())).ext_host_ptr
3266                    as *const _ as usize
3267            },
3268            0usize,
3269            concat!(
3270                "Offset of field: ",
3271                stringify!(cl_mem_android_native_buffer_host_ptr),
3272                "::",
3273                stringify!(ext_host_ptr)
3274            )
3275        );
3276        assert_eq!(
3277            unsafe {
3278                &(*(::core::ptr::null::<cl_mem_android_native_buffer_host_ptr>())).anb_ptr
3279                    as *const _ as usize
3280            },
3281            8usize,
3282            concat!(
3283                "Offset of field: ",
3284                stringify!(cl_mem_android_native_buffer_host_ptr),
3285                "::",
3286                stringify!(anb_ptr)
3287            )
3288        );
3289    }
3290
3291    #[test]
3292    #[allow(deref_nullptr)]
3293    fn bindgen_test_layout_cl_name_version_khr() {
3294        assert_eq!(
3295            ::core::mem::size_of::<cl_name_version_khr>(),
3296            68usize,
3297            concat!("Size of: ", stringify!(cl_name_version_khr))
3298        );
3299        assert_eq!(
3300            ::core::mem::align_of::<cl_name_version_khr>(),
3301            4usize,
3302            concat!("Alignment of ", stringify!(cl_name_version_khr))
3303        );
3304        assert_eq!(
3305            unsafe {
3306                &(*(::core::ptr::null::<cl_name_version_khr>())).version as *const _ as usize
3307            },
3308            0usize,
3309            concat!(
3310                "Offset of field: ",
3311                stringify!(cl_name_version_khr),
3312                "::",
3313                stringify!(version)
3314            )
3315        );
3316        assert_eq!(
3317            unsafe { &(*(::core::ptr::null::<cl_name_version_khr>())).name as *const _ as usize },
3318            4usize,
3319            concat!(
3320                "Offset of field: ",
3321                stringify!(cl_name_version_khr),
3322                "::",
3323                stringify!(name)
3324            )
3325        );
3326    }
3327
3328    #[test]
3329    #[allow(deref_nullptr)]
3330    fn bindgen_test_layout_cl_device_pci_bus_info_khr() {
3331        assert_eq!(
3332            ::core::mem::size_of::<cl_device_pci_bus_info_khr>(),
3333            16usize,
3334            concat!("Size of: ", stringify!(cl_device_pci_bus_info_khr))
3335        );
3336        assert_eq!(
3337            ::core::mem::align_of::<cl_device_pci_bus_info_khr>(),
3338            4usize,
3339            concat!("Alignment of ", stringify!(cl_device_pci_bus_info_khr))
3340        );
3341        assert_eq!(
3342            unsafe {
3343                &(*(::core::ptr::null::<cl_device_pci_bus_info_khr>())).pci_domain as *const _
3344                    as usize
3345            },
3346            0usize,
3347            concat!(
3348                "Offset of field: ",
3349                stringify!(cl_device_pci_bus_info_khr),
3350                "::",
3351                stringify!(pci_domain)
3352            )
3353        );
3354        assert_eq!(
3355            unsafe {
3356                &(*(::core::ptr::null::<cl_device_pci_bus_info_khr>())).pci_bus as *const _ as usize
3357            },
3358            4usize,
3359            concat!(
3360                "Offset of field: ",
3361                stringify!(cl_device_pci_bus_info_khr),
3362                "::",
3363                stringify!(pci_bus)
3364            )
3365        );
3366        assert_eq!(
3367            unsafe {
3368                &(*(::core::ptr::null::<cl_device_pci_bus_info_khr>())).pci_device as *const _
3369                    as usize
3370            },
3371            8usize,
3372            concat!(
3373                "Offset of field: ",
3374                stringify!(cl_device_pci_bus_info_khr),
3375                "::",
3376                stringify!(pci_device)
3377            )
3378        );
3379        assert_eq!(
3380            unsafe {
3381                &(*(::core::ptr::null::<cl_device_pci_bus_info_khr>())).pci_function as *const _
3382                    as usize
3383            },
3384            12usize,
3385            concat!(
3386                "Offset of field: ",
3387                stringify!(cl_device_pci_bus_info_khr),
3388                "::",
3389                stringify!(pci_function)
3390            )
3391        );
3392    }
3393
3394    #[test]
3395    #[allow(deref_nullptr)]
3396    fn bindgen_test_layout_cl_device_integer_dot_product_acceleration_properties_khr() {
3397        assert_eq!(
3398            ::core::mem::size_of::<cl_device_integer_dot_product_acceleration_properties_khr>(),
3399            24usize,
3400            concat!(
3401                "Size of: ",
3402                stringify!(cl_device_integer_dot_product_acceleration_properties_khr)
3403            )
3404        );
3405        assert_eq!(
3406            ::core::mem::align_of::<cl_device_integer_dot_product_acceleration_properties_khr>(),
3407            4usize,
3408            concat!(
3409                "Alignment of ",
3410                stringify!(cl_device_integer_dot_product_acceleration_properties_khr)
3411            )
3412        );
3413        assert_eq!(
3414            unsafe {
3415                &(*(::core::ptr::null::<cl_device_integer_dot_product_acceleration_properties_khr>(
3416                )))
3417                .signed_accelerated as *const _ as usize
3418            },
3419            0usize,
3420            concat!(
3421                "Offset of field: ",
3422                stringify!(cl_device_integer_dot_product_acceleration_properties_khr),
3423                "::",
3424                stringify!(signed_accelerated)
3425            )
3426        );
3427        assert_eq!(
3428            unsafe {
3429                &(*(::core::ptr::null::<cl_device_integer_dot_product_acceleration_properties_khr>(
3430                )))
3431                .unsigned_accelerated as *const _ as usize
3432            },
3433            4usize,
3434            concat!(
3435                "Offset of field: ",
3436                stringify!(cl_device_integer_dot_product_acceleration_properties_khr),
3437                "::",
3438                stringify!(unsigned_accelerated)
3439            )
3440        );
3441        assert_eq!(
3442            unsafe {
3443                &(*(::core::ptr::null::<cl_device_integer_dot_product_acceleration_properties_khr>(
3444                )))
3445                .mixed_signedness_accelerated as *const _ as usize
3446            },
3447            8usize,
3448            concat!(
3449                "Offset of field: ",
3450                stringify!(cl_device_integer_dot_product_acceleration_properties_khr),
3451                "::",
3452                stringify!(mixed_signedness_accelerated)
3453            )
3454        );
3455        assert_eq!(
3456            unsafe {
3457                &(*(::core::ptr::null::<cl_device_integer_dot_product_acceleration_properties_khr>(
3458                )))
3459                .accumulating_saturating_signed_accelerated as *const _ as usize
3460            },
3461            12usize,
3462            concat!(
3463                "Offset of field: ",
3464                stringify!(cl_device_integer_dot_product_acceleration_properties_khr),
3465                "::",
3466                stringify!(accumulating_saturating_signed_accelerated)
3467            )
3468        );
3469        assert_eq!(
3470            unsafe {
3471                &(*(::core::ptr::null::<cl_device_integer_dot_product_acceleration_properties_khr>(
3472                )))
3473                .accumulating_saturating_unsigned_accelerated as *const _ as usize
3474            },
3475            16usize,
3476            concat!(
3477                "Offset of field: ",
3478                stringify!(cl_device_integer_dot_product_acceleration_properties_khr),
3479                "::",
3480                stringify!(accumulating_saturating_unsigned_accelerated)
3481            )
3482        );
3483        assert_eq!(
3484            unsafe {
3485                &(*(::core::ptr::null::<cl_device_integer_dot_product_acceleration_properties_khr>(
3486                )))
3487                .accumulating_saturating_mixed_signedness_accelerated as *const _
3488                    as usize
3489            },
3490            20usize,
3491            concat!(
3492                "Offset of field: ",
3493                stringify!(cl_device_integer_dot_product_acceleration_properties_khr),
3494                "::",
3495                stringify!(accumulating_saturating_mixed_signedness_accelerated)
3496            )
3497        );
3498    }
3499
3500    #[test]
3501    #[allow(deref_nullptr)]
3502    fn bindgen_test_layout_cl_motion_estimation_desc_intel() {
3503        assert_eq!(
3504            ::core::mem::size_of::<cl_motion_estimation_desc_intel>(),
3505            16usize,
3506            concat!("Size of: ", stringify!(cl_motion_estimation_desc_intel))
3507        );
3508        assert_eq!(
3509            ::core::mem::align_of::<cl_motion_estimation_desc_intel>(),
3510            4usize,
3511            concat!("Alignment of ", stringify!(cl_motion_estimation_desc_intel))
3512        );
3513        assert_eq!(
3514            unsafe {
3515                &(*(::core::ptr::null::<cl_motion_estimation_desc_intel>())).mb_block_type
3516                    as *const _ as usize
3517            },
3518            0usize,
3519            concat!(
3520                "Offset of field: ",
3521                stringify!(cl_motion_estimation_desc_intel),
3522                "::",
3523                stringify!(mb_block_type)
3524            )
3525        );
3526        assert_eq!(
3527            unsafe {
3528                &(*(::core::ptr::null::<cl_motion_estimation_desc_intel>())).subpixel_mode
3529                    as *const _ as usize
3530            },
3531            4usize,
3532            concat!(
3533                "Offset of field: ",
3534                stringify!(cl_motion_estimation_desc_intel),
3535                "::",
3536                stringify!(subpixel_mode)
3537            )
3538        );
3539        assert_eq!(
3540            unsafe {
3541                &(*(::core::ptr::null::<cl_motion_estimation_desc_intel>())).sad_adjust_mode
3542                    as *const _ as usize
3543            },
3544            8usize,
3545            concat!(
3546                "Offset of field: ",
3547                stringify!(cl_motion_estimation_desc_intel),
3548                "::",
3549                stringify!(sad_adjust_mode)
3550            )
3551        );
3552        assert_eq!(
3553            unsafe {
3554                &(*(::core::ptr::null::<cl_motion_estimation_desc_intel>())).search_path_type
3555                    as *const _ as usize
3556            },
3557            12usize,
3558            concat!(
3559                "Offset of field: ",
3560                stringify!(cl_motion_estimation_desc_intel),
3561                "::",
3562                stringify!(search_path_type)
3563            )
3564        );
3565    }
3566
3567    #[test]
3568    #[allow(deref_nullptr)]
3569    fn bindgen_test_layout_cl_queue_family_properties_intel() {
3570        assert_eq!(
3571            ::core::mem::size_of::<cl_queue_family_properties_intel>(),
3572            88usize,
3573            concat!("Size of: ", stringify!(cl_queue_family_properties_intel))
3574        );
3575        assert_eq!(
3576            ::core::mem::align_of::<cl_queue_family_properties_intel>(),
3577            8usize,
3578            concat!(
3579                "Alignment of ",
3580                stringify!(cl_queue_family_properties_intel)
3581            )
3582        );
3583        assert_eq!(
3584            unsafe {
3585                &(*(::core::ptr::null::<cl_queue_family_properties_intel>())).properties as *const _
3586                    as usize
3587            },
3588            0usize,
3589            concat!(
3590                "Offset of field: ",
3591                stringify!(cl_queue_family_properties_intel),
3592                "::",
3593                stringify!(properties)
3594            )
3595        );
3596        assert_eq!(
3597            unsafe {
3598                &(*(::core::ptr::null::<cl_queue_family_properties_intel>())).capabilities
3599                    as *const _ as usize
3600            },
3601            8usize,
3602            concat!(
3603                "Offset of field: ",
3604                stringify!(cl_queue_family_properties_intel),
3605                "::",
3606                stringify!(capabilities)
3607            )
3608        );
3609        assert_eq!(
3610            unsafe {
3611                &(*(::core::ptr::null::<cl_queue_family_properties_intel>())).count as *const _
3612                    as usize
3613            },
3614            16usize,
3615            concat!(
3616                "Offset of field: ",
3617                stringify!(cl_queue_family_properties_intel),
3618                "::",
3619                stringify!(count)
3620            )
3621        );
3622        assert_eq!(
3623            unsafe {
3624                &(*(::core::ptr::null::<cl_queue_family_properties_intel>())).name as *const _
3625                    as usize
3626            },
3627            20usize,
3628            concat!(
3629                "Offset of field: ",
3630                stringify!(cl_queue_family_properties_intel),
3631                "::",
3632                stringify!(name)
3633            )
3634        );
3635    }
3636}