• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*******************************************************************************
2  * Copyright (c) 2019-2020 The Khronos Group Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *    http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  ******************************************************************************/
16 
17 #ifndef OPENCL_CL_ICD_H
18 #define OPENCL_CL_ICD_H
19 
20 #include <CL/cl.h>
21 #include <CL/cl_egl.h>
22 #include <CL/cl_ext.h>
23 #include <CL/cl_gl.h>
24 
25 #if defined(_WIN32)
26 #include <CL/cl_d3d11.h>
27 #include <CL/cl_d3d10.h>
28 #include <CL/cl_dx9_media_sharing.h>
29 #endif
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 /*
36  * This file contains pointer type definitions for each of the CL API calls as
37  * well as a type definition for the dispatch table used by the Khronos ICD
38  * loader (see cl_khr_icd extension specification for background).
39  */
40 
41 /* API function pointer definitions */
42 
43 // Platform APIs
44 typedef cl_int(CL_API_CALL *cl_api_clGetPlatformIDs)(
45     cl_uint num_entries, cl_platform_id *platforms,
46     cl_uint *num_platforms) CL_API_SUFFIX__VERSION_1_0;
47 
48 typedef cl_int(CL_API_CALL *cl_api_clGetPlatformInfo)(
49     cl_platform_id platform, cl_platform_info param_name,
50     size_t param_value_size, void *param_value,
51     size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
52 
53 // Device APIs
54 typedef cl_int(CL_API_CALL *cl_api_clGetDeviceIDs)(
55     cl_platform_id platform, cl_device_type device_type, cl_uint num_entries,
56     cl_device_id *devices, cl_uint *num_devices) CL_API_SUFFIX__VERSION_1_0;
57 
58 typedef cl_int(CL_API_CALL *cl_api_clGetDeviceInfo)(
59     cl_device_id device, cl_device_info param_name, size_t param_value_size,
60     void *param_value, size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
61 
62 #ifdef CL_VERSION_1_2
63 
64 typedef cl_int(CL_API_CALL *cl_api_clCreateSubDevices)(
65     cl_device_id in_device,
66     const cl_device_partition_property *partition_properties,
67     cl_uint num_entries, cl_device_id *out_devices, cl_uint *num_devices);
68 
69 typedef cl_int(CL_API_CALL *cl_api_clRetainDevice)(
70     cl_device_id device) CL_API_SUFFIX__VERSION_1_2;
71 
72 typedef cl_int(CL_API_CALL *cl_api_clReleaseDevice)(
73     cl_device_id device) CL_API_SUFFIX__VERSION_1_2;
74 
75 #else
76 
77 typedef void *cl_api_clCreateSubDevices;
78 typedef void *cl_api_clRetainDevice;
79 typedef void *cl_api_clReleaseDevice;
80 
81 #endif
82 
83 // Context APIs
84 typedef cl_context(CL_API_CALL *cl_api_clCreateContext)(
85     const cl_context_properties *properties, cl_uint num_devices,
86     const cl_device_id *devices,
87     void(CL_CALLBACK *pfn_notify)(const char *, const void *, size_t, void *),
88     void *user_data, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0;
89 
90 typedef cl_context(CL_API_CALL *cl_api_clCreateContextFromType)(
91     const cl_context_properties *properties, cl_device_type device_type,
92     void(CL_CALLBACK *pfn_notify)(const char *, const void *, size_t, void *),
93     void *user_data, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0;
94 
95 typedef cl_int(CL_API_CALL *cl_api_clRetainContext)(
96     cl_context context) CL_API_SUFFIX__VERSION_1_0;
97 
98 typedef cl_int(CL_API_CALL *cl_api_clReleaseContext)(
99     cl_context context) CL_API_SUFFIX__VERSION_1_0;
100 
101 typedef cl_int(CL_API_CALL *cl_api_clGetContextInfo)(
102     cl_context context, cl_context_info param_name, size_t param_value_size,
103     void *param_value, size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
104 
105 // Command Queue APIs
106 typedef cl_command_queue(CL_API_CALL *cl_api_clCreateCommandQueue)(
107     cl_context context, cl_device_id device,
108     cl_command_queue_properties properties,
109     cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0;
110 
111 #ifdef CL_VERSION_2_0
112 
113 typedef
114 cl_command_queue(CL_API_CALL *cl_api_clCreateCommandQueueWithProperties)(
115     cl_context /* context */, cl_device_id /* device */,
116     const cl_queue_properties * /* properties */,
117     cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_2_0;
118 
119 #else
120 
121 typedef void *cl_api_clCreateCommandQueueWithProperties;
122 
123 #endif
124 
125 typedef cl_int(CL_API_CALL *cl_api_clRetainCommandQueue)(
126     cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_0;
127 
128 typedef cl_int(CL_API_CALL *cl_api_clReleaseCommandQueue)(
129     cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_0;
130 
131 typedef cl_int(CL_API_CALL *cl_api_clGetCommandQueueInfo)(
132     cl_command_queue command_queue, cl_command_queue_info param_name,
133     size_t param_value_size, void *param_value,
134     size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
135 
136 // Memory Object APIs
137 typedef cl_mem(CL_API_CALL *cl_api_clCreateBuffer)(
138     cl_context context, cl_mem_flags flags, size_t size, void *host_ptr,
139     cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0;
140 
141 #ifdef CL_VERSION_1_2
142 
143 typedef cl_mem(CL_API_CALL *cl_api_clCreateImage)(
144     cl_context context, cl_mem_flags flags, const cl_image_format *image_format,
145     const cl_image_desc *image_desc, void *host_ptr,
146     cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_2;
147 
148 #else
149 
150 typedef void *cl_api_clCreateImage;
151 
152 #endif
153 
154 #ifdef CL_VERSION_3_0
155 
156 typedef cl_mem(CL_API_CALL *cl_api_clCreateBufferWithProperties)(
157     cl_context context, const cl_mem_properties *properties, cl_mem_flags flags,
158     size_t size, void *host_ptr,
159     cl_int *errcode_ret) CL_API_SUFFIX__VERSION_3_0;
160 
161 typedef cl_mem(CL_API_CALL *cl_api_clCreateImageWithProperties)(
162     cl_context context, const cl_mem_properties *properties, cl_mem_flags flags,
163     const cl_image_format *image_format, const cl_image_desc *image_desc,
164     void *host_ptr, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_3_0;
165 
166 typedef cl_int(CL_API_CALL* cl_api_clSetContextDestructorCallback)(
167     cl_context context,
168     void(CL_CALLBACK* pfn_notify)(cl_context context, void* user_data),
169     void* user_data) CL_API_SUFFIX__VERSION_3_0;
170 
171 #else
172 
173 typedef void *cl_api_clCreateBufferWithProperties;
174 typedef void *cl_api_clCreateImageWithProperties;
175 typedef void *cl_api_clSetContextDestructorCallback;
176 
177 #endif
178 
179 typedef cl_int(CL_API_CALL *cl_api_clRetainMemObject)(
180     cl_mem memobj) CL_API_SUFFIX__VERSION_1_0;
181 
182 typedef cl_int(CL_API_CALL *cl_api_clReleaseMemObject)(
183     cl_mem memobj) CL_API_SUFFIX__VERSION_1_0;
184 
185 typedef cl_int(CL_API_CALL *cl_api_clGetSupportedImageFormats)(
186     cl_context context, cl_mem_flags flags, cl_mem_object_type image_type,
187     cl_uint num_entries, cl_image_format *image_formats,
188     cl_uint *num_image_formats) CL_API_SUFFIX__VERSION_1_0;
189 
190 typedef cl_int(CL_API_CALL *cl_api_clGetMemObjectInfo)(
191     cl_mem memobj, cl_mem_info param_name, size_t param_value_size,
192     void *param_value, size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
193 
194 typedef cl_int(CL_API_CALL *cl_api_clGetImageInfo)(
195     cl_mem image, cl_image_info param_name, size_t param_value_size,
196     void *param_value, size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
197 
198 #ifdef CL_VERSION_2_0
199 
200 typedef cl_mem(CL_API_CALL *cl_api_clCreatePipe)(
201     cl_context /* context */, cl_mem_flags /* flags */,
202     cl_uint /* pipe_packet_size */, cl_uint /* pipe_max_packets */,
203     const cl_pipe_properties * /* properties */,
204     cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_2_0;
205 
206 typedef cl_int(CL_API_CALL *cl_api_clGetPipeInfo)(
207     cl_mem /* pipe */, cl_pipe_info /* param_name */,
208     size_t /* param_value_size */, void * /* param_value */,
209     size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_2_0;
210 
211 typedef void *(CL_API_CALL *cl_api_clSVMAlloc)(
212     cl_context /* context */, cl_svm_mem_flags /* flags */, size_t /* size */,
213     unsigned int /* alignment */)CL_API_SUFFIX__VERSION_2_0;
214 
215 typedef void(CL_API_CALL *cl_api_clSVMFree)(
216     cl_context /* context */,
217     void * /* svm_pointer */) CL_API_SUFFIX__VERSION_2_0;
218 
219 #else
220 
221 typedef void *cl_api_clCreatePipe;
222 typedef void *cl_api_clGetPipeInfo;
223 typedef void *cl_api_clSVMAlloc;
224 typedef void *cl_api_clSVMFree;
225 
226 #endif
227 
228 // Sampler APIs
229 typedef cl_sampler(CL_API_CALL *cl_api_clCreateSampler)(
230     cl_context context, cl_bool normalized_coords,
231     cl_addressing_mode addressing_mode, cl_filter_mode filter_mode,
232     cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0;
233 
234 typedef cl_int(CL_API_CALL *cl_api_clRetainSampler)(
235     cl_sampler sampler) CL_API_SUFFIX__VERSION_1_0;
236 
237 typedef cl_int(CL_API_CALL *cl_api_clReleaseSampler)(
238     cl_sampler sampler) CL_API_SUFFIX__VERSION_1_0;
239 
240 typedef cl_int(CL_API_CALL *cl_api_clGetSamplerInfo)(
241     cl_sampler sampler, cl_sampler_info param_name, size_t param_value_size,
242     void *param_value, size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
243 
244 #ifdef CL_VERSION_2_0
245 
246 typedef
247 cl_sampler(CL_API_CALL *cl_api_clCreateSamplerWithProperties)(
248     cl_context /* context */,
249     const cl_sampler_properties * /* sampler_properties */,
250     cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_2_0;
251 
252 #else
253 
254 typedef void *cl_api_clCreateSamplerWithProperties;
255 
256 #endif
257 
258 // Program Object APIs
259 typedef cl_program(CL_API_CALL *cl_api_clCreateProgramWithSource)(
260     cl_context context, cl_uint count, const char **strings,
261     const size_t *lengths, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0;
262 
263 typedef cl_program(CL_API_CALL *cl_api_clCreateProgramWithBinary)(
264     cl_context context, cl_uint num_devices, const cl_device_id *device_list,
265     const size_t *lengths, const unsigned char **binaries,
266     cl_int *binary_status, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0;
267 
268 #ifdef CL_VERSION_1_2
269 
270 typedef
271 cl_program(CL_API_CALL *cl_api_clCreateProgramWithBuiltInKernels)(
272     cl_context context, cl_uint num_devices, const cl_device_id *device_list,
273     const char *kernel_names, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_2;
274 
275 #else
276 
277 typedef void *cl_api_clCreateProgramWithBuiltInKernels;
278 
279 #endif
280 
281 typedef cl_int(CL_API_CALL *cl_api_clRetainProgram)(
282     cl_program program) CL_API_SUFFIX__VERSION_1_0;
283 
284 typedef cl_int(CL_API_CALL *cl_api_clReleaseProgram)(
285     cl_program program) CL_API_SUFFIX__VERSION_1_0;
286 
287 typedef cl_int(CL_API_CALL *cl_api_clBuildProgram)(
288     cl_program program, cl_uint num_devices, const cl_device_id *device_list,
289     const char *options,
290     void(CL_CALLBACK *pfn_notify)(cl_program program, void *user_data),
291     void *user_data) CL_API_SUFFIX__VERSION_1_0;
292 
293 #ifdef CL_VERSION_1_2
294 
295 typedef cl_int(CL_API_CALL *cl_api_clCompileProgram)(
296     cl_program program, cl_uint num_devices, const cl_device_id *device_list,
297     const char *options, cl_uint num_input_headers,
298     const cl_program *input_headers, const char **header_include_names,
299     void(CL_CALLBACK *pfn_notify)(cl_program program, void *user_data),
300     void *user_data) CL_API_SUFFIX__VERSION_1_2;
301 
302 typedef cl_program(CL_API_CALL *cl_api_clLinkProgram)(
303     cl_context context, cl_uint num_devices, const cl_device_id *device_list,
304     const char *options, cl_uint num_input_programs,
305     const cl_program *input_programs,
306     void(CL_CALLBACK *pfn_notify)(cl_program program, void *user_data),
307     void *user_data, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_2;
308 
309 #else
310 
311 typedef void *cl_api_clCompileProgram;
312 typedef void *cl_api_clLinkProgram;
313 
314 #endif
315 
316 #ifdef CL_VERSION_2_2
317 
318 typedef
319 cl_int(CL_API_CALL *cl_api_clSetProgramSpecializationConstant)(
320     cl_program program, cl_uint spec_id, size_t spec_size,
321     const void *spec_value) CL_API_SUFFIX__VERSION_2_2;
322 
323 typedef cl_int(CL_API_CALL *cl_api_clSetProgramReleaseCallback)(
324     cl_program program,
325     void(CL_CALLBACK *pfn_notify)(cl_program program, void *user_data),
326     void *user_data) CL_API_SUFFIX__VERSION_2_2;
327 
328 #else
329 
330 typedef void *cl_api_clSetProgramSpecializationConstant;
331 typedef void *cl_api_clSetProgramReleaseCallback;
332 
333 #endif
334 
335 #ifdef CL_VERSION_1_2
336 
337 typedef cl_int(CL_API_CALL *cl_api_clUnloadPlatformCompiler)(
338     cl_platform_id platform) CL_API_SUFFIX__VERSION_1_2;
339 
340 #else
341 
342 typedef void *cl_api_clUnloadPlatformCompiler;
343 
344 #endif
345 
346 typedef cl_int(CL_API_CALL *cl_api_clGetProgramInfo)(
347     cl_program program, cl_program_info param_name, size_t param_value_size,
348     void *param_value, size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
349 
350 typedef cl_int(CL_API_CALL *cl_api_clGetProgramBuildInfo)(
351     cl_program program, cl_device_id device, cl_program_build_info param_name,
352     size_t param_value_size, void *param_value,
353     size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
354 
355 // Kernel Object APIs
356 typedef cl_kernel(CL_API_CALL *cl_api_clCreateKernel)(
357     cl_program program, const char *kernel_name,
358     cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0;
359 
360 typedef cl_int(CL_API_CALL *cl_api_clCreateKernelsInProgram)(
361     cl_program program, cl_uint num_kernels, cl_kernel *kernels,
362     cl_uint *num_kernels_ret) CL_API_SUFFIX__VERSION_1_0;
363 
364 typedef cl_int(CL_API_CALL *cl_api_clRetainKernel)(
365     cl_kernel kernel) CL_API_SUFFIX__VERSION_1_0;
366 
367 typedef cl_int(CL_API_CALL *cl_api_clReleaseKernel)(
368     cl_kernel kernel) CL_API_SUFFIX__VERSION_1_0;
369 
370 typedef cl_int(CL_API_CALL *cl_api_clSetKernelArg)(
371     cl_kernel kernel, cl_uint arg_index, size_t arg_size,
372     const void *arg_value) CL_API_SUFFIX__VERSION_1_0;
373 
374 typedef cl_int(CL_API_CALL *cl_api_clGetKernelInfo)(
375     cl_kernel kernel, cl_kernel_info param_name, size_t param_value_size,
376     void *param_value, size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
377 
378 #ifdef CL_VERSION_1_2
379 
380 typedef cl_int(CL_API_CALL *cl_api_clGetKernelArgInfo)(
381     cl_kernel kernel, cl_uint arg_indx, cl_kernel_arg_info param_name,
382     size_t param_value_size, void *param_value,
383     size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_2;
384 
385 #else
386 
387 typedef void *cl_api_clGetKernelArgInfo;
388 
389 #endif
390 
391 typedef cl_int(CL_API_CALL *cl_api_clGetKernelWorkGroupInfo)(
392     cl_kernel kernel, cl_device_id device, cl_kernel_work_group_info param_name,
393     size_t param_value_size, void *param_value,
394     size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
395 
396 #ifdef CL_VERSION_2_0
397 
398 typedef cl_int(CL_API_CALL *cl_api_clSetKernelArgSVMPointer)(
399     cl_kernel /* kernel */, cl_uint /* arg_index */,
400     const void * /* arg_value */) CL_API_SUFFIX__VERSION_2_0;
401 
402 typedef cl_int(CL_API_CALL *cl_api_clSetKernelExecInfo)(
403     cl_kernel /* kernel */, cl_kernel_exec_info /* param_name */,
404     size_t /* param_value_size */,
405     const void * /* param_value */) CL_API_SUFFIX__VERSION_2_0;
406 
407 typedef cl_int(CL_API_CALL *cl_api_clGetKernelSubGroupInfoKHR)(
408     cl_kernel /* in_kernel */, cl_device_id /*in_device*/,
409     cl_kernel_sub_group_info /* param_name */, size_t /*input_value_size*/,
410     const void * /*input_value*/, size_t /*param_value_size*/,
411     void * /*param_value*/,
412     size_t * /*param_value_size_ret*/) CL_API_SUFFIX__VERSION_2_0;
413 
414 #else
415 
416 typedef void *cl_api_clSetKernelArgSVMPointer;
417 typedef void *cl_api_clSetKernelExecInfo;
418 typedef void *cl_api_clGetKernelSubGroupInfoKHR;
419 
420 #endif
421 
422 // Event Object APIs
423 typedef cl_int(CL_API_CALL *cl_api_clWaitForEvents)(
424     cl_uint num_events, const cl_event *event_list) CL_API_SUFFIX__VERSION_1_0;
425 
426 typedef cl_int(CL_API_CALL *cl_api_clGetEventInfo)(
427     cl_event event, cl_event_info param_name, size_t param_value_size,
428     void *param_value, size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
429 
430 typedef cl_int(CL_API_CALL *cl_api_clRetainEvent)(cl_event event)
431     CL_API_SUFFIX__VERSION_1_0;
432 
433 typedef cl_int(CL_API_CALL *cl_api_clReleaseEvent)(cl_event event)
434     CL_API_SUFFIX__VERSION_1_0;
435 
436 // Profiling APIs
437 typedef cl_int(CL_API_CALL *cl_api_clGetEventProfilingInfo)(
438     cl_event event, cl_profiling_info param_name, size_t param_value_size,
439     void *param_value, size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
440 
441 // Flush and Finish APIs
442 typedef cl_int(CL_API_CALL *cl_api_clFlush)(
443     cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_0;
444 
445 typedef cl_int(CL_API_CALL *cl_api_clFinish)(
446     cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_0;
447 
448 // Enqueued Commands APIs
449 typedef cl_int(CL_API_CALL *cl_api_clEnqueueReadBuffer)(
450     cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_read,
451     size_t offset, size_t cb, void *ptr, cl_uint num_events_in_wait_list,
452     const cl_event *event_wait_list,
453     cl_event *event) CL_API_SUFFIX__VERSION_1_0;
454 
455 #ifdef CL_VERSION_1_1
456 
457 typedef cl_int(CL_API_CALL *cl_api_clEnqueueReadBufferRect)(
458     cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_read,
459     const size_t *buffer_origin, const size_t *host_origin,
460     const size_t *region, size_t buffer_row_pitch, size_t buffer_slice_pitch,
461     size_t host_row_pitch, size_t host_slice_pitch, void *ptr,
462     cl_uint num_events_in_wait_list, const cl_event *event_wait_list,
463     cl_event *event) CL_API_SUFFIX__VERSION_1_1;
464 
465 #else
466 
467 typedef void *cl_api_clEnqueueReadBufferRect;
468 
469 #endif
470 
471 typedef cl_int(CL_API_CALL *cl_api_clEnqueueWriteBuffer)(
472     cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_write,
473     size_t offset, size_t cb, const void *ptr, cl_uint num_events_in_wait_list,
474     const cl_event *event_wait_list,
475     cl_event *event) CL_API_SUFFIX__VERSION_1_0;
476 
477 #ifdef CL_VERSION_1_1
478 
479 typedef cl_int(CL_API_CALL *cl_api_clEnqueueWriteBufferRect)(
480     cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_read,
481     const size_t *buffer_origin, const size_t *host_origin,
482     const size_t *region, size_t buffer_row_pitch, size_t buffer_slice_pitch,
483     size_t host_row_pitch, size_t host_slice_pitch, const void *ptr,
484     cl_uint num_events_in_wait_list, const cl_event *event_wait_list,
485     cl_event *event) CL_API_SUFFIX__VERSION_1_1;
486 
487 #else
488 
489 typedef void *cl_api_clEnqueueWriteBufferRect;
490 
491 #endif
492 
493 #ifdef CL_VERSION_1_2
494 
495 typedef cl_int(CL_API_CALL *cl_api_clEnqueueFillBuffer)(
496     cl_command_queue command_queue, cl_mem buffer, const void *pattern,
497     size_t pattern_size, size_t offset, size_t cb,
498     cl_uint num_events_in_wait_list, const cl_event *event_wait_list,
499     cl_event *event) CL_API_SUFFIX__VERSION_1_2;
500 
501 #else
502 
503 typedef void *cl_api_clEnqueueFillBuffer;
504 
505 #endif
506 
507 typedef cl_int(CL_API_CALL *cl_api_clEnqueueCopyBuffer)(
508     cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_buffer,
509     size_t src_offset, size_t dst_offset, size_t cb,
510     cl_uint num_events_in_wait_list, const cl_event *event_wait_list,
511     cl_event *event) CL_API_SUFFIX__VERSION_1_0;
512 
513 #ifdef CL_VERSION_1_1
514 
515 typedef cl_int(CL_API_CALL *cl_api_clEnqueueCopyBufferRect)(
516     cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_buffer,
517     const size_t *src_origin, const size_t *dst_origin, const size_t *region,
518     size_t src_row_pitch, size_t src_slice_pitch, size_t dst_row_pitch,
519     size_t dst_slice_pitch, cl_uint num_events_in_wait_list,
520     const cl_event *event_wait_list,
521     cl_event *event) CL_API_SUFFIX__VERSION_1_1;
522 
523 #else
524 
525 typedef void *cl_api_clEnqueueCopyBufferRect;
526 
527 #endif
528 
529 typedef cl_int(CL_API_CALL *cl_api_clEnqueueReadImage)(
530     cl_command_queue command_queue, cl_mem image, cl_bool blocking_read,
531     const size_t *origin, const size_t *region, size_t row_pitch,
532     size_t slice_pitch, void *ptr, cl_uint num_events_in_wait_list,
533     const cl_event *event_wait_list,
534     cl_event *event) CL_API_SUFFIX__VERSION_1_0;
535 
536 typedef cl_int(CL_API_CALL *cl_api_clEnqueueWriteImage)(
537     cl_command_queue command_queue, cl_mem image, cl_bool blocking_write,
538     const size_t *origin, const size_t *region, size_t input_row_pitch,
539     size_t input_slice_pitch, const void *ptr, cl_uint num_events_in_wait_list,
540     const cl_event *event_wait_list,
541     cl_event *event) CL_API_SUFFIX__VERSION_1_0;
542 
543 #ifdef CL_VERSION_1_2
544 
545 typedef cl_int(CL_API_CALL *cl_api_clEnqueueFillImage)(
546     cl_command_queue command_queue, cl_mem image, const void *fill_color,
547     const size_t origin[3], const size_t region[3],
548     cl_uint num_events_in_wait_list, const cl_event *event_wait_list,
549     cl_event *event) CL_API_SUFFIX__VERSION_1_2;
550 
551 #else
552 
553 typedef void *cl_api_clEnqueueFillImage;
554 
555 #endif
556 
557 typedef cl_int(CL_API_CALL *cl_api_clEnqueueCopyImage)(
558     cl_command_queue command_queue, cl_mem src_image, cl_mem dst_image,
559     const size_t *src_origin, const size_t *dst_origin, const size_t *region,
560     cl_uint num_events_in_wait_list, const cl_event *event_wait_list,
561     cl_event *event) CL_API_SUFFIX__VERSION_1_0;
562 
563 typedef cl_int(CL_API_CALL *cl_api_clEnqueueCopyImageToBuffer)(
564     cl_command_queue command_queue, cl_mem src_image, cl_mem dst_buffer,
565     const size_t *src_origin, const size_t *region, size_t dst_offset,
566     cl_uint num_events_in_wait_list, const cl_event *event_wait_list,
567     cl_event *event) CL_API_SUFFIX__VERSION_1_0;
568 
569 typedef cl_int(CL_API_CALL *cl_api_clEnqueueCopyBufferToImage)(
570     cl_command_queue command_queue, cl_mem src_buffer, cl_mem dst_image,
571     size_t src_offset, const size_t *dst_origin, const size_t *region,
572     cl_uint num_events_in_wait_list, const cl_event *event_wait_list,
573     cl_event *event) CL_API_SUFFIX__VERSION_1_0;
574 
575 typedef void *(CL_API_CALL *cl_api_clEnqueueMapBuffer)(
576     cl_command_queue command_queue, cl_mem buffer, cl_bool blocking_map,
577     cl_map_flags map_flags, size_t offset, size_t cb,
578     cl_uint num_events_in_wait_list, const cl_event *event_wait_list,
579     cl_event *event, cl_int *errcode_ret)CL_API_SUFFIX__VERSION_1_0;
580 
581 typedef void *(CL_API_CALL *cl_api_clEnqueueMapImage)(
582     cl_command_queue command_queue, cl_mem image, cl_bool blocking_map,
583     cl_map_flags map_flags, const size_t *origin, const size_t *region,
584     size_t *image_row_pitch, size_t *image_slice_pitch,
585     cl_uint num_events_in_wait_list, const cl_event *event_wait_list,
586     cl_event *event, cl_int *errcode_ret)CL_API_SUFFIX__VERSION_1_0;
587 
588 typedef cl_int(CL_API_CALL *cl_api_clEnqueueUnmapMemObject)(
589     cl_command_queue command_queue, cl_mem memobj, void *mapped_ptr,
590     cl_uint num_events_in_wait_list, const cl_event *event_wait_list,
591     cl_event *event) CL_API_SUFFIX__VERSION_1_0;
592 
593 #ifdef CL_VERSION_1_2
594 
595 typedef cl_int(CL_API_CALL *cl_api_clEnqueueMigrateMemObjects)(
596     cl_command_queue command_queue, cl_uint num_mem_objects,
597     const cl_mem *mem_objects, cl_mem_migration_flags flags,
598     cl_uint num_events_in_wait_list, const cl_event *event_wait_list,
599     cl_event *event) CL_API_SUFFIX__VERSION_1_2;
600 
601 #else
602 
603 typedef void *cl_api_clEnqueueMigrateMemObjects;
604 
605 #endif
606 
607 typedef cl_int(CL_API_CALL *cl_api_clEnqueueNDRangeKernel)(
608     cl_command_queue command_queue, cl_kernel kernel, cl_uint work_dim,
609     const size_t *global_work_offset, const size_t *global_work_size,
610     const size_t *local_work_size, cl_uint num_events_in_wait_list,
611     const cl_event *event_wait_list,
612     cl_event *event) CL_API_SUFFIX__VERSION_1_0;
613 
614 typedef cl_int(CL_API_CALL *cl_api_clEnqueueTask)(
615     cl_command_queue command_queue, cl_kernel kernel,
616     cl_uint num_events_in_wait_list, const cl_event *event_wait_list,
617     cl_event *event) CL_API_SUFFIX__VERSION_1_0;
618 
619 typedef cl_int(CL_API_CALL *cl_api_clEnqueueNativeKernel)(
620     cl_command_queue command_queue, void(CL_CALLBACK *user_func)(void *),
621     void *args, size_t cb_args, cl_uint num_mem_objects, const cl_mem *mem_list,
622     const void **args_mem_loc, cl_uint num_events_in_wait_list,
623     const cl_event *event_wait_list,
624     cl_event *event) CL_API_SUFFIX__VERSION_1_0;
625 
626 #ifdef CL_VERSION_1_2
627 
628 typedef cl_int(CL_API_CALL *cl_api_clEnqueueMarkerWithWaitList)(
629     cl_command_queue command_queue, cl_uint num_events_in_wait_list,
630     const cl_event *event_wait_list,
631     cl_event *event) CL_API_SUFFIX__VERSION_1_2;
632 
633 typedef cl_int(CL_API_CALL *cl_api_clEnqueueBarrierWithWaitList)(
634     cl_command_queue command_queue, cl_uint num_events_in_wait_list,
635     const cl_event *event_wait_list,
636     cl_event *event) CL_API_SUFFIX__VERSION_1_2;
637 
638 typedef void *(
639     CL_API_CALL *cl_api_clGetExtensionFunctionAddressForPlatform)(
640     cl_platform_id platform,
641     const char *function_name)CL_API_SUFFIX__VERSION_1_2;
642 
643 #else
644 
645 typedef void *cl_api_clEnqueueMarkerWithWaitList;
646 typedef void *cl_api_clEnqueueBarrierWithWaitList;
647 typedef void *cl_api_clGetExtensionFunctionAddressForPlatform;
648 
649 #endif
650 
651 // Shared Virtual Memory APIs
652 
653 #ifdef CL_VERSION_2_0
654 
655 typedef cl_int(CL_API_CALL *cl_api_clEnqueueSVMFree)(
656     cl_command_queue /* command_queue */, cl_uint /* num_svm_pointers */,
657     void ** /* svm_pointers */,
658     void(CL_CALLBACK *pfn_free_func)(cl_command_queue /* queue */,
659                                      cl_uint /* num_svm_pointers */,
660                                      void ** /* svm_pointers[] */,
661                                      void * /* user_data */),
662     void * /* user_data */, cl_uint /* num_events_in_wait_list */,
663     const cl_event * /* event_wait_list */,
664     cl_event * /* event */) CL_API_SUFFIX__VERSION_2_0;
665 
666 typedef cl_int(CL_API_CALL *cl_api_clEnqueueSVMMemcpy)(
667     cl_command_queue /* command_queue */, cl_bool /* blocking_copy */,
668     void * /* dst_ptr */, const void * /* src_ptr */, size_t /* size */,
669     cl_uint /* num_events_in_wait_list */,
670     const cl_event * /* event_wait_list */,
671     cl_event * /* event */) CL_API_SUFFIX__VERSION_2_0;
672 
673 typedef cl_int(CL_API_CALL *cl_api_clEnqueueSVMMemFill)(
674     cl_command_queue /* command_queue */, void * /* svm_ptr */,
675     const void * /* pattern */, size_t /* pattern_size */, size_t /* size */,
676     cl_uint /* num_events_in_wait_list */,
677     const cl_event * /* event_wait_list */,
678     cl_event * /* event */) CL_API_SUFFIX__VERSION_2_0;
679 
680 typedef cl_int(CL_API_CALL *cl_api_clEnqueueSVMMap)(
681     cl_command_queue /* command_queue */, cl_bool /* blocking_map */,
682     cl_map_flags /* map_flags */, void * /* svm_ptr */, size_t /* size */,
683     cl_uint /* num_events_in_wait_list */,
684     const cl_event * /* event_wait_list */,
685     cl_event * /* event */) CL_API_SUFFIX__VERSION_2_0;
686 
687 typedef cl_int(CL_API_CALL *cl_api_clEnqueueSVMUnmap)(
688     cl_command_queue /* command_queue */, void * /* svm_ptr */,
689     cl_uint /* num_events_in_wait_list */,
690     const cl_event * /* event_wait_list */,
691     cl_event * /* event */) CL_API_SUFFIX__VERSION_2_0;
692 
693 #else
694 
695 typedef void *cl_api_clEnqueueSVMFree;
696 typedef void *cl_api_clEnqueueSVMMemcpy;
697 typedef void *cl_api_clEnqueueSVMMemFill;
698 typedef void *cl_api_clEnqueueSVMMap;
699 typedef void *cl_api_clEnqueueSVMUnmap;
700 
701 #endif
702 
703 // Deprecated APIs
704 typedef cl_int(CL_API_CALL *cl_api_clSetCommandQueueProperty)(
705     cl_command_queue command_queue, cl_command_queue_properties properties,
706     cl_bool enable, cl_command_queue_properties *old_properties)
707     CL_API_SUFFIX__VERSION_1_0_DEPRECATED;
708 
709 typedef cl_mem(CL_API_CALL *cl_api_clCreateImage2D)(
710     cl_context context, cl_mem_flags flags, const cl_image_format *image_format,
711     size_t image_width, size_t image_height, size_t image_row_pitch,
712     void *host_ptr, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
713 
714 typedef cl_mem(CL_API_CALL *cl_api_clCreateImage3D)(
715     cl_context context, cl_mem_flags flags, const cl_image_format *image_format,
716     size_t image_width, size_t image_height, size_t image_depth,
717     size_t image_row_pitch, size_t image_slice_pitch, void *host_ptr,
718     cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
719 
720 typedef cl_int(CL_API_CALL *cl_api_clUnloadCompiler)(void)
721     CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
722 
723 typedef cl_int(CL_API_CALL *cl_api_clEnqueueMarker)(
724     cl_command_queue command_queue,
725     cl_event *event) CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
726 
727 typedef cl_int(CL_API_CALL *cl_api_clEnqueueWaitForEvents)(
728     cl_command_queue command_queue, cl_uint num_events,
729     const cl_event *event_list) CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
730 
731 typedef cl_int(CL_API_CALL *cl_api_clEnqueueBarrier)(
732     cl_command_queue command_queue) CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
733 
734 typedef void *(CL_API_CALL *cl_api_clGetExtensionFunctionAddress)(
735     const char *function_name)CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
736 
737 // GL and other APIs
738 typedef cl_mem(CL_API_CALL *cl_api_clCreateFromGLBuffer)(
739     cl_context context, cl_mem_flags flags, cl_GLuint bufobj,
740     int *errcode_ret) CL_API_SUFFIX__VERSION_1_0;
741 
742 typedef cl_mem(CL_API_CALL *cl_api_clCreateFromGLTexture)(
743     cl_context context, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel,
744     cl_GLuint texture, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_2;
745 
746 typedef cl_mem(CL_API_CALL *cl_api_clCreateFromGLTexture2D)(
747     cl_context context, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel,
748     cl_GLuint texture, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0;
749 
750 typedef cl_mem(CL_API_CALL *cl_api_clCreateFromGLTexture3D)(
751     cl_context context, cl_mem_flags flags, cl_GLenum target, cl_GLint miplevel,
752     cl_GLuint texture, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0;
753 
754 typedef cl_mem(CL_API_CALL *cl_api_clCreateFromGLRenderbuffer)(
755     cl_context context, cl_mem_flags flags, cl_GLuint renderbuffer,
756     cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0;
757 
758 typedef cl_int(CL_API_CALL *cl_api_clGetGLObjectInfo)(
759     cl_mem memobj, cl_gl_object_type *gl_object_type,
760     cl_GLuint *gl_object_name) CL_API_SUFFIX__VERSION_1_0;
761 
762 typedef cl_int(CL_API_CALL *cl_api_clGetGLTextureInfo)(
763     cl_mem memobj, cl_gl_texture_info param_name, size_t param_value_size,
764     void *param_value, size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_1_0;
765 
766 typedef cl_int(CL_API_CALL *cl_api_clEnqueueAcquireGLObjects)(
767     cl_command_queue command_queue, cl_uint num_objects,
768     const cl_mem *mem_objects, cl_uint num_events_in_wait_list,
769     const cl_event *event_wait_list,
770     cl_event *event) CL_API_SUFFIX__VERSION_1_0;
771 
772 typedef cl_int(CL_API_CALL *cl_api_clEnqueueReleaseGLObjects)(
773     cl_command_queue command_queue, cl_uint num_objects,
774     const cl_mem *mem_objects, cl_uint num_events_in_wait_list,
775     const cl_event *event_wait_list,
776     cl_event *event) CL_API_SUFFIX__VERSION_1_0;
777 
778 /* cl_khr_gl_sharing */
779 typedef cl_int(CL_API_CALL *cl_api_clGetGLContextInfoKHR)(
780     const cl_context_properties *properties, cl_gl_context_info param_name,
781     size_t param_value_size, void *param_value, size_t *param_value_size_ret);
782 
783 /* cl_khr_gl_event */
784 typedef cl_event(CL_API_CALL *cl_api_clCreateEventFromGLsyncKHR)(
785     cl_context context, cl_GLsync sync, cl_int *errcode_ret);
786 
787 #if defined(_WIN32)
788 
789 /* cl_khr_d3d10_sharing */
790 
791 typedef cl_int(CL_API_CALL *cl_api_clGetDeviceIDsFromD3D10KHR)(
792     cl_platform_id platform, cl_d3d10_device_source_khr d3d_device_source,
793     void *d3d_object, cl_d3d10_device_set_khr d3d_device_set,
794     cl_uint num_entries, cl_device_id *devices,
795     cl_uint *num_devices) CL_API_SUFFIX__VERSION_1_0;
796 
797 typedef cl_mem(CL_API_CALL *cl_api_clCreateFromD3D10BufferKHR)(
798     cl_context context, cl_mem_flags flags, ID3D10Buffer *resource,
799     cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0;
800 
801 typedef cl_mem(CL_API_CALL *cl_api_clCreateFromD3D10Texture2DKHR)(
802     cl_context context, cl_mem_flags flags, ID3D10Texture2D *resource,
803     UINT subresource, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0;
804 
805 typedef cl_mem(CL_API_CALL *cl_api_clCreateFromD3D10Texture3DKHR)(
806     cl_context context, cl_mem_flags flags, ID3D10Texture3D *resource,
807     UINT subresource, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_0;
808 
809 typedef
810 cl_int(CL_API_CALL *cl_api_clEnqueueAcquireD3D10ObjectsKHR)(
811     cl_command_queue command_queue, cl_uint num_objects,
812     const cl_mem *mem_objects, cl_uint num_events_in_wait_list,
813     const cl_event *event_wait_list,
814     cl_event *event) CL_API_SUFFIX__VERSION_1_0;
815 
816 typedef
817 cl_int(CL_API_CALL *cl_api_clEnqueueReleaseD3D10ObjectsKHR)(
818     cl_command_queue command_queue, cl_uint num_objects,
819     const cl_mem *mem_objects, cl_uint num_events_in_wait_list,
820     const cl_event *event_wait_list,
821     cl_event *event) CL_API_SUFFIX__VERSION_1_0;
822 
823 extern CL_API_ENTRY cl_int CL_API_CALL clGetDeviceIDsFromD3D10KHR(
824     cl_platform_id platform, cl_d3d10_device_source_khr d3d_device_source,
825     void *d3d_object, cl_d3d10_device_set_khr d3d_device_set,
826     cl_uint num_entries, cl_device_id *devices, cl_uint *num_devices);
827 
828 extern CL_API_ENTRY cl_mem CL_API_CALL
829 clCreateFromD3D10BufferKHR(cl_context context, cl_mem_flags flags,
830                            ID3D10Buffer *resource, cl_int *errcode_ret);
831 
832 extern CL_API_ENTRY cl_mem CL_API_CALL clCreateFromD3D10Texture2DKHR(
833     cl_context context, cl_mem_flags flags, ID3D10Texture2D *resource,
834     UINT subresource, cl_int *errcode_ret);
835 
836 extern CL_API_ENTRY cl_mem CL_API_CALL clCreateFromD3D10Texture3DKHR(
837     cl_context context, cl_mem_flags flags, ID3D10Texture3D *resource,
838     UINT subresource, cl_int *errcode_ret);
839 
840 extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueAcquireD3D10ObjectsKHR(
841     cl_command_queue command_queue, cl_uint num_objects,
842     const cl_mem *mem_objects, cl_uint num_events_in_wait_list,
843     const cl_event *event_wait_list, cl_event *event);
844 
845 extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueReleaseD3D10ObjectsKHR(
846     cl_command_queue command_queue, cl_uint num_objects,
847     const cl_mem *mem_objects, cl_uint num_events_in_wait_list,
848     const cl_event *event_wait_list, cl_event *event);
849 
850 /* cl_khr_d3d11_sharing */
851 typedef cl_int(CL_API_CALL *cl_api_clGetDeviceIDsFromD3D11KHR)(
852     cl_platform_id platform, cl_d3d11_device_source_khr d3d_device_source,
853     void *d3d_object, cl_d3d11_device_set_khr d3d_device_set,
854     cl_uint num_entries, cl_device_id *devices,
855     cl_uint *num_devices) CL_API_SUFFIX__VERSION_1_2;
856 
857 typedef cl_mem(CL_API_CALL *cl_api_clCreateFromD3D11BufferKHR)(
858     cl_context context, cl_mem_flags flags, ID3D11Buffer *resource,
859     cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_2;
860 
861 typedef cl_mem(CL_API_CALL *cl_api_clCreateFromD3D11Texture2DKHR)(
862     cl_context context, cl_mem_flags flags, ID3D11Texture2D *resource,
863     UINT subresource, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_2;
864 
865 typedef cl_mem(CL_API_CALL *cl_api_clCreateFromD3D11Texture3DKHR)(
866     cl_context context, cl_mem_flags flags, ID3D11Texture3D *resource,
867     UINT subresource, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_2;
868 
869 typedef
870 cl_int(CL_API_CALL *cl_api_clEnqueueAcquireD3D11ObjectsKHR)(
871     cl_command_queue command_queue, cl_uint num_objects,
872     const cl_mem *mem_objects, cl_uint num_events_in_wait_list,
873     const cl_event *event_wait_list,
874     cl_event *event) CL_API_SUFFIX__VERSION_1_2;
875 
876 typedef
877 cl_int(CL_API_CALL *cl_api_clEnqueueReleaseD3D11ObjectsKHR)(
878     cl_command_queue command_queue, cl_uint num_objects,
879     const cl_mem *mem_objects, cl_uint num_events_in_wait_list,
880     const cl_event *event_wait_list,
881     cl_event *event) CL_API_SUFFIX__VERSION_1_2;
882 
883 /* cl_khr_dx9_media_sharing */
884 typedef
885 cl_int(CL_API_CALL *cl_api_clGetDeviceIDsFromDX9MediaAdapterKHR)(
886     cl_platform_id platform, cl_uint num_media_adapters,
887     cl_dx9_media_adapter_type_khr *media_adapters_type, void *media_adapters,
888     cl_dx9_media_adapter_set_khr media_adapter_set, cl_uint num_entries,
889     cl_device_id *devices, cl_uint *num_devices) CL_API_SUFFIX__VERSION_1_2;
890 
891 typedef cl_mem(CL_API_CALL *cl_api_clCreateFromDX9MediaSurfaceKHR)(
892     cl_context context, cl_mem_flags flags,
893     cl_dx9_media_adapter_type_khr adapter_type, void *surface_info,
894     cl_uint plane, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_1_2;
895 
896 typedef
897 cl_int(CL_API_CALL *cl_api_clEnqueueAcquireDX9MediaSurfacesKHR)(
898     cl_command_queue command_queue, cl_uint num_objects,
899     const cl_mem *mem_objects, cl_uint num_events_in_wait_list,
900     const cl_event *event_wait_list,
901     cl_event *event) CL_API_SUFFIX__VERSION_1_2;
902 
903 typedef
904 cl_int(CL_API_CALL *cl_api_clEnqueueReleaseDX9MediaSurfacesKHR)(
905     cl_command_queue command_queue, cl_uint num_objects,
906     const cl_mem *mem_objects, cl_uint num_events_in_wait_list,
907     const cl_event *event_wait_list,
908     cl_event *event) CL_API_SUFFIX__VERSION_1_2;
909 
910 /* cl_khr_d3d11_sharing */
911 extern CL_API_ENTRY cl_int CL_API_CALL clGetDeviceIDsFromD3D11KHR(
912     cl_platform_id platform, cl_d3d11_device_source_khr d3d_device_source,
913     void *d3d_object, cl_d3d11_device_set_khr d3d_device_set,
914     cl_uint num_entries, cl_device_id *devices, cl_uint *num_devices);
915 
916 extern CL_API_ENTRY cl_mem CL_API_CALL
917 clCreateFromD3D11BufferKHR(cl_context context, cl_mem_flags flags,
918                            ID3D11Buffer *resource, cl_int *errcode_ret);
919 
920 extern CL_API_ENTRY cl_mem CL_API_CALL clCreateFromD3D11Texture2DKHR(
921     cl_context context, cl_mem_flags flags, ID3D11Texture2D *resource,
922     UINT subresource, cl_int *errcode_ret);
923 
924 extern CL_API_ENTRY cl_mem CL_API_CALL clCreateFromD3D11Texture3DKHR(
925     cl_context context, cl_mem_flags flags, ID3D11Texture3D *resource,
926     UINT subresource, cl_int *errcode_ret);
927 
928 extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueAcquireD3D11ObjectsKHR(
929     cl_command_queue command_queue, cl_uint num_objects,
930     const cl_mem *mem_objects, cl_uint num_events_in_wait_list,
931     const cl_event *event_wait_list, cl_event *event);
932 
933 extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueReleaseD3D11ObjectsKHR(
934     cl_command_queue command_queue, cl_uint num_objects,
935     const cl_mem *mem_objects, cl_uint num_events_in_wait_list,
936     const cl_event *event_wait_list, cl_event *event);
937 
938 /* cl_khr_dx9_media_sharing */
939 extern CL_API_ENTRY cl_int CL_API_CALL clGetDeviceIDsFromDX9MediaAdapterKHR(
940     cl_platform_id platform, cl_uint num_media_adapters,
941     cl_dx9_media_adapter_type_khr *media_adapter_type, void *media_adapters,
942     cl_dx9_media_adapter_set_khr media_adapter_set, cl_uint num_entries,
943     cl_device_id *devices, cl_uint *num_devices);
944 
945 extern CL_API_ENTRY cl_mem CL_API_CALL clCreateFromDX9MediaSurfaceKHR(
946     cl_context context, cl_mem_flags flags,
947     cl_dx9_media_adapter_type_khr adapter_type, void *surface_info,
948     cl_uint plane, cl_int *errcode_ret);
949 
950 extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueAcquireDX9MediaSurfacesKHR(
951     cl_command_queue command_queue, cl_uint num_objects,
952     const cl_mem *mem_objects, cl_uint num_events_in_wait_list,
953     const cl_event *event_wait_list, cl_event *event);
954 
955 extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueReleaseDX9MediaSurfacesKHR(
956     cl_command_queue command_queue, cl_uint num_objects,
957     const cl_mem *mem_objects, cl_uint num_events_in_wait_list,
958     const cl_event *event_wait_list, cl_event *event);
959 
960 #else
961 
962 /* cl_khr_d3d10_sharing */
963 typedef void *cl_api_clGetDeviceIDsFromD3D10KHR;
964 typedef void *cl_api_clCreateFromD3D10BufferKHR;
965 typedef void *cl_api_clCreateFromD3D10Texture2DKHR;
966 typedef void *cl_api_clCreateFromD3D10Texture3DKHR;
967 typedef void *cl_api_clEnqueueAcquireD3D10ObjectsKHR;
968 typedef void *cl_api_clEnqueueReleaseD3D10ObjectsKHR;
969 
970 /* cl_khr_d3d11_sharing */
971 typedef void *cl_api_clGetDeviceIDsFromD3D11KHR;
972 typedef void *cl_api_clCreateFromD3D11BufferKHR;
973 typedef void *cl_api_clCreateFromD3D11Texture2DKHR;
974 typedef void *cl_api_clCreateFromD3D11Texture3DKHR;
975 typedef void *cl_api_clEnqueueAcquireD3D11ObjectsKHR;
976 typedef void *cl_api_clEnqueueReleaseD3D11ObjectsKHR;
977 
978 /* cl_khr_dx9_media_sharing */
979 typedef void *cl_api_clCreateFromDX9MediaSurfaceKHR;
980 typedef void *cl_api_clEnqueueAcquireDX9MediaSurfacesKHR;
981 typedef void *cl_api_clEnqueueReleaseDX9MediaSurfacesKHR;
982 typedef void *cl_api_clGetDeviceIDsFromDX9MediaAdapterKHR;
983 
984 #endif
985 
986 /* OpenCL 1.1 */
987 
988 #ifdef CL_VERSION_1_1
989 
990 typedef cl_int(CL_API_CALL *cl_api_clSetEventCallback)(
991     cl_event /* event */, cl_int /* command_exec_callback_type */,
992     void(CL_CALLBACK * /* pfn_notify */)(cl_event, cl_int, void *),
993     void * /* user_data */) CL_API_SUFFIX__VERSION_1_1;
994 
995 typedef cl_mem(CL_API_CALL *cl_api_clCreateSubBuffer)(
996     cl_mem /* buffer */, cl_mem_flags /* flags */,
997     cl_buffer_create_type /* buffer_create_type */,
998     const void * /* buffer_create_info */,
999     cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_1;
1000 
1001 typedef
1002 cl_int(CL_API_CALL *cl_api_clSetMemObjectDestructorCallback)(
1003     cl_mem /* memobj */,
1004     void(CL_CALLBACK * /*pfn_notify*/)(cl_mem /* memobj */,
1005                                        void * /*user_data*/),
1006     void * /*user_data */) CL_API_SUFFIX__VERSION_1_1;
1007 
1008 typedef cl_event(CL_API_CALL *cl_api_clCreateUserEvent)(
1009     cl_context /* context */,
1010     cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_1;
1011 
1012 typedef cl_int(CL_API_CALL *cl_api_clSetUserEventStatus)(
1013     cl_event /* event */,
1014     cl_int /* execution_status */) CL_API_SUFFIX__VERSION_1_1;
1015 
1016 #else
1017 
1018 typedef void *cl_api_clSetEventCallback;
1019 typedef void *cl_api_clCreateSubBuffer;
1020 typedef void *cl_api_clSetMemObjectDestructorCallback;
1021 typedef void *cl_api_clCreateUserEvent;
1022 typedef void *cl_api_clSetUserEventStatus;
1023 
1024 #endif
1025 
1026 typedef cl_int(CL_API_CALL *cl_api_clCreateSubDevicesEXT)(
1027     cl_device_id in_device,
1028     const cl_device_partition_property_ext *partition_properties,
1029     cl_uint num_entries, cl_device_id *out_devices, cl_uint *num_devices);
1030 
1031 typedef cl_int(CL_API_CALL *cl_api_clRetainDeviceEXT)(
1032     cl_device_id device) CL_API_SUFFIX__VERSION_1_0;
1033 
1034 typedef cl_int(CL_API_CALL *cl_api_clReleaseDeviceEXT)(
1035     cl_device_id device) CL_API_SUFFIX__VERSION_1_0;
1036 
1037 /* cl_khr_egl_image */
1038 typedef cl_mem(CL_API_CALL *cl_api_clCreateFromEGLImageKHR)(
1039     cl_context context, CLeglDisplayKHR display, CLeglImageKHR image,
1040     cl_mem_flags flags, const cl_egl_image_properties_khr *properties,
1041     cl_int *errcode_ret);
1042 
1043 typedef cl_int(CL_API_CALL *cl_api_clEnqueueAcquireEGLObjectsKHR)(
1044     cl_command_queue command_queue, cl_uint num_objects,
1045     const cl_mem *mem_objects, cl_uint num_events_in_wait_list,
1046     const cl_event *event_wait_list, cl_event *event);
1047 
1048 typedef cl_int(CL_API_CALL *cl_api_clEnqueueReleaseEGLObjectsKHR)(
1049     cl_command_queue command_queue, cl_uint num_objects,
1050     const cl_mem *mem_objects, cl_uint num_events_in_wait_list,
1051     const cl_event *event_wait_list, cl_event *event);
1052 
1053 /* cl_khr_egl_event */
1054 typedef cl_event(CL_API_CALL *cl_api_clCreateEventFromEGLSyncKHR)(
1055     cl_context context, CLeglSyncKHR sync, CLeglDisplayKHR display,
1056     cl_int *errcode_ret);
1057 
1058 #ifdef CL_VERSION_2_1
1059 
1060 typedef cl_int(CL_API_CALL *cl_api_clSetDefaultDeviceCommandQueue)(
1061     cl_context context, cl_device_id device,
1062     cl_command_queue command_queue) CL_API_SUFFIX__VERSION_2_1;
1063 
1064 typedef cl_program(CL_API_CALL *cl_api_clCreateProgramWithIL)(
1065     cl_context context, const void *il, size_t length,
1066     cl_int *errcode_ret) CL_API_SUFFIX__VERSION_2_1;
1067 
1068 typedef cl_int(CL_API_CALL *cl_api_clGetKernelSubGroupInfo)(
1069     cl_kernel kernel, cl_device_id device, cl_kernel_sub_group_info param_name,
1070     size_t input_value_size, const void *input_value, size_t param_value_size,
1071     void *param_value, size_t *param_value_size_ret) CL_API_SUFFIX__VERSION_2_1;
1072 
1073 typedef cl_kernel(CL_API_CALL *cl_api_clCloneKernel)(
1074     cl_kernel source_kernel, cl_int *errcode_ret) CL_API_SUFFIX__VERSION_2_1;
1075 
1076 typedef cl_int(CL_API_CALL *cl_api_clEnqueueSVMMigrateMem)(
1077     cl_command_queue command_queue, cl_uint num_svm_pointers,
1078     const void **svm_pointers, const size_t *sizes,
1079     cl_mem_migration_flags flags, cl_uint num_events_in_wait_list,
1080     const cl_event *event_wait_list,
1081     cl_event *event) CL_API_SUFFIX__VERSION_2_1;
1082 
1083 typedef cl_int(CL_API_CALL *cl_api_clGetDeviceAndHostTimer)(
1084     cl_device_id device, cl_ulong *device_timestamp,
1085     cl_ulong *host_timestamp) CL_API_SUFFIX__VERSION_2_1;
1086 
1087 typedef cl_int(CL_API_CALL *cl_api_clGetHostTimer)(
1088     cl_device_id device, cl_ulong *host_timestamp) CL_API_SUFFIX__VERSION_2_1;
1089 
1090 #else
1091 
1092 typedef void *cl_api_clSetDefaultDeviceCommandQueue;
1093 typedef void *cl_api_clCreateProgramWithIL;
1094 typedef void *cl_api_clGetKernelSubGroupInfo;
1095 typedef void *cl_api_clCloneKernel;
1096 typedef void *cl_api_clEnqueueSVMMigrateMem;
1097 typedef void *cl_api_clGetDeviceAndHostTimer;
1098 typedef void *cl_api_clGetHostTimer;
1099 
1100 #endif
1101 
1102 /* Vendor dispatch table struture */
1103 
1104 typedef struct _cl_icd_dispatch {
1105   /* OpenCL 1.0 */
1106   cl_api_clGetPlatformIDs clGetPlatformIDs;
1107   cl_api_clGetPlatformInfo clGetPlatformInfo;
1108   cl_api_clGetDeviceIDs clGetDeviceIDs;
1109   cl_api_clGetDeviceInfo clGetDeviceInfo;
1110   cl_api_clCreateContext clCreateContext;
1111   cl_api_clCreateContextFromType clCreateContextFromType;
1112   cl_api_clRetainContext clRetainContext;
1113   cl_api_clReleaseContext clReleaseContext;
1114   cl_api_clGetContextInfo clGetContextInfo;
1115   cl_api_clCreateCommandQueue clCreateCommandQueue;
1116   cl_api_clRetainCommandQueue clRetainCommandQueue;
1117   cl_api_clReleaseCommandQueue clReleaseCommandQueue;
1118   cl_api_clGetCommandQueueInfo clGetCommandQueueInfo;
1119   cl_api_clSetCommandQueueProperty clSetCommandQueueProperty;
1120   cl_api_clCreateBuffer clCreateBuffer;
1121   cl_api_clCreateImage2D clCreateImage2D;
1122   cl_api_clCreateImage3D clCreateImage3D;
1123   cl_api_clRetainMemObject clRetainMemObject;
1124   cl_api_clReleaseMemObject clReleaseMemObject;
1125   cl_api_clGetSupportedImageFormats clGetSupportedImageFormats;
1126   cl_api_clGetMemObjectInfo clGetMemObjectInfo;
1127   cl_api_clGetImageInfo clGetImageInfo;
1128   cl_api_clCreateSampler clCreateSampler;
1129   cl_api_clRetainSampler clRetainSampler;
1130   cl_api_clReleaseSampler clReleaseSampler;
1131   cl_api_clGetSamplerInfo clGetSamplerInfo;
1132   cl_api_clCreateProgramWithSource clCreateProgramWithSource;
1133   cl_api_clCreateProgramWithBinary clCreateProgramWithBinary;
1134   cl_api_clRetainProgram clRetainProgram;
1135   cl_api_clReleaseProgram clReleaseProgram;
1136   cl_api_clBuildProgram clBuildProgram;
1137   cl_api_clUnloadCompiler clUnloadCompiler;
1138   cl_api_clGetProgramInfo clGetProgramInfo;
1139   cl_api_clGetProgramBuildInfo clGetProgramBuildInfo;
1140   cl_api_clCreateKernel clCreateKernel;
1141   cl_api_clCreateKernelsInProgram clCreateKernelsInProgram;
1142   cl_api_clRetainKernel clRetainKernel;
1143   cl_api_clReleaseKernel clReleaseKernel;
1144   cl_api_clSetKernelArg clSetKernelArg;
1145   cl_api_clGetKernelInfo clGetKernelInfo;
1146   cl_api_clGetKernelWorkGroupInfo clGetKernelWorkGroupInfo;
1147   cl_api_clWaitForEvents clWaitForEvents;
1148   cl_api_clGetEventInfo clGetEventInfo;
1149   cl_api_clRetainEvent clRetainEvent;
1150   cl_api_clReleaseEvent clReleaseEvent;
1151   cl_api_clGetEventProfilingInfo clGetEventProfilingInfo;
1152   cl_api_clFlush clFlush;
1153   cl_api_clFinish clFinish;
1154   cl_api_clEnqueueReadBuffer clEnqueueReadBuffer;
1155   cl_api_clEnqueueWriteBuffer clEnqueueWriteBuffer;
1156   cl_api_clEnqueueCopyBuffer clEnqueueCopyBuffer;
1157   cl_api_clEnqueueReadImage clEnqueueReadImage;
1158   cl_api_clEnqueueWriteImage clEnqueueWriteImage;
1159   cl_api_clEnqueueCopyImage clEnqueueCopyImage;
1160   cl_api_clEnqueueCopyImageToBuffer clEnqueueCopyImageToBuffer;
1161   cl_api_clEnqueueCopyBufferToImage clEnqueueCopyBufferToImage;
1162   cl_api_clEnqueueMapBuffer clEnqueueMapBuffer;
1163   cl_api_clEnqueueMapImage clEnqueueMapImage;
1164   cl_api_clEnqueueUnmapMemObject clEnqueueUnmapMemObject;
1165   cl_api_clEnqueueNDRangeKernel clEnqueueNDRangeKernel;
1166   cl_api_clEnqueueTask clEnqueueTask;
1167   cl_api_clEnqueueNativeKernel clEnqueueNativeKernel;
1168   cl_api_clEnqueueMarker clEnqueueMarker;
1169   cl_api_clEnqueueWaitForEvents clEnqueueWaitForEvents;
1170   cl_api_clEnqueueBarrier clEnqueueBarrier;
1171   cl_api_clGetExtensionFunctionAddress clGetExtensionFunctionAddress;
1172   cl_api_clCreateFromGLBuffer clCreateFromGLBuffer;
1173   cl_api_clCreateFromGLTexture2D clCreateFromGLTexture2D;
1174   cl_api_clCreateFromGLTexture3D clCreateFromGLTexture3D;
1175   cl_api_clCreateFromGLRenderbuffer clCreateFromGLRenderbuffer;
1176   cl_api_clGetGLObjectInfo clGetGLObjectInfo;
1177   cl_api_clGetGLTextureInfo clGetGLTextureInfo;
1178   cl_api_clEnqueueAcquireGLObjects clEnqueueAcquireGLObjects;
1179   cl_api_clEnqueueReleaseGLObjects clEnqueueReleaseGLObjects;
1180   cl_api_clGetGLContextInfoKHR clGetGLContextInfoKHR;
1181 
1182   /* cl_khr_d3d10_sharing */
1183   cl_api_clGetDeviceIDsFromD3D10KHR clGetDeviceIDsFromD3D10KHR;
1184   cl_api_clCreateFromD3D10BufferKHR clCreateFromD3D10BufferKHR;
1185   cl_api_clCreateFromD3D10Texture2DKHR clCreateFromD3D10Texture2DKHR;
1186   cl_api_clCreateFromD3D10Texture3DKHR clCreateFromD3D10Texture3DKHR;
1187   cl_api_clEnqueueAcquireD3D10ObjectsKHR clEnqueueAcquireD3D10ObjectsKHR;
1188   cl_api_clEnqueueReleaseD3D10ObjectsKHR clEnqueueReleaseD3D10ObjectsKHR;
1189 
1190   /* OpenCL 1.1 */
1191   cl_api_clSetEventCallback clSetEventCallback;
1192   cl_api_clCreateSubBuffer clCreateSubBuffer;
1193   cl_api_clSetMemObjectDestructorCallback clSetMemObjectDestructorCallback;
1194   cl_api_clCreateUserEvent clCreateUserEvent;
1195   cl_api_clSetUserEventStatus clSetUserEventStatus;
1196   cl_api_clEnqueueReadBufferRect clEnqueueReadBufferRect;
1197   cl_api_clEnqueueWriteBufferRect clEnqueueWriteBufferRect;
1198   cl_api_clEnqueueCopyBufferRect clEnqueueCopyBufferRect;
1199 
1200   /* cl_ext_device_fission */
1201   cl_api_clCreateSubDevicesEXT clCreateSubDevicesEXT;
1202   cl_api_clRetainDeviceEXT clRetainDeviceEXT;
1203   cl_api_clReleaseDeviceEXT clReleaseDeviceEXT;
1204 
1205   /* cl_khr_gl_event */
1206   cl_api_clCreateEventFromGLsyncKHR clCreateEventFromGLsyncKHR;
1207 
1208   /* OpenCL 1.2 */
1209   cl_api_clCreateSubDevices clCreateSubDevices;
1210   cl_api_clRetainDevice clRetainDevice;
1211   cl_api_clReleaseDevice clReleaseDevice;
1212   cl_api_clCreateImage clCreateImage;
1213   cl_api_clCreateProgramWithBuiltInKernels clCreateProgramWithBuiltInKernels;
1214   cl_api_clCompileProgram clCompileProgram;
1215   cl_api_clLinkProgram clLinkProgram;
1216   cl_api_clUnloadPlatformCompiler clUnloadPlatformCompiler;
1217   cl_api_clGetKernelArgInfo clGetKernelArgInfo;
1218   cl_api_clEnqueueFillBuffer clEnqueueFillBuffer;
1219   cl_api_clEnqueueFillImage clEnqueueFillImage;
1220   cl_api_clEnqueueMigrateMemObjects clEnqueueMigrateMemObjects;
1221   cl_api_clEnqueueMarkerWithWaitList clEnqueueMarkerWithWaitList;
1222   cl_api_clEnqueueBarrierWithWaitList clEnqueueBarrierWithWaitList;
1223   cl_api_clGetExtensionFunctionAddressForPlatform
1224       clGetExtensionFunctionAddressForPlatform;
1225   cl_api_clCreateFromGLTexture clCreateFromGLTexture;
1226 
1227   /* cl_khr_d3d11_sharing */
1228   cl_api_clGetDeviceIDsFromD3D11KHR clGetDeviceIDsFromD3D11KHR;
1229   cl_api_clCreateFromD3D11BufferKHR clCreateFromD3D11BufferKHR;
1230   cl_api_clCreateFromD3D11Texture2DKHR clCreateFromD3D11Texture2DKHR;
1231   cl_api_clCreateFromD3D11Texture3DKHR clCreateFromD3D11Texture3DKHR;
1232   cl_api_clCreateFromDX9MediaSurfaceKHR clCreateFromDX9MediaSurfaceKHR;
1233   cl_api_clEnqueueAcquireD3D11ObjectsKHR clEnqueueAcquireD3D11ObjectsKHR;
1234   cl_api_clEnqueueReleaseD3D11ObjectsKHR clEnqueueReleaseD3D11ObjectsKHR;
1235 
1236   /* cl_khr_dx9_media_sharing */
1237   cl_api_clGetDeviceIDsFromDX9MediaAdapterKHR
1238       clGetDeviceIDsFromDX9MediaAdapterKHR;
1239   cl_api_clEnqueueAcquireDX9MediaSurfacesKHR
1240       clEnqueueAcquireDX9MediaSurfacesKHR;
1241   cl_api_clEnqueueReleaseDX9MediaSurfacesKHR
1242       clEnqueueReleaseDX9MediaSurfacesKHR;
1243 
1244   /* cl_khr_egl_image */
1245   cl_api_clCreateFromEGLImageKHR clCreateFromEGLImageKHR;
1246   cl_api_clEnqueueAcquireEGLObjectsKHR clEnqueueAcquireEGLObjectsKHR;
1247   cl_api_clEnqueueReleaseEGLObjectsKHR clEnqueueReleaseEGLObjectsKHR;
1248 
1249   /* cl_khr_egl_event */
1250   cl_api_clCreateEventFromEGLSyncKHR clCreateEventFromEGLSyncKHR;
1251 
1252   /* OpenCL 2.0 */
1253   cl_api_clCreateCommandQueueWithProperties clCreateCommandQueueWithProperties;
1254   cl_api_clCreatePipe clCreatePipe;
1255   cl_api_clGetPipeInfo clGetPipeInfo;
1256   cl_api_clSVMAlloc clSVMAlloc;
1257   cl_api_clSVMFree clSVMFree;
1258   cl_api_clEnqueueSVMFree clEnqueueSVMFree;
1259   cl_api_clEnqueueSVMMemcpy clEnqueueSVMMemcpy;
1260   cl_api_clEnqueueSVMMemFill clEnqueueSVMMemFill;
1261   cl_api_clEnqueueSVMMap clEnqueueSVMMap;
1262   cl_api_clEnqueueSVMUnmap clEnqueueSVMUnmap;
1263   cl_api_clCreateSamplerWithProperties clCreateSamplerWithProperties;
1264   cl_api_clSetKernelArgSVMPointer clSetKernelArgSVMPointer;
1265   cl_api_clSetKernelExecInfo clSetKernelExecInfo;
1266 
1267   /* cl_khr_sub_groups */
1268   cl_api_clGetKernelSubGroupInfoKHR clGetKernelSubGroupInfoKHR;
1269 
1270   /* OpenCL 2.1 */
1271   cl_api_clCloneKernel clCloneKernel;
1272   cl_api_clCreateProgramWithIL clCreateProgramWithIL;
1273   cl_api_clEnqueueSVMMigrateMem clEnqueueSVMMigrateMem;
1274   cl_api_clGetDeviceAndHostTimer clGetDeviceAndHostTimer;
1275   cl_api_clGetHostTimer clGetHostTimer;
1276   cl_api_clGetKernelSubGroupInfo clGetKernelSubGroupInfo;
1277   cl_api_clSetDefaultDeviceCommandQueue clSetDefaultDeviceCommandQueue;
1278 
1279   /* OpenCL 2.2 */
1280   cl_api_clSetProgramReleaseCallback clSetProgramReleaseCallback;
1281   cl_api_clSetProgramSpecializationConstant clSetProgramSpecializationConstant;
1282 
1283   /* OpenCL 3.0 */
1284   cl_api_clCreateBufferWithProperties clCreateBufferWithProperties;
1285   cl_api_clCreateImageWithProperties clCreateImageWithProperties;
1286   cl_api_clSetContextDestructorCallback clSetContextDestructorCallback;
1287 
1288 } cl_icd_dispatch;
1289 
1290 #ifdef __cplusplus
1291 }
1292 #endif
1293 
1294 #endif /* #ifndef OPENCL_CL_ICD_H */
1295