1//
2// Copyright 2013 Francisco Jerez
3//
4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"),
6// to deal in the Software without restriction, including without limitation
7// the rights to use, copy, modify, merge, publish, distribute, sublicense,
8// and/or sell copies of the Software, and to permit persons to whom the
9// Software is furnished to do so, subject to the following conditions:
10//
11// The above copyright notice and this permission notice shall be included in
12// all copies or substantial portions of the Software.
13//
14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20// OTHER DEALINGS IN THE SOFTWARE.
21//
22
23#ifndef API_DISPATCH_HPP
24#define API_DISPATCH_HPP
25
26#define CL_TARGET_OPENCL_VERSION 220
27
28#define CL_USE_DEPRECATED_OPENCL_1_0_APIS
29#define CL_USE_DEPRECATED_OPENCL_1_1_APIS
30#define CL_USE_DEPRECATED_OPENCL_1_2_APIS
31#define CL_USE_DEPRECATED_OPENCL_2_0_APIS
32#define CL_USE_DEPRECATED_OPENCL_2_1_APIS
33
34
35#include "CL/cl.h"
36#include "CL/cl_ext.h"
37#include "CL/cl_egl.h"
38#include "CL/cl_gl.h"
39
40///
41/// OpenCL ICD vendor dispatch table.
42///
43/// The entry point ordering should always be in agreement with
44/// Khronos' ICD loader.
45///
46struct _cl_icd_dispatch {
47   CL_API_ENTRY cl_int (CL_API_CALL *clGetPlatformIDs)(
48      cl_uint num_entries,
49      cl_platform_id *platforms,
50      cl_uint *num_platforms);
51
52   CL_API_ENTRY cl_int (CL_API_CALL *clGetPlatformInfo)(
53      cl_platform_id platform,
54      cl_platform_info param_name,
55      size_t param_value_size,
56      void *param_value,
57      size_t *param_value_size_ret);
58
59   CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceIDs)(
60      cl_platform_id platform,
61      cl_device_type device_type,
62      cl_uint num_entries,
63      cl_device_id *devices,
64      cl_uint *num_devices);
65
66   CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceInfo)(
67      cl_device_id device,
68      cl_device_info param_name,
69      size_t param_value_size,
70      void *param_value,
71      size_t *param_value_size_ret);
72
73   CL_API_ENTRY cl_context (CL_API_CALL *clCreateContext)(
74      const cl_context_properties *properties,
75      cl_uint num_devices,
76      const cl_device_id *devices,
77      void (CL_CALLBACK *pfn_notify)(const char *, const void *, size_t, void *),
78      void *user_data,
79      cl_int *errcode_ret);
80
81   CL_API_ENTRY cl_context (CL_API_CALL *clCreateContextFromType)(
82      const cl_context_properties *properties,
83      cl_device_type device_type,
84      void (CL_CALLBACK *pfn_notify)(const char *, const void *, size_t, void *),
85      void *user_data,
86      cl_int *errcode_ret);
87
88   CL_API_ENTRY cl_int (CL_API_CALL *clRetainContext)(
89      cl_context context);
90
91   CL_API_ENTRY cl_int (CL_API_CALL *clReleaseContext)(
92      cl_context context);
93
94   CL_API_ENTRY cl_int (CL_API_CALL *clGetContextInfo)(
95      cl_context context,
96      cl_context_info param_name,
97      size_t param_value_size,
98      void *param_value,
99      size_t *param_value_size_ret);
100
101   CL_API_ENTRY cl_command_queue (CL_API_CALL *clCreateCommandQueue)(
102      cl_context context,
103      cl_device_id device,
104      cl_command_queue_properties properties,
105      cl_int *errcode_ret);
106
107   CL_API_ENTRY cl_int (CL_API_CALL *clRetainCommandQueue)(
108      cl_command_queue command_queue);
109
110   CL_API_ENTRY cl_int (CL_API_CALL *clReleaseCommandQueue)(
111      cl_command_queue command_queue);
112
113   CL_API_ENTRY cl_int (CL_API_CALL *clGetCommandQueueInfo)(
114      cl_command_queue command_queue,
115      cl_command_queue_info param_name,
116      size_t param_value_size,
117      void *param_value,
118      size_t *param_value_size_ret);
119
120   CL_API_ENTRY cl_int (CL_API_CALL *clSetCommandQueueProperty)(
121      cl_command_queue command_queue,
122      cl_command_queue_properties properties,
123      cl_bool enable,
124      cl_command_queue_properties *old_properties);
125
126   CL_API_ENTRY cl_mem (CL_API_CALL *clCreateBuffer)(
127      cl_context context,
128      cl_mem_flags flags,
129      size_t size,
130      void *host_ptr,
131      cl_int *errcode_ret);
132
133   CL_API_ENTRY cl_mem (CL_API_CALL *clCreateImage2D)(
134      cl_context context,
135      cl_mem_flags flags,
136      const cl_image_format *image_format,
137      size_t image_width,
138      size_t image_height,
139      size_t image_row_pitch,
140      void *host_ptr,
141      cl_int *errcode_ret);
142
143   CL_API_ENTRY cl_mem (CL_API_CALL *clCreateImage3D)(
144      cl_context context,
145      cl_mem_flags flags,
146      const cl_image_format *image_format,
147      size_t image_width,
148      size_t image_height,
149      size_t image_depth,
150      size_t image_row_pitch,
151      size_t image_slice_pitch,
152      void *host_ptr,
153      cl_int *errcode_ret);
154
155   CL_API_ENTRY cl_int (CL_API_CALL *clRetainMemObject)(
156      cl_mem memobj);
157
158   CL_API_ENTRY cl_int (CL_API_CALL *clReleaseMemObject)(
159      cl_mem memobj);
160
161   CL_API_ENTRY cl_int (CL_API_CALL *clGetSupportedImageFormats)(
162      cl_context context,
163      cl_mem_flags flags,
164      cl_mem_object_type image_type,
165      cl_uint num_entries,
166      cl_image_format *image_formats,
167      cl_uint *num_image_formats);
168
169   CL_API_ENTRY cl_int (CL_API_CALL *clGetMemObjectInfo)(
170      cl_mem memobj,
171      cl_mem_info param_name,
172      size_t param_value_size,
173      void *param_value,
174      size_t *param_value_size_ret);
175
176   CL_API_ENTRY cl_int (CL_API_CALL *clGetImageInfo)(
177      cl_mem image,
178      cl_image_info param_name,
179      size_t param_value_size,
180      void *param_value,
181      size_t *param_value_size_ret);
182
183   CL_API_ENTRY cl_sampler (CL_API_CALL *clCreateSampler)(
184      cl_context context,
185      cl_bool normalized_coords,
186      cl_addressing_mode addressing_mode,
187      cl_filter_mode filter_mode,
188      cl_int *errcode_ret);
189
190   CL_API_ENTRY cl_int (CL_API_CALL *clRetainSampler)(
191      cl_sampler sampler);
192
193   CL_API_ENTRY cl_int (CL_API_CALL *clReleaseSampler)(
194      cl_sampler sampler);
195
196   CL_API_ENTRY cl_int (CL_API_CALL *clGetSamplerInfo)(
197      cl_sampler sampler,
198      cl_sampler_info param_name,
199      size_t param_value_size,
200      void *param_value,
201      size_t *param_value_size_ret);
202
203   CL_API_ENTRY cl_program (CL_API_CALL *clCreateProgramWithSource)(
204      cl_context context,
205      cl_uint count,
206      const char **strings,
207      const size_t *lengths,
208      cl_int *errcode_ret);
209
210   CL_API_ENTRY cl_program (CL_API_CALL *clCreateProgramWithBinary)(
211      cl_context context,
212      cl_uint num_devices,
213      const cl_device_id *device_list,
214      const size_t *lengths,
215      const unsigned char **binaries,
216      cl_int *binary_status,
217      cl_int *errcode_ret);
218
219   CL_API_ENTRY cl_int (CL_API_CALL *clRetainProgram)(
220      cl_program program);
221
222   CL_API_ENTRY cl_int (CL_API_CALL *clReleaseProgram)(
223      cl_program program);
224
225   CL_API_ENTRY cl_int (CL_API_CALL *clBuildProgram)(
226      cl_program program,
227      cl_uint num_devices,
228      const cl_device_id *device_list,
229      const char *options,
230      void (CL_CALLBACK *pfn_notify)(cl_program, void *),
231      void *user_data);
232
233   CL_API_ENTRY cl_int (CL_API_CALL *clUnloadCompiler)(
234      void);
235
236   CL_API_ENTRY cl_int (CL_API_CALL *clGetProgramInfo)(
237      cl_program program,
238      cl_program_info param_name,
239      size_t param_value_size,
240      void *param_value,
241      size_t *param_value_size_ret);
242
243   CL_API_ENTRY cl_int (CL_API_CALL *clGetProgramBuildInfo)(
244      cl_program program,
245      cl_device_id device,
246      cl_program_build_info param_name,
247      size_t param_value_size,
248      void *param_value,
249      size_t *param_value_size_ret);
250
251   CL_API_ENTRY cl_kernel (CL_API_CALL *clCreateKernel)(
252      cl_program program,
253      const char *kernel_name,
254      cl_int *errcode_ret);
255
256   CL_API_ENTRY cl_int (CL_API_CALL *clCreateKernelsInProgram)(
257      cl_program program,
258      cl_uint num_kernels,
259      cl_kernel *kernels,
260      cl_uint *num_kernels_ret);
261
262   CL_API_ENTRY cl_int (CL_API_CALL *clRetainKernel)(
263      cl_kernel kernel);
264
265   CL_API_ENTRY cl_int (CL_API_CALL *clReleaseKernel)(
266      cl_kernel kernel);
267
268   CL_API_ENTRY cl_int (CL_API_CALL *clSetKernelArg)(
269      cl_kernel kernel,
270      cl_uint arg_index,
271      size_t arg_size,
272      const void *arg_value);
273
274   CL_API_ENTRY cl_int (CL_API_CALL *clGetKernelInfo)(
275      cl_kernel kernel,
276      cl_kernel_info param_name,
277      size_t param_value_size,
278      void *param_value,
279      size_t *param_value_size_ret);
280
281   CL_API_ENTRY cl_int (CL_API_CALL *clGetKernelWorkGroupInfo)(
282      cl_kernel kernel,
283      cl_device_id device,
284      cl_kernel_work_group_info param_name,
285      size_t param_value_size,
286      void *param_value,
287      size_t *param_value_size_ret);
288
289   CL_API_ENTRY cl_int (CL_API_CALL *clWaitForEvents)(
290      cl_uint num_events,
291      const cl_event *event_list);
292
293   CL_API_ENTRY cl_int (CL_API_CALL *clGetEventInfo)(
294      cl_event event,
295      cl_event_info param_name,
296      size_t param_value_size,
297      void *param_value,
298      size_t *param_value_size_ret);
299
300   CL_API_ENTRY cl_int (CL_API_CALL *clRetainEvent)(
301      cl_event event);
302
303   CL_API_ENTRY cl_int (CL_API_CALL *clReleaseEvent)(
304      cl_event event);
305
306   CL_API_ENTRY cl_int (CL_API_CALL *clGetEventProfilingInfo)(
307      cl_event event,
308      cl_profiling_info param_name,
309      size_t param_value_size,
310      void *param_value,
311      size_t *param_value_size_ret);
312
313   CL_API_ENTRY cl_int (CL_API_CALL *clFlush)(
314      cl_command_queue command_queue);
315
316   CL_API_ENTRY cl_int (CL_API_CALL *clFinish)(
317      cl_command_queue command_queue);
318
319   CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReadBuffer)(
320      cl_command_queue command_queue,
321      cl_mem buffer,
322      cl_bool blocking_read,
323      size_t offset,
324      size_t cb,
325      void *ptr,
326      cl_uint num_events_in_wait_list,
327      const cl_event *event_wait_list,
328      cl_event *event);
329
330   CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueWriteBuffer)(
331      cl_command_queue command_queue,
332      cl_mem buffer,
333      cl_bool blocking_write,
334      size_t offset,
335      size_t cb,
336      const void *ptr,
337      cl_uint num_events_in_wait_list,
338      const cl_event *event_wait_list,
339      cl_event *event);
340
341   CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueCopyBuffer)(
342      cl_command_queue command_queue,
343      cl_mem src_buffer,
344      cl_mem dst_buffer,
345      size_t src_offset,
346      size_t dst_offset,
347      size_t cb,
348      cl_uint num_events_in_wait_list,
349      const cl_event *event_wait_list,
350      cl_event *event);
351
352   CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReadImage)(
353      cl_command_queue command_queue,
354      cl_mem image,
355      cl_bool blocking_read,
356      const size_t *origin,
357      const size_t *region,
358      size_t row_pitch,
359      size_t slice_pitch,
360      void *ptr,
361      cl_uint num_events_in_wait_list,
362      const cl_event *event_wait_list,
363      cl_event *event);
364
365   CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueWriteImage)(
366      cl_command_queue command_queue,
367      cl_mem image,
368      cl_bool blocking_write,
369      const size_t *origin,
370      const size_t *region,
371      size_t input_row_pitch,
372      size_t input_slice_pitch,
373      const void *ptr,
374      cl_uint num_events_in_wait_list,
375      const cl_event *event_wait_list,
376      cl_event *event);
377
378   CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueCopyImage)(
379      cl_command_queue command_queue,
380      cl_mem src_image,
381      cl_mem dst_image,
382      const size_t *src_origin,
383      const size_t *dst_origin,
384      const size_t *region,
385      cl_uint num_events_in_wait_list,
386      const cl_event *event_wait_list,
387      cl_event *event);
388
389   CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueCopyImageToBuffer)(
390      cl_command_queue command_queue,
391      cl_mem src_image,
392      cl_mem dst_buffer,
393      const size_t *src_origin,
394      const size_t *region,
395      size_t dst_offset,
396      cl_uint num_events_in_wait_list,
397      const cl_event *event_wait_list,
398      cl_event *event);
399
400   CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueCopyBufferToImage)(
401      cl_command_queue command_queue,
402      cl_mem src_buffer,
403      cl_mem dst_image,
404      size_t src_offset,
405      const size_t *dst_origin,
406      const size_t *region,
407      cl_uint num_events_in_wait_list,
408      const cl_event *event_wait_list,
409      cl_event *event);
410
411   CL_API_ENTRY void *(CL_API_CALL *clEnqueueMapBuffer)(
412      cl_command_queue command_queue,
413      cl_mem buffer,
414      cl_bool blocking_map,
415      cl_map_flags map_flags,
416      size_t offset,
417      size_t cb,
418      cl_uint num_events_in_wait_list,
419      const cl_event *event_wait_list,
420      cl_event *event,
421      cl_int *errcode_ret);
422
423   CL_API_ENTRY void *(CL_API_CALL *clEnqueueMapImage)(
424      cl_command_queue command_queue,
425      cl_mem image,
426      cl_bool blocking_map,
427      cl_map_flags map_flags,
428      const size_t *origin,
429      const size_t *region,
430      size_t *image_row_pitch,
431      size_t *image_slice_pitch,
432      cl_uint num_events_in_wait_list,
433      const cl_event *event_wait_list,
434      cl_event *event,
435      cl_int *errcode_ret);
436
437   CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueUnmapMemObject)(
438      cl_command_queue command_queue,
439      cl_mem memobj,
440      void *mapped_ptr,
441      cl_uint num_events_in_wait_list,
442      const cl_event *event_wait_list,
443      cl_event *event);
444
445   CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueNDRangeKernel)(
446      cl_command_queue command_queue,
447      cl_kernel kernel,
448      cl_uint work_dim,
449      const size_t *global_work_offset,
450      const size_t *global_work_size,
451      const size_t *local_work_size,
452      cl_uint num_events_in_wait_list,
453      const cl_event *event_wait_list,
454      cl_event *event);
455
456   CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueTask)(
457      cl_command_queue command_queue,
458      cl_kernel kernel,
459      cl_uint num_events_in_wait_list,
460      const cl_event *event_wait_list,
461      cl_event *event);
462
463   CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueNativeKernel)(
464      cl_command_queue command_queue,
465      void (CL_CALLBACK *user_func)(void *),
466      void *args,
467      size_t cb_args,
468      cl_uint num_mem_objects,
469      const cl_mem *mem_list,
470      const void **args_mem_loc,
471      cl_uint num_events_in_wait_list,
472      const cl_event *event_wait_list,
473      cl_event *event);
474
475   CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueMarker)(
476      cl_command_queue command_queue,
477      cl_event *event);
478
479   CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueWaitForEvents)(
480      cl_command_queue command_queue,
481      cl_uint num_events,
482      const cl_event *event_list);
483
484   CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueBarrier)(
485      cl_command_queue command_queue);
486
487   CL_API_ENTRY void *(CL_API_CALL *clGetExtensionFunctionAddress)(
488      const char *function_name);
489
490   CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromGLBuffer)(
491      cl_context context,
492      cl_mem_flags flags,
493      cl_GLuint bufobj,
494      int *errcode_ret);
495
496   CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromGLTexture2D)(
497      cl_context context,
498      cl_mem_flags flags,
499      cl_GLenum target,
500      cl_GLint miplevel,
501      cl_GLuint texture,
502      cl_int *errcode_ret);
503
504   CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromGLTexture3D)(
505      cl_context context,
506      cl_mem_flags flags,
507      cl_GLenum target,
508      cl_GLint miplevel,
509      cl_GLuint texture,
510      cl_int *errcode_ret);
511
512   CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromGLRenderbuffer)(
513      cl_context context,
514      cl_mem_flags flags,
515      cl_GLuint renderbuffer,
516      cl_int *errcode_ret);
517
518   CL_API_ENTRY cl_int (CL_API_CALL *clGetGLObjectInfo)(
519      cl_mem memobj,
520      cl_gl_object_type *gl_object_type,
521      cl_GLuint *gl_object_name);
522
523   CL_API_ENTRY cl_int (CL_API_CALL *clGetGLTextureInfo)(
524      cl_mem memobj,
525      cl_gl_texture_info param_name,
526      size_t param_value_size,
527      void *param_value,
528      size_t *param_value_size_ret);
529
530   CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireGLObjects)(
531      cl_command_queue command_queue,
532      cl_uint num_objects,
533      const cl_mem *mem_objects,
534      cl_uint num_events_in_wait_list,
535      const cl_event *event_wait_list,
536      cl_event *event);
537
538   CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseGLObjects)(
539      cl_command_queue command_queue,
540      cl_uint num_objects,
541      const cl_mem *mem_objects,
542      cl_uint num_events_in_wait_list,
543      const cl_event *event_wait_list,
544      cl_event *event);
545
546   CL_API_ENTRY cl_int (CL_API_CALL *clGetGLContextInfoKHR)(
547      const cl_context_properties *properties,
548      cl_gl_context_info param_name,
549      size_t param_value_size,
550      void *param_value,
551      size_t *param_value_size_ret);
552
553   void *clGetDeviceIDsFromD3D10KHR;
554   void *clCreateFromD3D10BufferKHR;
555   void *clCreateFromD3D10Texture2DKHR;
556   void *clCreateFromD3D10Texture3DKHR;
557   void *clEnqueueAcquireD3D10ObjectsKHR;
558   void *clEnqueueReleaseD3D10ObjectsKHR;
559
560   CL_API_ENTRY cl_int (CL_API_CALL *clSetEventCallback)(
561      cl_event event,
562      cl_int type,
563      void (CL_CALLBACK *pfn_notify)(cl_event, cl_int, void *),
564      void *user_data);
565
566   CL_API_ENTRY cl_mem (CL_API_CALL *clCreateSubBuffer)(
567      cl_mem                   buffer,
568      cl_mem_flags             flags,
569      cl_buffer_create_type    buffer_create_type,
570      const void *buffer_create_info,
571      cl_int *errcode_ret);
572
573   CL_API_ENTRY cl_int (CL_API_CALL *clSetMemObjectDestructorCallback)(
574      cl_mem memobj,
575      void (CL_CALLBACK *pfn_notify)(cl_mem, void *),
576      void *user_data);
577
578   CL_API_ENTRY cl_event (CL_API_CALL *clCreateUserEvent)(
579      cl_context context,
580      cl_int *errcode_ret);
581
582   CL_API_ENTRY cl_int (CL_API_CALL *clSetUserEventStatus)(
583      cl_event event,
584      cl_int status);
585
586   CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReadBufferRect)(
587      cl_command_queue command_queue,
588      cl_mem buffer,
589      cl_bool blocking_read,
590      const size_t *buffer_origin,
591      const size_t *host_origin,
592      const size_t *region,
593      size_t buffer_row_pitch,
594      size_t buffer_slice_pitch,
595      size_t host_row_pitch,
596      size_t host_slice_pitch,
597      void *ptr,
598      cl_uint num_events_in_wait_list,
599      const cl_event *event_wait_list,
600      cl_event *event);
601
602   CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueWriteBufferRect)(
603      cl_command_queue command_queue,
604      cl_mem buffer,
605      cl_bool blocking_read,
606      const size_t *buffer_origin,
607      const size_t *host_origin,
608      const size_t *region,
609      size_t buffer_row_pitch,
610      size_t buffer_slice_pitch,
611      size_t host_row_pitch,
612      size_t host_slice_pitch,
613      const void *ptr,
614      cl_uint num_events_in_wait_list,
615      const cl_event *event_wait_list,
616      cl_event *event);
617
618   CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueCopyBufferRect)(
619      cl_command_queue command_queue,
620      cl_mem src_buffer,
621      cl_mem dst_buffer,
622      const size_t *src_origin,
623      const size_t *dst_origin,
624      const size_t *region,
625      size_t src_row_pitch,
626      size_t src_slice_pitch,
627      size_t dst_row_pitch,
628      size_t dst_slice_pitch,
629      cl_uint num_events_in_wait_list,
630      const cl_event *event_wait_list,
631      cl_event *event);
632
633   CL_API_ENTRY cl_int (CL_API_CALL *clCreateSubDevicesEXT)(
634      cl_device_id in_device,
635      const cl_device_partition_property_ext *partition_properties,
636      cl_uint num_entries,
637      cl_device_id *out_devices,
638      cl_uint *num_devices);
639
640   CL_API_ENTRY cl_int (CL_API_CALL *clRetainDeviceEXT)(
641      cl_device_id device);
642
643   CL_API_ENTRY cl_int (CL_API_CALL *clReleaseDeviceEXT)(
644      cl_device_id device);
645
646   CL_API_ENTRY cl_event (CL_API_CALL *clCreateEventFromGLsyncKHR)(
647      cl_context context,
648      cl_GLsync sync,
649      cl_int *errcode_ret);
650
651    CL_API_ENTRY cl_int (CL_API_CALL *clCreateSubDevices)(
652       cl_device_id in_device,
653       const cl_device_partition_property *partition_properties,
654       cl_uint num_entries,
655       cl_device_id *out_devices,
656       cl_uint *num_devices);
657
658   CL_API_ENTRY cl_int (CL_API_CALL *clRetainDevice)(
659      cl_device_id device);
660
661   CL_API_ENTRY cl_int (CL_API_CALL *clReleaseDevice)(
662      cl_device_id device);
663
664   CL_API_ENTRY cl_mem (CL_API_CALL *clCreateImage)(
665      cl_context context,
666      cl_mem_flags flags,
667      const cl_image_format *image_format,
668      const cl_image_desc *image_desc,
669      void *host_ptr,
670      cl_int *errcode_ret);
671
672   CL_API_ENTRY cl_program (CL_API_CALL *clCreateProgramWithBuiltInKernels)(
673      cl_context context,
674      cl_uint num_devices,
675      const cl_device_id *device_list,
676      const char *kernel_names,
677      cl_int *errcode_ret);
678
679   CL_API_ENTRY cl_int (CL_API_CALL *clCompileProgram)(
680      cl_program program,
681      cl_uint num_devices,
682      const cl_device_id *device_list,
683      const char *options,
684      cl_uint num_input_headers,
685      const cl_program *input_headers,
686      const char **header_include_names,
687      void (CL_CALLBACK *pfn_notify)(cl_program, void *),
688      void *user_data);
689
690   CL_API_ENTRY cl_program (CL_API_CALL *clLinkProgram)(
691      cl_context context,
692      cl_uint num_devices,
693      const cl_device_id *device_list,
694      const char *options,
695      cl_uint num_input_programs,
696      const cl_program *input_programs,
697      void (CL_CALLBACK *pfn_notify)(cl_program, void *),
698      void *user_data,
699      cl_int *errcode_ret);
700
701   CL_API_ENTRY cl_int (CL_API_CALL *clUnloadPlatformCompiler)(
702      cl_platform_id platform);
703
704   CL_API_ENTRY cl_int (CL_API_CALL *clGetKernelArgInfo)(
705      cl_kernel kernel,
706      cl_uint arg_indx,
707      cl_kernel_arg_info  param_name,
708      size_t param_value_size,
709      void *param_value,
710      size_t *param_value_size_ret);
711
712   CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueFillBuffer)(
713      cl_command_queue command_queue,
714      cl_mem buffer,
715      const void *pattern,
716      size_t pattern_size,
717      size_t offset,
718      size_t size,
719      cl_uint num_events_in_wait_list,
720      const cl_event *event_wait_list,
721      cl_event *event);
722
723   CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueFillImage)(
724      cl_command_queue command_queue,
725      cl_mem image,
726      const void *fill_color,
727      const size_t *origin,
728      const size_t *region,
729      cl_uint num_events_in_wait_list,
730      const cl_event *event_wait_list,
731      cl_event *event);
732
733   CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueMigrateMemObjects)(
734      cl_command_queue command_queue,
735      cl_uint num_mem_objects,
736      const cl_mem *mem_objects,
737      cl_mem_migration_flags flags,
738      cl_uint num_events_in_wait_list,
739      const cl_event *event_wait_list,
740      cl_event *event);
741
742   CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueMarkerWithWaitList)(
743      cl_command_queue command_queue,
744      cl_uint num_events_in_wait_list,
745      const cl_event *event_wait_list,
746      cl_event *event);
747
748   CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueBarrierWithWaitList)(
749      cl_command_queue command_queue,
750      cl_uint num_events_in_wait_list,
751      const cl_event *event_wait_list,
752      cl_event *event);
753
754   CL_API_ENTRY void *(CL_API_CALL *clGetExtensionFunctionAddressForPlatform)(
755      cl_platform_id platform,
756      const char *function_name);
757
758   CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromGLTexture)(
759      cl_context context,
760      cl_mem_flags flags,
761      cl_GLenum target,
762      cl_GLint miplevel,
763      cl_GLuint texture,
764      cl_int *errcode_ret);
765
766   void *clGetDeviceIDsFromD3D11KHR;
767   void *clCreateFromD3D11BufferKHR;
768   void *clCreateFromD3D11Texture2DKHR;
769   void *clCreateFromD3D11Texture3DKHR;
770   void *clCreateFromDX9MediaSurfaceKHR;
771   void *clEnqueueAcquireD3D11ObjectsKHR;
772   void *clEnqueueReleaseD3D11ObjectsKHR;
773   void *clGetDeviceIDsFromDX9MediaAdapterKHR;
774   void *clEnqueueAcquireDX9MediaSurfacesKHR;
775   void *clEnqueueReleaseDX9MediaSurfacesKHR;
776
777   CL_API_ENTRY void (CL_API_CALL *clCreateFromEGLImageKHR)(
778      cl_context context,
779      CLeglDisplayKHR display,
780      CLeglImageKHR image,
781      cl_mem_flags flags,
782      const cl_egl_image_properties_khr *properties,
783      cl_int *errcode_ret);
784
785   CL_API_ENTRY void (CL_API_CALL *clEnqueueAcquireEGLObjectsKHR)(
786      cl_command_queue command_queue,
787      cl_uint num_objects,
788      const cl_mem *mem_objects,
789      cl_uint num_events_in_wait_list,
790      const cl_event *event_wait_list,
791      cl_event *event);
792
793   CL_API_ENTRY void (CL_API_CALL *clEnqueueReleaseEGLObjectsKHR)(
794      cl_command_queue command_queue,
795      cl_uint num_objects,
796      const cl_mem *mem_objects,
797      cl_uint num_events_in_wait_list,
798      const cl_event *event_wait_list,
799      cl_event *event);
800
801   CL_API_ENTRY void (CL_API_CALL *clCreateEventFromEGLSyncKHR)(
802      cl_context context,
803      CLeglSyncKHR sync,
804      CLeglDisplayKHR display,
805      cl_int *errcode_ret);
806
807   CL_API_ENTRY cl_command_queue (CL_API_CALL *clCreateCommandQueueWithProperties)(
808      cl_context context,
809      cl_device_id device,
810      const cl_queue_properties *properties,
811      cl_int *errcode_ret);
812
813   CL_API_ENTRY void (CL_API_CALL *clCreatePipe)(
814      cl_context context,
815      cl_mem_flags flags,
816      cl_uint pipe_packet_size,
817      cl_uint pipe_max_packets,
818      const cl_pipe_properties *properties,
819      cl_int *errcode_ret);
820
821   CL_API_ENTRY void (CL_API_CALL *clGetPipeInfo)(
822      cl_mem pipe,
823      cl_pipe_info param_name,
824      size_t param_value_size,
825      void *param_value,
826      size_t *param_value_size_ret);
827
828   CL_API_ENTRY void (CL_API_CALL *clSVMAlloc)(
829      cl_context context,
830      cl_svm_mem_flags flags,
831      size_t size,
832      unsigned int alignment);
833
834   CL_API_ENTRY void (CL_API_CALL *clSVMFree)(
835      cl_context context,
836      void *svm_pointer);
837
838   CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueSVMFree)(
839      cl_command_queue command_queue,
840      cl_uint num_svm_pointers,
841      void **svm_pointers,
842      void (CL_CALLBACK *pfn_free_func)(cl_command_queue, cl_uint, void **, void *),
843      void *user_data,
844      cl_uint num_events_in_wait_list,
845      const cl_event *event_wait_list,
846      cl_event *event);
847
848   CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueSVMMemcpy)(
849      cl_command_queue command_queue,
850      cl_bool blocking_copy,
851      void *dst_ptr,
852      const void *src_ptr,
853      size_t size,
854      cl_uint num_events_in_wait_list,
855      const cl_event *event_wait_list,
856      cl_event *event);
857
858   CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueSVMMemFill)(
859      cl_command_queue command_queue,
860      void *svm_ptr,
861      const void *pattern,
862      size_t pattern_size,
863      size_t size,
864      cl_uint num_events_in_wait_list,
865      const cl_event *event_wait_list,
866      cl_event *event);
867
868   CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueSVMMap)(
869      cl_command_queue command_queue,
870      cl_bool blocking_map,
871      cl_map_flags map_flags,
872      void *svm_ptr,
873      size_t size,
874      cl_uint num_events_in_wait_list,
875      const cl_event *event_wait_list,
876      cl_event *event);
877
878   CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueSVMUnmap)(
879      cl_command_queue command_queue,
880      void *svm_ptr,
881      cl_uint num_events_in_wait_list,
882      const cl_event *event_wait_list,
883      cl_event *event);
884
885   CL_API_ENTRY void (CL_API_CALL *clCreateSamplerWithProperties)(
886      cl_context context,
887      const cl_sampler_properties *sampler_properties,
888      cl_int *errcode_ret);
889
890   CL_API_ENTRY cl_int (CL_API_CALL *clSetKernelArgSVMPointer)(
891      cl_kernel kernel,
892      cl_uint arg_index,
893      const void *arg_value);
894
895   CL_API_ENTRY void (CL_API_CALL *clSetKernelExecInfo)(
896      cl_kernel kernel,
897      cl_kernel_exec_info param_name,
898      size_t param_value_size,
899      const void *param_value);
900
901   CL_API_ENTRY void (CL_API_CALL *clGetKernelSubGroupInfoKHR)(
902      cl_kernel kernel,
903      cl_device_id device,
904      cl_kernel_sub_group_info param_name,
905      size_t input_value_size,
906      const void *input_value,
907      size_t param_value_size,
908      void *param_value,
909      size_t *param_value_size_ret);
910
911   CL_API_ENTRY cl_kernel (CL_API_CALL *clCloneKernel)(
912      cl_kernel source_kernel,
913      cl_int *errcode_ret);
914
915   CL_API_ENTRY cl_program (CL_API_CALL *clCreateProgramWithIL)(
916      cl_context context,
917      const void *il,
918      size_t length,
919      cl_int *errcode_ret);
920
921   CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueSVMMigrateMem)(
922      cl_command_queue command_queue,
923      cl_uint num_svm_pointers,
924      const void **svm_pointers,
925      const size_t *sizes,
926      cl_mem_migration_flags flags,
927      cl_uint num_events_in_wait_list,
928      const cl_event *event_wait_list,
929      cl_event *event);
930
931   CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceAndHostTimer)(
932      cl_device_id device,
933      cl_ulong *device_timestamp,
934      cl_ulong *host_timestamp);
935
936   CL_API_ENTRY cl_int (CL_API_CALL *clGetHostTimer)(
937      cl_device_id device,
938      cl_ulong *host_timestamp);
939
940   CL_API_ENTRY void (CL_API_CALL *clGetKernelSubGroupInfo)(
941      cl_kernel kernel,
942      cl_device_id device,
943      cl_kernel_sub_group_info param_name,
944      size_t input_value_size,
945      const void *input_value,
946      size_t param_value_size,
947      void *param_value,
948      size_t *param_value_size_ret);
949
950   CL_API_ENTRY cl_int (CL_API_CALL *clSetDefaultDeviceCommandQueue)(
951      cl_context context,
952      cl_device_id device,
953      cl_command_queue command_queue);
954
955   CL_API_ENTRY cl_int (CL_API_CALL *clSetProgramReleaseCallback)(
956      cl_program program,
957      void (CL_CALLBACK *pfn_notify)(cl_program program, void *user_data),
958      void *user_data);
959
960   CL_API_ENTRY cl_int (CL_API_CALL *clSetProgramSpecializationConstant)(
961      cl_program program,
962      cl_uint spec_id,
963      size_t spec_size,
964      const void *spec_value);
965};
966
967namespace clover {
968   extern const _cl_icd_dispatch _dispatch;
969
970   cl_int
971   GetPlatformInfo(cl_platform_id d_platform, cl_platform_info param,
972                   size_t size, void *r_buf, size_t *r_size);
973
974   void *
975   GetExtensionFunctionAddress(const char *p_name);
976
977   void *
978   GetExtensionFunctionAddressForPlatform(cl_platform_id d_platform,
979                                          const char *p_name);
980
981   cl_int
982   IcdGetPlatformIDsKHR(cl_uint num_entries, cl_platform_id *rd_platforms,
983                        cl_uint *rnum_platforms);
984}
985
986#endif
987