1 /*
2  * Copyright (C) 2018-2021 Intel Corporation
3  *
4  * SPDX-License-Identifier: MIT
5  *
6  */
7 
8 #pragma once
9 
10 #include "CL/cl.h"
11 #include "CL/cl_ext.h"
12 #include "CL/cl_ext_intel.h"
13 #include "CL/cl_gl.h"
14 #include "CL/cl_gl_ext.h"
15 #if defined(_WIN32)
16 #include <d3d10_1.h>
17 
18 #include "CL/cl_d3d10.h"
19 #include "CL/cl_d3d11.h"
20 #include "CL/cl_dx9_media_sharing.h"
21 #define CL_DX9_MEDIA_SHARING_INTEL_EXT
22 #include "shared/source/os_interface/windows/windows_wrapper.h"
23 
24 #include "CL/cl_dx9_media_sharing_intel.h"
25 #else
26 #define CL_CONTEXT_D3D10_DEVICE_KHR 0x4014
27 #define CL_CONTEXT_D3D10_PREFER_SHARED_RESOURCES_KHR 0x402C
28 #define CL_MEM_D3D10_RESOURCE_KHR 0x4015
29 typedef cl_uint cl_dx9_device_source_intel;
30 typedef cl_uint cl_dx9_device_set_intel;
31 typedef cl_uint cl_dx9_media_adapter_type_khr;
32 typedef cl_uint cl_dx9_media_adapter_set_khr;
33 typedef cl_uint cl_d3d10_device_source_khr;
34 typedef cl_uint cl_d3d10_device_set_khr;
35 typedef void *IDirect3DSurface9;
36 typedef void *ID3D10Buffer;
37 typedef void *ID3D10Texture2D;
38 typedef void *ID3D10Texture3D;
39 typedef unsigned int UINT;
40 typedef cl_uint cl_d3d11_device_source_khr;
41 typedef cl_uint cl_d3d11_device_set_khr;
42 typedef void *ID3D11Buffer;
43 typedef void *ID3D11Texture2D;
44 typedef void *ID3D11Texture3D;
45 typedef void *HANDLE;
46 #endif
47 
48 typedef cl_bitfield cl_queue_properties_khr;
49 typedef void(CL_CALLBACK *ctxt_logging_fn)(const char *, const void *, size_t, void *);
50 typedef void(CL_CALLBACK *prog_logging_fn)(cl_program, void *);
51 typedef void(CL_CALLBACK *evnt_logging_fn)(cl_event, cl_int, void *);
52 typedef void(CL_CALLBACK *memobj_logging_fn)(cl_mem, void *);
53 typedef void(CL_CALLBACK *svmfree_logging_fn)(cl_command_queue, cl_uint, void *[], void *);
54 
55 /*
56 *
57 * function pointer typedefs
58 *
59 */
60 
61 // Platform APIs
62 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clGetPlatformIDs)(
63     cl_uint numEntries,
64     cl_platform_id *platforms,
65     cl_uint *numPlatforms) CL_API_SUFFIX__VERSION_1_0;
66 
67 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clGetPlatformInfo)(
68     cl_platform_id platform,
69     cl_platform_info paramName,
70     size_t paramValueSize,
71     void *paramValue,
72     size_t *paramValueSizeRet) CL_API_SUFFIX__VERSION_1_0;
73 
74 // Device APIs
75 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clGetDeviceIDs)(
76     cl_platform_id platform,
77     cl_device_type deviceType,
78     cl_uint numEntries,
79     cl_device_id *devices,
80     cl_uint *numDevices) CL_API_SUFFIX__VERSION_1_0;
81 
82 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clGetDeviceInfo)(
83     cl_device_id device,
84     cl_device_info paramName,
85     size_t paramValueSize,
86     void *paramValue,
87     size_t *paramValueSizeRet) CL_API_SUFFIX__VERSION_1_0;
88 
89 // Context APIs
90 typedef CL_API_ENTRY cl_context(CL_API_CALL *KHRpfn_clCreateContext)(
91     const cl_context_properties *properties,
92     cl_uint numDevices,
93     const cl_device_id *devices,
94     ctxt_logging_fn funcNotify,
95     void *userData,
96     cl_int *errcodeRet) CL_API_SUFFIX__VERSION_1_0;
97 
98 typedef CL_API_ENTRY cl_context(CL_API_CALL *KHRpfn_clCreateContextFromType)(
99     const cl_context_properties *properties,
100     cl_device_type deviceType,
101     ctxt_logging_fn funcNotify,
102     void *userData,
103     cl_int *errcodeRet) CL_API_SUFFIX__VERSION_1_0;
104 
105 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clRetainContext)(
106     cl_context context) CL_API_SUFFIX__VERSION_1_0;
107 
108 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clReleaseContext)(
109     cl_context context) CL_API_SUFFIX__VERSION_1_0;
110 
111 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clGetContextInfo)(
112     cl_context context,
113     cl_context_info paramName,
114     size_t paramValueSize,
115     void *paramValue,
116     size_t *paramValueSizeRet) CL_API_SUFFIX__VERSION_1_0;
117 
118 // Command Queue APIs
119 typedef CL_API_ENTRY cl_command_queue(CL_API_CALL *KHRpfn_clCreateCommandQueue)(
120     cl_context context,
121     cl_device_id device,
122     cl_command_queue_properties properties,
123     cl_int *errcodeRet) CL_API_SUFFIX__VERSION_1_0;
124 
125 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clRetainCommandQueue)(
126     cl_command_queue commandQueue) CL_API_SUFFIX__VERSION_1_0;
127 
128 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clReleaseCommandQueue)(
129     cl_command_queue commandQueue) CL_API_SUFFIX__VERSION_1_0;
130 
131 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clGetCommandQueueInfo)(
132     cl_command_queue commandQueue,
133     cl_command_queue_info paramName,
134     size_t paramValueSize,
135     void *paramValue,
136     size_t *paramValueSizeRet) CL_API_SUFFIX__VERSION_1_0;
137 
138 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clSetCommandQueueProperty)(
139     cl_command_queue commandQueue,
140     cl_command_queue_properties properties,
141     cl_bool enable,
142     cl_command_queue_properties *oldProperties) CL_API_SUFFIX__VERSION_1_0;
143 
144 // Memory Object APIs
145 typedef CL_API_ENTRY cl_mem(CL_API_CALL *KHRpfn_clCreateBuffer)(
146     cl_context context,
147     cl_mem_flags flags,
148     size_t size,
149     void *hostPtr,
150     cl_int *errcodeRet) CL_API_SUFFIX__VERSION_1_0;
151 
152 typedef CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
153 cl_mem(CL_API_CALL *KHRpfn_clCreateImage2D)(
154     cl_context context,
155     cl_mem_flags flags,
156     const cl_image_format *imageFormat,
157     size_t imageWidth,
158     size_t imageHeight,
159     size_t imageRowPitch,
160     void *hostPtr,
161     cl_int *errcodeRet) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
162 
163 typedef CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
164 cl_mem(CL_API_CALL *KHRpfn_clCreateImage3D)(
165     cl_context context,
166     cl_mem_flags flags,
167     const cl_image_format *imageFormat,
168     size_t imageWidth,
169     size_t imageHeight,
170     size_t imageDepth,
171     size_t imageRowPitch,
172     size_t imageSlicePitch,
173     void *hostPtr,
174     cl_int *errcodeRet) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
175 
176 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clRetainMemObject)(
177     cl_mem memobj) CL_API_SUFFIX__VERSION_1_0;
178 
179 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clReleaseMemObject)(
180     cl_mem memobj) CL_API_SUFFIX__VERSION_1_0;
181 
182 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clGetSupportedImageFormats)(
183     cl_context context,
184     cl_mem_flags flags,
185     cl_mem_object_type imageType,
186     cl_uint numEntries,
187     cl_image_format *imageFormats,
188     cl_uint *numImageFormats) CL_API_SUFFIX__VERSION_1_0;
189 
190 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clGetMemObjectInfo)(
191     cl_mem memobj,
192     cl_mem_info paramName,
193     size_t paramValueSize,
194     void *paramValue,
195     size_t *paramValueSizeRet) CL_API_SUFFIX__VERSION_1_0;
196 
197 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clGetImageInfo)(
198     cl_mem image,
199     cl_image_info paramName,
200     size_t paramValueSize,
201     void *paramValue,
202     size_t *paramValueSizeRet) CL_API_SUFFIX__VERSION_1_0;
203 
204 // Sampler APIs
205 typedef CL_API_ENTRY cl_sampler(CL_API_CALL *KHRpfn_clCreateSampler)(
206     cl_context context,
207     cl_bool normalizedCoords,
208     cl_addressing_mode addressingMode,
209     cl_filter_mode filterMode,
210     cl_int *errcodeRet) CL_API_SUFFIX__VERSION_1_0;
211 
212 typedef CL_API_ENTRY cl_sampler(CL_API_CALL *KHRpfn_clCreateSamplerWithProperties)(
213     cl_context context,
214     const cl_sampler_properties *samplerProperties,
215     cl_int *errcodeRet) CL_API_SUFFIX__VERSION_2_0;
216 
217 typedef CL_API_ENTRY cl_mem(CL_API_CALL *KHRpfn_clCreatePipe)(
218     cl_context context,
219     cl_mem_flags flags,
220     cl_uint pipePacketSize,
221     cl_uint pipeMaxPackets,
222     const cl_pipe_properties *properties,
223     cl_int *errcodeRet) CL_API_SUFFIX__VERSION_2_0;
224 
225 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clGetPipeInfo)(
226     cl_mem image,
227     cl_pipe_info paramName,
228     size_t paramValueSize,
229     void *paramValue,
230     size_t *paramValueSizeRet) CL_API_SUFFIX__VERSION_2_0;
231 
232 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clRetainSampler)(
233     cl_sampler sampler) CL_API_SUFFIX__VERSION_1_0;
234 
235 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clReleaseSampler)(
236     cl_sampler sampler) CL_API_SUFFIX__VERSION_1_0;
237 
238 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clGetSamplerInfo)(
239     cl_sampler sampler,
240     cl_sampler_info paramName,
241     size_t paramValueSize,
242     void *paramValue,
243     size_t *paramValueSizeRet) CL_API_SUFFIX__VERSION_1_0;
244 
245 // Program Object APIs
246 typedef CL_API_ENTRY cl_program(CL_API_CALL *KHRpfn_clCreateProgramWithSource)(
247     cl_context context,
248     cl_uint count,
249     const char **strings,
250     const size_t *lengths,
251     cl_int *errcodeRet) CL_API_SUFFIX__VERSION_1_0;
252 
253 typedef CL_API_ENTRY cl_program(CL_API_CALL *KHRpfn_clCreateProgramWithBinary)(
254     cl_context context,
255     cl_uint numDevices,
256     const cl_device_id *deviceList,
257     const size_t *lengths,
258     const unsigned char **binaries,
259     cl_int *binaryStatus,
260     cl_int *errcodeRet) CL_API_SUFFIX__VERSION_1_0;
261 
262 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clRetainProgram)(
263     cl_program program) CL_API_SUFFIX__VERSION_1_0;
264 
265 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clReleaseProgram)(
266     cl_program program) CL_API_SUFFIX__VERSION_1_0;
267 
268 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clBuildProgram)(
269     cl_program program,
270     cl_uint numDevices,
271     const cl_device_id *deviceList,
272     const char *options,
273     prog_logging_fn funcNotify,
274     void *userData) CL_API_SUFFIX__VERSION_1_0;
275 
276 typedef CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
277 cl_int(CL_API_CALL *KHRpfn_clUnloadCompiler)() CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
278 
279 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clGetProgramInfo)(
280     cl_program program,
281     cl_program_info paramName,
282     size_t paramValueSize,
283     void *paramValue,
284     size_t *paramValueSizeRet) CL_API_SUFFIX__VERSION_1_0;
285 
286 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clGetProgramBuildInfo)(
287     cl_program program,
288     cl_device_id device,
289     cl_program_build_info paramName,
290     size_t paramValueSize,
291     void *paramValue,
292     size_t *paramValueSizeRet) CL_API_SUFFIX__VERSION_1_0;
293 
294 // Kernel Object APIs
295 typedef CL_API_ENTRY cl_kernel(CL_API_CALL *KHRpfn_clCreateKernel)(
296     cl_program program,
297     const char *kernelName,
298     cl_int *errcodeRet) CL_API_SUFFIX__VERSION_1_0;
299 
300 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clCreateKernelsInProgram)(
301     cl_program program,
302     cl_uint numKernels,
303     cl_kernel *kernels,
304     cl_uint *numKernelsRet) CL_API_SUFFIX__VERSION_1_0;
305 
306 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clRetainKernel)(
307     cl_kernel kernel) CL_API_SUFFIX__VERSION_1_0;
308 
309 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clReleaseKernel)(
310     cl_kernel kernel) CL_API_SUFFIX__VERSION_1_0;
311 
312 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clSetKernelArg)(
313     cl_kernel kernel,
314     cl_uint argIndex,
315     size_t argSize,
316     const void *argValue) CL_API_SUFFIX__VERSION_1_0;
317 
318 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clGetKernelInfo)(
319     cl_kernel kernel,
320     cl_kernel_info paramName,
321     size_t paramValueSize,
322     void *paramValue,
323     size_t *paramValueSizeRet) CL_API_SUFFIX__VERSION_1_0;
324 
325 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clGetKernelWorkGroupInfo)(
326     cl_kernel kernel,
327     cl_device_id device,
328     cl_kernel_work_group_info paramName,
329     size_t paramValueSize,
330     void *paramValue,
331     size_t *paramValueSizeRet) CL_API_SUFFIX__VERSION_1_0;
332 
333 // Event Object APIs
334 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clWaitForEvents)(
335     cl_uint numEvents,
336     const cl_event *eventList) CL_API_SUFFIX__VERSION_1_0;
337 
338 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clGetEventInfo)(
339     cl_event event,
340     cl_event_info paramName,
341     size_t paramValueSize,
342     void *paramValue,
343     size_t *paramValueSizeRet) CL_API_SUFFIX__VERSION_1_0;
344 
345 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clRetainEvent)(
346     cl_event event) CL_API_SUFFIX__VERSION_1_0;
347 
348 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clReleaseEvent)(
349     cl_event event) CL_API_SUFFIX__VERSION_1_0;
350 
351 // Profiling APIs
352 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clGetEventProfilingInfo)(
353     cl_event event,
354     cl_profiling_info paramName,
355     size_t paramValueSize,
356     void *paramValue,
357     size_t *paramValueSizeRet) CL_API_SUFFIX__VERSION_1_0;
358 
359 // Flush and Finish APIs
360 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clFlush)(
361     cl_command_queue commandQueue) CL_API_SUFFIX__VERSION_1_0;
362 
363 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clFinish)(
364     cl_command_queue commandQueue) CL_API_SUFFIX__VERSION_1_0;
365 
366 // Enqueued Commands APIs
367 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clEnqueueReadBuffer)(
368     cl_command_queue commandQueue,
369     cl_mem buffer,
370     cl_bool blockingRead,
371     size_t offset,
372     size_t cb,
373     void *ptr,
374     cl_uint numEventsInWaitList,
375     const cl_event *eventWaitList,
376     cl_event *event) CL_API_SUFFIX__VERSION_1_0;
377 
378 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clEnqueueWriteBuffer)(
379     cl_command_queue commandQueue,
380     cl_mem buffer,
381     cl_bool blockingWrite,
382     size_t offset,
383     size_t cb,
384     const void *ptr,
385     cl_uint numEventsInWaitList,
386     const cl_event *eventWaitList,
387     cl_event *event) CL_API_SUFFIX__VERSION_1_0;
388 
389 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clEnqueueCopyBuffer)(
390     cl_command_queue commandQueue,
391     cl_mem srcBuffer,
392     cl_mem dstBuffer,
393     size_t srcOffset,
394     size_t dstOffset,
395     size_t cb,
396     cl_uint numEventsInWaitList,
397     const cl_event *eventWaitList,
398     cl_event *event) CL_API_SUFFIX__VERSION_1_0;
399 
400 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clEnqueueReadImage)(
401     cl_command_queue commandQueue,
402     cl_mem image,
403     cl_bool blockingRead,
404     const size_t *origin,
405     const size_t *region,
406     size_t rowPitch,
407     size_t slicePitch,
408     void *ptr,
409     cl_uint numEventsInWaitList,
410     const cl_event *eventWaitList,
411     cl_event *event) CL_API_SUFFIX__VERSION_1_0;
412 
413 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clEnqueueWriteImage)(
414     cl_command_queue commandQueue,
415     cl_mem image,
416     cl_bool blockingWrite,
417     const size_t *origin,
418     const size_t *region,
419     size_t inputRowPitch,
420     size_t inputSlicePitch,
421     const void *ptr,
422     cl_uint numEventsInWaitList,
423     const cl_event *eventWaitList,
424     cl_event *event) CL_API_SUFFIX__VERSION_1_0;
425 
426 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clEnqueueCopyImage)(
427     cl_command_queue commandQueue,
428     cl_mem srcImage,
429     cl_mem dstImage,
430     const size_t *srcOrigin,
431     const size_t *dstOrigin,
432     const size_t *region,
433     cl_uint numEventsInWaitList,
434     const cl_event *eventWaitList,
435     cl_event *event) CL_API_SUFFIX__VERSION_1_0;
436 
437 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clEnqueueCopyImageToBuffer)(
438     cl_command_queue commandQueue,
439     cl_mem srcImage,
440     cl_mem dstBuffer,
441     const size_t *srcOrigin,
442     const size_t *region,
443     size_t dstOffset,
444     cl_uint numEventsInWaitList,
445     const cl_event *eventWaitList,
446     cl_event *event) CL_API_SUFFIX__VERSION_1_0;
447 
448 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clEnqueueCopyBufferToImage)(
449     cl_command_queue commandQueue,
450     cl_mem srcBuffer,
451     cl_mem dstImage,
452     size_t srcOffset,
453     const size_t *dstOrigin,
454     const size_t *region,
455     cl_uint numEventsInWaitList,
456     const cl_event *eventWaitList,
457     cl_event *event) CL_API_SUFFIX__VERSION_1_0;
458 
459 typedef CL_API_ENTRY void *(CL_API_CALL *KHRpfn_clEnqueueMapBuffer)(
460     cl_command_queue commandQueue,
461     cl_mem buffer,
462     cl_bool blockingMap,
463     cl_map_flags mapFlags,
464     size_t offset,
465     size_t cb,
466     cl_uint numEventsInWaitList,
467     const cl_event *eventWaitList,
468     cl_event *event,
469     cl_int *errcodeRet)CL_API_SUFFIX__VERSION_1_0;
470 
471 typedef CL_API_ENTRY void *(CL_API_CALL *KHRpfn_clEnqueueMapImage)(
472     cl_command_queue commandQueue,
473     cl_mem image,
474     cl_bool blockingMap,
475     cl_map_flags mapFlags,
476     const size_t *origin,
477     const size_t *region,
478     size_t *imageRowPitch,
479     size_t *imageSlicePitch,
480     cl_uint numEventsInWaitList,
481     const cl_event *eventWaitList,
482     cl_event *event,
483     cl_int *errcodeRet)CL_API_SUFFIX__VERSION_1_0;
484 
485 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clEnqueueUnmapMemObject)(
486     cl_command_queue commandQueue,
487     cl_mem memobj,
488     void *mappedPtr,
489     cl_uint numEventsInWaitList,
490     const cl_event *eventWaitList,
491     cl_event *event) CL_API_SUFFIX__VERSION_1_0;
492 
493 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clEnqueueNDRangeKernel)(
494     cl_command_queue commandQueue,
495     cl_kernel kernel,
496     cl_uint workDim,
497     const size_t *globalWorkOffset,
498     const size_t *globalWorkSize,
499     const size_t *localWorkSize,
500     cl_uint numEventsInWaitList,
501     const cl_event *eventWaitList,
502     cl_event *event) CL_API_SUFFIX__VERSION_1_0;
503 
504 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clEnqueueTask)(
505     cl_command_queue commandQueue,
506     cl_kernel kernel,
507     cl_uint numEventsInWaitList,
508     const cl_event *eventWaitList,
509     cl_event *event) CL_API_SUFFIX__VERSION_1_0;
510 
511 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clEnqueueNativeKernel)(
512     cl_command_queue commandQueue,
513     void(CL_CALLBACK *userFunc)(void *),
514     void *args,
515     size_t cbArgs,
516     cl_uint numMemObjects,
517     const cl_mem *memList,
518     const void **argsMemLoc,
519     cl_uint numEventsInWaitList,
520     const cl_event *eventWaitList,
521     cl_event *event) CL_API_SUFFIX__VERSION_1_0;
522 
523 typedef CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
524 cl_int(CL_API_CALL *KHRpfn_clEnqueueMarker)(
525     cl_command_queue commandQueue,
526     cl_event *event) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
527 
528 typedef CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
529 cl_int(CL_API_CALL *KHRpfn_clEnqueueWaitForEvents)(
530     cl_command_queue commandQueue,
531     cl_uint numEvents,
532     const cl_event *eventList) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
533 
534 typedef CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED
535 cl_int(CL_API_CALL *KHRpfn_clEnqueueBarrier)(
536     cl_command_queue commandQueue) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
537 
538 typedef CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED void *(CL_API_CALL *KHRpfn_clGetExtensionFunctionAddress)(
539     const char *functionName)CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
540 
541 typedef CL_API_ENTRY cl_mem(CL_API_CALL *KHRpfn_clCreateFromGLBuffer)(
542     cl_context context,
543     cl_mem_flags flags,
544     cl_GLuint bufobj,
545     cl_int *errcodeRet) CL_API_SUFFIX__VERSION_1_0;
546 
547 typedef CL_API_ENTRY cl_mem(CL_API_CALL *KHRpfn_clCreateFromGLTexture)(
548     cl_context context,
549     cl_mem_flags flags,
550     cl_GLenum textureTarget,
551     cl_GLint miplevel,
552     cl_GLuint texture,
553     cl_int *errcodeRet) CL_API_SUFFIX__VERSION_1_2;
554 
555 typedef CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem(CL_API_CALL *KHRpfn_clCreateFromGLTexture2D)(
556     cl_context context,
557     cl_mem_flags flags,
558     cl_GLenum textureTarget,
559     cl_GLint miplevel,
560     cl_GLuint texture,
561     cl_int *errcodeRet) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
562 
563 typedef CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem(CL_API_CALL *KHRpfn_clCreateFromGLTexture3D)(
564     cl_context context,
565     cl_mem_flags flags,
566     cl_GLenum textureTarget,
567     cl_GLint miplevel,
568     cl_GLuint texture,
569     cl_int *errcodeRet) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED;
570 
571 typedef CL_API_ENTRY cl_mem(CL_API_CALL *KHRpfn_clCreateFromGLRenderbuffer)(
572     cl_context context,
573     cl_mem_flags flags,
574     cl_GLuint renderbuffer,
575     cl_int *errcodeRet) CL_API_SUFFIX__VERSION_1_0;
576 
577 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clGetGLObjectInfo)(
578     cl_mem memobj,
579     cl_gl_object_type *glObjectType,
580     cl_GLuint *glObjectName) CL_API_SUFFIX__VERSION_1_0;
581 
582 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clGetGLTextureInfo)(
583     cl_mem memobj,
584     cl_gl_texture_info paramName,
585     size_t paramValueSize,
586     void *paramValue,
587     size_t *paramValueSizeRet) CL_API_SUFFIX__VERSION_1_0;
588 
589 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clEnqueueAcquireGLObjects)(
590     cl_command_queue commandQueue,
591     cl_uint numObjects,
592     const cl_mem *memObjects,
593     cl_uint numEventsInWaitList,
594     const cl_event *eventWaitList,
595     cl_event *event) CL_API_SUFFIX__VERSION_1_0;
596 
597 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clEnqueueReleaseGLObjects)(
598     cl_command_queue commandQueue,
599     cl_uint numObjects,
600     const cl_mem *memObjects,
601     cl_uint numEventsInWaitList,
602     const cl_event *eventWaitList,
603     cl_event *event) CL_API_SUFFIX__VERSION_1_0;
604 
605 /* cl_khr_gl_sharing */
606 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clGetGLContextInfoKHR)(
607     const cl_context_properties *properties,
608     cl_gl_context_info paramName,
609     size_t paramValueSize,
610     void *paramValue,
611     size_t *paramValueSizeRet) CL_API_SUFFIX__VERSION_1_0;
612 
613 #ifndef _WIN32
614 typedef void *clGetDeviceIDsFromDX9INTEL_fn;
615 typedef void *clCreateFromDX9MediaSurfaceINTEL_fn;
616 typedef void *clEnqueueAcquireDX9ObjectsINTEL_fn;
617 typedef void *clEnqueueReleaseDX9ObjectsINTEL_fn;
618 typedef void *clGetDeviceIDsFromDX9MediaAdapterKHR_fn;
619 typedef void *clCreateFromDX9MediaSurfaceKHR_fn;
620 typedef void *clEnqueueAcquireDX9MediaSurfacesKHR_fn;
621 typedef void *clEnqueueReleaseDX9MediaSurfacesKHR_fn;
622 typedef void *clGetDeviceIDsFromD3D10KHR_fn;
623 typedef void *clCreateFromD3D10BufferKHR_fn;
624 typedef void *clCreateFromD3D10Texture2DKHR_fn;
625 typedef void *clCreateFromD3D10Texture3DKHR_fn;
626 typedef void *clEnqueueAcquireD3D10ObjectsKHR_fn;
627 typedef void *clEnqueueReleaseD3D10ObjectsKHR_fn;
628 typedef void *clGetDeviceIDsFromD3D11KHR_fn;
629 typedef void *clCreateFromD3D11BufferKHR_fn;
630 typedef void *clCreateFromD3D11Texture2DKHR_fn;
631 typedef void *clCreateFromD3D11Texture3DKHR_fn;
632 typedef void *clEnqueueAcquireD3D11ObjectsKHR_fn;
633 typedef void *clEnqueueReleaseD3D11ObjectsKHR_fn;
634 #endif
635 
636 /* OpenCL 1.1 */
637 
638 /* cl_kgr_gl_event */
639 typedef CL_API_ENTRY cl_event(CL_API_CALL *KHRpfn_clCreateEventFromGLsyncKHR)(
640     cl_context context,
641     cl_GLsync sync,
642     cl_int *errcodeRet) CL_API_SUFFIX__VERSION_1_2;
643 
644 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clSetEventCallback)(
645     cl_event event,
646     cl_int commandExecCallbackType,
647     evnt_logging_fn pfnNotify,
648     void *userData) CL_API_SUFFIX__VERSION_1_1;
649 
650 typedef CL_API_ENTRY cl_mem(CL_API_CALL *KHRpfn_clCreateSubBuffer)(
651     cl_mem buffer,
652     cl_mem_flags flags,
653     cl_buffer_create_type bufferCreateType,
654     const void *bufferCreateInfo,
655     cl_int *errcodeRet) CL_API_SUFFIX__VERSION_1_1;
656 
657 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clSetMemObjectDestructorCallback)(
658     cl_mem memobj,
659     memobj_logging_fn pfnNotify,
660     void *userData) CL_API_SUFFIX__VERSION_1_1;
661 
662 typedef CL_API_ENTRY cl_event(CL_API_CALL *KHRpfn_clCreateUserEvent)(
663     cl_context context,
664     cl_int *errcodeRet) CL_API_SUFFIX__VERSION_1_1;
665 
666 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clSetUserEventStatus)(
667     cl_event event,
668     cl_int executionStatus) CL_API_SUFFIX__VERSION_1_1;
669 
670 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clEnqueueReadBufferRect)(
671     cl_command_queue commandQueue,
672     cl_mem buffer,
673     cl_bool blockingRead,
674     const size_t *bufferOffset,
675     const size_t *hostOffset,
676     const size_t *region,
677     size_t bufferRowPitch,
678     size_t bufferSlicePitch,
679     size_t hostRowPitch,
680     size_t hostSlicePitch,
681     void *ptr,
682     cl_uint numEventsInWaitList,
683     const cl_event *eventWaitList,
684     cl_event *event) CL_API_SUFFIX__VERSION_1_1;
685 
686 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clEnqueueWriteBufferRect)(
687     cl_command_queue commandQueue,
688     cl_mem buffer,
689     cl_bool blockingRead,
690     const size_t *bufferOffset,
691     const size_t *hostOffset,
692     const size_t *region,
693     size_t bufferRowPitch,
694     size_t bufferSlicePitch,
695     size_t hostRowPitch,
696     size_t hostSlicePitch,
697     const void *ptr,
698     cl_uint numEventsInWaitList,
699     const cl_event *eventWaitList,
700     cl_event *event) CL_API_SUFFIX__VERSION_1_1;
701 
702 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clEnqueueCopyBufferRect)(
703     cl_command_queue commandQueue,
704     cl_mem srcBuffer,
705     cl_mem dstBuffer,
706     const size_t *srcOrigin,
707     const size_t *dstOrigin,
708     const size_t *region,
709     size_t srcRowPitch,
710     size_t srcSlicePitch,
711     size_t dstRowPitch,
712     size_t dstSlicePitch,
713     cl_uint numEventsInWaitList,
714     const cl_event *eventWaitList,
715     cl_event *event) CL_API_SUFFIX__VERSION_1_1;
716 
717 /*OpenCL 1.2*/
718 
719 typedef CL_API_ENTRY cl_mem(CL_API_CALL *KHRpfn_clCreateImage)(
720     cl_context context,
721     cl_mem_flags flags,
722     const cl_image_format *imageFormat,
723     const cl_image_desc *imageDesc,
724     void *hostPtr,
725     cl_int *errcodeRet) CL_API_SUFFIX__VERSION_1_2;
726 
727 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clGetKernelArgInfo)(
728     cl_kernel kernel,
729     cl_uint argIndx,
730     cl_kernel_arg_info paramName,
731     size_t paramValueSize,
732     void *paramValue,
733     size_t *paramValueSizeRet) CL_API_SUFFIX__VERSION_1_2;
734 
735 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clEnqueueFillBuffer)(
736     cl_command_queue commandQueue,
737     cl_mem buffer,
738     const void *pattern,
739     size_t patternSize,
740     size_t offset,
741     size_t cb,
742     cl_uint numEventsInWaitList,
743     const cl_event *eventWaitList,
744     cl_event *event) CL_API_SUFFIX__VERSION_1_2;
745 
746 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clEnqueueFillImage)(
747     cl_command_queue commandQueue,
748     cl_mem image,
749     const void *fillColor,
750     const size_t *origin,
751     const size_t *region,
752     cl_uint numEventsInWaitList,
753     const cl_event *eventWaitList,
754     cl_event *event) CL_API_SUFFIX__VERSION_1_2;
755 
756 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clEnqueueMigrateMemObjects)(
757     cl_command_queue commandQueue,
758     cl_uint numMemObjects,
759     const cl_mem *memObjects,
760     cl_mem_migration_flags flags,
761     cl_uint numEventsInWaitList,
762     const cl_event *eventWaitList,
763     cl_event *event) CL_API_SUFFIX__VERSION_1_2;
764 
765 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clEnqueueMarkerWithWaitList)(
766     cl_command_queue commandQueue,
767     cl_uint numEventsInWaitList,
768     const cl_event *eventWaitList,
769     cl_event *event) CL_API_SUFFIX__VERSION_1_2;
770 
771 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clEnqueueBarrierWithWaitList)(
772     cl_command_queue commandQueue,
773     cl_uint numEventsInWaitList,
774     const cl_event *eventWaitList,
775     cl_event *event) CL_API_SUFFIX__VERSION_1_2;
776 
777 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clCreateSubDevices)(
778     cl_device_id inDevice,
779     const cl_device_partition_property *properties,
780     cl_uint numEntries,
781     cl_device_id *outDevices,
782     cl_uint *numDevices) CL_API_SUFFIX__VERSION_1_2;
783 
784 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clRetainDevice)(
785     cl_device_id device) CL_API_SUFFIX__VERSION_1_2;
786 
787 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clReleaseDevice)(
788     cl_device_id device) CL_API_SUFFIX__VERSION_1_2;
789 
790 typedef CL_API_ENTRY cl_program(CL_API_CALL *KHRpfn_clCreateProgramWithBuiltInKernels)(
791     cl_context context,
792     cl_uint numDevices,
793     const cl_device_id *deviceList,
794     const char *kernelNames,
795     cl_int *errcodeRet) CL_API_SUFFIX__VERSION_1_2;
796 
797 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clCompileProgram)(
798     cl_program program,
799     cl_uint numDevices,
800     const cl_device_id *deviceList,
801     const char *options,
802     cl_uint numInputHeaders,
803     const cl_program *inputHeaders,
804     const char **headerIncludeNames,
805     void(CL_CALLBACK *pfnNotify)(cl_program program, void *userData),
806     void *userData) CL_API_SUFFIX__VERSION_1_2;
807 
808 typedef CL_API_ENTRY cl_program(CL_API_CALL *KHRpfn_clLinkProgram)(
809     cl_context context,
810     cl_uint numDevices,
811     const cl_device_id *deviceList,
812     const char *options,
813     cl_uint numInputPrograms,
814     const cl_program *inputPrograms,
815     void(CL_CALLBACK *pfnNotify)(cl_program program, void *userData),
816     void *userData,
817     cl_int *errcodeRet) CL_API_SUFFIX__VERSION_1_2;
818 
819 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clUnloadPlatformCompiler)(
820     cl_platform_id platform) CL_API_SUFFIX__VERSION_1_2;
821 
822 typedef CL_API_ENTRY void *(CL_API_CALL *KHRpfn_clGetExtensionFunctionAddressForPlatform)(
823     cl_platform_id platform,
824     const char *funcName)CL_API_SUFFIX__VERSION_1_2;
825 
826 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clCreateSubDevicesEXT)(
827     cl_device_id inDevice,
828     const cl_device_partition_property_ext *partitionProperties,
829     cl_uint numEntries,
830     cl_device_id *outDevices,
831     cl_uint *numDevices);
832 
833 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clRetainDeviceEXT)(
834     cl_device_id device) CL_API_SUFFIX__VERSION_1_0;
835 
836 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clReleaseDeviceEXT)(
837     cl_device_id device) CL_API_SUFFIX__VERSION_1_0;
838 
839 /*cl_khr_egl_image*/
840 typedef void *KHRpfn_clCreateFromEGLImageKHR;
841 typedef void *KHRpfn_clEnqueueAcquireEGLObjectsKHR;
842 typedef void *KHRpfn_clEnqueueReleaseEGLObjectsKHR;
843 
844 /*cl_khr_egl_event*/
845 typedef void *KHRpfn_clCreateEventFromEGLSyncKHR;
846 
847 /*OpenCL2.0*/
848 typedef CL_API_ENTRY cl_command_queue(CL_API_CALL *KHRpfn_clCreateCommandQueueWithProperties)(
849     cl_context context,
850     cl_device_id device,
851     const cl_queue_properties *properties,
852     cl_int *errcodeRet) CL_API_SUFFIX__VERSION_2_0;
853 
854 typedef CL_API_ENTRY void *(CL_API_CALL *KHRpfn_clSVMAlloc)(
855     cl_context context,
856     cl_svm_mem_flags flags,
857     size_t size,
858     cl_uint alignment)CL_API_SUFFIX__VERSION_2_0;
859 
860 typedef CL_API_ENTRY void(CL_API_CALL *KHRpfn_clSVMFree)(
861     cl_context context,
862     void *svmPointer) CL_API_SUFFIX__VERSION_2_0;
863 
864 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clEnqueueSVMFree)(
865     cl_command_queue commandQueue,
866     cl_uint numSvmPointers,
867     void *svmPointers[],
868     void(CL_CALLBACK *pfnFreeFunc)(cl_command_queue queue,
869                                    cl_uint numSvmPointers,
870                                    void *svmPointers[],
871                                    void *userData),
872     void *userData,
873     cl_uint numEventsInWaitList,
874     const cl_event *eventWaitList,
875     cl_event *event) CL_API_SUFFIX__VERSION_2_0;
876 
877 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clEnqueueSVMMemcpy)(
878     cl_command_queue commandQueue,
879     cl_bool blockingCopy,
880     void *dstPtr,
881     const void *srcPtr,
882     size_t size,
883     cl_uint numEventsInWaitList,
884     const cl_event *eventWaitList,
885     cl_event *event) CL_API_SUFFIX__VERSION_2_0;
886 
887 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clEnqueueSVMMemFill)(
888     cl_command_queue commandQueue,
889     void *svmPtr,
890     const void *pattern,
891     size_t patternSize,
892     size_t size,
893     cl_uint numEventsInWaitList,
894     const cl_event *eventWaitList,
895     cl_event *event) CL_API_SUFFIX__VERSION_2_0;
896 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clEnqueueSVMMap)(
897     cl_command_queue commandQueue,
898     cl_bool blockingMap,
899     cl_map_flags mapFlags,
900     void *svmPtr,
901     size_t size,
902     cl_uint numEventsInWaitList,
903     const cl_event *eventWaitList,
904     cl_event *event) CL_API_SUFFIX__VERSION_2_0;
905 
906 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clEnqueueSVMUnmap)(
907     cl_command_queue commandQueue,
908     void *svmPtr,
909     cl_uint numEventsInWaitList,
910     const cl_event *eventWaitList,
911     cl_event *event) CL_API_SUFFIX__VERSION_2_0;
912 
913 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clSetKernelArgSVMPointer)(
914     cl_kernel kernel,
915     cl_uint argIndex,
916     const void *argValue) CL_API_SUFFIX__VERSION_2_0;
917 
918 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clSetKernelExecInfo)(
919     cl_kernel kernel,
920     cl_kernel_exec_info paramName,
921     size_t paramValueSize,
922     const void *paramValue) CL_API_SUFFIX__VERSION_2_0;
923 
924 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clGetKernelSubGroupInfoKHR)(
925     cl_kernel kernel,
926     cl_device_id device,
927     cl_kernel_sub_group_info paramName,
928     size_t inputValueSize,
929     const void *inputValue,
930     size_t paramValueSize,
931     void *paramValue,
932     size_t *paramValueSizeRet) CL_API_SUFFIX__VERSION_2_0;
933 
934 /*OpenCL2.1*/
935 typedef CL_API_ENTRY cl_kernel(CL_API_CALL *KHRpfn_clCloneKernel)(
936     cl_kernel sourceKernel,
937     cl_int *errcodeRet) CL_API_SUFFIX__VERSION_2_1;
938 
939 typedef CL_API_ENTRY cl_program(CL_API_CALL *KHRpfn_clCreateProgramWithIL)(
940     cl_context context,
941     const void *il,
942     size_t length,
943     cl_int *errcodeRet) CL_API_SUFFIX__VERSION_2_1;
944 
945 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clEnqueueSVMMigrateMem)(
946     cl_command_queue commandQueue,
947     cl_uint numSvmPointers,
948     const void **svmPointers,
949     const size_t *sizes,
950     const cl_mem_migration_flags flags,
951     cl_uint numEventsInWaitList,
952     const cl_event *eventWaitList,
953     cl_event *event) CL_API_SUFFIX__VERSION_2_1;
954 
955 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clGetDeviceAndHostTimer)(
956     cl_device_id device,
957     cl_ulong *deviceTimestamp,
958     cl_ulong *hostTimestamp) CL_API_SUFFIX__VERSION_2_1;
959 
960 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clGetHostTimer)(
961     cl_device_id device,
962     cl_ulong *hostTimestamp) CL_API_SUFFIX__VERSION_2_1;
963 
964 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clGetKernelSubGroupInfo)(
965     cl_kernel kernel,
966     cl_device_id device,
967     cl_kernel_sub_group_info paramName,
968     size_t inputValueSize,
969     const void *inputValue,
970     size_t paramValueSize,
971     void *paramValue,
972     size_t *paramValueSizeRet) CL_API_SUFFIX__VERSION_2_1;
973 
974 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clSetDefaultDeviceCommandQueue)(
975     cl_context context,
976     cl_device_id device,
977     cl_command_queue commandQueue) CL_API_SUFFIX__VERSION_2_1;
978 
979 /*OpenCL2.2*/
980 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clSetProgramReleaseCallback)(
981     cl_program program,
982     void(CL_CALLBACK *pfnNotify)(cl_program program, void *userData),
983     void *userData) CL_API_SUFFIX__VERSION_2_2;
984 
985 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clSetProgramSpecializationConstant)(
986     cl_program program,
987     cl_uint specIdd,
988     size_t specSize,
989     const void *specValue) CL_API_SUFFIX__VERSION_2_2;
990 
991 /*OpenCL3.0*/
992 typedef CL_API_ENTRY cl_mem(CL_API_CALL *KHRpfn_clCreateBufferWithProperties)(
993     cl_context context,
994     const cl_mem_properties *properties,
995     cl_mem_flags flags,
996     size_t size,
997     void *hostPtr,
998     cl_int *errcodeRet) CL_API_SUFFIX__VERSION_3_0;
999 
1000 typedef CL_API_ENTRY cl_mem(CL_API_CALL *KHRpfn_clCreateImageWithProperties)(
1001     cl_context context,
1002     const cl_mem_properties *properties,
1003     cl_mem_flags flags,
1004     const cl_image_format *imageFormat,
1005     const cl_image_desc *imageDesc,
1006     void *hostPtr,
1007     cl_int *errcodeRet) CL_API_SUFFIX__VERSION_3_0;
1008 
1009 typedef CL_API_ENTRY cl_int(CL_API_CALL *KHRpfn_clSetContextDestructorCallback)(
1010     cl_context context,
1011     void(CL_CALLBACK *pfnNotify)(cl_context context, void *userData),
1012     void *userData) CL_API_SUFFIX__VERSION_3_0;
1013 
1014 /* clCreateImage */
1015 
1016 typedef CL_API_ENTRY cl_int(CL_API_CALL *INTELpfn_clGetImageParamsINTEL)(
1017     cl_context context,
1018     const cl_image_format *imageFormat,
1019     const cl_image_desc *imageDesc,
1020     size_t *imageRowPitch,
1021     size_t *imageSlicePitch) CL_API_SUFFIX__VERSION_1_1;
1022 
1023 /* Performance Counter APIs */
1024 typedef CL_API_ENTRY cl_command_queue(CL_API_CALL *INTELpfn_clCreatePerfCountersCommandQueueINTEL)(
1025     cl_context context,
1026     cl_device_id device,
1027     cl_command_queue_properties properties,
1028     cl_uint configuration,
1029     cl_int *errcodeRet);
1030 
1031 typedef CL_API_ENTRY cl_int(CL_API_CALL *INTELpfn_clSetPerformanceConfigurationINTEL)(
1032     cl_device_id device,
1033     cl_uint count,
1034     cl_uint *offsets,
1035     cl_uint *values);
1036 
1037 /* cl_intel_accelerator */
1038 
1039 typedef CL_API_ENTRY cl_accelerator_intel(CL_API_CALL *INTELpfn_clCreateAcceleratorINTEL)(
1040     cl_context context,
1041     cl_accelerator_type_intel acceleratorType,
1042     size_t descriptorSize,
1043     const void *descriptor,
1044     cl_int *errcodeRet) CL_API_SUFFIX__VERSION_1_2;
1045 
1046 typedef CL_API_ENTRY cl_int(CL_API_CALL *INTELpfn_clGetAcceleratorInfoINTEL)(
1047     cl_accelerator_intel accelerator,
1048     cl_accelerator_info_intel paramName,
1049     size_t paramValueSize,
1050     void *paramValue,
1051     size_t *paramValueSizeRet) CL_API_SUFFIX__VERSION_1_2;
1052 
1053 typedef CL_API_ENTRY cl_int(CL_API_CALL *INTELpfn_clRetainAcceleratorINTEL)(
1054     cl_accelerator_intel accelerator) CL_API_SUFFIX__VERSION_1_2;
1055 
1056 typedef CL_API_ENTRY cl_int(CL_API_CALL *INTELpfn_clReleaseAcceleratorINTEL)(
1057     cl_accelerator_intel accelerator) CL_API_SUFFIX__VERSION_1_2;
1058 
1059 /* cl_intel_va_api_media_sharing */
1060 #ifdef LIBVA
1061 #include "CL/cl_va_api_media_sharing_intel.h"
1062 typedef CL_API_ENTRY cl_mem(CL_API_CALL *INTELpfn_clCreateFromVA_APIMediaSurfaceINTEL)(
1063     cl_context context,
1064     cl_mem_flags flags,
1065     VASurfaceID *surface,
1066     cl_uint plane,
1067     cl_int *errcodeRet) CL_API_SUFFIX__VERSION_1_2;
1068 
1069 typedef CL_API_ENTRY cl_int(CL_API_CALL *INTELpfn_clGetDeviceIDsFromVA_APIMediaAdapterINTEL)(
1070     cl_platform_id platform,
1071     cl_va_api_device_source_intel mediaAdapterType,
1072     void *mediaAdapter,
1073     cl_va_api_device_set_intel mediaAdapterSet,
1074     cl_uint numEntries,
1075     cl_device_id *devices,
1076     cl_uint *numDevices) CL_API_SUFFIX__VERSION_1_2;
1077 
1078 typedef CL_API_ENTRY cl_int(CL_API_CALL *INTELpfn_clEnqueueAcquireVA_APIMediaSurfacesINTEL)(
1079     cl_command_queue commandQueue,
1080     cl_uint numObjects,
1081     const cl_mem *memObjects,
1082     cl_uint numEventsInWaitList,
1083     const cl_event *eventWaitList,
1084     cl_event *event) CL_API_SUFFIX__VERSION_1_2;
1085 
1086 typedef CL_API_ENTRY cl_int(CL_API_CALL *INTELpfn_clEnqueueReleaseVA_APIMediaSurfacesINTEL)(
1087     cl_command_queue commandQueue,
1088     cl_uint numObjects,
1089     const cl_mem *memObjects,
1090     cl_uint numEventsInWaitList,
1091     const cl_event *eventWaitList,
1092     cl_event *event) CL_API_SUFFIX__VERSION_1_2;
1093 #else
1094 typedef void (*INTELpfn_clCreateFromVA_APIMediaSurfaceINTEL)();
1095 typedef void (*INTELpfn_clGetDeviceIDsFromVA_APIMediaAdapterINTEL)();
1096 typedef void (*INTELpfn_clEnqueueAcquireVA_APIMediaSurfacesINTEL)();
1097 typedef void (*INTELpfn_clEnqueueReleaseVA_APIMediaSurfacesINTEL)();
1098 #endif
1099 
1100 /*
1101 *
1102 * vendor dispatch table structure
1103 *
1104 * note that the types in the structure KHRicdVendorDispatch mirror the function
1105 * names listed in the string table khrIcdVendorDispatchFunctionNames
1106 *
1107 */
1108 
1109 struct SDispatchTable {
1110     KHRpfn_clGetPlatformIDs clGetPlatformIDs;
1111     KHRpfn_clGetPlatformInfo clGetPlatformInfo;
1112     KHRpfn_clGetDeviceIDs clGetDeviceIDs;
1113     KHRpfn_clGetDeviceInfo clGetDeviceInfo;
1114     KHRpfn_clCreateContext clCreateContext;
1115     KHRpfn_clCreateContextFromType clCreateContextFromType;
1116     KHRpfn_clRetainContext clRetainContext;
1117     KHRpfn_clReleaseContext clReleaseContext;
1118     KHRpfn_clGetContextInfo clGetContextInfo;
1119     KHRpfn_clCreateCommandQueue clCreateCommandQueue;
1120     KHRpfn_clRetainCommandQueue clRetainCommandQueue;
1121     KHRpfn_clReleaseCommandQueue clReleaseCommandQueue;
1122     KHRpfn_clGetCommandQueueInfo clGetCommandQueueInfo;
1123     KHRpfn_clSetCommandQueueProperty clSetCommandQueueProperty;
1124     KHRpfn_clCreateBuffer clCreateBuffer;
1125     KHRpfn_clCreateImage2D clCreateImage2D;
1126     KHRpfn_clCreateImage3D clCreateImage3D;
1127     KHRpfn_clRetainMemObject clRetainMemObject;
1128     KHRpfn_clReleaseMemObject clReleaseMemObject;
1129     KHRpfn_clGetSupportedImageFormats clGetSupportedImageFormats;
1130     KHRpfn_clGetMemObjectInfo clGetMemObjectInfo;
1131     KHRpfn_clGetImageInfo clGetImageInfo;
1132     KHRpfn_clCreateSampler clCreateSampler;
1133     KHRpfn_clRetainSampler clRetainSampler;
1134     KHRpfn_clReleaseSampler clReleaseSampler;
1135     KHRpfn_clGetSamplerInfo clGetSamplerInfo;
1136     KHRpfn_clCreateProgramWithSource clCreateProgramWithSource;
1137     KHRpfn_clCreateProgramWithBinary clCreateProgramWithBinary;
1138     KHRpfn_clRetainProgram clRetainProgram;
1139     KHRpfn_clReleaseProgram clReleaseProgram;
1140     KHRpfn_clBuildProgram clBuildProgram;
1141     KHRpfn_clUnloadCompiler clUnloadCompiler;
1142     KHRpfn_clGetProgramInfo clGetProgramInfo;
1143     KHRpfn_clGetProgramBuildInfo clGetProgramBuildInfo;
1144     KHRpfn_clCreateKernel clCreateKernel;
1145     KHRpfn_clCreateKernelsInProgram clCreateKernelsInProgram;
1146     KHRpfn_clRetainKernel clRetainKernel;
1147     KHRpfn_clReleaseKernel clReleaseKernel;
1148     KHRpfn_clSetKernelArg clSetKernelArg;
1149     KHRpfn_clGetKernelInfo clGetKernelInfo;
1150     KHRpfn_clGetKernelWorkGroupInfo clGetKernelWorkGroupInfo;
1151     KHRpfn_clWaitForEvents clWaitForEvents;
1152     KHRpfn_clGetEventInfo clGetEventInfo;
1153     KHRpfn_clRetainEvent clRetainEvent;
1154     KHRpfn_clReleaseEvent clReleaseEvent;
1155     KHRpfn_clGetEventProfilingInfo clGetEventProfilingInfo;
1156     KHRpfn_clFlush clFlush;
1157     KHRpfn_clFinish clFinish;
1158     KHRpfn_clEnqueueReadBuffer clEnqueueReadBuffer;
1159     KHRpfn_clEnqueueWriteBuffer clEnqueueWriteBuffer;
1160     KHRpfn_clEnqueueCopyBuffer clEnqueueCopyBuffer;
1161     KHRpfn_clEnqueueReadImage clEnqueueReadImage;
1162     KHRpfn_clEnqueueWriteImage clEnqueueWriteImage;
1163     KHRpfn_clEnqueueCopyImage clEnqueueCopyImage;
1164     KHRpfn_clEnqueueCopyImageToBuffer clEnqueueCopyImageToBuffer;
1165     KHRpfn_clEnqueueCopyBufferToImage clEnqueueCopyBufferToImage;
1166     KHRpfn_clEnqueueMapBuffer clEnqueueMapBuffer;
1167     KHRpfn_clEnqueueMapImage clEnqueueMapImage;
1168     KHRpfn_clEnqueueUnmapMemObject clEnqueueUnmapMemObject;
1169     KHRpfn_clEnqueueNDRangeKernel clEnqueueNDRangeKernel;
1170     KHRpfn_clEnqueueTask clEnqueueTask;
1171     KHRpfn_clEnqueueNativeKernel clEnqueueNativeKernel;
1172     KHRpfn_clEnqueueMarker clEnqueueMarker;
1173     KHRpfn_clEnqueueWaitForEvents clEnqueueWaitForEvents;
1174     KHRpfn_clEnqueueBarrier clEnqueueBarrier;
1175     KHRpfn_clGetExtensionFunctionAddress clGetExtensionFunctionAddress;
1176     KHRpfn_clCreateFromGLBuffer clCreateFromGLBuffer;
1177     KHRpfn_clCreateFromGLTexture2D clCreateFromGLTexture2D;
1178     KHRpfn_clCreateFromGLTexture3D clCreateFromGLTexture3D;
1179     KHRpfn_clCreateFromGLRenderbuffer clCreateFromGLRenderbuffer;
1180     KHRpfn_clGetGLObjectInfo clGetGLObjectInfo;
1181     KHRpfn_clGetGLTextureInfo clGetGLTextureInfo;
1182     KHRpfn_clEnqueueAcquireGLObjects clEnqueueAcquireGLObjects;
1183     KHRpfn_clEnqueueReleaseGLObjects clEnqueueReleaseGLObjects;
1184     KHRpfn_clGetGLContextInfoKHR clGetGLContextInfoKHR;
1185 
1186     /* cl_khr_d3d10_sharing */
1187     clGetDeviceIDsFromD3D10KHR_fn clGetDeviceIDsFromD3D10KHR;
1188     clCreateFromD3D10BufferKHR_fn clCreateFromD3D10BufferKHR;
1189     clCreateFromD3D10Texture2DKHR_fn clCreateFromD3D10Texture2DKHR;
1190     clCreateFromD3D10Texture3DKHR_fn clCreateFromD3D10Texture3DKHR;
1191     clEnqueueAcquireD3D10ObjectsKHR_fn clEnqueueAcquireD3D10ObjectsKHR;
1192     clEnqueueReleaseD3D10ObjectsKHR_fn clEnqueueReleaseD3D10ObjectsKHR;
1193 
1194     /* OpenCL 1.1 */
1195     KHRpfn_clSetEventCallback clSetEventCallback;
1196     KHRpfn_clCreateSubBuffer clCreateSubBuffer;
1197     KHRpfn_clSetMemObjectDestructorCallback clSetMemObjectDestructorCallback;
1198     KHRpfn_clCreateUserEvent clCreateUserEvent;
1199     KHRpfn_clSetUserEventStatus clSetUserEventStatus;
1200     KHRpfn_clEnqueueReadBufferRect clEnqueueReadBufferRect;
1201     KHRpfn_clEnqueueWriteBufferRect clEnqueueWriteBufferRect;
1202     KHRpfn_clEnqueueCopyBufferRect clEnqueueCopyBufferRect;
1203 
1204     /* cl_ext_device_fission */
1205     KHRpfn_clCreateSubDevicesEXT clCreateSubDevicesEXT;
1206     KHRpfn_clRetainDeviceEXT clRetainDeviceEXT;
1207     KHRpfn_clReleaseDeviceEXT clReleaseDeviceEXT;
1208 
1209     /* cl_khr_gl_event */
1210     KHRpfn_clCreateEventFromGLsyncKHR clCreateEventFromGLsyncKHR;
1211 
1212     /* OpenCL 1.2 */
1213     KHRpfn_clCreateSubDevices clCreateSubDevices;
1214     KHRpfn_clRetainDevice clRetainDevice;
1215     KHRpfn_clReleaseDevice clReleaseDevice;
1216     KHRpfn_clCreateImage clCreateImage;
1217     KHRpfn_clCreateProgramWithBuiltInKernels clCreateProgramWithBuiltInKernels;
1218     KHRpfn_clCompileProgram clCompileProgram;
1219     KHRpfn_clLinkProgram clLinkProgram;
1220     KHRpfn_clUnloadPlatformCompiler clUnloadPlatformCompiler;
1221     KHRpfn_clGetKernelArgInfo clGetKernelArgInfo;
1222     KHRpfn_clEnqueueFillBuffer clEnqueueFillBuffer;
1223     KHRpfn_clEnqueueFillImage clEnqueueFillImage;
1224     KHRpfn_clEnqueueMigrateMemObjects clEnqueueMigrateMemObjects;
1225     KHRpfn_clEnqueueMarkerWithWaitList clEnqueueMarkerWithWaitList;
1226     KHRpfn_clEnqueueBarrierWithWaitList clEnqueueBarrierWithWaitList;
1227     KHRpfn_clGetExtensionFunctionAddressForPlatform clGetExtensionFunctionAddressForPlatform;
1228     KHRpfn_clCreateFromGLTexture clCreateFromGLTexture;
1229 
1230     /* cl_khr_d3d11_sharing */
1231     clGetDeviceIDsFromD3D11KHR_fn clGetDeviceIDsFromD3D11KHR;
1232     clCreateFromD3D11BufferKHR_fn clCreateFromD3D11BufferKHR;
1233     clCreateFromD3D11Texture2DKHR_fn clCreateFromD3D11Texture2DKHR;
1234     clCreateFromD3D11Texture3DKHR_fn clCreateFromD3D11Texture3DKHR;
1235     clCreateFromDX9MediaSurfaceKHR_fn clCreateFromDX9MediaSurfaceKHR;
1236     clEnqueueAcquireD3D11ObjectsKHR_fn clEnqueueAcquireD3D11ObjectsKHR;
1237     clEnqueueReleaseD3D11ObjectsKHR_fn clEnqueueReleaseD3D11ObjectsKHR;
1238 
1239     /* cl_khr_dx9_media_sharing */
1240     clGetDeviceIDsFromDX9MediaAdapterKHR_fn clGetDeviceIDsFromDX9MediaAdapterKHR;
1241     clEnqueueAcquireDX9MediaSurfacesKHR_fn clEnqueueAcquireDX9MediaSurfacesKHR;
1242     clEnqueueReleaseDX9MediaSurfacesKHR_fn clEnqueueReleaseDX9MediaSurfacesKHR;
1243 
1244     /* cl_khr_egl_image */
1245     KHRpfn_clCreateFromEGLImageKHR clCreateFromEGLImageKHR;
1246     KHRpfn_clEnqueueAcquireEGLObjectsKHR clEnqueueAcquireEGLObjectsKHR;
1247     KHRpfn_clEnqueueReleaseEGLObjectsKHR clEnqueueReleaseEGLObjectsKHR;
1248 
1249     /* cl_khr_egl_event */
1250     KHRpfn_clCreateEventFromEGLSyncKHR clCreateEventFromEGLSyncKHR;
1251 
1252     /* OpenCL 2.0 */
1253     KHRpfn_clCreateCommandQueueWithProperties clCreateCommandQueueWithProperties;
1254     KHRpfn_clCreatePipe clCreatePipe;
1255     KHRpfn_clGetPipeInfo clGetPipeInfo;
1256     KHRpfn_clSVMAlloc clSVMAlloc;
1257     KHRpfn_clSVMFree clSVMFree;
1258     KHRpfn_clEnqueueSVMFree clEnqueueSVMFree;
1259     KHRpfn_clEnqueueSVMMemcpy clEnqueueSVMMemcpy;
1260     KHRpfn_clEnqueueSVMMemFill clEnqueueSVMMemFill;
1261     KHRpfn_clEnqueueSVMMap clEnqueueSVMMap;
1262     KHRpfn_clEnqueueSVMUnmap clEnqueueSVMUnmap;
1263     KHRpfn_clCreateSamplerWithProperties clCreateSamplerWithProperties;
1264     KHRpfn_clSetKernelArgSVMPointer clSetKernelArgSVMPointer;
1265     KHRpfn_clSetKernelExecInfo clSetKernelExecInfo;
1266 
1267     KHRpfn_clGetKernelSubGroupInfoKHR clGetKernelSubGroupInfoKHR;
1268 
1269     /* OpenCL 2.1 */
1270     KHRpfn_clCloneKernel clCloneKernel;
1271     KHRpfn_clCreateProgramWithIL clCreateProgramWithIL;
1272     KHRpfn_clEnqueueSVMMigrateMem clEnqueueSVMMigrateMem;
1273     KHRpfn_clGetDeviceAndHostTimer clGetDeviceAndHostTimer;
1274     KHRpfn_clGetHostTimer clGetHostTimer;
1275     KHRpfn_clGetKernelSubGroupInfo clGetKernelSubGroupInfo;
1276     KHRpfn_clSetDefaultDeviceCommandQueue clSetDefaultDeviceCommandQueue;
1277 
1278     /* OpenCL 2.2 */
1279     KHRpfn_clSetProgramReleaseCallback clSetProgramReleaseCallback;
1280     KHRpfn_clSetProgramSpecializationConstant clSetProgramSpecializationConstant;
1281 
1282     /* OpenCL 3.0 */
1283     KHRpfn_clCreateBufferWithProperties clCreateBufferWithProperties;
1284     KHRpfn_clCreateImageWithProperties clCreateImageWithProperties;
1285     KHRpfn_clSetContextDestructorCallback clSetContextDestructorCallback;
1286 };
1287 
1288 struct SCRTDispatchTable {
1289     // Support CRT entry point
1290     KHRpfn_clGetKernelArgInfo clGetKernelArgInfo;
1291 
1292     clGetDeviceIDsFromDX9INTEL_fn clGetDeviceIDsFromDX9INTEL;
1293     clCreateFromDX9MediaSurfaceINTEL_fn clCreateFromDX9MediaSurfaceINTEL;
1294     clEnqueueAcquireDX9ObjectsINTEL_fn clEnqueueAcquireDX9ObjectsINTEL;
1295     clEnqueueReleaseDX9ObjectsINTEL_fn clEnqueueReleaseDX9ObjectsINTEL;
1296 
1297     INTELpfn_clGetImageParamsINTEL clGetImageParamsINTEL;
1298     // API to expose the Performance Counters to applications
1299     INTELpfn_clCreatePerfCountersCommandQueueINTEL clCreatePerfCountersCommandQueueINTEL;
1300 
1301     // Video Analytics Accelerator
1302     INTELpfn_clCreateAcceleratorINTEL clCreateAcceleratorINTEL;
1303     INTELpfn_clGetAcceleratorInfoINTEL clGetAcceleratorInfoINTEL;
1304     INTELpfn_clRetainAcceleratorINTEL clRetainAcceleratorINTEL;
1305     INTELpfn_clReleaseAcceleratorINTEL clReleaseAcceleratorINTEL;
1306 
1307     void *placeholder12;
1308     void *placeholder13;
1309 
1310 // VAMedia sharing extension
1311 #ifdef LIBVA
1312     INTELpfn_clCreateFromVA_APIMediaSurfaceINTEL clCreateFromVA_APIMediaSurfaceINTEL;
1313     INTELpfn_clGetDeviceIDsFromVA_APIMediaAdapterINTEL clGetDeviceIDsFromVA_APIMediaAdapterINTEL;
1314     INTELpfn_clEnqueueReleaseVA_APIMediaSurfacesINTEL clEnqueueReleaseVA_APIMediaSurfacesINTEL;
1315     INTELpfn_clEnqueueAcquireVA_APIMediaSurfacesINTEL clEnqueueAcquireVA_APIMediaSurfacesINTEL;
1316 #else
1317     void *placeholder14;
1318     void *placeholder15;
1319     void *placeholder16;
1320     void *placeholder17;
1321 #endif
1322 
1323     void *placeholder18;
1324     void *placeholder19;
1325     void *placeholder20;
1326     void *placeholder21;
1327     // OCL Performance Counters configuration
1328     INTELpfn_clSetPerformanceConfigurationINTEL clSetPerformanceConfigurationINTEL;
1329 };
1330 
1331 extern SDispatchTable icdGlobalDispatchTable;
1332 extern SCRTDispatchTable crtGlobalDispatchTable;
1333 
1334 struct SEntryPointsTable {
1335     SDispatchTable *icdDispatch;
1336     SCRTDispatchTable *crtDispatch;
1337 };
1338 
1339 struct SEntryPointsTableData {
1340     SDispatchTable icdDispatch;
1341     SCRTDispatchTable crtDispatch;
1342 };
1343 
1344 extern SEntryPointsTable globalDispatchTable;
1345