xref: /aosp_15_r20/external/OpenCL-ICD-Loader/loader/icd_dispatch_generated.c (revision 1cddb830dba8aa7c1cc1039338e56b3b9fa24952)
1 /*
2  * Copyright (c) 2012-2023 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  * OpenCL is a trademark of Apple Inc. used under license by Khronos.
17  */
18 
19 #include "icd.h"
20 #include "icd_dispatch.h"
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 ///////////////////////////////////////////////////////////////////////////////
27 // Core APIs:
28 #if defined(CL_ENABLE_LAYERS)
29 extern cl_int CL_API_CALL clGetPlatformIDs_disp(
30     cl_uint num_entries,
31     cl_platform_id* platforms,
32     cl_uint* num_platforms) CL_API_SUFFIX__VERSION_1_0;
33 #endif // defined(CL_ENABLE_LAYERS)
34 
clGetPlatformInfo(cl_platform_id platform,cl_platform_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret)35 CL_API_ENTRY cl_int CL_API_CALL clGetPlatformInfo(
36     cl_platform_id platform,
37     cl_platform_info param_name,
38     size_t param_value_size,
39     void* param_value,
40     size_t* param_value_size_ret)
41 {
42 #if defined(CL_ENABLE_LAYERS)
43     if (khrFirstLayer)
44         return khrFirstLayer->dispatch.clGetPlatformInfo(
45             platform,
46             param_name,
47             param_value_size,
48             param_value,
49             param_value_size_ret);
50 #endif // defined(CL_ENABLE_LAYERS)
51     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(platform, CL_INVALID_PLATFORM);
52     return platform->dispatch->clGetPlatformInfo(
53         platform,
54         param_name,
55         param_value_size,
56         param_value,
57         param_value_size_ret);
58 }
59 
60 ///////////////////////////////////////////////////////////////////////////////
61 #if defined(CL_ENABLE_LAYERS)
clGetPlatformInfo_disp(cl_platform_id platform,cl_platform_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret)62 static cl_int CL_API_CALL clGetPlatformInfo_disp(
63     cl_platform_id platform,
64     cl_platform_info param_name,
65     size_t param_value_size,
66     void* param_value,
67     size_t* param_value_size_ret)
68 {
69     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(platform, CL_INVALID_PLATFORM);
70     return platform->dispatch->clGetPlatformInfo(
71         platform,
72         param_name,
73         param_value_size,
74         param_value,
75         param_value_size_ret);
76 }
77 #endif // defined(CL_ENABLE_LAYERS)
78 
79 ///////////////////////////////////////////////////////////////////////////////
80 
clGetDeviceIDs(cl_platform_id platform,cl_device_type device_type,cl_uint num_entries,cl_device_id * devices,cl_uint * num_devices)81 CL_API_ENTRY cl_int CL_API_CALL clGetDeviceIDs(
82     cl_platform_id platform,
83     cl_device_type device_type,
84     cl_uint num_entries,
85     cl_device_id* devices,
86     cl_uint* num_devices)
87 {
88 #if defined(CL_ENABLE_LAYERS)
89     if (khrFirstLayer)
90         return khrFirstLayer->dispatch.clGetDeviceIDs(
91             platform,
92             device_type,
93             num_entries,
94             devices,
95             num_devices);
96 #endif // defined(CL_ENABLE_LAYERS)
97     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(platform, CL_INVALID_PLATFORM);
98     return platform->dispatch->clGetDeviceIDs(
99         platform,
100         device_type,
101         num_entries,
102         devices,
103         num_devices);
104 }
105 
106 ///////////////////////////////////////////////////////////////////////////////
107 #if defined(CL_ENABLE_LAYERS)
clGetDeviceIDs_disp(cl_platform_id platform,cl_device_type device_type,cl_uint num_entries,cl_device_id * devices,cl_uint * num_devices)108 static cl_int CL_API_CALL clGetDeviceIDs_disp(
109     cl_platform_id platform,
110     cl_device_type device_type,
111     cl_uint num_entries,
112     cl_device_id* devices,
113     cl_uint* num_devices)
114 {
115     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(platform, CL_INVALID_PLATFORM);
116     return platform->dispatch->clGetDeviceIDs(
117         platform,
118         device_type,
119         num_entries,
120         devices,
121         num_devices);
122 }
123 #endif // defined(CL_ENABLE_LAYERS)
124 
125 ///////////////////////////////////////////////////////////////////////////////
126 
clGetDeviceInfo(cl_device_id device,cl_device_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret)127 CL_API_ENTRY cl_int CL_API_CALL clGetDeviceInfo(
128     cl_device_id device,
129     cl_device_info param_name,
130     size_t param_value_size,
131     void* param_value,
132     size_t* param_value_size_ret)
133 {
134 #if defined(CL_ENABLE_LAYERS)
135     if (khrFirstLayer)
136         return khrFirstLayer->dispatch.clGetDeviceInfo(
137             device,
138             param_name,
139             param_value_size,
140             param_value,
141             param_value_size_ret);
142 #endif // defined(CL_ENABLE_LAYERS)
143     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(device, CL_INVALID_DEVICE);
144     return device->dispatch->clGetDeviceInfo(
145         device,
146         param_name,
147         param_value_size,
148         param_value,
149         param_value_size_ret);
150 }
151 
152 ///////////////////////////////////////////////////////////////////////////////
153 #if defined(CL_ENABLE_LAYERS)
clGetDeviceInfo_disp(cl_device_id device,cl_device_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret)154 static cl_int CL_API_CALL clGetDeviceInfo_disp(
155     cl_device_id device,
156     cl_device_info param_name,
157     size_t param_value_size,
158     void* param_value,
159     size_t* param_value_size_ret)
160 {
161     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(device, CL_INVALID_DEVICE);
162     return device->dispatch->clGetDeviceInfo(
163         device,
164         param_name,
165         param_value_size,
166         param_value,
167         param_value_size_ret);
168 }
169 #endif // defined(CL_ENABLE_LAYERS)
170 
171 ///////////////////////////////////////////////////////////////////////////////
172 
clCreateContext(const cl_context_properties * properties,cl_uint num_devices,const cl_device_id * devices,void (CL_CALLBACK * pfn_notify)(const char * errinfo,const void * private_info,size_t cb,void * user_data),void * user_data,cl_int * errcode_ret)173 CL_API_ENTRY cl_context CL_API_CALL clCreateContext(
174     const cl_context_properties* properties,
175     cl_uint num_devices,
176     const cl_device_id* devices,
177     void (CL_CALLBACK* pfn_notify)(const char* errinfo, const void* private_info, size_t cb, void* user_data),
178     void* user_data,
179     cl_int* errcode_ret)
180 {
181 #if defined(CL_ENABLE_LAYERS)
182     if (khrFirstLayer)
183         return khrFirstLayer->dispatch.clCreateContext(
184             properties,
185             num_devices,
186             devices,
187             pfn_notify,
188             user_data,
189             errcode_ret);
190 #endif // defined(CL_ENABLE_LAYERS)
191     if (num_devices == 0 || devices == NULL) {
192         KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(NULL, CL_INVALID_VALUE);
193     }
194     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(devices[0], CL_INVALID_DEVICE);
195     return devices[0]->dispatch->clCreateContext(
196         properties,
197         num_devices,
198         devices,
199         pfn_notify,
200         user_data,
201         errcode_ret);
202 }
203 
204 ///////////////////////////////////////////////////////////////////////////////
205 #if defined(CL_ENABLE_LAYERS)
clCreateContext_disp(const cl_context_properties * properties,cl_uint num_devices,const cl_device_id * devices,void (CL_CALLBACK * pfn_notify)(const char * errinfo,const void * private_info,size_t cb,void * user_data),void * user_data,cl_int * errcode_ret)206 static cl_context CL_API_CALL clCreateContext_disp(
207     const cl_context_properties* properties,
208     cl_uint num_devices,
209     const cl_device_id* devices,
210     void (CL_CALLBACK* pfn_notify)(const char* errinfo, const void* private_info, size_t cb, void* user_data),
211     void* user_data,
212     cl_int* errcode_ret)
213 {
214     if (num_devices == 0 || devices == NULL) {
215         KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(NULL, CL_INVALID_VALUE);
216     }
217     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(devices[0], CL_INVALID_DEVICE);
218     return devices[0]->dispatch->clCreateContext(
219         properties,
220         num_devices,
221         devices,
222         pfn_notify,
223         user_data,
224         errcode_ret);
225 }
226 #endif // defined(CL_ENABLE_LAYERS)
227 
228 ///////////////////////////////////////////////////////////////////////////////
229 
clCreateContextFromType(const cl_context_properties * properties,cl_device_type device_type,void (CL_CALLBACK * pfn_notify)(const char * errinfo,const void * private_info,size_t cb,void * user_data),void * user_data,cl_int * errcode_ret)230 CL_API_ENTRY cl_context CL_API_CALL clCreateContextFromType(
231     const cl_context_properties* properties,
232     cl_device_type device_type,
233     void (CL_CALLBACK* pfn_notify)(const char* errinfo, const void* private_info, size_t cb, void* user_data),
234     void* user_data,
235     cl_int* errcode_ret)
236 {
237     khrIcdInitialize();
238 #if defined(CL_ENABLE_LAYERS)
239     if (khrFirstLayer)
240         return khrFirstLayer->dispatch.clCreateContextFromType(
241             properties,
242             device_type,
243             pfn_notify,
244             user_data,
245             errcode_ret);
246 #endif // defined(CL_ENABLE_LAYERS)
247     cl_platform_id platform = NULL;
248     khrIcdContextPropertiesGetPlatform(properties, &platform);
249     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(platform, CL_INVALID_PLATFORM);
250     return platform->dispatch->clCreateContextFromType(
251         properties,
252         device_type,
253         pfn_notify,
254         user_data,
255         errcode_ret);
256 }
257 
258 ///////////////////////////////////////////////////////////////////////////////
259 #if defined(CL_ENABLE_LAYERS)
clCreateContextFromType_disp(const cl_context_properties * properties,cl_device_type device_type,void (CL_CALLBACK * pfn_notify)(const char * errinfo,const void * private_info,size_t cb,void * user_data),void * user_data,cl_int * errcode_ret)260 static cl_context CL_API_CALL clCreateContextFromType_disp(
261     const cl_context_properties* properties,
262     cl_device_type device_type,
263     void (CL_CALLBACK* pfn_notify)(const char* errinfo, const void* private_info, size_t cb, void* user_data),
264     void* user_data,
265     cl_int* errcode_ret)
266 {
267     khrIcdInitialize();
268     cl_platform_id platform = NULL;
269     khrIcdContextPropertiesGetPlatform(properties, &platform);
270     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(platform, CL_INVALID_PLATFORM);
271     return platform->dispatch->clCreateContextFromType(
272         properties,
273         device_type,
274         pfn_notify,
275         user_data,
276         errcode_ret);
277 }
278 #endif // defined(CL_ENABLE_LAYERS)
279 
280 ///////////////////////////////////////////////////////////////////////////////
281 
clRetainContext(cl_context context)282 CL_API_ENTRY cl_int CL_API_CALL clRetainContext(
283     cl_context context)
284 {
285 #if defined(CL_ENABLE_LAYERS)
286     if (khrFirstLayer)
287         return khrFirstLayer->dispatch.clRetainContext(
288             context);
289 #endif // defined(CL_ENABLE_LAYERS)
290     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(context, CL_INVALID_CONTEXT);
291     return context->dispatch->clRetainContext(
292         context);
293 }
294 
295 ///////////////////////////////////////////////////////////////////////////////
296 #if defined(CL_ENABLE_LAYERS)
clRetainContext_disp(cl_context context)297 static cl_int CL_API_CALL clRetainContext_disp(
298     cl_context context)
299 {
300     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(context, CL_INVALID_CONTEXT);
301     return context->dispatch->clRetainContext(
302         context);
303 }
304 #endif // defined(CL_ENABLE_LAYERS)
305 
306 ///////////////////////////////////////////////////////////////////////////////
307 
clReleaseContext(cl_context context)308 CL_API_ENTRY cl_int CL_API_CALL clReleaseContext(
309     cl_context context)
310 {
311 #if defined(CL_ENABLE_LAYERS)
312     if (khrFirstLayer)
313         return khrFirstLayer->dispatch.clReleaseContext(
314             context);
315 #endif // defined(CL_ENABLE_LAYERS)
316     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(context, CL_INVALID_CONTEXT);
317     return context->dispatch->clReleaseContext(
318         context);
319 }
320 
321 ///////////////////////////////////////////////////////////////////////////////
322 #if defined(CL_ENABLE_LAYERS)
clReleaseContext_disp(cl_context context)323 static cl_int CL_API_CALL clReleaseContext_disp(
324     cl_context context)
325 {
326     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(context, CL_INVALID_CONTEXT);
327     return context->dispatch->clReleaseContext(
328         context);
329 }
330 #endif // defined(CL_ENABLE_LAYERS)
331 
332 ///////////////////////////////////////////////////////////////////////////////
333 
clGetContextInfo(cl_context context,cl_context_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret)334 CL_API_ENTRY cl_int CL_API_CALL clGetContextInfo(
335     cl_context context,
336     cl_context_info param_name,
337     size_t param_value_size,
338     void* param_value,
339     size_t* param_value_size_ret)
340 {
341 #if defined(CL_ENABLE_LAYERS)
342     if (khrFirstLayer)
343         return khrFirstLayer->dispatch.clGetContextInfo(
344             context,
345             param_name,
346             param_value_size,
347             param_value,
348             param_value_size_ret);
349 #endif // defined(CL_ENABLE_LAYERS)
350     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(context, CL_INVALID_CONTEXT);
351     return context->dispatch->clGetContextInfo(
352         context,
353         param_name,
354         param_value_size,
355         param_value,
356         param_value_size_ret);
357 }
358 
359 ///////////////////////////////////////////////////////////////////////////////
360 #if defined(CL_ENABLE_LAYERS)
clGetContextInfo_disp(cl_context context,cl_context_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret)361 static cl_int CL_API_CALL clGetContextInfo_disp(
362     cl_context context,
363     cl_context_info param_name,
364     size_t param_value_size,
365     void* param_value,
366     size_t* param_value_size_ret)
367 {
368     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(context, CL_INVALID_CONTEXT);
369     return context->dispatch->clGetContextInfo(
370         context,
371         param_name,
372         param_value_size,
373         param_value,
374         param_value_size_ret);
375 }
376 #endif // defined(CL_ENABLE_LAYERS)
377 
378 ///////////////////////////////////////////////////////////////////////////////
379 
clRetainCommandQueue(cl_command_queue command_queue)380 CL_API_ENTRY cl_int CL_API_CALL clRetainCommandQueue(
381     cl_command_queue command_queue)
382 {
383 #if defined(CL_ENABLE_LAYERS)
384     if (khrFirstLayer)
385         return khrFirstLayer->dispatch.clRetainCommandQueue(
386             command_queue);
387 #endif // defined(CL_ENABLE_LAYERS)
388     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
389     return command_queue->dispatch->clRetainCommandQueue(
390         command_queue);
391 }
392 
393 ///////////////////////////////////////////////////////////////////////////////
394 #if defined(CL_ENABLE_LAYERS)
clRetainCommandQueue_disp(cl_command_queue command_queue)395 static cl_int CL_API_CALL clRetainCommandQueue_disp(
396     cl_command_queue command_queue)
397 {
398     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
399     return command_queue->dispatch->clRetainCommandQueue(
400         command_queue);
401 }
402 #endif // defined(CL_ENABLE_LAYERS)
403 
404 ///////////////////////////////////////////////////////////////////////////////
405 
clReleaseCommandQueue(cl_command_queue command_queue)406 CL_API_ENTRY cl_int CL_API_CALL clReleaseCommandQueue(
407     cl_command_queue command_queue)
408 {
409 #if defined(CL_ENABLE_LAYERS)
410     if (khrFirstLayer)
411         return khrFirstLayer->dispatch.clReleaseCommandQueue(
412             command_queue);
413 #endif // defined(CL_ENABLE_LAYERS)
414     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
415     return command_queue->dispatch->clReleaseCommandQueue(
416         command_queue);
417 }
418 
419 ///////////////////////////////////////////////////////////////////////////////
420 #if defined(CL_ENABLE_LAYERS)
clReleaseCommandQueue_disp(cl_command_queue command_queue)421 static cl_int CL_API_CALL clReleaseCommandQueue_disp(
422     cl_command_queue command_queue)
423 {
424     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
425     return command_queue->dispatch->clReleaseCommandQueue(
426         command_queue);
427 }
428 #endif // defined(CL_ENABLE_LAYERS)
429 
430 ///////////////////////////////////////////////////////////////////////////////
431 
clGetCommandQueueInfo(cl_command_queue command_queue,cl_command_queue_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret)432 CL_API_ENTRY cl_int CL_API_CALL clGetCommandQueueInfo(
433     cl_command_queue command_queue,
434     cl_command_queue_info param_name,
435     size_t param_value_size,
436     void* param_value,
437     size_t* param_value_size_ret)
438 {
439 #if defined(CL_ENABLE_LAYERS)
440     if (khrFirstLayer)
441         return khrFirstLayer->dispatch.clGetCommandQueueInfo(
442             command_queue,
443             param_name,
444             param_value_size,
445             param_value,
446             param_value_size_ret);
447 #endif // defined(CL_ENABLE_LAYERS)
448     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
449     return command_queue->dispatch->clGetCommandQueueInfo(
450         command_queue,
451         param_name,
452         param_value_size,
453         param_value,
454         param_value_size_ret);
455 }
456 
457 ///////////////////////////////////////////////////////////////////////////////
458 #if defined(CL_ENABLE_LAYERS)
clGetCommandQueueInfo_disp(cl_command_queue command_queue,cl_command_queue_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret)459 static cl_int CL_API_CALL clGetCommandQueueInfo_disp(
460     cl_command_queue command_queue,
461     cl_command_queue_info param_name,
462     size_t param_value_size,
463     void* param_value,
464     size_t* param_value_size_ret)
465 {
466     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
467     return command_queue->dispatch->clGetCommandQueueInfo(
468         command_queue,
469         param_name,
470         param_value_size,
471         param_value,
472         param_value_size_ret);
473 }
474 #endif // defined(CL_ENABLE_LAYERS)
475 
476 ///////////////////////////////////////////////////////////////////////////////
477 
clCreateBuffer(cl_context context,cl_mem_flags flags,size_t size,void * host_ptr,cl_int * errcode_ret)478 CL_API_ENTRY cl_mem CL_API_CALL clCreateBuffer(
479     cl_context context,
480     cl_mem_flags flags,
481     size_t size,
482     void* host_ptr,
483     cl_int* errcode_ret)
484 {
485 #if defined(CL_ENABLE_LAYERS)
486     if (khrFirstLayer)
487         return khrFirstLayer->dispatch.clCreateBuffer(
488             context,
489             flags,
490             size,
491             host_ptr,
492             errcode_ret);
493 #endif // defined(CL_ENABLE_LAYERS)
494     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
495     return context->dispatch->clCreateBuffer(
496         context,
497         flags,
498         size,
499         host_ptr,
500         errcode_ret);
501 }
502 
503 ///////////////////////////////////////////////////////////////////////////////
504 #if defined(CL_ENABLE_LAYERS)
clCreateBuffer_disp(cl_context context,cl_mem_flags flags,size_t size,void * host_ptr,cl_int * errcode_ret)505 static cl_mem CL_API_CALL clCreateBuffer_disp(
506     cl_context context,
507     cl_mem_flags flags,
508     size_t size,
509     void* host_ptr,
510     cl_int* errcode_ret)
511 {
512     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
513     return context->dispatch->clCreateBuffer(
514         context,
515         flags,
516         size,
517         host_ptr,
518         errcode_ret);
519 }
520 #endif // defined(CL_ENABLE_LAYERS)
521 
522 ///////////////////////////////////////////////////////////////////////////////
523 
clRetainMemObject(cl_mem memobj)524 CL_API_ENTRY cl_int CL_API_CALL clRetainMemObject(
525     cl_mem memobj)
526 {
527 #if defined(CL_ENABLE_LAYERS)
528     if (khrFirstLayer)
529         return khrFirstLayer->dispatch.clRetainMemObject(
530             memobj);
531 #endif // defined(CL_ENABLE_LAYERS)
532     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(memobj, CL_INVALID_MEM_OBJECT);
533     return memobj->dispatch->clRetainMemObject(
534         memobj);
535 }
536 
537 ///////////////////////////////////////////////////////////////////////////////
538 #if defined(CL_ENABLE_LAYERS)
clRetainMemObject_disp(cl_mem memobj)539 static cl_int CL_API_CALL clRetainMemObject_disp(
540     cl_mem memobj)
541 {
542     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(memobj, CL_INVALID_MEM_OBJECT);
543     return memobj->dispatch->clRetainMemObject(
544         memobj);
545 }
546 #endif // defined(CL_ENABLE_LAYERS)
547 
548 ///////////////////////////////////////////////////////////////////////////////
549 
clReleaseMemObject(cl_mem memobj)550 CL_API_ENTRY cl_int CL_API_CALL clReleaseMemObject(
551     cl_mem memobj)
552 {
553 #if defined(CL_ENABLE_LAYERS)
554     if (khrFirstLayer)
555         return khrFirstLayer->dispatch.clReleaseMemObject(
556             memobj);
557 #endif // defined(CL_ENABLE_LAYERS)
558     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(memobj, CL_INVALID_MEM_OBJECT);
559     return memobj->dispatch->clReleaseMemObject(
560         memobj);
561 }
562 
563 ///////////////////////////////////////////////////////////////////////////////
564 #if defined(CL_ENABLE_LAYERS)
clReleaseMemObject_disp(cl_mem memobj)565 static cl_int CL_API_CALL clReleaseMemObject_disp(
566     cl_mem memobj)
567 {
568     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(memobj, CL_INVALID_MEM_OBJECT);
569     return memobj->dispatch->clReleaseMemObject(
570         memobj);
571 }
572 #endif // defined(CL_ENABLE_LAYERS)
573 
574 ///////////////////////////////////////////////////////////////////////////////
575 
clGetSupportedImageFormats(cl_context context,cl_mem_flags flags,cl_mem_object_type image_type,cl_uint num_entries,cl_image_format * image_formats,cl_uint * num_image_formats)576 CL_API_ENTRY cl_int CL_API_CALL clGetSupportedImageFormats(
577     cl_context context,
578     cl_mem_flags flags,
579     cl_mem_object_type image_type,
580     cl_uint num_entries,
581     cl_image_format* image_formats,
582     cl_uint* num_image_formats)
583 {
584 #if defined(CL_ENABLE_LAYERS)
585     if (khrFirstLayer)
586         return khrFirstLayer->dispatch.clGetSupportedImageFormats(
587             context,
588             flags,
589             image_type,
590             num_entries,
591             image_formats,
592             num_image_formats);
593 #endif // defined(CL_ENABLE_LAYERS)
594     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(context, CL_INVALID_CONTEXT);
595     return context->dispatch->clGetSupportedImageFormats(
596         context,
597         flags,
598         image_type,
599         num_entries,
600         image_formats,
601         num_image_formats);
602 }
603 
604 ///////////////////////////////////////////////////////////////////////////////
605 #if defined(CL_ENABLE_LAYERS)
clGetSupportedImageFormats_disp(cl_context context,cl_mem_flags flags,cl_mem_object_type image_type,cl_uint num_entries,cl_image_format * image_formats,cl_uint * num_image_formats)606 static cl_int CL_API_CALL clGetSupportedImageFormats_disp(
607     cl_context context,
608     cl_mem_flags flags,
609     cl_mem_object_type image_type,
610     cl_uint num_entries,
611     cl_image_format* image_formats,
612     cl_uint* num_image_formats)
613 {
614     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(context, CL_INVALID_CONTEXT);
615     return context->dispatch->clGetSupportedImageFormats(
616         context,
617         flags,
618         image_type,
619         num_entries,
620         image_formats,
621         num_image_formats);
622 }
623 #endif // defined(CL_ENABLE_LAYERS)
624 
625 ///////////////////////////////////////////////////////////////////////////////
626 
clGetMemObjectInfo(cl_mem memobj,cl_mem_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret)627 CL_API_ENTRY cl_int CL_API_CALL clGetMemObjectInfo(
628     cl_mem memobj,
629     cl_mem_info param_name,
630     size_t param_value_size,
631     void* param_value,
632     size_t* param_value_size_ret)
633 {
634 #if defined(CL_ENABLE_LAYERS)
635     if (khrFirstLayer)
636         return khrFirstLayer->dispatch.clGetMemObjectInfo(
637             memobj,
638             param_name,
639             param_value_size,
640             param_value,
641             param_value_size_ret);
642 #endif // defined(CL_ENABLE_LAYERS)
643     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(memobj, CL_INVALID_MEM_OBJECT);
644     return memobj->dispatch->clGetMemObjectInfo(
645         memobj,
646         param_name,
647         param_value_size,
648         param_value,
649         param_value_size_ret);
650 }
651 
652 ///////////////////////////////////////////////////////////////////////////////
653 #if defined(CL_ENABLE_LAYERS)
clGetMemObjectInfo_disp(cl_mem memobj,cl_mem_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret)654 static cl_int CL_API_CALL clGetMemObjectInfo_disp(
655     cl_mem memobj,
656     cl_mem_info param_name,
657     size_t param_value_size,
658     void* param_value,
659     size_t* param_value_size_ret)
660 {
661     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(memobj, CL_INVALID_MEM_OBJECT);
662     return memobj->dispatch->clGetMemObjectInfo(
663         memobj,
664         param_name,
665         param_value_size,
666         param_value,
667         param_value_size_ret);
668 }
669 #endif // defined(CL_ENABLE_LAYERS)
670 
671 ///////////////////////////////////////////////////////////////////////////////
672 
clGetImageInfo(cl_mem image,cl_image_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret)673 CL_API_ENTRY cl_int CL_API_CALL clGetImageInfo(
674     cl_mem image,
675     cl_image_info param_name,
676     size_t param_value_size,
677     void* param_value,
678     size_t* param_value_size_ret)
679 {
680 #if defined(CL_ENABLE_LAYERS)
681     if (khrFirstLayer)
682         return khrFirstLayer->dispatch.clGetImageInfo(
683             image,
684             param_name,
685             param_value_size,
686             param_value,
687             param_value_size_ret);
688 #endif // defined(CL_ENABLE_LAYERS)
689     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(image, CL_INVALID_MEM_OBJECT);
690     return image->dispatch->clGetImageInfo(
691         image,
692         param_name,
693         param_value_size,
694         param_value,
695         param_value_size_ret);
696 }
697 
698 ///////////////////////////////////////////////////////////////////////////////
699 #if defined(CL_ENABLE_LAYERS)
clGetImageInfo_disp(cl_mem image,cl_image_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret)700 static cl_int CL_API_CALL clGetImageInfo_disp(
701     cl_mem image,
702     cl_image_info param_name,
703     size_t param_value_size,
704     void* param_value,
705     size_t* param_value_size_ret)
706 {
707     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(image, CL_INVALID_MEM_OBJECT);
708     return image->dispatch->clGetImageInfo(
709         image,
710         param_name,
711         param_value_size,
712         param_value,
713         param_value_size_ret);
714 }
715 #endif // defined(CL_ENABLE_LAYERS)
716 
717 ///////////////////////////////////////////////////////////////////////////////
718 
clRetainSampler(cl_sampler sampler)719 CL_API_ENTRY cl_int CL_API_CALL clRetainSampler(
720     cl_sampler sampler)
721 {
722 #if defined(CL_ENABLE_LAYERS)
723     if (khrFirstLayer)
724         return khrFirstLayer->dispatch.clRetainSampler(
725             sampler);
726 #endif // defined(CL_ENABLE_LAYERS)
727     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(sampler, CL_INVALID_SAMPLER);
728     return sampler->dispatch->clRetainSampler(
729         sampler);
730 }
731 
732 ///////////////////////////////////////////////////////////////////////////////
733 #if defined(CL_ENABLE_LAYERS)
clRetainSampler_disp(cl_sampler sampler)734 static cl_int CL_API_CALL clRetainSampler_disp(
735     cl_sampler sampler)
736 {
737     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(sampler, CL_INVALID_SAMPLER);
738     return sampler->dispatch->clRetainSampler(
739         sampler);
740 }
741 #endif // defined(CL_ENABLE_LAYERS)
742 
743 ///////////////////////////////////////////////////////////////////////////////
744 
clReleaseSampler(cl_sampler sampler)745 CL_API_ENTRY cl_int CL_API_CALL clReleaseSampler(
746     cl_sampler sampler)
747 {
748 #if defined(CL_ENABLE_LAYERS)
749     if (khrFirstLayer)
750         return khrFirstLayer->dispatch.clReleaseSampler(
751             sampler);
752 #endif // defined(CL_ENABLE_LAYERS)
753     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(sampler, CL_INVALID_SAMPLER);
754     return sampler->dispatch->clReleaseSampler(
755         sampler);
756 }
757 
758 ///////////////////////////////////////////////////////////////////////////////
759 #if defined(CL_ENABLE_LAYERS)
clReleaseSampler_disp(cl_sampler sampler)760 static cl_int CL_API_CALL clReleaseSampler_disp(
761     cl_sampler sampler)
762 {
763     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(sampler, CL_INVALID_SAMPLER);
764     return sampler->dispatch->clReleaseSampler(
765         sampler);
766 }
767 #endif // defined(CL_ENABLE_LAYERS)
768 
769 ///////////////////////////////////////////////////////////////////////////////
770 
clGetSamplerInfo(cl_sampler sampler,cl_sampler_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret)771 CL_API_ENTRY cl_int CL_API_CALL clGetSamplerInfo(
772     cl_sampler sampler,
773     cl_sampler_info param_name,
774     size_t param_value_size,
775     void* param_value,
776     size_t* param_value_size_ret)
777 {
778 #if defined(CL_ENABLE_LAYERS)
779     if (khrFirstLayer)
780         return khrFirstLayer->dispatch.clGetSamplerInfo(
781             sampler,
782             param_name,
783             param_value_size,
784             param_value,
785             param_value_size_ret);
786 #endif // defined(CL_ENABLE_LAYERS)
787     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(sampler, CL_INVALID_SAMPLER);
788     return sampler->dispatch->clGetSamplerInfo(
789         sampler,
790         param_name,
791         param_value_size,
792         param_value,
793         param_value_size_ret);
794 }
795 
796 ///////////////////////////////////////////////////////////////////////////////
797 #if defined(CL_ENABLE_LAYERS)
clGetSamplerInfo_disp(cl_sampler sampler,cl_sampler_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret)798 static cl_int CL_API_CALL clGetSamplerInfo_disp(
799     cl_sampler sampler,
800     cl_sampler_info param_name,
801     size_t param_value_size,
802     void* param_value,
803     size_t* param_value_size_ret)
804 {
805     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(sampler, CL_INVALID_SAMPLER);
806     return sampler->dispatch->clGetSamplerInfo(
807         sampler,
808         param_name,
809         param_value_size,
810         param_value,
811         param_value_size_ret);
812 }
813 #endif // defined(CL_ENABLE_LAYERS)
814 
815 ///////////////////////////////////////////////////////////////////////////////
816 
clCreateProgramWithSource(cl_context context,cl_uint count,const char ** strings,const size_t * lengths,cl_int * errcode_ret)817 CL_API_ENTRY cl_program CL_API_CALL clCreateProgramWithSource(
818     cl_context context,
819     cl_uint count,
820     const char** strings,
821     const size_t* lengths,
822     cl_int* errcode_ret)
823 {
824 #if defined(CL_ENABLE_LAYERS)
825     if (khrFirstLayer)
826         return khrFirstLayer->dispatch.clCreateProgramWithSource(
827             context,
828             count,
829             strings,
830             lengths,
831             errcode_ret);
832 #endif // defined(CL_ENABLE_LAYERS)
833     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
834     return context->dispatch->clCreateProgramWithSource(
835         context,
836         count,
837         strings,
838         lengths,
839         errcode_ret);
840 }
841 
842 ///////////////////////////////////////////////////////////////////////////////
843 #if defined(CL_ENABLE_LAYERS)
clCreateProgramWithSource_disp(cl_context context,cl_uint count,const char ** strings,const size_t * lengths,cl_int * errcode_ret)844 static cl_program CL_API_CALL clCreateProgramWithSource_disp(
845     cl_context context,
846     cl_uint count,
847     const char** strings,
848     const size_t* lengths,
849     cl_int* errcode_ret)
850 {
851     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
852     return context->dispatch->clCreateProgramWithSource(
853         context,
854         count,
855         strings,
856         lengths,
857         errcode_ret);
858 }
859 #endif // defined(CL_ENABLE_LAYERS)
860 
861 ///////////////////////////////////////////////////////////////////////////////
862 
clCreateProgramWithBinary(cl_context context,cl_uint num_devices,const cl_device_id * device_list,const size_t * lengths,const unsigned char ** binaries,cl_int * binary_status,cl_int * errcode_ret)863 CL_API_ENTRY cl_program CL_API_CALL clCreateProgramWithBinary(
864     cl_context context,
865     cl_uint num_devices,
866     const cl_device_id* device_list,
867     const size_t* lengths,
868     const unsigned char** binaries,
869     cl_int* binary_status,
870     cl_int* errcode_ret)
871 {
872 #if defined(CL_ENABLE_LAYERS)
873     if (khrFirstLayer)
874         return khrFirstLayer->dispatch.clCreateProgramWithBinary(
875             context,
876             num_devices,
877             device_list,
878             lengths,
879             binaries,
880             binary_status,
881             errcode_ret);
882 #endif // defined(CL_ENABLE_LAYERS)
883     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
884     return context->dispatch->clCreateProgramWithBinary(
885         context,
886         num_devices,
887         device_list,
888         lengths,
889         binaries,
890         binary_status,
891         errcode_ret);
892 }
893 
894 ///////////////////////////////////////////////////////////////////////////////
895 #if defined(CL_ENABLE_LAYERS)
clCreateProgramWithBinary_disp(cl_context context,cl_uint num_devices,const cl_device_id * device_list,const size_t * lengths,const unsigned char ** binaries,cl_int * binary_status,cl_int * errcode_ret)896 static cl_program CL_API_CALL clCreateProgramWithBinary_disp(
897     cl_context context,
898     cl_uint num_devices,
899     const cl_device_id* device_list,
900     const size_t* lengths,
901     const unsigned char** binaries,
902     cl_int* binary_status,
903     cl_int* errcode_ret)
904 {
905     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
906     return context->dispatch->clCreateProgramWithBinary(
907         context,
908         num_devices,
909         device_list,
910         lengths,
911         binaries,
912         binary_status,
913         errcode_ret);
914 }
915 #endif // defined(CL_ENABLE_LAYERS)
916 
917 ///////////////////////////////////////////////////////////////////////////////
918 
clRetainProgram(cl_program program)919 CL_API_ENTRY cl_int CL_API_CALL clRetainProgram(
920     cl_program program)
921 {
922 #if defined(CL_ENABLE_LAYERS)
923     if (khrFirstLayer)
924         return khrFirstLayer->dispatch.clRetainProgram(
925             program);
926 #endif // defined(CL_ENABLE_LAYERS)
927     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM);
928     return program->dispatch->clRetainProgram(
929         program);
930 }
931 
932 ///////////////////////////////////////////////////////////////////////////////
933 #if defined(CL_ENABLE_LAYERS)
clRetainProgram_disp(cl_program program)934 static cl_int CL_API_CALL clRetainProgram_disp(
935     cl_program program)
936 {
937     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM);
938     return program->dispatch->clRetainProgram(
939         program);
940 }
941 #endif // defined(CL_ENABLE_LAYERS)
942 
943 ///////////////////////////////////////////////////////////////////////////////
944 
clReleaseProgram(cl_program program)945 CL_API_ENTRY cl_int CL_API_CALL clReleaseProgram(
946     cl_program program)
947 {
948 #if defined(CL_ENABLE_LAYERS)
949     if (khrFirstLayer)
950         return khrFirstLayer->dispatch.clReleaseProgram(
951             program);
952 #endif // defined(CL_ENABLE_LAYERS)
953     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM);
954     return program->dispatch->clReleaseProgram(
955         program);
956 }
957 
958 ///////////////////////////////////////////////////////////////////////////////
959 #if defined(CL_ENABLE_LAYERS)
clReleaseProgram_disp(cl_program program)960 static cl_int CL_API_CALL clReleaseProgram_disp(
961     cl_program program)
962 {
963     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM);
964     return program->dispatch->clReleaseProgram(
965         program);
966 }
967 #endif // defined(CL_ENABLE_LAYERS)
968 
969 ///////////////////////////////////////////////////////////////////////////////
970 
clBuildProgram(cl_program program,cl_uint num_devices,const cl_device_id * device_list,const char * options,void (CL_CALLBACK * pfn_notify)(cl_program program,void * user_data),void * user_data)971 CL_API_ENTRY cl_int CL_API_CALL clBuildProgram(
972     cl_program program,
973     cl_uint num_devices,
974     const cl_device_id* device_list,
975     const char* options,
976     void (CL_CALLBACK* pfn_notify)(cl_program program, void* user_data),
977     void* user_data)
978 {
979 #if defined(CL_ENABLE_LAYERS)
980     if (khrFirstLayer)
981         return khrFirstLayer->dispatch.clBuildProgram(
982             program,
983             num_devices,
984             device_list,
985             options,
986             pfn_notify,
987             user_data);
988 #endif // defined(CL_ENABLE_LAYERS)
989     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM);
990     return program->dispatch->clBuildProgram(
991         program,
992         num_devices,
993         device_list,
994         options,
995         pfn_notify,
996         user_data);
997 }
998 
999 ///////////////////////////////////////////////////////////////////////////////
1000 #if defined(CL_ENABLE_LAYERS)
clBuildProgram_disp(cl_program program,cl_uint num_devices,const cl_device_id * device_list,const char * options,void (CL_CALLBACK * pfn_notify)(cl_program program,void * user_data),void * user_data)1001 static cl_int CL_API_CALL clBuildProgram_disp(
1002     cl_program program,
1003     cl_uint num_devices,
1004     const cl_device_id* device_list,
1005     const char* options,
1006     void (CL_CALLBACK* pfn_notify)(cl_program program, void* user_data),
1007     void* user_data)
1008 {
1009     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM);
1010     return program->dispatch->clBuildProgram(
1011         program,
1012         num_devices,
1013         device_list,
1014         options,
1015         pfn_notify,
1016         user_data);
1017 }
1018 #endif // defined(CL_ENABLE_LAYERS)
1019 
1020 ///////////////////////////////////////////////////////////////////////////////
1021 
clGetProgramInfo(cl_program program,cl_program_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret)1022 CL_API_ENTRY cl_int CL_API_CALL clGetProgramInfo(
1023     cl_program program,
1024     cl_program_info param_name,
1025     size_t param_value_size,
1026     void* param_value,
1027     size_t* param_value_size_ret)
1028 {
1029 #if defined(CL_ENABLE_LAYERS)
1030     if (khrFirstLayer)
1031         return khrFirstLayer->dispatch.clGetProgramInfo(
1032             program,
1033             param_name,
1034             param_value_size,
1035             param_value,
1036             param_value_size_ret);
1037 #endif // defined(CL_ENABLE_LAYERS)
1038     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM);
1039     return program->dispatch->clGetProgramInfo(
1040         program,
1041         param_name,
1042         param_value_size,
1043         param_value,
1044         param_value_size_ret);
1045 }
1046 
1047 ///////////////////////////////////////////////////////////////////////////////
1048 #if defined(CL_ENABLE_LAYERS)
clGetProgramInfo_disp(cl_program program,cl_program_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret)1049 static cl_int CL_API_CALL clGetProgramInfo_disp(
1050     cl_program program,
1051     cl_program_info param_name,
1052     size_t param_value_size,
1053     void* param_value,
1054     size_t* param_value_size_ret)
1055 {
1056     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM);
1057     return program->dispatch->clGetProgramInfo(
1058         program,
1059         param_name,
1060         param_value_size,
1061         param_value,
1062         param_value_size_ret);
1063 }
1064 #endif // defined(CL_ENABLE_LAYERS)
1065 
1066 ///////////////////////////////////////////////////////////////////////////////
1067 
clGetProgramBuildInfo(cl_program program,cl_device_id device,cl_program_build_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret)1068 CL_API_ENTRY cl_int CL_API_CALL clGetProgramBuildInfo(
1069     cl_program program,
1070     cl_device_id device,
1071     cl_program_build_info param_name,
1072     size_t param_value_size,
1073     void* param_value,
1074     size_t* param_value_size_ret)
1075 {
1076 #if defined(CL_ENABLE_LAYERS)
1077     if (khrFirstLayer)
1078         return khrFirstLayer->dispatch.clGetProgramBuildInfo(
1079             program,
1080             device,
1081             param_name,
1082             param_value_size,
1083             param_value,
1084             param_value_size_ret);
1085 #endif // defined(CL_ENABLE_LAYERS)
1086     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM);
1087     return program->dispatch->clGetProgramBuildInfo(
1088         program,
1089         device,
1090         param_name,
1091         param_value_size,
1092         param_value,
1093         param_value_size_ret);
1094 }
1095 
1096 ///////////////////////////////////////////////////////////////////////////////
1097 #if defined(CL_ENABLE_LAYERS)
clGetProgramBuildInfo_disp(cl_program program,cl_device_id device,cl_program_build_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret)1098 static cl_int CL_API_CALL clGetProgramBuildInfo_disp(
1099     cl_program program,
1100     cl_device_id device,
1101     cl_program_build_info param_name,
1102     size_t param_value_size,
1103     void* param_value,
1104     size_t* param_value_size_ret)
1105 {
1106     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM);
1107     return program->dispatch->clGetProgramBuildInfo(
1108         program,
1109         device,
1110         param_name,
1111         param_value_size,
1112         param_value,
1113         param_value_size_ret);
1114 }
1115 #endif // defined(CL_ENABLE_LAYERS)
1116 
1117 ///////////////////////////////////////////////////////////////////////////////
1118 
clCreateKernel(cl_program program,const char * kernel_name,cl_int * errcode_ret)1119 CL_API_ENTRY cl_kernel CL_API_CALL clCreateKernel(
1120     cl_program program,
1121     const char* kernel_name,
1122     cl_int* errcode_ret)
1123 {
1124 #if defined(CL_ENABLE_LAYERS)
1125     if (khrFirstLayer)
1126         return khrFirstLayer->dispatch.clCreateKernel(
1127             program,
1128             kernel_name,
1129             errcode_ret);
1130 #endif // defined(CL_ENABLE_LAYERS)
1131     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(program, CL_INVALID_PROGRAM);
1132     return program->dispatch->clCreateKernel(
1133         program,
1134         kernel_name,
1135         errcode_ret);
1136 }
1137 
1138 ///////////////////////////////////////////////////////////////////////////////
1139 #if defined(CL_ENABLE_LAYERS)
clCreateKernel_disp(cl_program program,const char * kernel_name,cl_int * errcode_ret)1140 static cl_kernel CL_API_CALL clCreateKernel_disp(
1141     cl_program program,
1142     const char* kernel_name,
1143     cl_int* errcode_ret)
1144 {
1145     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(program, CL_INVALID_PROGRAM);
1146     return program->dispatch->clCreateKernel(
1147         program,
1148         kernel_name,
1149         errcode_ret);
1150 }
1151 #endif // defined(CL_ENABLE_LAYERS)
1152 
1153 ///////////////////////////////////////////////////////////////////////////////
1154 
clCreateKernelsInProgram(cl_program program,cl_uint num_kernels,cl_kernel * kernels,cl_uint * num_kernels_ret)1155 CL_API_ENTRY cl_int CL_API_CALL clCreateKernelsInProgram(
1156     cl_program program,
1157     cl_uint num_kernels,
1158     cl_kernel* kernels,
1159     cl_uint* num_kernels_ret)
1160 {
1161 #if defined(CL_ENABLE_LAYERS)
1162     if (khrFirstLayer)
1163         return khrFirstLayer->dispatch.clCreateKernelsInProgram(
1164             program,
1165             num_kernels,
1166             kernels,
1167             num_kernels_ret);
1168 #endif // defined(CL_ENABLE_LAYERS)
1169     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM);
1170     return program->dispatch->clCreateKernelsInProgram(
1171         program,
1172         num_kernels,
1173         kernels,
1174         num_kernels_ret);
1175 }
1176 
1177 ///////////////////////////////////////////////////////////////////////////////
1178 #if defined(CL_ENABLE_LAYERS)
clCreateKernelsInProgram_disp(cl_program program,cl_uint num_kernels,cl_kernel * kernels,cl_uint * num_kernels_ret)1179 static cl_int CL_API_CALL clCreateKernelsInProgram_disp(
1180     cl_program program,
1181     cl_uint num_kernels,
1182     cl_kernel* kernels,
1183     cl_uint* num_kernels_ret)
1184 {
1185     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM);
1186     return program->dispatch->clCreateKernelsInProgram(
1187         program,
1188         num_kernels,
1189         kernels,
1190         num_kernels_ret);
1191 }
1192 #endif // defined(CL_ENABLE_LAYERS)
1193 
1194 ///////////////////////////////////////////////////////////////////////////////
1195 
clRetainKernel(cl_kernel kernel)1196 CL_API_ENTRY cl_int CL_API_CALL clRetainKernel(
1197     cl_kernel kernel)
1198 {
1199 #if defined(CL_ENABLE_LAYERS)
1200     if (khrFirstLayer)
1201         return khrFirstLayer->dispatch.clRetainKernel(
1202             kernel);
1203 #endif // defined(CL_ENABLE_LAYERS)
1204     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL);
1205     return kernel->dispatch->clRetainKernel(
1206         kernel);
1207 }
1208 
1209 ///////////////////////////////////////////////////////////////////////////////
1210 #if defined(CL_ENABLE_LAYERS)
clRetainKernel_disp(cl_kernel kernel)1211 static cl_int CL_API_CALL clRetainKernel_disp(
1212     cl_kernel kernel)
1213 {
1214     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL);
1215     return kernel->dispatch->clRetainKernel(
1216         kernel);
1217 }
1218 #endif // defined(CL_ENABLE_LAYERS)
1219 
1220 ///////////////////////////////////////////////////////////////////////////////
1221 
clReleaseKernel(cl_kernel kernel)1222 CL_API_ENTRY cl_int CL_API_CALL clReleaseKernel(
1223     cl_kernel kernel)
1224 {
1225 #if defined(CL_ENABLE_LAYERS)
1226     if (khrFirstLayer)
1227         return khrFirstLayer->dispatch.clReleaseKernel(
1228             kernel);
1229 #endif // defined(CL_ENABLE_LAYERS)
1230     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL);
1231     return kernel->dispatch->clReleaseKernel(
1232         kernel);
1233 }
1234 
1235 ///////////////////////////////////////////////////////////////////////////////
1236 #if defined(CL_ENABLE_LAYERS)
clReleaseKernel_disp(cl_kernel kernel)1237 static cl_int CL_API_CALL clReleaseKernel_disp(
1238     cl_kernel kernel)
1239 {
1240     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL);
1241     return kernel->dispatch->clReleaseKernel(
1242         kernel);
1243 }
1244 #endif // defined(CL_ENABLE_LAYERS)
1245 
1246 ///////////////////////////////////////////////////////////////////////////////
1247 
clSetKernelArg(cl_kernel kernel,cl_uint arg_index,size_t arg_size,const void * arg_value)1248 CL_API_ENTRY cl_int CL_API_CALL clSetKernelArg(
1249     cl_kernel kernel,
1250     cl_uint arg_index,
1251     size_t arg_size,
1252     const void* arg_value)
1253 {
1254 #if defined(CL_ENABLE_LAYERS)
1255     if (khrFirstLayer)
1256         return khrFirstLayer->dispatch.clSetKernelArg(
1257             kernel,
1258             arg_index,
1259             arg_size,
1260             arg_value);
1261 #endif // defined(CL_ENABLE_LAYERS)
1262     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL);
1263     return kernel->dispatch->clSetKernelArg(
1264         kernel,
1265         arg_index,
1266         arg_size,
1267         arg_value);
1268 }
1269 
1270 ///////////////////////////////////////////////////////////////////////////////
1271 #if defined(CL_ENABLE_LAYERS)
clSetKernelArg_disp(cl_kernel kernel,cl_uint arg_index,size_t arg_size,const void * arg_value)1272 static cl_int CL_API_CALL clSetKernelArg_disp(
1273     cl_kernel kernel,
1274     cl_uint arg_index,
1275     size_t arg_size,
1276     const void* arg_value)
1277 {
1278     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL);
1279     return kernel->dispatch->clSetKernelArg(
1280         kernel,
1281         arg_index,
1282         arg_size,
1283         arg_value);
1284 }
1285 #endif // defined(CL_ENABLE_LAYERS)
1286 
1287 ///////////////////////////////////////////////////////////////////////////////
1288 
clGetKernelInfo(cl_kernel kernel,cl_kernel_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret)1289 CL_API_ENTRY cl_int CL_API_CALL clGetKernelInfo(
1290     cl_kernel kernel,
1291     cl_kernel_info param_name,
1292     size_t param_value_size,
1293     void* param_value,
1294     size_t* param_value_size_ret)
1295 {
1296 #if defined(CL_ENABLE_LAYERS)
1297     if (khrFirstLayer)
1298         return khrFirstLayer->dispatch.clGetKernelInfo(
1299             kernel,
1300             param_name,
1301             param_value_size,
1302             param_value,
1303             param_value_size_ret);
1304 #endif // defined(CL_ENABLE_LAYERS)
1305     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL);
1306     return kernel->dispatch->clGetKernelInfo(
1307         kernel,
1308         param_name,
1309         param_value_size,
1310         param_value,
1311         param_value_size_ret);
1312 }
1313 
1314 ///////////////////////////////////////////////////////////////////////////////
1315 #if defined(CL_ENABLE_LAYERS)
clGetKernelInfo_disp(cl_kernel kernel,cl_kernel_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret)1316 static cl_int CL_API_CALL clGetKernelInfo_disp(
1317     cl_kernel kernel,
1318     cl_kernel_info param_name,
1319     size_t param_value_size,
1320     void* param_value,
1321     size_t* param_value_size_ret)
1322 {
1323     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL);
1324     return kernel->dispatch->clGetKernelInfo(
1325         kernel,
1326         param_name,
1327         param_value_size,
1328         param_value,
1329         param_value_size_ret);
1330 }
1331 #endif // defined(CL_ENABLE_LAYERS)
1332 
1333 ///////////////////////////////////////////////////////////////////////////////
1334 
clGetKernelWorkGroupInfo(cl_kernel kernel,cl_device_id device,cl_kernel_work_group_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret)1335 CL_API_ENTRY cl_int CL_API_CALL clGetKernelWorkGroupInfo(
1336     cl_kernel kernel,
1337     cl_device_id device,
1338     cl_kernel_work_group_info param_name,
1339     size_t param_value_size,
1340     void* param_value,
1341     size_t* param_value_size_ret)
1342 {
1343 #if defined(CL_ENABLE_LAYERS)
1344     if (khrFirstLayer)
1345         return khrFirstLayer->dispatch.clGetKernelWorkGroupInfo(
1346             kernel,
1347             device,
1348             param_name,
1349             param_value_size,
1350             param_value,
1351             param_value_size_ret);
1352 #endif // defined(CL_ENABLE_LAYERS)
1353     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL);
1354     return kernel->dispatch->clGetKernelWorkGroupInfo(
1355         kernel,
1356         device,
1357         param_name,
1358         param_value_size,
1359         param_value,
1360         param_value_size_ret);
1361 }
1362 
1363 ///////////////////////////////////////////////////////////////////////////////
1364 #if defined(CL_ENABLE_LAYERS)
clGetKernelWorkGroupInfo_disp(cl_kernel kernel,cl_device_id device,cl_kernel_work_group_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret)1365 static cl_int CL_API_CALL clGetKernelWorkGroupInfo_disp(
1366     cl_kernel kernel,
1367     cl_device_id device,
1368     cl_kernel_work_group_info param_name,
1369     size_t param_value_size,
1370     void* param_value,
1371     size_t* param_value_size_ret)
1372 {
1373     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL);
1374     return kernel->dispatch->clGetKernelWorkGroupInfo(
1375         kernel,
1376         device,
1377         param_name,
1378         param_value_size,
1379         param_value,
1380         param_value_size_ret);
1381 }
1382 #endif // defined(CL_ENABLE_LAYERS)
1383 
1384 ///////////////////////////////////////////////////////////////////////////////
1385 
clWaitForEvents(cl_uint num_events,const cl_event * event_list)1386 CL_API_ENTRY cl_int CL_API_CALL clWaitForEvents(
1387     cl_uint num_events,
1388     const cl_event* event_list)
1389 {
1390 #if defined(CL_ENABLE_LAYERS)
1391     if (khrFirstLayer)
1392         return khrFirstLayer->dispatch.clWaitForEvents(
1393             num_events,
1394             event_list);
1395 #endif // defined(CL_ENABLE_LAYERS)
1396     if (num_events == 0 || event_list == NULL) {
1397         return CL_INVALID_VALUE;
1398     }
1399     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(event_list[0], CL_INVALID_EVENT);
1400     return event_list[0]->dispatch->clWaitForEvents(
1401         num_events,
1402         event_list);
1403 }
1404 
1405 ///////////////////////////////////////////////////////////////////////////////
1406 #if defined(CL_ENABLE_LAYERS)
clWaitForEvents_disp(cl_uint num_events,const cl_event * event_list)1407 static cl_int CL_API_CALL clWaitForEvents_disp(
1408     cl_uint num_events,
1409     const cl_event* event_list)
1410 {
1411     if (num_events == 0 || event_list == NULL) {
1412         return CL_INVALID_VALUE;
1413     }
1414     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(event_list[0], CL_INVALID_EVENT);
1415     return event_list[0]->dispatch->clWaitForEvents(
1416         num_events,
1417         event_list);
1418 }
1419 #endif // defined(CL_ENABLE_LAYERS)
1420 
1421 ///////////////////////////////////////////////////////////////////////////////
1422 
clGetEventInfo(cl_event event,cl_event_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret)1423 CL_API_ENTRY cl_int CL_API_CALL clGetEventInfo(
1424     cl_event event,
1425     cl_event_info param_name,
1426     size_t param_value_size,
1427     void* param_value,
1428     size_t* param_value_size_ret)
1429 {
1430 #if defined(CL_ENABLE_LAYERS)
1431     if (khrFirstLayer)
1432         return khrFirstLayer->dispatch.clGetEventInfo(
1433             event,
1434             param_name,
1435             param_value_size,
1436             param_value,
1437             param_value_size_ret);
1438 #endif // defined(CL_ENABLE_LAYERS)
1439     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(event, CL_INVALID_EVENT);
1440     return event->dispatch->clGetEventInfo(
1441         event,
1442         param_name,
1443         param_value_size,
1444         param_value,
1445         param_value_size_ret);
1446 }
1447 
1448 ///////////////////////////////////////////////////////////////////////////////
1449 #if defined(CL_ENABLE_LAYERS)
clGetEventInfo_disp(cl_event event,cl_event_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret)1450 static cl_int CL_API_CALL clGetEventInfo_disp(
1451     cl_event event,
1452     cl_event_info param_name,
1453     size_t param_value_size,
1454     void* param_value,
1455     size_t* param_value_size_ret)
1456 {
1457     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(event, CL_INVALID_EVENT);
1458     return event->dispatch->clGetEventInfo(
1459         event,
1460         param_name,
1461         param_value_size,
1462         param_value,
1463         param_value_size_ret);
1464 }
1465 #endif // defined(CL_ENABLE_LAYERS)
1466 
1467 ///////////////////////////////////////////////////////////////////////////////
1468 
clRetainEvent(cl_event event)1469 CL_API_ENTRY cl_int CL_API_CALL clRetainEvent(
1470     cl_event event)
1471 {
1472 #if defined(CL_ENABLE_LAYERS)
1473     if (khrFirstLayer)
1474         return khrFirstLayer->dispatch.clRetainEvent(
1475             event);
1476 #endif // defined(CL_ENABLE_LAYERS)
1477     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(event, CL_INVALID_EVENT);
1478     return event->dispatch->clRetainEvent(
1479         event);
1480 }
1481 
1482 ///////////////////////////////////////////////////////////////////////////////
1483 #if defined(CL_ENABLE_LAYERS)
clRetainEvent_disp(cl_event event)1484 static cl_int CL_API_CALL clRetainEvent_disp(
1485     cl_event event)
1486 {
1487     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(event, CL_INVALID_EVENT);
1488     return event->dispatch->clRetainEvent(
1489         event);
1490 }
1491 #endif // defined(CL_ENABLE_LAYERS)
1492 
1493 ///////////////////////////////////////////////////////////////////////////////
1494 
clReleaseEvent(cl_event event)1495 CL_API_ENTRY cl_int CL_API_CALL clReleaseEvent(
1496     cl_event event)
1497 {
1498 #if defined(CL_ENABLE_LAYERS)
1499     if (khrFirstLayer)
1500         return khrFirstLayer->dispatch.clReleaseEvent(
1501             event);
1502 #endif // defined(CL_ENABLE_LAYERS)
1503     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(event, CL_INVALID_EVENT);
1504     return event->dispatch->clReleaseEvent(
1505         event);
1506 }
1507 
1508 ///////////////////////////////////////////////////////////////////////////////
1509 #if defined(CL_ENABLE_LAYERS)
clReleaseEvent_disp(cl_event event)1510 static cl_int CL_API_CALL clReleaseEvent_disp(
1511     cl_event event)
1512 {
1513     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(event, CL_INVALID_EVENT);
1514     return event->dispatch->clReleaseEvent(
1515         event);
1516 }
1517 #endif // defined(CL_ENABLE_LAYERS)
1518 
1519 ///////////////////////////////////////////////////////////////////////////////
1520 
clGetEventProfilingInfo(cl_event event,cl_profiling_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret)1521 CL_API_ENTRY cl_int CL_API_CALL clGetEventProfilingInfo(
1522     cl_event event,
1523     cl_profiling_info param_name,
1524     size_t param_value_size,
1525     void* param_value,
1526     size_t* param_value_size_ret)
1527 {
1528 #if defined(CL_ENABLE_LAYERS)
1529     if (khrFirstLayer)
1530         return khrFirstLayer->dispatch.clGetEventProfilingInfo(
1531             event,
1532             param_name,
1533             param_value_size,
1534             param_value,
1535             param_value_size_ret);
1536 #endif // defined(CL_ENABLE_LAYERS)
1537     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(event, CL_INVALID_EVENT);
1538     return event->dispatch->clGetEventProfilingInfo(
1539         event,
1540         param_name,
1541         param_value_size,
1542         param_value,
1543         param_value_size_ret);
1544 }
1545 
1546 ///////////////////////////////////////////////////////////////////////////////
1547 #if defined(CL_ENABLE_LAYERS)
clGetEventProfilingInfo_disp(cl_event event,cl_profiling_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret)1548 static cl_int CL_API_CALL clGetEventProfilingInfo_disp(
1549     cl_event event,
1550     cl_profiling_info param_name,
1551     size_t param_value_size,
1552     void* param_value,
1553     size_t* param_value_size_ret)
1554 {
1555     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(event, CL_INVALID_EVENT);
1556     return event->dispatch->clGetEventProfilingInfo(
1557         event,
1558         param_name,
1559         param_value_size,
1560         param_value,
1561         param_value_size_ret);
1562 }
1563 #endif // defined(CL_ENABLE_LAYERS)
1564 
1565 ///////////////////////////////////////////////////////////////////////////////
1566 
clFlush(cl_command_queue command_queue)1567 CL_API_ENTRY cl_int CL_API_CALL clFlush(
1568     cl_command_queue command_queue)
1569 {
1570 #if defined(CL_ENABLE_LAYERS)
1571     if (khrFirstLayer)
1572         return khrFirstLayer->dispatch.clFlush(
1573             command_queue);
1574 #endif // defined(CL_ENABLE_LAYERS)
1575     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
1576     return command_queue->dispatch->clFlush(
1577         command_queue);
1578 }
1579 
1580 ///////////////////////////////////////////////////////////////////////////////
1581 #if defined(CL_ENABLE_LAYERS)
clFlush_disp(cl_command_queue command_queue)1582 static cl_int CL_API_CALL clFlush_disp(
1583     cl_command_queue command_queue)
1584 {
1585     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
1586     return command_queue->dispatch->clFlush(
1587         command_queue);
1588 }
1589 #endif // defined(CL_ENABLE_LAYERS)
1590 
1591 ///////////////////////////////////////////////////////////////////////////////
1592 
clFinish(cl_command_queue command_queue)1593 CL_API_ENTRY cl_int CL_API_CALL clFinish(
1594     cl_command_queue command_queue)
1595 {
1596 #if defined(CL_ENABLE_LAYERS)
1597     if (khrFirstLayer)
1598         return khrFirstLayer->dispatch.clFinish(
1599             command_queue);
1600 #endif // defined(CL_ENABLE_LAYERS)
1601     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
1602     return command_queue->dispatch->clFinish(
1603         command_queue);
1604 }
1605 
1606 ///////////////////////////////////////////////////////////////////////////////
1607 #if defined(CL_ENABLE_LAYERS)
clFinish_disp(cl_command_queue command_queue)1608 static cl_int CL_API_CALL clFinish_disp(
1609     cl_command_queue command_queue)
1610 {
1611     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
1612     return command_queue->dispatch->clFinish(
1613         command_queue);
1614 }
1615 #endif // defined(CL_ENABLE_LAYERS)
1616 
1617 ///////////////////////////////////////////////////////////////////////////////
1618 
clEnqueueReadBuffer(cl_command_queue command_queue,cl_mem buffer,cl_bool blocking_read,size_t offset,size_t size,void * ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)1619 CL_API_ENTRY cl_int CL_API_CALL clEnqueueReadBuffer(
1620     cl_command_queue command_queue,
1621     cl_mem buffer,
1622     cl_bool blocking_read,
1623     size_t offset,
1624     size_t size,
1625     void* ptr,
1626     cl_uint num_events_in_wait_list,
1627     const cl_event* event_wait_list,
1628     cl_event* event)
1629 {
1630 #if defined(CL_ENABLE_LAYERS)
1631     if (khrFirstLayer)
1632         return khrFirstLayer->dispatch.clEnqueueReadBuffer(
1633             command_queue,
1634             buffer,
1635             blocking_read,
1636             offset,
1637             size,
1638             ptr,
1639             num_events_in_wait_list,
1640             event_wait_list,
1641             event);
1642 #endif // defined(CL_ENABLE_LAYERS)
1643     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
1644     return command_queue->dispatch->clEnqueueReadBuffer(
1645         command_queue,
1646         buffer,
1647         blocking_read,
1648         offset,
1649         size,
1650         ptr,
1651         num_events_in_wait_list,
1652         event_wait_list,
1653         event);
1654 }
1655 
1656 ///////////////////////////////////////////////////////////////////////////////
1657 #if defined(CL_ENABLE_LAYERS)
clEnqueueReadBuffer_disp(cl_command_queue command_queue,cl_mem buffer,cl_bool blocking_read,size_t offset,size_t size,void * ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)1658 static cl_int CL_API_CALL clEnqueueReadBuffer_disp(
1659     cl_command_queue command_queue,
1660     cl_mem buffer,
1661     cl_bool blocking_read,
1662     size_t offset,
1663     size_t size,
1664     void* ptr,
1665     cl_uint num_events_in_wait_list,
1666     const cl_event* event_wait_list,
1667     cl_event* event)
1668 {
1669     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
1670     return command_queue->dispatch->clEnqueueReadBuffer(
1671         command_queue,
1672         buffer,
1673         blocking_read,
1674         offset,
1675         size,
1676         ptr,
1677         num_events_in_wait_list,
1678         event_wait_list,
1679         event);
1680 }
1681 #endif // defined(CL_ENABLE_LAYERS)
1682 
1683 ///////////////////////////////////////////////////////////////////////////////
1684 
clEnqueueWriteBuffer(cl_command_queue command_queue,cl_mem buffer,cl_bool blocking_write,size_t offset,size_t size,const void * ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)1685 CL_API_ENTRY cl_int CL_API_CALL clEnqueueWriteBuffer(
1686     cl_command_queue command_queue,
1687     cl_mem buffer,
1688     cl_bool blocking_write,
1689     size_t offset,
1690     size_t size,
1691     const void* ptr,
1692     cl_uint num_events_in_wait_list,
1693     const cl_event* event_wait_list,
1694     cl_event* event)
1695 {
1696 #if defined(CL_ENABLE_LAYERS)
1697     if (khrFirstLayer)
1698         return khrFirstLayer->dispatch.clEnqueueWriteBuffer(
1699             command_queue,
1700             buffer,
1701             blocking_write,
1702             offset,
1703             size,
1704             ptr,
1705             num_events_in_wait_list,
1706             event_wait_list,
1707             event);
1708 #endif // defined(CL_ENABLE_LAYERS)
1709     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
1710     return command_queue->dispatch->clEnqueueWriteBuffer(
1711         command_queue,
1712         buffer,
1713         blocking_write,
1714         offset,
1715         size,
1716         ptr,
1717         num_events_in_wait_list,
1718         event_wait_list,
1719         event);
1720 }
1721 
1722 ///////////////////////////////////////////////////////////////////////////////
1723 #if defined(CL_ENABLE_LAYERS)
clEnqueueWriteBuffer_disp(cl_command_queue command_queue,cl_mem buffer,cl_bool blocking_write,size_t offset,size_t size,const void * ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)1724 static cl_int CL_API_CALL clEnqueueWriteBuffer_disp(
1725     cl_command_queue command_queue,
1726     cl_mem buffer,
1727     cl_bool blocking_write,
1728     size_t offset,
1729     size_t size,
1730     const void* ptr,
1731     cl_uint num_events_in_wait_list,
1732     const cl_event* event_wait_list,
1733     cl_event* event)
1734 {
1735     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
1736     return command_queue->dispatch->clEnqueueWriteBuffer(
1737         command_queue,
1738         buffer,
1739         blocking_write,
1740         offset,
1741         size,
1742         ptr,
1743         num_events_in_wait_list,
1744         event_wait_list,
1745         event);
1746 }
1747 #endif // defined(CL_ENABLE_LAYERS)
1748 
1749 ///////////////////////////////////////////////////////////////////////////////
1750 
clEnqueueCopyBuffer(cl_command_queue command_queue,cl_mem src_buffer,cl_mem dst_buffer,size_t src_offset,size_t dst_offset,size_t size,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)1751 CL_API_ENTRY cl_int CL_API_CALL clEnqueueCopyBuffer(
1752     cl_command_queue command_queue,
1753     cl_mem src_buffer,
1754     cl_mem dst_buffer,
1755     size_t src_offset,
1756     size_t dst_offset,
1757     size_t size,
1758     cl_uint num_events_in_wait_list,
1759     const cl_event* event_wait_list,
1760     cl_event* event)
1761 {
1762 #if defined(CL_ENABLE_LAYERS)
1763     if (khrFirstLayer)
1764         return khrFirstLayer->dispatch.clEnqueueCopyBuffer(
1765             command_queue,
1766             src_buffer,
1767             dst_buffer,
1768             src_offset,
1769             dst_offset,
1770             size,
1771             num_events_in_wait_list,
1772             event_wait_list,
1773             event);
1774 #endif // defined(CL_ENABLE_LAYERS)
1775     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
1776     return command_queue->dispatch->clEnqueueCopyBuffer(
1777         command_queue,
1778         src_buffer,
1779         dst_buffer,
1780         src_offset,
1781         dst_offset,
1782         size,
1783         num_events_in_wait_list,
1784         event_wait_list,
1785         event);
1786 }
1787 
1788 ///////////////////////////////////////////////////////////////////////////////
1789 #if defined(CL_ENABLE_LAYERS)
clEnqueueCopyBuffer_disp(cl_command_queue command_queue,cl_mem src_buffer,cl_mem dst_buffer,size_t src_offset,size_t dst_offset,size_t size,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)1790 static cl_int CL_API_CALL clEnqueueCopyBuffer_disp(
1791     cl_command_queue command_queue,
1792     cl_mem src_buffer,
1793     cl_mem dst_buffer,
1794     size_t src_offset,
1795     size_t dst_offset,
1796     size_t size,
1797     cl_uint num_events_in_wait_list,
1798     const cl_event* event_wait_list,
1799     cl_event* event)
1800 {
1801     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
1802     return command_queue->dispatch->clEnqueueCopyBuffer(
1803         command_queue,
1804         src_buffer,
1805         dst_buffer,
1806         src_offset,
1807         dst_offset,
1808         size,
1809         num_events_in_wait_list,
1810         event_wait_list,
1811         event);
1812 }
1813 #endif // defined(CL_ENABLE_LAYERS)
1814 
1815 ///////////////////////////////////////////////////////////////////////////////
1816 
clEnqueueReadImage(cl_command_queue command_queue,cl_mem image,cl_bool blocking_read,const size_t * origin,const size_t * region,size_t row_pitch,size_t slice_pitch,void * ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)1817 CL_API_ENTRY cl_int CL_API_CALL clEnqueueReadImage(
1818     cl_command_queue command_queue,
1819     cl_mem image,
1820     cl_bool blocking_read,
1821     const size_t* origin,
1822     const size_t* region,
1823     size_t row_pitch,
1824     size_t slice_pitch,
1825     void* ptr,
1826     cl_uint num_events_in_wait_list,
1827     const cl_event* event_wait_list,
1828     cl_event* event)
1829 {
1830 #if defined(CL_ENABLE_LAYERS)
1831     if (khrFirstLayer)
1832         return khrFirstLayer->dispatch.clEnqueueReadImage(
1833             command_queue,
1834             image,
1835             blocking_read,
1836             origin,
1837             region,
1838             row_pitch,
1839             slice_pitch,
1840             ptr,
1841             num_events_in_wait_list,
1842             event_wait_list,
1843             event);
1844 #endif // defined(CL_ENABLE_LAYERS)
1845     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
1846     return command_queue->dispatch->clEnqueueReadImage(
1847         command_queue,
1848         image,
1849         blocking_read,
1850         origin,
1851         region,
1852         row_pitch,
1853         slice_pitch,
1854         ptr,
1855         num_events_in_wait_list,
1856         event_wait_list,
1857         event);
1858 }
1859 
1860 ///////////////////////////////////////////////////////////////////////////////
1861 #if defined(CL_ENABLE_LAYERS)
clEnqueueReadImage_disp(cl_command_queue command_queue,cl_mem image,cl_bool blocking_read,const size_t * origin,const size_t * region,size_t row_pitch,size_t slice_pitch,void * ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)1862 static cl_int CL_API_CALL clEnqueueReadImage_disp(
1863     cl_command_queue command_queue,
1864     cl_mem image,
1865     cl_bool blocking_read,
1866     const size_t* origin,
1867     const size_t* region,
1868     size_t row_pitch,
1869     size_t slice_pitch,
1870     void* ptr,
1871     cl_uint num_events_in_wait_list,
1872     const cl_event* event_wait_list,
1873     cl_event* event)
1874 {
1875     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
1876     return command_queue->dispatch->clEnqueueReadImage(
1877         command_queue,
1878         image,
1879         blocking_read,
1880         origin,
1881         region,
1882         row_pitch,
1883         slice_pitch,
1884         ptr,
1885         num_events_in_wait_list,
1886         event_wait_list,
1887         event);
1888 }
1889 #endif // defined(CL_ENABLE_LAYERS)
1890 
1891 ///////////////////////////////////////////////////////////////////////////////
1892 
clEnqueueWriteImage(cl_command_queue command_queue,cl_mem image,cl_bool blocking_write,const size_t * origin,const size_t * region,size_t input_row_pitch,size_t input_slice_pitch,const void * ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)1893 CL_API_ENTRY cl_int CL_API_CALL clEnqueueWriteImage(
1894     cl_command_queue command_queue,
1895     cl_mem image,
1896     cl_bool blocking_write,
1897     const size_t* origin,
1898     const size_t* region,
1899     size_t input_row_pitch,
1900     size_t input_slice_pitch,
1901     const void* ptr,
1902     cl_uint num_events_in_wait_list,
1903     const cl_event* event_wait_list,
1904     cl_event* event)
1905 {
1906 #if defined(CL_ENABLE_LAYERS)
1907     if (khrFirstLayer)
1908         return khrFirstLayer->dispatch.clEnqueueWriteImage(
1909             command_queue,
1910             image,
1911             blocking_write,
1912             origin,
1913             region,
1914             input_row_pitch,
1915             input_slice_pitch,
1916             ptr,
1917             num_events_in_wait_list,
1918             event_wait_list,
1919             event);
1920 #endif // defined(CL_ENABLE_LAYERS)
1921     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
1922     return command_queue->dispatch->clEnqueueWriteImage(
1923         command_queue,
1924         image,
1925         blocking_write,
1926         origin,
1927         region,
1928         input_row_pitch,
1929         input_slice_pitch,
1930         ptr,
1931         num_events_in_wait_list,
1932         event_wait_list,
1933         event);
1934 }
1935 
1936 ///////////////////////////////////////////////////////////////////////////////
1937 #if defined(CL_ENABLE_LAYERS)
clEnqueueWriteImage_disp(cl_command_queue command_queue,cl_mem image,cl_bool blocking_write,const size_t * origin,const size_t * region,size_t input_row_pitch,size_t input_slice_pitch,const void * ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)1938 static cl_int CL_API_CALL clEnqueueWriteImage_disp(
1939     cl_command_queue command_queue,
1940     cl_mem image,
1941     cl_bool blocking_write,
1942     const size_t* origin,
1943     const size_t* region,
1944     size_t input_row_pitch,
1945     size_t input_slice_pitch,
1946     const void* ptr,
1947     cl_uint num_events_in_wait_list,
1948     const cl_event* event_wait_list,
1949     cl_event* event)
1950 {
1951     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
1952     return command_queue->dispatch->clEnqueueWriteImage(
1953         command_queue,
1954         image,
1955         blocking_write,
1956         origin,
1957         region,
1958         input_row_pitch,
1959         input_slice_pitch,
1960         ptr,
1961         num_events_in_wait_list,
1962         event_wait_list,
1963         event);
1964 }
1965 #endif // defined(CL_ENABLE_LAYERS)
1966 
1967 ///////////////////////////////////////////////////////////////////////////////
1968 
clEnqueueCopyImage(cl_command_queue command_queue,cl_mem src_image,cl_mem dst_image,const size_t * src_origin,const size_t * dst_origin,const size_t * region,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)1969 CL_API_ENTRY cl_int CL_API_CALL clEnqueueCopyImage(
1970     cl_command_queue command_queue,
1971     cl_mem src_image,
1972     cl_mem dst_image,
1973     const size_t* src_origin,
1974     const size_t* dst_origin,
1975     const size_t* region,
1976     cl_uint num_events_in_wait_list,
1977     const cl_event* event_wait_list,
1978     cl_event* event)
1979 {
1980 #if defined(CL_ENABLE_LAYERS)
1981     if (khrFirstLayer)
1982         return khrFirstLayer->dispatch.clEnqueueCopyImage(
1983             command_queue,
1984             src_image,
1985             dst_image,
1986             src_origin,
1987             dst_origin,
1988             region,
1989             num_events_in_wait_list,
1990             event_wait_list,
1991             event);
1992 #endif // defined(CL_ENABLE_LAYERS)
1993     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
1994     return command_queue->dispatch->clEnqueueCopyImage(
1995         command_queue,
1996         src_image,
1997         dst_image,
1998         src_origin,
1999         dst_origin,
2000         region,
2001         num_events_in_wait_list,
2002         event_wait_list,
2003         event);
2004 }
2005 
2006 ///////////////////////////////////////////////////////////////////////////////
2007 #if defined(CL_ENABLE_LAYERS)
clEnqueueCopyImage_disp(cl_command_queue command_queue,cl_mem src_image,cl_mem dst_image,const size_t * src_origin,const size_t * dst_origin,const size_t * region,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)2008 static cl_int CL_API_CALL clEnqueueCopyImage_disp(
2009     cl_command_queue command_queue,
2010     cl_mem src_image,
2011     cl_mem dst_image,
2012     const size_t* src_origin,
2013     const size_t* dst_origin,
2014     const size_t* region,
2015     cl_uint num_events_in_wait_list,
2016     const cl_event* event_wait_list,
2017     cl_event* event)
2018 {
2019     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
2020     return command_queue->dispatch->clEnqueueCopyImage(
2021         command_queue,
2022         src_image,
2023         dst_image,
2024         src_origin,
2025         dst_origin,
2026         region,
2027         num_events_in_wait_list,
2028         event_wait_list,
2029         event);
2030 }
2031 #endif // defined(CL_ENABLE_LAYERS)
2032 
2033 ///////////////////////////////////////////////////////////////////////////////
2034 
clEnqueueCopyImageToBuffer(cl_command_queue command_queue,cl_mem src_image,cl_mem dst_buffer,const size_t * src_origin,const size_t * region,size_t dst_offset,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)2035 CL_API_ENTRY cl_int CL_API_CALL clEnqueueCopyImageToBuffer(
2036     cl_command_queue command_queue,
2037     cl_mem src_image,
2038     cl_mem dst_buffer,
2039     const size_t* src_origin,
2040     const size_t* region,
2041     size_t dst_offset,
2042     cl_uint num_events_in_wait_list,
2043     const cl_event* event_wait_list,
2044     cl_event* event)
2045 {
2046 #if defined(CL_ENABLE_LAYERS)
2047     if (khrFirstLayer)
2048         return khrFirstLayer->dispatch.clEnqueueCopyImageToBuffer(
2049             command_queue,
2050             src_image,
2051             dst_buffer,
2052             src_origin,
2053             region,
2054             dst_offset,
2055             num_events_in_wait_list,
2056             event_wait_list,
2057             event);
2058 #endif // defined(CL_ENABLE_LAYERS)
2059     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
2060     return command_queue->dispatch->clEnqueueCopyImageToBuffer(
2061         command_queue,
2062         src_image,
2063         dst_buffer,
2064         src_origin,
2065         region,
2066         dst_offset,
2067         num_events_in_wait_list,
2068         event_wait_list,
2069         event);
2070 }
2071 
2072 ///////////////////////////////////////////////////////////////////////////////
2073 #if defined(CL_ENABLE_LAYERS)
clEnqueueCopyImageToBuffer_disp(cl_command_queue command_queue,cl_mem src_image,cl_mem dst_buffer,const size_t * src_origin,const size_t * region,size_t dst_offset,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)2074 static cl_int CL_API_CALL clEnqueueCopyImageToBuffer_disp(
2075     cl_command_queue command_queue,
2076     cl_mem src_image,
2077     cl_mem dst_buffer,
2078     const size_t* src_origin,
2079     const size_t* region,
2080     size_t dst_offset,
2081     cl_uint num_events_in_wait_list,
2082     const cl_event* event_wait_list,
2083     cl_event* event)
2084 {
2085     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
2086     return command_queue->dispatch->clEnqueueCopyImageToBuffer(
2087         command_queue,
2088         src_image,
2089         dst_buffer,
2090         src_origin,
2091         region,
2092         dst_offset,
2093         num_events_in_wait_list,
2094         event_wait_list,
2095         event);
2096 }
2097 #endif // defined(CL_ENABLE_LAYERS)
2098 
2099 ///////////////////////////////////////////////////////////////////////////////
2100 
clEnqueueCopyBufferToImage(cl_command_queue command_queue,cl_mem src_buffer,cl_mem dst_image,size_t src_offset,const size_t * dst_origin,const size_t * region,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)2101 CL_API_ENTRY cl_int CL_API_CALL clEnqueueCopyBufferToImage(
2102     cl_command_queue command_queue,
2103     cl_mem src_buffer,
2104     cl_mem dst_image,
2105     size_t src_offset,
2106     const size_t* dst_origin,
2107     const size_t* region,
2108     cl_uint num_events_in_wait_list,
2109     const cl_event* event_wait_list,
2110     cl_event* event)
2111 {
2112 #if defined(CL_ENABLE_LAYERS)
2113     if (khrFirstLayer)
2114         return khrFirstLayer->dispatch.clEnqueueCopyBufferToImage(
2115             command_queue,
2116             src_buffer,
2117             dst_image,
2118             src_offset,
2119             dst_origin,
2120             region,
2121             num_events_in_wait_list,
2122             event_wait_list,
2123             event);
2124 #endif // defined(CL_ENABLE_LAYERS)
2125     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
2126     return command_queue->dispatch->clEnqueueCopyBufferToImage(
2127         command_queue,
2128         src_buffer,
2129         dst_image,
2130         src_offset,
2131         dst_origin,
2132         region,
2133         num_events_in_wait_list,
2134         event_wait_list,
2135         event);
2136 }
2137 
2138 ///////////////////////////////////////////////////////////////////////////////
2139 #if defined(CL_ENABLE_LAYERS)
clEnqueueCopyBufferToImage_disp(cl_command_queue command_queue,cl_mem src_buffer,cl_mem dst_image,size_t src_offset,const size_t * dst_origin,const size_t * region,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)2140 static cl_int CL_API_CALL clEnqueueCopyBufferToImage_disp(
2141     cl_command_queue command_queue,
2142     cl_mem src_buffer,
2143     cl_mem dst_image,
2144     size_t src_offset,
2145     const size_t* dst_origin,
2146     const size_t* region,
2147     cl_uint num_events_in_wait_list,
2148     const cl_event* event_wait_list,
2149     cl_event* event)
2150 {
2151     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
2152     return command_queue->dispatch->clEnqueueCopyBufferToImage(
2153         command_queue,
2154         src_buffer,
2155         dst_image,
2156         src_offset,
2157         dst_origin,
2158         region,
2159         num_events_in_wait_list,
2160         event_wait_list,
2161         event);
2162 }
2163 #endif // defined(CL_ENABLE_LAYERS)
2164 
2165 ///////////////////////////////////////////////////////////////////////////////
2166 
clEnqueueMapBuffer(cl_command_queue command_queue,cl_mem buffer,cl_bool blocking_map,cl_map_flags map_flags,size_t offset,size_t size,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int * errcode_ret)2167 CL_API_ENTRY void* CL_API_CALL clEnqueueMapBuffer(
2168     cl_command_queue command_queue,
2169     cl_mem buffer,
2170     cl_bool blocking_map,
2171     cl_map_flags map_flags,
2172     size_t offset,
2173     size_t size,
2174     cl_uint num_events_in_wait_list,
2175     const cl_event* event_wait_list,
2176     cl_event* event,
2177     cl_int* errcode_ret)
2178 {
2179 #if defined(CL_ENABLE_LAYERS)
2180     if (khrFirstLayer)
2181         return khrFirstLayer->dispatch.clEnqueueMapBuffer(
2182             command_queue,
2183             buffer,
2184             blocking_map,
2185             map_flags,
2186             offset,
2187             size,
2188             num_events_in_wait_list,
2189             event_wait_list,
2190             event,
2191             errcode_ret);
2192 #endif // defined(CL_ENABLE_LAYERS)
2193     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(command_queue, CL_INVALID_COMMAND_QUEUE);
2194     return command_queue->dispatch->clEnqueueMapBuffer(
2195         command_queue,
2196         buffer,
2197         blocking_map,
2198         map_flags,
2199         offset,
2200         size,
2201         num_events_in_wait_list,
2202         event_wait_list,
2203         event,
2204         errcode_ret);
2205 }
2206 
2207 ///////////////////////////////////////////////////////////////////////////////
2208 #if defined(CL_ENABLE_LAYERS)
clEnqueueMapBuffer_disp(cl_command_queue command_queue,cl_mem buffer,cl_bool blocking_map,cl_map_flags map_flags,size_t offset,size_t size,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int * errcode_ret)2209 static void* CL_API_CALL clEnqueueMapBuffer_disp(
2210     cl_command_queue command_queue,
2211     cl_mem buffer,
2212     cl_bool blocking_map,
2213     cl_map_flags map_flags,
2214     size_t offset,
2215     size_t size,
2216     cl_uint num_events_in_wait_list,
2217     const cl_event* event_wait_list,
2218     cl_event* event,
2219     cl_int* errcode_ret)
2220 {
2221     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(command_queue, CL_INVALID_COMMAND_QUEUE);
2222     return command_queue->dispatch->clEnqueueMapBuffer(
2223         command_queue,
2224         buffer,
2225         blocking_map,
2226         map_flags,
2227         offset,
2228         size,
2229         num_events_in_wait_list,
2230         event_wait_list,
2231         event,
2232         errcode_ret);
2233 }
2234 #endif // defined(CL_ENABLE_LAYERS)
2235 
2236 ///////////////////////////////////////////////////////////////////////////////
2237 
clEnqueueMapImage(cl_command_queue command_queue,cl_mem image,cl_bool blocking_map,cl_map_flags map_flags,const size_t * origin,const size_t * region,size_t * image_row_pitch,size_t * image_slice_pitch,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int * errcode_ret)2238 CL_API_ENTRY void* CL_API_CALL clEnqueueMapImage(
2239     cl_command_queue command_queue,
2240     cl_mem image,
2241     cl_bool blocking_map,
2242     cl_map_flags map_flags,
2243     const size_t* origin,
2244     const size_t* region,
2245     size_t* image_row_pitch,
2246     size_t* image_slice_pitch,
2247     cl_uint num_events_in_wait_list,
2248     const cl_event* event_wait_list,
2249     cl_event* event,
2250     cl_int* errcode_ret)
2251 {
2252 #if defined(CL_ENABLE_LAYERS)
2253     if (khrFirstLayer)
2254         return khrFirstLayer->dispatch.clEnqueueMapImage(
2255             command_queue,
2256             image,
2257             blocking_map,
2258             map_flags,
2259             origin,
2260             region,
2261             image_row_pitch,
2262             image_slice_pitch,
2263             num_events_in_wait_list,
2264             event_wait_list,
2265             event,
2266             errcode_ret);
2267 #endif // defined(CL_ENABLE_LAYERS)
2268     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(command_queue, CL_INVALID_COMMAND_QUEUE);
2269     return command_queue->dispatch->clEnqueueMapImage(
2270         command_queue,
2271         image,
2272         blocking_map,
2273         map_flags,
2274         origin,
2275         region,
2276         image_row_pitch,
2277         image_slice_pitch,
2278         num_events_in_wait_list,
2279         event_wait_list,
2280         event,
2281         errcode_ret);
2282 }
2283 
2284 ///////////////////////////////////////////////////////////////////////////////
2285 #if defined(CL_ENABLE_LAYERS)
clEnqueueMapImage_disp(cl_command_queue command_queue,cl_mem image,cl_bool blocking_map,cl_map_flags map_flags,const size_t * origin,const size_t * region,size_t * image_row_pitch,size_t * image_slice_pitch,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int * errcode_ret)2286 static void* CL_API_CALL clEnqueueMapImage_disp(
2287     cl_command_queue command_queue,
2288     cl_mem image,
2289     cl_bool blocking_map,
2290     cl_map_flags map_flags,
2291     const size_t* origin,
2292     const size_t* region,
2293     size_t* image_row_pitch,
2294     size_t* image_slice_pitch,
2295     cl_uint num_events_in_wait_list,
2296     const cl_event* event_wait_list,
2297     cl_event* event,
2298     cl_int* errcode_ret)
2299 {
2300     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(command_queue, CL_INVALID_COMMAND_QUEUE);
2301     return command_queue->dispatch->clEnqueueMapImage(
2302         command_queue,
2303         image,
2304         blocking_map,
2305         map_flags,
2306         origin,
2307         region,
2308         image_row_pitch,
2309         image_slice_pitch,
2310         num_events_in_wait_list,
2311         event_wait_list,
2312         event,
2313         errcode_ret);
2314 }
2315 #endif // defined(CL_ENABLE_LAYERS)
2316 
2317 ///////////////////////////////////////////////////////////////////////////////
2318 
clEnqueueUnmapMemObject(cl_command_queue command_queue,cl_mem memobj,void * mapped_ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)2319 CL_API_ENTRY cl_int CL_API_CALL clEnqueueUnmapMemObject(
2320     cl_command_queue command_queue,
2321     cl_mem memobj,
2322     void* mapped_ptr,
2323     cl_uint num_events_in_wait_list,
2324     const cl_event* event_wait_list,
2325     cl_event* event)
2326 {
2327 #if defined(CL_ENABLE_LAYERS)
2328     if (khrFirstLayer)
2329         return khrFirstLayer->dispatch.clEnqueueUnmapMemObject(
2330             command_queue,
2331             memobj,
2332             mapped_ptr,
2333             num_events_in_wait_list,
2334             event_wait_list,
2335             event);
2336 #endif // defined(CL_ENABLE_LAYERS)
2337     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
2338     return command_queue->dispatch->clEnqueueUnmapMemObject(
2339         command_queue,
2340         memobj,
2341         mapped_ptr,
2342         num_events_in_wait_list,
2343         event_wait_list,
2344         event);
2345 }
2346 
2347 ///////////////////////////////////////////////////////////////////////////////
2348 #if defined(CL_ENABLE_LAYERS)
clEnqueueUnmapMemObject_disp(cl_command_queue command_queue,cl_mem memobj,void * mapped_ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)2349 static cl_int CL_API_CALL clEnqueueUnmapMemObject_disp(
2350     cl_command_queue command_queue,
2351     cl_mem memobj,
2352     void* mapped_ptr,
2353     cl_uint num_events_in_wait_list,
2354     const cl_event* event_wait_list,
2355     cl_event* event)
2356 {
2357     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
2358     return command_queue->dispatch->clEnqueueUnmapMemObject(
2359         command_queue,
2360         memobj,
2361         mapped_ptr,
2362         num_events_in_wait_list,
2363         event_wait_list,
2364         event);
2365 }
2366 #endif // defined(CL_ENABLE_LAYERS)
2367 
2368 ///////////////////////////////////////////////////////////////////////////////
2369 
clEnqueueNDRangeKernel(cl_command_queue command_queue,cl_kernel kernel,cl_uint work_dim,const size_t * global_work_offset,const size_t * global_work_size,const size_t * local_work_size,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)2370 CL_API_ENTRY cl_int CL_API_CALL clEnqueueNDRangeKernel(
2371     cl_command_queue command_queue,
2372     cl_kernel kernel,
2373     cl_uint work_dim,
2374     const size_t* global_work_offset,
2375     const size_t* global_work_size,
2376     const size_t* local_work_size,
2377     cl_uint num_events_in_wait_list,
2378     const cl_event* event_wait_list,
2379     cl_event* event)
2380 {
2381 #if defined(CL_ENABLE_LAYERS)
2382     if (khrFirstLayer)
2383         return khrFirstLayer->dispatch.clEnqueueNDRangeKernel(
2384             command_queue,
2385             kernel,
2386             work_dim,
2387             global_work_offset,
2388             global_work_size,
2389             local_work_size,
2390             num_events_in_wait_list,
2391             event_wait_list,
2392             event);
2393 #endif // defined(CL_ENABLE_LAYERS)
2394     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
2395     return command_queue->dispatch->clEnqueueNDRangeKernel(
2396         command_queue,
2397         kernel,
2398         work_dim,
2399         global_work_offset,
2400         global_work_size,
2401         local_work_size,
2402         num_events_in_wait_list,
2403         event_wait_list,
2404         event);
2405 }
2406 
2407 ///////////////////////////////////////////////////////////////////////////////
2408 #if defined(CL_ENABLE_LAYERS)
clEnqueueNDRangeKernel_disp(cl_command_queue command_queue,cl_kernel kernel,cl_uint work_dim,const size_t * global_work_offset,const size_t * global_work_size,const size_t * local_work_size,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)2409 static cl_int CL_API_CALL clEnqueueNDRangeKernel_disp(
2410     cl_command_queue command_queue,
2411     cl_kernel kernel,
2412     cl_uint work_dim,
2413     const size_t* global_work_offset,
2414     const size_t* global_work_size,
2415     const size_t* local_work_size,
2416     cl_uint num_events_in_wait_list,
2417     const cl_event* event_wait_list,
2418     cl_event* event)
2419 {
2420     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
2421     return command_queue->dispatch->clEnqueueNDRangeKernel(
2422         command_queue,
2423         kernel,
2424         work_dim,
2425         global_work_offset,
2426         global_work_size,
2427         local_work_size,
2428         num_events_in_wait_list,
2429         event_wait_list,
2430         event);
2431 }
2432 #endif // defined(CL_ENABLE_LAYERS)
2433 
2434 ///////////////////////////////////////////////////////////////////////////////
2435 
clEnqueueNativeKernel(cl_command_queue command_queue,void (CL_CALLBACK * user_func)(void *),void * args,size_t cb_args,cl_uint num_mem_objects,const cl_mem * mem_list,const void ** args_mem_loc,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)2436 CL_API_ENTRY cl_int CL_API_CALL clEnqueueNativeKernel(
2437     cl_command_queue command_queue,
2438     void (CL_CALLBACK* user_func)(void*),
2439     void* args,
2440     size_t cb_args,
2441     cl_uint num_mem_objects,
2442     const cl_mem* mem_list,
2443     const void** args_mem_loc,
2444     cl_uint num_events_in_wait_list,
2445     const cl_event* event_wait_list,
2446     cl_event* event)
2447 {
2448 #if defined(CL_ENABLE_LAYERS)
2449     if (khrFirstLayer)
2450         return khrFirstLayer->dispatch.clEnqueueNativeKernel(
2451             command_queue,
2452             user_func,
2453             args,
2454             cb_args,
2455             num_mem_objects,
2456             mem_list,
2457             args_mem_loc,
2458             num_events_in_wait_list,
2459             event_wait_list,
2460             event);
2461 #endif // defined(CL_ENABLE_LAYERS)
2462     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
2463     return command_queue->dispatch->clEnqueueNativeKernel(
2464         command_queue,
2465         user_func,
2466         args,
2467         cb_args,
2468         num_mem_objects,
2469         mem_list,
2470         args_mem_loc,
2471         num_events_in_wait_list,
2472         event_wait_list,
2473         event);
2474 }
2475 
2476 ///////////////////////////////////////////////////////////////////////////////
2477 #if defined(CL_ENABLE_LAYERS)
clEnqueueNativeKernel_disp(cl_command_queue command_queue,void (CL_CALLBACK * user_func)(void *),void * args,size_t cb_args,cl_uint num_mem_objects,const cl_mem * mem_list,const void ** args_mem_loc,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)2478 static cl_int CL_API_CALL clEnqueueNativeKernel_disp(
2479     cl_command_queue command_queue,
2480     void (CL_CALLBACK* user_func)(void*),
2481     void* args,
2482     size_t cb_args,
2483     cl_uint num_mem_objects,
2484     const cl_mem* mem_list,
2485     const void** args_mem_loc,
2486     cl_uint num_events_in_wait_list,
2487     const cl_event* event_wait_list,
2488     cl_event* event)
2489 {
2490     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
2491     return command_queue->dispatch->clEnqueueNativeKernel(
2492         command_queue,
2493         user_func,
2494         args,
2495         cb_args,
2496         num_mem_objects,
2497         mem_list,
2498         args_mem_loc,
2499         num_events_in_wait_list,
2500         event_wait_list,
2501         event);
2502 }
2503 #endif // defined(CL_ENABLE_LAYERS)
2504 
2505 ///////////////////////////////////////////////////////////////////////////////
2506 
clSetCommandQueueProperty(cl_command_queue command_queue,cl_command_queue_properties properties,cl_bool enable,cl_command_queue_properties * old_properties)2507 CL_API_ENTRY cl_int CL_API_CALL clSetCommandQueueProperty(
2508     cl_command_queue command_queue,
2509     cl_command_queue_properties properties,
2510     cl_bool enable,
2511     cl_command_queue_properties* old_properties)
2512 {
2513 #if defined(CL_ENABLE_LAYERS)
2514     if (khrFirstLayer)
2515         return khrFirstLayer->dispatch.clSetCommandQueueProperty(
2516             command_queue,
2517             properties,
2518             enable,
2519             old_properties);
2520 #endif // defined(CL_ENABLE_LAYERS)
2521     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
2522     return command_queue->dispatch->clSetCommandQueueProperty(
2523         command_queue,
2524         properties,
2525         enable,
2526         old_properties);
2527 }
2528 
2529 ///////////////////////////////////////////////////////////////////////////////
2530 #if defined(CL_ENABLE_LAYERS)
clSetCommandQueueProperty_disp(cl_command_queue command_queue,cl_command_queue_properties properties,cl_bool enable,cl_command_queue_properties * old_properties)2531 static cl_int CL_API_CALL clSetCommandQueueProperty_disp(
2532     cl_command_queue command_queue,
2533     cl_command_queue_properties properties,
2534     cl_bool enable,
2535     cl_command_queue_properties* old_properties)
2536 {
2537     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
2538     return command_queue->dispatch->clSetCommandQueueProperty(
2539         command_queue,
2540         properties,
2541         enable,
2542         old_properties);
2543 }
2544 #endif // defined(CL_ENABLE_LAYERS)
2545 
2546 ///////////////////////////////////////////////////////////////////////////////
2547 
clCreateImage2D(cl_context context,cl_mem_flags flags,const cl_image_format * image_format,size_t image_width,size_t image_height,size_t image_row_pitch,void * host_ptr,cl_int * errcode_ret)2548 CL_API_ENTRY cl_mem CL_API_CALL clCreateImage2D(
2549     cl_context context,
2550     cl_mem_flags flags,
2551     const cl_image_format* image_format,
2552     size_t image_width,
2553     size_t image_height,
2554     size_t image_row_pitch,
2555     void* host_ptr,
2556     cl_int* errcode_ret)
2557 {
2558 #if defined(CL_ENABLE_LAYERS)
2559     if (khrFirstLayer)
2560         return khrFirstLayer->dispatch.clCreateImage2D(
2561             context,
2562             flags,
2563             image_format,
2564             image_width,
2565             image_height,
2566             image_row_pitch,
2567             host_ptr,
2568             errcode_ret);
2569 #endif // defined(CL_ENABLE_LAYERS)
2570     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
2571     return context->dispatch->clCreateImage2D(
2572         context,
2573         flags,
2574         image_format,
2575         image_width,
2576         image_height,
2577         image_row_pitch,
2578         host_ptr,
2579         errcode_ret);
2580 }
2581 
2582 ///////////////////////////////////////////////////////////////////////////////
2583 #if defined(CL_ENABLE_LAYERS)
clCreateImage2D_disp(cl_context context,cl_mem_flags flags,const cl_image_format * image_format,size_t image_width,size_t image_height,size_t image_row_pitch,void * host_ptr,cl_int * errcode_ret)2584 static cl_mem CL_API_CALL clCreateImage2D_disp(
2585     cl_context context,
2586     cl_mem_flags flags,
2587     const cl_image_format* image_format,
2588     size_t image_width,
2589     size_t image_height,
2590     size_t image_row_pitch,
2591     void* host_ptr,
2592     cl_int* errcode_ret)
2593 {
2594     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
2595     return context->dispatch->clCreateImage2D(
2596         context,
2597         flags,
2598         image_format,
2599         image_width,
2600         image_height,
2601         image_row_pitch,
2602         host_ptr,
2603         errcode_ret);
2604 }
2605 #endif // defined(CL_ENABLE_LAYERS)
2606 
2607 ///////////////////////////////////////////////////////////////////////////////
2608 
clCreateImage3D(cl_context context,cl_mem_flags flags,const cl_image_format * image_format,size_t image_width,size_t image_height,size_t image_depth,size_t image_row_pitch,size_t image_slice_pitch,void * host_ptr,cl_int * errcode_ret)2609 CL_API_ENTRY cl_mem CL_API_CALL clCreateImage3D(
2610     cl_context context,
2611     cl_mem_flags flags,
2612     const cl_image_format* image_format,
2613     size_t image_width,
2614     size_t image_height,
2615     size_t image_depth,
2616     size_t image_row_pitch,
2617     size_t image_slice_pitch,
2618     void* host_ptr,
2619     cl_int* errcode_ret)
2620 {
2621 #if defined(CL_ENABLE_LAYERS)
2622     if (khrFirstLayer)
2623         return khrFirstLayer->dispatch.clCreateImage3D(
2624             context,
2625             flags,
2626             image_format,
2627             image_width,
2628             image_height,
2629             image_depth,
2630             image_row_pitch,
2631             image_slice_pitch,
2632             host_ptr,
2633             errcode_ret);
2634 #endif // defined(CL_ENABLE_LAYERS)
2635     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
2636     return context->dispatch->clCreateImage3D(
2637         context,
2638         flags,
2639         image_format,
2640         image_width,
2641         image_height,
2642         image_depth,
2643         image_row_pitch,
2644         image_slice_pitch,
2645         host_ptr,
2646         errcode_ret);
2647 }
2648 
2649 ///////////////////////////////////////////////////////////////////////////////
2650 #if defined(CL_ENABLE_LAYERS)
clCreateImage3D_disp(cl_context context,cl_mem_flags flags,const cl_image_format * image_format,size_t image_width,size_t image_height,size_t image_depth,size_t image_row_pitch,size_t image_slice_pitch,void * host_ptr,cl_int * errcode_ret)2651 static cl_mem CL_API_CALL clCreateImage3D_disp(
2652     cl_context context,
2653     cl_mem_flags flags,
2654     const cl_image_format* image_format,
2655     size_t image_width,
2656     size_t image_height,
2657     size_t image_depth,
2658     size_t image_row_pitch,
2659     size_t image_slice_pitch,
2660     void* host_ptr,
2661     cl_int* errcode_ret)
2662 {
2663     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
2664     return context->dispatch->clCreateImage3D(
2665         context,
2666         flags,
2667         image_format,
2668         image_width,
2669         image_height,
2670         image_depth,
2671         image_row_pitch,
2672         image_slice_pitch,
2673         host_ptr,
2674         errcode_ret);
2675 }
2676 #endif // defined(CL_ENABLE_LAYERS)
2677 
2678 ///////////////////////////////////////////////////////////////////////////////
2679 
clEnqueueMarker(cl_command_queue command_queue,cl_event * event)2680 CL_API_ENTRY cl_int CL_API_CALL clEnqueueMarker(
2681     cl_command_queue command_queue,
2682     cl_event* event)
2683 {
2684 #if defined(CL_ENABLE_LAYERS)
2685     if (khrFirstLayer)
2686         return khrFirstLayer->dispatch.clEnqueueMarker(
2687             command_queue,
2688             event);
2689 #endif // defined(CL_ENABLE_LAYERS)
2690     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
2691     return command_queue->dispatch->clEnqueueMarker(
2692         command_queue,
2693         event);
2694 }
2695 
2696 ///////////////////////////////////////////////////////////////////////////////
2697 #if defined(CL_ENABLE_LAYERS)
clEnqueueMarker_disp(cl_command_queue command_queue,cl_event * event)2698 static cl_int CL_API_CALL clEnqueueMarker_disp(
2699     cl_command_queue command_queue,
2700     cl_event* event)
2701 {
2702     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
2703     return command_queue->dispatch->clEnqueueMarker(
2704         command_queue,
2705         event);
2706 }
2707 #endif // defined(CL_ENABLE_LAYERS)
2708 
2709 ///////////////////////////////////////////////////////////////////////////////
2710 
clEnqueueWaitForEvents(cl_command_queue command_queue,cl_uint num_events,const cl_event * event_list)2711 CL_API_ENTRY cl_int CL_API_CALL clEnqueueWaitForEvents(
2712     cl_command_queue command_queue,
2713     cl_uint num_events,
2714     const cl_event* event_list)
2715 {
2716 #if defined(CL_ENABLE_LAYERS)
2717     if (khrFirstLayer)
2718         return khrFirstLayer->dispatch.clEnqueueWaitForEvents(
2719             command_queue,
2720             num_events,
2721             event_list);
2722 #endif // defined(CL_ENABLE_LAYERS)
2723     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
2724     return command_queue->dispatch->clEnqueueWaitForEvents(
2725         command_queue,
2726         num_events,
2727         event_list);
2728 }
2729 
2730 ///////////////////////////////////////////////////////////////////////////////
2731 #if defined(CL_ENABLE_LAYERS)
clEnqueueWaitForEvents_disp(cl_command_queue command_queue,cl_uint num_events,const cl_event * event_list)2732 static cl_int CL_API_CALL clEnqueueWaitForEvents_disp(
2733     cl_command_queue command_queue,
2734     cl_uint num_events,
2735     const cl_event* event_list)
2736 {
2737     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
2738     return command_queue->dispatch->clEnqueueWaitForEvents(
2739         command_queue,
2740         num_events,
2741         event_list);
2742 }
2743 #endif // defined(CL_ENABLE_LAYERS)
2744 
2745 ///////////////////////////////////////////////////////////////////////////////
2746 
clEnqueueBarrier(cl_command_queue command_queue)2747 CL_API_ENTRY cl_int CL_API_CALL clEnqueueBarrier(
2748     cl_command_queue command_queue)
2749 {
2750 #if defined(CL_ENABLE_LAYERS)
2751     if (khrFirstLayer)
2752         return khrFirstLayer->dispatch.clEnqueueBarrier(
2753             command_queue);
2754 #endif // defined(CL_ENABLE_LAYERS)
2755     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
2756     return command_queue->dispatch->clEnqueueBarrier(
2757         command_queue);
2758 }
2759 
2760 ///////////////////////////////////////////////////////////////////////////////
2761 #if defined(CL_ENABLE_LAYERS)
clEnqueueBarrier_disp(cl_command_queue command_queue)2762 static cl_int CL_API_CALL clEnqueueBarrier_disp(
2763     cl_command_queue command_queue)
2764 {
2765     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
2766     return command_queue->dispatch->clEnqueueBarrier(
2767         command_queue);
2768 }
2769 #endif // defined(CL_ENABLE_LAYERS)
2770 
2771 ///////////////////////////////////////////////////////////////////////////////
2772 
clUnloadCompiler(void)2773 CL_API_ENTRY cl_int CL_API_CALL clUnloadCompiler(
2774     void )
2775 {
2776 #if defined(CL_ENABLE_LAYERS)
2777     if (khrFirstLayer)
2778         return khrFirstLayer->dispatch.clUnloadCompiler(
2779             );
2780 #endif // defined(CL_ENABLE_LAYERS)
2781     // Nothing!
2782     return CL_SUCCESS;
2783 }
2784 
2785 ///////////////////////////////////////////////////////////////////////////////
2786 #if defined(CL_ENABLE_LAYERS)
clUnloadCompiler_disp(void)2787 static cl_int CL_API_CALL clUnloadCompiler_disp(
2788     void )
2789 {
2790     // Nothing!
2791     return CL_SUCCESS;
2792 }
2793 #endif // defined(CL_ENABLE_LAYERS)
2794 
2795 ///////////////////////////////////////////////////////////////////////////////
2796 #if defined(CL_ENABLE_LAYERS)
2797 extern void* CL_API_CALL clGetExtensionFunctionAddress_disp(
2798     const char* func_name) CL_API_SUFFIX__VERSION_1_1_DEPRECATED;
2799 #endif // defined(CL_ENABLE_LAYERS)
2800 
clCreateCommandQueue(cl_context context,cl_device_id device,cl_command_queue_properties properties,cl_int * errcode_ret)2801 CL_API_ENTRY cl_command_queue CL_API_CALL clCreateCommandQueue(
2802     cl_context context,
2803     cl_device_id device,
2804     cl_command_queue_properties properties,
2805     cl_int* errcode_ret)
2806 {
2807 #if defined(CL_ENABLE_LAYERS)
2808     if (khrFirstLayer)
2809         return khrFirstLayer->dispatch.clCreateCommandQueue(
2810             context,
2811             device,
2812             properties,
2813             errcode_ret);
2814 #endif // defined(CL_ENABLE_LAYERS)
2815     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
2816     return context->dispatch->clCreateCommandQueue(
2817         context,
2818         device,
2819         properties,
2820         errcode_ret);
2821 }
2822 
2823 ///////////////////////////////////////////////////////////////////////////////
2824 #if defined(CL_ENABLE_LAYERS)
clCreateCommandQueue_disp(cl_context context,cl_device_id device,cl_command_queue_properties properties,cl_int * errcode_ret)2825 static cl_command_queue CL_API_CALL clCreateCommandQueue_disp(
2826     cl_context context,
2827     cl_device_id device,
2828     cl_command_queue_properties properties,
2829     cl_int* errcode_ret)
2830 {
2831     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
2832     return context->dispatch->clCreateCommandQueue(
2833         context,
2834         device,
2835         properties,
2836         errcode_ret);
2837 }
2838 #endif // defined(CL_ENABLE_LAYERS)
2839 
2840 ///////////////////////////////////////////////////////////////////////////////
2841 
clCreateSampler(cl_context context,cl_bool normalized_coords,cl_addressing_mode addressing_mode,cl_filter_mode filter_mode,cl_int * errcode_ret)2842 CL_API_ENTRY cl_sampler CL_API_CALL clCreateSampler(
2843     cl_context context,
2844     cl_bool normalized_coords,
2845     cl_addressing_mode addressing_mode,
2846     cl_filter_mode filter_mode,
2847     cl_int* errcode_ret)
2848 {
2849 #if defined(CL_ENABLE_LAYERS)
2850     if (khrFirstLayer)
2851         return khrFirstLayer->dispatch.clCreateSampler(
2852             context,
2853             normalized_coords,
2854             addressing_mode,
2855             filter_mode,
2856             errcode_ret);
2857 #endif // defined(CL_ENABLE_LAYERS)
2858     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
2859     return context->dispatch->clCreateSampler(
2860         context,
2861         normalized_coords,
2862         addressing_mode,
2863         filter_mode,
2864         errcode_ret);
2865 }
2866 
2867 ///////////////////////////////////////////////////////////////////////////////
2868 #if defined(CL_ENABLE_LAYERS)
clCreateSampler_disp(cl_context context,cl_bool normalized_coords,cl_addressing_mode addressing_mode,cl_filter_mode filter_mode,cl_int * errcode_ret)2869 static cl_sampler CL_API_CALL clCreateSampler_disp(
2870     cl_context context,
2871     cl_bool normalized_coords,
2872     cl_addressing_mode addressing_mode,
2873     cl_filter_mode filter_mode,
2874     cl_int* errcode_ret)
2875 {
2876     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
2877     return context->dispatch->clCreateSampler(
2878         context,
2879         normalized_coords,
2880         addressing_mode,
2881         filter_mode,
2882         errcode_ret);
2883 }
2884 #endif // defined(CL_ENABLE_LAYERS)
2885 
2886 ///////////////////////////////////////////////////////////////////////////////
2887 
clEnqueueTask(cl_command_queue command_queue,cl_kernel kernel,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)2888 CL_API_ENTRY cl_int CL_API_CALL clEnqueueTask(
2889     cl_command_queue command_queue,
2890     cl_kernel kernel,
2891     cl_uint num_events_in_wait_list,
2892     const cl_event* event_wait_list,
2893     cl_event* event)
2894 {
2895 #if defined(CL_ENABLE_LAYERS)
2896     if (khrFirstLayer)
2897         return khrFirstLayer->dispatch.clEnqueueTask(
2898             command_queue,
2899             kernel,
2900             num_events_in_wait_list,
2901             event_wait_list,
2902             event);
2903 #endif // defined(CL_ENABLE_LAYERS)
2904     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
2905     return command_queue->dispatch->clEnqueueTask(
2906         command_queue,
2907         kernel,
2908         num_events_in_wait_list,
2909         event_wait_list,
2910         event);
2911 }
2912 
2913 ///////////////////////////////////////////////////////////////////////////////
2914 #if defined(CL_ENABLE_LAYERS)
clEnqueueTask_disp(cl_command_queue command_queue,cl_kernel kernel,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)2915 static cl_int CL_API_CALL clEnqueueTask_disp(
2916     cl_command_queue command_queue,
2917     cl_kernel kernel,
2918     cl_uint num_events_in_wait_list,
2919     const cl_event* event_wait_list,
2920     cl_event* event)
2921 {
2922     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
2923     return command_queue->dispatch->clEnqueueTask(
2924         command_queue,
2925         kernel,
2926         num_events_in_wait_list,
2927         event_wait_list,
2928         event);
2929 }
2930 #endif // defined(CL_ENABLE_LAYERS)
2931 
2932 ///////////////////////////////////////////////////////////////////////////////
2933 
clCreateSubBuffer(cl_mem buffer,cl_mem_flags flags,cl_buffer_create_type buffer_create_type,const void * buffer_create_info,cl_int * errcode_ret)2934 CL_API_ENTRY cl_mem CL_API_CALL clCreateSubBuffer(
2935     cl_mem buffer,
2936     cl_mem_flags flags,
2937     cl_buffer_create_type buffer_create_type,
2938     const void* buffer_create_info,
2939     cl_int* errcode_ret)
2940 {
2941 #if defined(CL_ENABLE_LAYERS)
2942     if (khrFirstLayer)
2943         return khrFirstLayer->dispatch.clCreateSubBuffer(
2944             buffer,
2945             flags,
2946             buffer_create_type,
2947             buffer_create_info,
2948             errcode_ret);
2949 #endif // defined(CL_ENABLE_LAYERS)
2950     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(buffer, CL_INVALID_MEM_OBJECT);
2951     return buffer->dispatch->clCreateSubBuffer(
2952         buffer,
2953         flags,
2954         buffer_create_type,
2955         buffer_create_info,
2956         errcode_ret);
2957 }
2958 
2959 ///////////////////////////////////////////////////////////////////////////////
2960 #if defined(CL_ENABLE_LAYERS)
clCreateSubBuffer_disp(cl_mem buffer,cl_mem_flags flags,cl_buffer_create_type buffer_create_type,const void * buffer_create_info,cl_int * errcode_ret)2961 static cl_mem CL_API_CALL clCreateSubBuffer_disp(
2962     cl_mem buffer,
2963     cl_mem_flags flags,
2964     cl_buffer_create_type buffer_create_type,
2965     const void* buffer_create_info,
2966     cl_int* errcode_ret)
2967 {
2968     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(buffer, CL_INVALID_MEM_OBJECT);
2969     return buffer->dispatch->clCreateSubBuffer(
2970         buffer,
2971         flags,
2972         buffer_create_type,
2973         buffer_create_info,
2974         errcode_ret);
2975 }
2976 #endif // defined(CL_ENABLE_LAYERS)
2977 
2978 ///////////////////////////////////////////////////////////////////////////////
2979 
clSetMemObjectDestructorCallback(cl_mem memobj,void (CL_CALLBACK * pfn_notify)(cl_mem memobj,void * user_data),void * user_data)2980 CL_API_ENTRY cl_int CL_API_CALL clSetMemObjectDestructorCallback(
2981     cl_mem memobj,
2982     void (CL_CALLBACK* pfn_notify)(cl_mem memobj, void* user_data),
2983     void* user_data)
2984 {
2985 #if defined(CL_ENABLE_LAYERS)
2986     if (khrFirstLayer)
2987         return khrFirstLayer->dispatch.clSetMemObjectDestructorCallback(
2988             memobj,
2989             pfn_notify,
2990             user_data);
2991 #endif // defined(CL_ENABLE_LAYERS)
2992     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(memobj, CL_INVALID_MEM_OBJECT);
2993     return memobj->dispatch->clSetMemObjectDestructorCallback(
2994         memobj,
2995         pfn_notify,
2996         user_data);
2997 }
2998 
2999 ///////////////////////////////////////////////////////////////////////////////
3000 #if defined(CL_ENABLE_LAYERS)
clSetMemObjectDestructorCallback_disp(cl_mem memobj,void (CL_CALLBACK * pfn_notify)(cl_mem memobj,void * user_data),void * user_data)3001 static cl_int CL_API_CALL clSetMemObjectDestructorCallback_disp(
3002     cl_mem memobj,
3003     void (CL_CALLBACK* pfn_notify)(cl_mem memobj, void* user_data),
3004     void* user_data)
3005 {
3006     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(memobj, CL_INVALID_MEM_OBJECT);
3007     return memobj->dispatch->clSetMemObjectDestructorCallback(
3008         memobj,
3009         pfn_notify,
3010         user_data);
3011 }
3012 #endif // defined(CL_ENABLE_LAYERS)
3013 
3014 ///////////////////////////////////////////////////////////////////////////////
3015 
clCreateUserEvent(cl_context context,cl_int * errcode_ret)3016 CL_API_ENTRY cl_event CL_API_CALL clCreateUserEvent(
3017     cl_context context,
3018     cl_int* errcode_ret)
3019 {
3020 #if defined(CL_ENABLE_LAYERS)
3021     if (khrFirstLayer)
3022         return khrFirstLayer->dispatch.clCreateUserEvent(
3023             context,
3024             errcode_ret);
3025 #endif // defined(CL_ENABLE_LAYERS)
3026     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
3027     return context->dispatch->clCreateUserEvent(
3028         context,
3029         errcode_ret);
3030 }
3031 
3032 ///////////////////////////////////////////////////////////////////////////////
3033 #if defined(CL_ENABLE_LAYERS)
clCreateUserEvent_disp(cl_context context,cl_int * errcode_ret)3034 static cl_event CL_API_CALL clCreateUserEvent_disp(
3035     cl_context context,
3036     cl_int* errcode_ret)
3037 {
3038     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
3039     return context->dispatch->clCreateUserEvent(
3040         context,
3041         errcode_ret);
3042 }
3043 #endif // defined(CL_ENABLE_LAYERS)
3044 
3045 ///////////////////////////////////////////////////////////////////////////////
3046 
clSetUserEventStatus(cl_event event,cl_int execution_status)3047 CL_API_ENTRY cl_int CL_API_CALL clSetUserEventStatus(
3048     cl_event event,
3049     cl_int execution_status)
3050 {
3051 #if defined(CL_ENABLE_LAYERS)
3052     if (khrFirstLayer)
3053         return khrFirstLayer->dispatch.clSetUserEventStatus(
3054             event,
3055             execution_status);
3056 #endif // defined(CL_ENABLE_LAYERS)
3057     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(event, CL_INVALID_EVENT);
3058     return event->dispatch->clSetUserEventStatus(
3059         event,
3060         execution_status);
3061 }
3062 
3063 ///////////////////////////////////////////////////////////////////////////////
3064 #if defined(CL_ENABLE_LAYERS)
clSetUserEventStatus_disp(cl_event event,cl_int execution_status)3065 static cl_int CL_API_CALL clSetUserEventStatus_disp(
3066     cl_event event,
3067     cl_int execution_status)
3068 {
3069     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(event, CL_INVALID_EVENT);
3070     return event->dispatch->clSetUserEventStatus(
3071         event,
3072         execution_status);
3073 }
3074 #endif // defined(CL_ENABLE_LAYERS)
3075 
3076 ///////////////////////////////////////////////////////////////////////////////
3077 
clSetEventCallback(cl_event event,cl_int command_exec_callback_type,void (CL_CALLBACK * pfn_notify)(cl_event event,cl_int event_command_status,void * user_data),void * user_data)3078 CL_API_ENTRY cl_int CL_API_CALL clSetEventCallback(
3079     cl_event event,
3080     cl_int command_exec_callback_type,
3081     void (CL_CALLBACK* pfn_notify)(cl_event event, cl_int event_command_status, void *user_data),
3082     void* user_data)
3083 {
3084 #if defined(CL_ENABLE_LAYERS)
3085     if (khrFirstLayer)
3086         return khrFirstLayer->dispatch.clSetEventCallback(
3087             event,
3088             command_exec_callback_type,
3089             pfn_notify,
3090             user_data);
3091 #endif // defined(CL_ENABLE_LAYERS)
3092     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(event, CL_INVALID_EVENT);
3093     return event->dispatch->clSetEventCallback(
3094         event,
3095         command_exec_callback_type,
3096         pfn_notify,
3097         user_data);
3098 }
3099 
3100 ///////////////////////////////////////////////////////////////////////////////
3101 #if defined(CL_ENABLE_LAYERS)
clSetEventCallback_disp(cl_event event,cl_int command_exec_callback_type,void (CL_CALLBACK * pfn_notify)(cl_event event,cl_int event_command_status,void * user_data),void * user_data)3102 static cl_int CL_API_CALL clSetEventCallback_disp(
3103     cl_event event,
3104     cl_int command_exec_callback_type,
3105     void (CL_CALLBACK* pfn_notify)(cl_event event, cl_int event_command_status, void *user_data),
3106     void* user_data)
3107 {
3108     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(event, CL_INVALID_EVENT);
3109     return event->dispatch->clSetEventCallback(
3110         event,
3111         command_exec_callback_type,
3112         pfn_notify,
3113         user_data);
3114 }
3115 #endif // defined(CL_ENABLE_LAYERS)
3116 
3117 ///////////////////////////////////////////////////////////////////////////////
3118 
clEnqueueReadBufferRect(cl_command_queue command_queue,cl_mem buffer,cl_bool blocking_read,const size_t * buffer_origin,const size_t * host_origin,const size_t * region,size_t buffer_row_pitch,size_t buffer_slice_pitch,size_t host_row_pitch,size_t host_slice_pitch,void * ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)3119 CL_API_ENTRY cl_int CL_API_CALL clEnqueueReadBufferRect(
3120     cl_command_queue command_queue,
3121     cl_mem buffer,
3122     cl_bool blocking_read,
3123     const size_t* buffer_origin,
3124     const size_t* host_origin,
3125     const size_t* region,
3126     size_t buffer_row_pitch,
3127     size_t buffer_slice_pitch,
3128     size_t host_row_pitch,
3129     size_t host_slice_pitch,
3130     void* ptr,
3131     cl_uint num_events_in_wait_list,
3132     const cl_event* event_wait_list,
3133     cl_event* event)
3134 {
3135 #if defined(CL_ENABLE_LAYERS)
3136     if (khrFirstLayer)
3137         return khrFirstLayer->dispatch.clEnqueueReadBufferRect(
3138             command_queue,
3139             buffer,
3140             blocking_read,
3141             buffer_origin,
3142             host_origin,
3143             region,
3144             buffer_row_pitch,
3145             buffer_slice_pitch,
3146             host_row_pitch,
3147             host_slice_pitch,
3148             ptr,
3149             num_events_in_wait_list,
3150             event_wait_list,
3151             event);
3152 #endif // defined(CL_ENABLE_LAYERS)
3153     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
3154     return command_queue->dispatch->clEnqueueReadBufferRect(
3155         command_queue,
3156         buffer,
3157         blocking_read,
3158         buffer_origin,
3159         host_origin,
3160         region,
3161         buffer_row_pitch,
3162         buffer_slice_pitch,
3163         host_row_pitch,
3164         host_slice_pitch,
3165         ptr,
3166         num_events_in_wait_list,
3167         event_wait_list,
3168         event);
3169 }
3170 
3171 ///////////////////////////////////////////////////////////////////////////////
3172 #if defined(CL_ENABLE_LAYERS)
clEnqueueReadBufferRect_disp(cl_command_queue command_queue,cl_mem buffer,cl_bool blocking_read,const size_t * buffer_origin,const size_t * host_origin,const size_t * region,size_t buffer_row_pitch,size_t buffer_slice_pitch,size_t host_row_pitch,size_t host_slice_pitch,void * ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)3173 static cl_int CL_API_CALL clEnqueueReadBufferRect_disp(
3174     cl_command_queue command_queue,
3175     cl_mem buffer,
3176     cl_bool blocking_read,
3177     const size_t* buffer_origin,
3178     const size_t* host_origin,
3179     const size_t* region,
3180     size_t buffer_row_pitch,
3181     size_t buffer_slice_pitch,
3182     size_t host_row_pitch,
3183     size_t host_slice_pitch,
3184     void* ptr,
3185     cl_uint num_events_in_wait_list,
3186     const cl_event* event_wait_list,
3187     cl_event* event)
3188 {
3189     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
3190     return command_queue->dispatch->clEnqueueReadBufferRect(
3191         command_queue,
3192         buffer,
3193         blocking_read,
3194         buffer_origin,
3195         host_origin,
3196         region,
3197         buffer_row_pitch,
3198         buffer_slice_pitch,
3199         host_row_pitch,
3200         host_slice_pitch,
3201         ptr,
3202         num_events_in_wait_list,
3203         event_wait_list,
3204         event);
3205 }
3206 #endif // defined(CL_ENABLE_LAYERS)
3207 
3208 ///////////////////////////////////////////////////////////////////////////////
3209 
clEnqueueWriteBufferRect(cl_command_queue command_queue,cl_mem buffer,cl_bool blocking_write,const size_t * buffer_origin,const size_t * host_origin,const size_t * region,size_t buffer_row_pitch,size_t buffer_slice_pitch,size_t host_row_pitch,size_t host_slice_pitch,const void * ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)3210 CL_API_ENTRY cl_int CL_API_CALL clEnqueueWriteBufferRect(
3211     cl_command_queue command_queue,
3212     cl_mem buffer,
3213     cl_bool blocking_write,
3214     const size_t* buffer_origin,
3215     const size_t* host_origin,
3216     const size_t* region,
3217     size_t buffer_row_pitch,
3218     size_t buffer_slice_pitch,
3219     size_t host_row_pitch,
3220     size_t host_slice_pitch,
3221     const void* ptr,
3222     cl_uint num_events_in_wait_list,
3223     const cl_event* event_wait_list,
3224     cl_event* event)
3225 {
3226 #if defined(CL_ENABLE_LAYERS)
3227     if (khrFirstLayer)
3228         return khrFirstLayer->dispatch.clEnqueueWriteBufferRect(
3229             command_queue,
3230             buffer,
3231             blocking_write,
3232             buffer_origin,
3233             host_origin,
3234             region,
3235             buffer_row_pitch,
3236             buffer_slice_pitch,
3237             host_row_pitch,
3238             host_slice_pitch,
3239             ptr,
3240             num_events_in_wait_list,
3241             event_wait_list,
3242             event);
3243 #endif // defined(CL_ENABLE_LAYERS)
3244     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
3245     return command_queue->dispatch->clEnqueueWriteBufferRect(
3246         command_queue,
3247         buffer,
3248         blocking_write,
3249         buffer_origin,
3250         host_origin,
3251         region,
3252         buffer_row_pitch,
3253         buffer_slice_pitch,
3254         host_row_pitch,
3255         host_slice_pitch,
3256         ptr,
3257         num_events_in_wait_list,
3258         event_wait_list,
3259         event);
3260 }
3261 
3262 ///////////////////////////////////////////////////////////////////////////////
3263 #if defined(CL_ENABLE_LAYERS)
clEnqueueWriteBufferRect_disp(cl_command_queue command_queue,cl_mem buffer,cl_bool blocking_write,const size_t * buffer_origin,const size_t * host_origin,const size_t * region,size_t buffer_row_pitch,size_t buffer_slice_pitch,size_t host_row_pitch,size_t host_slice_pitch,const void * ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)3264 static cl_int CL_API_CALL clEnqueueWriteBufferRect_disp(
3265     cl_command_queue command_queue,
3266     cl_mem buffer,
3267     cl_bool blocking_write,
3268     const size_t* buffer_origin,
3269     const size_t* host_origin,
3270     const size_t* region,
3271     size_t buffer_row_pitch,
3272     size_t buffer_slice_pitch,
3273     size_t host_row_pitch,
3274     size_t host_slice_pitch,
3275     const void* ptr,
3276     cl_uint num_events_in_wait_list,
3277     const cl_event* event_wait_list,
3278     cl_event* event)
3279 {
3280     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
3281     return command_queue->dispatch->clEnqueueWriteBufferRect(
3282         command_queue,
3283         buffer,
3284         blocking_write,
3285         buffer_origin,
3286         host_origin,
3287         region,
3288         buffer_row_pitch,
3289         buffer_slice_pitch,
3290         host_row_pitch,
3291         host_slice_pitch,
3292         ptr,
3293         num_events_in_wait_list,
3294         event_wait_list,
3295         event);
3296 }
3297 #endif // defined(CL_ENABLE_LAYERS)
3298 
3299 ///////////////////////////////////////////////////////////////////////////////
3300 
clEnqueueCopyBufferRect(cl_command_queue command_queue,cl_mem src_buffer,cl_mem dst_buffer,const size_t * src_origin,const size_t * dst_origin,const size_t * region,size_t src_row_pitch,size_t src_slice_pitch,size_t dst_row_pitch,size_t dst_slice_pitch,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)3301 CL_API_ENTRY cl_int CL_API_CALL clEnqueueCopyBufferRect(
3302     cl_command_queue command_queue,
3303     cl_mem src_buffer,
3304     cl_mem dst_buffer,
3305     const size_t* src_origin,
3306     const size_t* dst_origin,
3307     const size_t* region,
3308     size_t src_row_pitch,
3309     size_t src_slice_pitch,
3310     size_t dst_row_pitch,
3311     size_t dst_slice_pitch,
3312     cl_uint num_events_in_wait_list,
3313     const cl_event* event_wait_list,
3314     cl_event* event)
3315 {
3316 #if defined(CL_ENABLE_LAYERS)
3317     if (khrFirstLayer)
3318         return khrFirstLayer->dispatch.clEnqueueCopyBufferRect(
3319             command_queue,
3320             src_buffer,
3321             dst_buffer,
3322             src_origin,
3323             dst_origin,
3324             region,
3325             src_row_pitch,
3326             src_slice_pitch,
3327             dst_row_pitch,
3328             dst_slice_pitch,
3329             num_events_in_wait_list,
3330             event_wait_list,
3331             event);
3332 #endif // defined(CL_ENABLE_LAYERS)
3333     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
3334     return command_queue->dispatch->clEnqueueCopyBufferRect(
3335         command_queue,
3336         src_buffer,
3337         dst_buffer,
3338         src_origin,
3339         dst_origin,
3340         region,
3341         src_row_pitch,
3342         src_slice_pitch,
3343         dst_row_pitch,
3344         dst_slice_pitch,
3345         num_events_in_wait_list,
3346         event_wait_list,
3347         event);
3348 }
3349 
3350 ///////////////////////////////////////////////////////////////////////////////
3351 #if defined(CL_ENABLE_LAYERS)
clEnqueueCopyBufferRect_disp(cl_command_queue command_queue,cl_mem src_buffer,cl_mem dst_buffer,const size_t * src_origin,const size_t * dst_origin,const size_t * region,size_t src_row_pitch,size_t src_slice_pitch,size_t dst_row_pitch,size_t dst_slice_pitch,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)3352 static cl_int CL_API_CALL clEnqueueCopyBufferRect_disp(
3353     cl_command_queue command_queue,
3354     cl_mem src_buffer,
3355     cl_mem dst_buffer,
3356     const size_t* src_origin,
3357     const size_t* dst_origin,
3358     const size_t* region,
3359     size_t src_row_pitch,
3360     size_t src_slice_pitch,
3361     size_t dst_row_pitch,
3362     size_t dst_slice_pitch,
3363     cl_uint num_events_in_wait_list,
3364     const cl_event* event_wait_list,
3365     cl_event* event)
3366 {
3367     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
3368     return command_queue->dispatch->clEnqueueCopyBufferRect(
3369         command_queue,
3370         src_buffer,
3371         dst_buffer,
3372         src_origin,
3373         dst_origin,
3374         region,
3375         src_row_pitch,
3376         src_slice_pitch,
3377         dst_row_pitch,
3378         dst_slice_pitch,
3379         num_events_in_wait_list,
3380         event_wait_list,
3381         event);
3382 }
3383 #endif // defined(CL_ENABLE_LAYERS)
3384 
3385 ///////////////////////////////////////////////////////////////////////////////
3386 
clCreateSubDevices(cl_device_id in_device,const cl_device_partition_property * properties,cl_uint num_devices,cl_device_id * out_devices,cl_uint * num_devices_ret)3387 CL_API_ENTRY cl_int CL_API_CALL clCreateSubDevices(
3388     cl_device_id in_device,
3389     const cl_device_partition_property* properties,
3390     cl_uint num_devices,
3391     cl_device_id* out_devices,
3392     cl_uint* num_devices_ret)
3393 {
3394 #if defined(CL_ENABLE_LAYERS)
3395     if (khrFirstLayer)
3396         return khrFirstLayer->dispatch.clCreateSubDevices(
3397             in_device,
3398             properties,
3399             num_devices,
3400             out_devices,
3401             num_devices_ret);
3402 #endif // defined(CL_ENABLE_LAYERS)
3403     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(in_device, CL_INVALID_DEVICE);
3404     return in_device->dispatch->clCreateSubDevices(
3405         in_device,
3406         properties,
3407         num_devices,
3408         out_devices,
3409         num_devices_ret);
3410 }
3411 
3412 ///////////////////////////////////////////////////////////////////////////////
3413 #if defined(CL_ENABLE_LAYERS)
clCreateSubDevices_disp(cl_device_id in_device,const cl_device_partition_property * properties,cl_uint num_devices,cl_device_id * out_devices,cl_uint * num_devices_ret)3414 static cl_int CL_API_CALL clCreateSubDevices_disp(
3415     cl_device_id in_device,
3416     const cl_device_partition_property* properties,
3417     cl_uint num_devices,
3418     cl_device_id* out_devices,
3419     cl_uint* num_devices_ret)
3420 {
3421     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(in_device, CL_INVALID_DEVICE);
3422     return in_device->dispatch->clCreateSubDevices(
3423         in_device,
3424         properties,
3425         num_devices,
3426         out_devices,
3427         num_devices_ret);
3428 }
3429 #endif // defined(CL_ENABLE_LAYERS)
3430 
3431 ///////////////////////////////////////////////////////////////////////////////
3432 
clRetainDevice(cl_device_id device)3433 CL_API_ENTRY cl_int CL_API_CALL clRetainDevice(
3434     cl_device_id device)
3435 {
3436 #if defined(CL_ENABLE_LAYERS)
3437     if (khrFirstLayer)
3438         return khrFirstLayer->dispatch.clRetainDevice(
3439             device);
3440 #endif // defined(CL_ENABLE_LAYERS)
3441     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(device, CL_INVALID_DEVICE);
3442     return device->dispatch->clRetainDevice(
3443         device);
3444 }
3445 
3446 ///////////////////////////////////////////////////////////////////////////////
3447 #if defined(CL_ENABLE_LAYERS)
clRetainDevice_disp(cl_device_id device)3448 static cl_int CL_API_CALL clRetainDevice_disp(
3449     cl_device_id device)
3450 {
3451     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(device, CL_INVALID_DEVICE);
3452     return device->dispatch->clRetainDevice(
3453         device);
3454 }
3455 #endif // defined(CL_ENABLE_LAYERS)
3456 
3457 ///////////////////////////////////////////////////////////////////////////////
3458 
clReleaseDevice(cl_device_id device)3459 CL_API_ENTRY cl_int CL_API_CALL clReleaseDevice(
3460     cl_device_id device)
3461 {
3462 #if defined(CL_ENABLE_LAYERS)
3463     if (khrFirstLayer)
3464         return khrFirstLayer->dispatch.clReleaseDevice(
3465             device);
3466 #endif // defined(CL_ENABLE_LAYERS)
3467     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(device, CL_INVALID_DEVICE);
3468     return device->dispatch->clReleaseDevice(
3469         device);
3470 }
3471 
3472 ///////////////////////////////////////////////////////////////////////////////
3473 #if defined(CL_ENABLE_LAYERS)
clReleaseDevice_disp(cl_device_id device)3474 static cl_int CL_API_CALL clReleaseDevice_disp(
3475     cl_device_id device)
3476 {
3477     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(device, CL_INVALID_DEVICE);
3478     return device->dispatch->clReleaseDevice(
3479         device);
3480 }
3481 #endif // defined(CL_ENABLE_LAYERS)
3482 
3483 ///////////////////////////////////////////////////////////////////////////////
3484 
clCreateImage(cl_context context,cl_mem_flags flags,const cl_image_format * image_format,const cl_image_desc * image_desc,void * host_ptr,cl_int * errcode_ret)3485 CL_API_ENTRY cl_mem CL_API_CALL clCreateImage(
3486     cl_context context,
3487     cl_mem_flags flags,
3488     const cl_image_format* image_format,
3489     const cl_image_desc* image_desc,
3490     void* host_ptr,
3491     cl_int* errcode_ret)
3492 {
3493 #if defined(CL_ENABLE_LAYERS)
3494     if (khrFirstLayer)
3495         return khrFirstLayer->dispatch.clCreateImage(
3496             context,
3497             flags,
3498             image_format,
3499             image_desc,
3500             host_ptr,
3501             errcode_ret);
3502 #endif // defined(CL_ENABLE_LAYERS)
3503     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
3504     return context->dispatch->clCreateImage(
3505         context,
3506         flags,
3507         image_format,
3508         image_desc,
3509         host_ptr,
3510         errcode_ret);
3511 }
3512 
3513 ///////////////////////////////////////////////////////////////////////////////
3514 #if defined(CL_ENABLE_LAYERS)
clCreateImage_disp(cl_context context,cl_mem_flags flags,const cl_image_format * image_format,const cl_image_desc * image_desc,void * host_ptr,cl_int * errcode_ret)3515 static cl_mem CL_API_CALL clCreateImage_disp(
3516     cl_context context,
3517     cl_mem_flags flags,
3518     const cl_image_format* image_format,
3519     const cl_image_desc* image_desc,
3520     void* host_ptr,
3521     cl_int* errcode_ret)
3522 {
3523     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
3524     return context->dispatch->clCreateImage(
3525         context,
3526         flags,
3527         image_format,
3528         image_desc,
3529         host_ptr,
3530         errcode_ret);
3531 }
3532 #endif // defined(CL_ENABLE_LAYERS)
3533 
3534 ///////////////////////////////////////////////////////////////////////////////
3535 
clCreateProgramWithBuiltInKernels(cl_context context,cl_uint num_devices,const cl_device_id * device_list,const char * kernel_names,cl_int * errcode_ret)3536 CL_API_ENTRY cl_program CL_API_CALL clCreateProgramWithBuiltInKernels(
3537     cl_context context,
3538     cl_uint num_devices,
3539     const cl_device_id* device_list,
3540     const char* kernel_names,
3541     cl_int* errcode_ret)
3542 {
3543 #if defined(CL_ENABLE_LAYERS)
3544     if (khrFirstLayer)
3545         return khrFirstLayer->dispatch.clCreateProgramWithBuiltInKernels(
3546             context,
3547             num_devices,
3548             device_list,
3549             kernel_names,
3550             errcode_ret);
3551 #endif // defined(CL_ENABLE_LAYERS)
3552     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
3553     return context->dispatch->clCreateProgramWithBuiltInKernels(
3554         context,
3555         num_devices,
3556         device_list,
3557         kernel_names,
3558         errcode_ret);
3559 }
3560 
3561 ///////////////////////////////////////////////////////////////////////////////
3562 #if defined(CL_ENABLE_LAYERS)
clCreateProgramWithBuiltInKernels_disp(cl_context context,cl_uint num_devices,const cl_device_id * device_list,const char * kernel_names,cl_int * errcode_ret)3563 static cl_program CL_API_CALL clCreateProgramWithBuiltInKernels_disp(
3564     cl_context context,
3565     cl_uint num_devices,
3566     const cl_device_id* device_list,
3567     const char* kernel_names,
3568     cl_int* errcode_ret)
3569 {
3570     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
3571     return context->dispatch->clCreateProgramWithBuiltInKernels(
3572         context,
3573         num_devices,
3574         device_list,
3575         kernel_names,
3576         errcode_ret);
3577 }
3578 #endif // defined(CL_ENABLE_LAYERS)
3579 
3580 ///////////////////////////////////////////////////////////////////////////////
3581 
clCompileProgram(cl_program program,cl_uint num_devices,const cl_device_id * device_list,const char * options,cl_uint num_input_headers,const cl_program * input_headers,const char ** header_include_names,void (CL_CALLBACK * pfn_notify)(cl_program program,void * user_data),void * user_data)3582 CL_API_ENTRY cl_int CL_API_CALL clCompileProgram(
3583     cl_program program,
3584     cl_uint num_devices,
3585     const cl_device_id* device_list,
3586     const char* options,
3587     cl_uint num_input_headers,
3588     const cl_program* input_headers,
3589     const char** header_include_names,
3590     void (CL_CALLBACK* pfn_notify)(cl_program program, void* user_data),
3591     void* user_data)
3592 {
3593 #if defined(CL_ENABLE_LAYERS)
3594     if (khrFirstLayer)
3595         return khrFirstLayer->dispatch.clCompileProgram(
3596             program,
3597             num_devices,
3598             device_list,
3599             options,
3600             num_input_headers,
3601             input_headers,
3602             header_include_names,
3603             pfn_notify,
3604             user_data);
3605 #endif // defined(CL_ENABLE_LAYERS)
3606     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM);
3607     return program->dispatch->clCompileProgram(
3608         program,
3609         num_devices,
3610         device_list,
3611         options,
3612         num_input_headers,
3613         input_headers,
3614         header_include_names,
3615         pfn_notify,
3616         user_data);
3617 }
3618 
3619 ///////////////////////////////////////////////////////////////////////////////
3620 #if defined(CL_ENABLE_LAYERS)
clCompileProgram_disp(cl_program program,cl_uint num_devices,const cl_device_id * device_list,const char * options,cl_uint num_input_headers,const cl_program * input_headers,const char ** header_include_names,void (CL_CALLBACK * pfn_notify)(cl_program program,void * user_data),void * user_data)3621 static cl_int CL_API_CALL clCompileProgram_disp(
3622     cl_program program,
3623     cl_uint num_devices,
3624     const cl_device_id* device_list,
3625     const char* options,
3626     cl_uint num_input_headers,
3627     const cl_program* input_headers,
3628     const char** header_include_names,
3629     void (CL_CALLBACK* pfn_notify)(cl_program program, void* user_data),
3630     void* user_data)
3631 {
3632     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM);
3633     return program->dispatch->clCompileProgram(
3634         program,
3635         num_devices,
3636         device_list,
3637         options,
3638         num_input_headers,
3639         input_headers,
3640         header_include_names,
3641         pfn_notify,
3642         user_data);
3643 }
3644 #endif // defined(CL_ENABLE_LAYERS)
3645 
3646 ///////////////////////////////////////////////////////////////////////////////
3647 
clLinkProgram(cl_context context,cl_uint num_devices,const cl_device_id * device_list,const char * options,cl_uint num_input_programs,const cl_program * input_programs,void (CL_CALLBACK * pfn_notify)(cl_program program,void * user_data),void * user_data,cl_int * errcode_ret)3648 CL_API_ENTRY cl_program CL_API_CALL clLinkProgram(
3649     cl_context context,
3650     cl_uint num_devices,
3651     const cl_device_id* device_list,
3652     const char* options,
3653     cl_uint num_input_programs,
3654     const cl_program* input_programs,
3655     void (CL_CALLBACK* pfn_notify)(cl_program program, void* user_data),
3656     void* user_data,
3657     cl_int* errcode_ret)
3658 {
3659 #if defined(CL_ENABLE_LAYERS)
3660     if (khrFirstLayer)
3661         return khrFirstLayer->dispatch.clLinkProgram(
3662             context,
3663             num_devices,
3664             device_list,
3665             options,
3666             num_input_programs,
3667             input_programs,
3668             pfn_notify,
3669             user_data,
3670             errcode_ret);
3671 #endif // defined(CL_ENABLE_LAYERS)
3672     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
3673     return context->dispatch->clLinkProgram(
3674         context,
3675         num_devices,
3676         device_list,
3677         options,
3678         num_input_programs,
3679         input_programs,
3680         pfn_notify,
3681         user_data,
3682         errcode_ret);
3683 }
3684 
3685 ///////////////////////////////////////////////////////////////////////////////
3686 #if defined(CL_ENABLE_LAYERS)
clLinkProgram_disp(cl_context context,cl_uint num_devices,const cl_device_id * device_list,const char * options,cl_uint num_input_programs,const cl_program * input_programs,void (CL_CALLBACK * pfn_notify)(cl_program program,void * user_data),void * user_data,cl_int * errcode_ret)3687 static cl_program CL_API_CALL clLinkProgram_disp(
3688     cl_context context,
3689     cl_uint num_devices,
3690     const cl_device_id* device_list,
3691     const char* options,
3692     cl_uint num_input_programs,
3693     const cl_program* input_programs,
3694     void (CL_CALLBACK* pfn_notify)(cl_program program, void* user_data),
3695     void* user_data,
3696     cl_int* errcode_ret)
3697 {
3698     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
3699     return context->dispatch->clLinkProgram(
3700         context,
3701         num_devices,
3702         device_list,
3703         options,
3704         num_input_programs,
3705         input_programs,
3706         pfn_notify,
3707         user_data,
3708         errcode_ret);
3709 }
3710 #endif // defined(CL_ENABLE_LAYERS)
3711 
3712 ///////////////////////////////////////////////////////////////////////////////
3713 
clUnloadPlatformCompiler(cl_platform_id platform)3714 CL_API_ENTRY cl_int CL_API_CALL clUnloadPlatformCompiler(
3715     cl_platform_id platform)
3716 {
3717 #if defined(CL_ENABLE_LAYERS)
3718     if (khrFirstLayer)
3719         return khrFirstLayer->dispatch.clUnloadPlatformCompiler(
3720             platform);
3721 #endif // defined(CL_ENABLE_LAYERS)
3722     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(platform, CL_INVALID_PLATFORM);
3723     return platform->dispatch->clUnloadPlatformCompiler(
3724         platform);
3725 }
3726 
3727 ///////////////////////////////////////////////////////////////////////////////
3728 #if defined(CL_ENABLE_LAYERS)
clUnloadPlatformCompiler_disp(cl_platform_id platform)3729 static cl_int CL_API_CALL clUnloadPlatformCompiler_disp(
3730     cl_platform_id platform)
3731 {
3732     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(platform, CL_INVALID_PLATFORM);
3733     return platform->dispatch->clUnloadPlatformCompiler(
3734         platform);
3735 }
3736 #endif // defined(CL_ENABLE_LAYERS)
3737 
3738 ///////////////////////////////////////////////////////////////////////////////
3739 
clGetKernelArgInfo(cl_kernel kernel,cl_uint arg_index,cl_kernel_arg_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret)3740 CL_API_ENTRY cl_int CL_API_CALL clGetKernelArgInfo(
3741     cl_kernel kernel,
3742     cl_uint arg_index,
3743     cl_kernel_arg_info param_name,
3744     size_t param_value_size,
3745     void* param_value,
3746     size_t* param_value_size_ret)
3747 {
3748 #if defined(CL_ENABLE_LAYERS)
3749     if (khrFirstLayer)
3750         return khrFirstLayer->dispatch.clGetKernelArgInfo(
3751             kernel,
3752             arg_index,
3753             param_name,
3754             param_value_size,
3755             param_value,
3756             param_value_size_ret);
3757 #endif // defined(CL_ENABLE_LAYERS)
3758     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL);
3759     return kernel->dispatch->clGetKernelArgInfo(
3760         kernel,
3761         arg_index,
3762         param_name,
3763         param_value_size,
3764         param_value,
3765         param_value_size_ret);
3766 }
3767 
3768 ///////////////////////////////////////////////////////////////////////////////
3769 #if defined(CL_ENABLE_LAYERS)
clGetKernelArgInfo_disp(cl_kernel kernel,cl_uint arg_index,cl_kernel_arg_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret)3770 static cl_int CL_API_CALL clGetKernelArgInfo_disp(
3771     cl_kernel kernel,
3772     cl_uint arg_index,
3773     cl_kernel_arg_info param_name,
3774     size_t param_value_size,
3775     void* param_value,
3776     size_t* param_value_size_ret)
3777 {
3778     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL);
3779     return kernel->dispatch->clGetKernelArgInfo(
3780         kernel,
3781         arg_index,
3782         param_name,
3783         param_value_size,
3784         param_value,
3785         param_value_size_ret);
3786 }
3787 #endif // defined(CL_ENABLE_LAYERS)
3788 
3789 ///////////////////////////////////////////////////////////////////////////////
3790 
clEnqueueFillBuffer(cl_command_queue command_queue,cl_mem buffer,const void * pattern,size_t pattern_size,size_t offset,size_t size,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)3791 CL_API_ENTRY cl_int CL_API_CALL clEnqueueFillBuffer(
3792     cl_command_queue command_queue,
3793     cl_mem buffer,
3794     const void* pattern,
3795     size_t pattern_size,
3796     size_t offset,
3797     size_t size,
3798     cl_uint num_events_in_wait_list,
3799     const cl_event* event_wait_list,
3800     cl_event* event)
3801 {
3802 #if defined(CL_ENABLE_LAYERS)
3803     if (khrFirstLayer)
3804         return khrFirstLayer->dispatch.clEnqueueFillBuffer(
3805             command_queue,
3806             buffer,
3807             pattern,
3808             pattern_size,
3809             offset,
3810             size,
3811             num_events_in_wait_list,
3812             event_wait_list,
3813             event);
3814 #endif // defined(CL_ENABLE_LAYERS)
3815     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
3816     return command_queue->dispatch->clEnqueueFillBuffer(
3817         command_queue,
3818         buffer,
3819         pattern,
3820         pattern_size,
3821         offset,
3822         size,
3823         num_events_in_wait_list,
3824         event_wait_list,
3825         event);
3826 }
3827 
3828 ///////////////////////////////////////////////////////////////////////////////
3829 #if defined(CL_ENABLE_LAYERS)
clEnqueueFillBuffer_disp(cl_command_queue command_queue,cl_mem buffer,const void * pattern,size_t pattern_size,size_t offset,size_t size,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)3830 static cl_int CL_API_CALL clEnqueueFillBuffer_disp(
3831     cl_command_queue command_queue,
3832     cl_mem buffer,
3833     const void* pattern,
3834     size_t pattern_size,
3835     size_t offset,
3836     size_t size,
3837     cl_uint num_events_in_wait_list,
3838     const cl_event* event_wait_list,
3839     cl_event* event)
3840 {
3841     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
3842     return command_queue->dispatch->clEnqueueFillBuffer(
3843         command_queue,
3844         buffer,
3845         pattern,
3846         pattern_size,
3847         offset,
3848         size,
3849         num_events_in_wait_list,
3850         event_wait_list,
3851         event);
3852 }
3853 #endif // defined(CL_ENABLE_LAYERS)
3854 
3855 ///////////////////////////////////////////////////////////////////////////////
3856 
clEnqueueFillImage(cl_command_queue command_queue,cl_mem image,const void * fill_color,const size_t * origin,const size_t * region,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)3857 CL_API_ENTRY cl_int CL_API_CALL clEnqueueFillImage(
3858     cl_command_queue command_queue,
3859     cl_mem image,
3860     const void* fill_color,
3861     const size_t* origin,
3862     const size_t* region,
3863     cl_uint num_events_in_wait_list,
3864     const cl_event* event_wait_list,
3865     cl_event* event)
3866 {
3867 #if defined(CL_ENABLE_LAYERS)
3868     if (khrFirstLayer)
3869         return khrFirstLayer->dispatch.clEnqueueFillImage(
3870             command_queue,
3871             image,
3872             fill_color,
3873             origin,
3874             region,
3875             num_events_in_wait_list,
3876             event_wait_list,
3877             event);
3878 #endif // defined(CL_ENABLE_LAYERS)
3879     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
3880     return command_queue->dispatch->clEnqueueFillImage(
3881         command_queue,
3882         image,
3883         fill_color,
3884         origin,
3885         region,
3886         num_events_in_wait_list,
3887         event_wait_list,
3888         event);
3889 }
3890 
3891 ///////////////////////////////////////////////////////////////////////////////
3892 #if defined(CL_ENABLE_LAYERS)
clEnqueueFillImage_disp(cl_command_queue command_queue,cl_mem image,const void * fill_color,const size_t * origin,const size_t * region,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)3893 static cl_int CL_API_CALL clEnqueueFillImage_disp(
3894     cl_command_queue command_queue,
3895     cl_mem image,
3896     const void* fill_color,
3897     const size_t* origin,
3898     const size_t* region,
3899     cl_uint num_events_in_wait_list,
3900     const cl_event* event_wait_list,
3901     cl_event* event)
3902 {
3903     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
3904     return command_queue->dispatch->clEnqueueFillImage(
3905         command_queue,
3906         image,
3907         fill_color,
3908         origin,
3909         region,
3910         num_events_in_wait_list,
3911         event_wait_list,
3912         event);
3913 }
3914 #endif // defined(CL_ENABLE_LAYERS)
3915 
3916 ///////////////////////////////////////////////////////////////////////////////
3917 
clEnqueueMigrateMemObjects(cl_command_queue command_queue,cl_uint num_mem_objects,const cl_mem * mem_objects,cl_mem_migration_flags flags,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)3918 CL_API_ENTRY cl_int CL_API_CALL clEnqueueMigrateMemObjects(
3919     cl_command_queue command_queue,
3920     cl_uint num_mem_objects,
3921     const cl_mem* mem_objects,
3922     cl_mem_migration_flags flags,
3923     cl_uint num_events_in_wait_list,
3924     const cl_event* event_wait_list,
3925     cl_event* event)
3926 {
3927 #if defined(CL_ENABLE_LAYERS)
3928     if (khrFirstLayer)
3929         return khrFirstLayer->dispatch.clEnqueueMigrateMemObjects(
3930             command_queue,
3931             num_mem_objects,
3932             mem_objects,
3933             flags,
3934             num_events_in_wait_list,
3935             event_wait_list,
3936             event);
3937 #endif // defined(CL_ENABLE_LAYERS)
3938     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
3939     return command_queue->dispatch->clEnqueueMigrateMemObjects(
3940         command_queue,
3941         num_mem_objects,
3942         mem_objects,
3943         flags,
3944         num_events_in_wait_list,
3945         event_wait_list,
3946         event);
3947 }
3948 
3949 ///////////////////////////////////////////////////////////////////////////////
3950 #if defined(CL_ENABLE_LAYERS)
clEnqueueMigrateMemObjects_disp(cl_command_queue command_queue,cl_uint num_mem_objects,const cl_mem * mem_objects,cl_mem_migration_flags flags,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)3951 static cl_int CL_API_CALL clEnqueueMigrateMemObjects_disp(
3952     cl_command_queue command_queue,
3953     cl_uint num_mem_objects,
3954     const cl_mem* mem_objects,
3955     cl_mem_migration_flags flags,
3956     cl_uint num_events_in_wait_list,
3957     const cl_event* event_wait_list,
3958     cl_event* event)
3959 {
3960     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
3961     return command_queue->dispatch->clEnqueueMigrateMemObjects(
3962         command_queue,
3963         num_mem_objects,
3964         mem_objects,
3965         flags,
3966         num_events_in_wait_list,
3967         event_wait_list,
3968         event);
3969 }
3970 #endif // defined(CL_ENABLE_LAYERS)
3971 
3972 ///////////////////////////////////////////////////////////////////////////////
3973 
clEnqueueMarkerWithWaitList(cl_command_queue command_queue,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)3974 CL_API_ENTRY cl_int CL_API_CALL clEnqueueMarkerWithWaitList(
3975     cl_command_queue command_queue,
3976     cl_uint num_events_in_wait_list,
3977     const cl_event* event_wait_list,
3978     cl_event* event)
3979 {
3980 #if defined(CL_ENABLE_LAYERS)
3981     if (khrFirstLayer)
3982         return khrFirstLayer->dispatch.clEnqueueMarkerWithWaitList(
3983             command_queue,
3984             num_events_in_wait_list,
3985             event_wait_list,
3986             event);
3987 #endif // defined(CL_ENABLE_LAYERS)
3988     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
3989     return command_queue->dispatch->clEnqueueMarkerWithWaitList(
3990         command_queue,
3991         num_events_in_wait_list,
3992         event_wait_list,
3993         event);
3994 }
3995 
3996 ///////////////////////////////////////////////////////////////////////////////
3997 #if defined(CL_ENABLE_LAYERS)
clEnqueueMarkerWithWaitList_disp(cl_command_queue command_queue,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)3998 static cl_int CL_API_CALL clEnqueueMarkerWithWaitList_disp(
3999     cl_command_queue command_queue,
4000     cl_uint num_events_in_wait_list,
4001     const cl_event* event_wait_list,
4002     cl_event* event)
4003 {
4004     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
4005     return command_queue->dispatch->clEnqueueMarkerWithWaitList(
4006         command_queue,
4007         num_events_in_wait_list,
4008         event_wait_list,
4009         event);
4010 }
4011 #endif // defined(CL_ENABLE_LAYERS)
4012 
4013 ///////////////////////////////////////////////////////////////////////////////
4014 
clEnqueueBarrierWithWaitList(cl_command_queue command_queue,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)4015 CL_API_ENTRY cl_int CL_API_CALL clEnqueueBarrierWithWaitList(
4016     cl_command_queue command_queue,
4017     cl_uint num_events_in_wait_list,
4018     const cl_event* event_wait_list,
4019     cl_event* event)
4020 {
4021 #if defined(CL_ENABLE_LAYERS)
4022     if (khrFirstLayer)
4023         return khrFirstLayer->dispatch.clEnqueueBarrierWithWaitList(
4024             command_queue,
4025             num_events_in_wait_list,
4026             event_wait_list,
4027             event);
4028 #endif // defined(CL_ENABLE_LAYERS)
4029     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
4030     return command_queue->dispatch->clEnqueueBarrierWithWaitList(
4031         command_queue,
4032         num_events_in_wait_list,
4033         event_wait_list,
4034         event);
4035 }
4036 
4037 ///////////////////////////////////////////////////////////////////////////////
4038 #if defined(CL_ENABLE_LAYERS)
clEnqueueBarrierWithWaitList_disp(cl_command_queue command_queue,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)4039 static cl_int CL_API_CALL clEnqueueBarrierWithWaitList_disp(
4040     cl_command_queue command_queue,
4041     cl_uint num_events_in_wait_list,
4042     const cl_event* event_wait_list,
4043     cl_event* event)
4044 {
4045     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
4046     return command_queue->dispatch->clEnqueueBarrierWithWaitList(
4047         command_queue,
4048         num_events_in_wait_list,
4049         event_wait_list,
4050         event);
4051 }
4052 #endif // defined(CL_ENABLE_LAYERS)
4053 
4054 ///////////////////////////////////////////////////////////////////////////////
4055 #if defined(CL_ENABLE_LAYERS)
4056 extern void* CL_API_CALL clGetExtensionFunctionAddressForPlatform_disp(
4057     cl_platform_id platform,
4058     const char* func_name) CL_API_SUFFIX__VERSION_1_2;
4059 #endif // defined(CL_ENABLE_LAYERS)
4060 
clCreateCommandQueueWithProperties(cl_context context,cl_device_id device,const cl_queue_properties * properties,cl_int * errcode_ret)4061 CL_API_ENTRY cl_command_queue CL_API_CALL clCreateCommandQueueWithProperties(
4062     cl_context context,
4063     cl_device_id device,
4064     const cl_queue_properties* properties,
4065     cl_int* errcode_ret)
4066 {
4067 #if defined(CL_ENABLE_LAYERS)
4068     if (khrFirstLayer)
4069         return khrFirstLayer->dispatch.clCreateCommandQueueWithProperties(
4070             context,
4071             device,
4072             properties,
4073             errcode_ret);
4074 #endif // defined(CL_ENABLE_LAYERS)
4075     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
4076     return context->dispatch->clCreateCommandQueueWithProperties(
4077         context,
4078         device,
4079         properties,
4080         errcode_ret);
4081 }
4082 
4083 ///////////////////////////////////////////////////////////////////////////////
4084 #if defined(CL_ENABLE_LAYERS)
clCreateCommandQueueWithProperties_disp(cl_context context,cl_device_id device,const cl_queue_properties * properties,cl_int * errcode_ret)4085 static cl_command_queue CL_API_CALL clCreateCommandQueueWithProperties_disp(
4086     cl_context context,
4087     cl_device_id device,
4088     const cl_queue_properties* properties,
4089     cl_int* errcode_ret)
4090 {
4091     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
4092     return context->dispatch->clCreateCommandQueueWithProperties(
4093         context,
4094         device,
4095         properties,
4096         errcode_ret);
4097 }
4098 #endif // defined(CL_ENABLE_LAYERS)
4099 
4100 ///////////////////////////////////////////////////////////////////////////////
4101 
clCreatePipe(cl_context context,cl_mem_flags flags,cl_uint pipe_packet_size,cl_uint pipe_max_packets,const cl_pipe_properties * properties,cl_int * errcode_ret)4102 CL_API_ENTRY cl_mem CL_API_CALL clCreatePipe(
4103     cl_context context,
4104     cl_mem_flags flags,
4105     cl_uint pipe_packet_size,
4106     cl_uint pipe_max_packets,
4107     const cl_pipe_properties* properties,
4108     cl_int* errcode_ret)
4109 {
4110 #if defined(CL_ENABLE_LAYERS)
4111     if (khrFirstLayer)
4112         return khrFirstLayer->dispatch.clCreatePipe(
4113             context,
4114             flags,
4115             pipe_packet_size,
4116             pipe_max_packets,
4117             properties,
4118             errcode_ret);
4119 #endif // defined(CL_ENABLE_LAYERS)
4120     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
4121     return context->dispatch->clCreatePipe(
4122         context,
4123         flags,
4124         pipe_packet_size,
4125         pipe_max_packets,
4126         properties,
4127         errcode_ret);
4128 }
4129 
4130 ///////////////////////////////////////////////////////////////////////////////
4131 #if defined(CL_ENABLE_LAYERS)
clCreatePipe_disp(cl_context context,cl_mem_flags flags,cl_uint pipe_packet_size,cl_uint pipe_max_packets,const cl_pipe_properties * properties,cl_int * errcode_ret)4132 static cl_mem CL_API_CALL clCreatePipe_disp(
4133     cl_context context,
4134     cl_mem_flags flags,
4135     cl_uint pipe_packet_size,
4136     cl_uint pipe_max_packets,
4137     const cl_pipe_properties* properties,
4138     cl_int* errcode_ret)
4139 {
4140     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
4141     return context->dispatch->clCreatePipe(
4142         context,
4143         flags,
4144         pipe_packet_size,
4145         pipe_max_packets,
4146         properties,
4147         errcode_ret);
4148 }
4149 #endif // defined(CL_ENABLE_LAYERS)
4150 
4151 ///////////////////////////////////////////////////////////////////////////////
4152 
clGetPipeInfo(cl_mem pipe,cl_pipe_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret)4153 CL_API_ENTRY cl_int CL_API_CALL clGetPipeInfo(
4154     cl_mem pipe,
4155     cl_pipe_info param_name,
4156     size_t param_value_size,
4157     void* param_value,
4158     size_t* param_value_size_ret)
4159 {
4160 #if defined(CL_ENABLE_LAYERS)
4161     if (khrFirstLayer)
4162         return khrFirstLayer->dispatch.clGetPipeInfo(
4163             pipe,
4164             param_name,
4165             param_value_size,
4166             param_value,
4167             param_value_size_ret);
4168 #endif // defined(CL_ENABLE_LAYERS)
4169     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(pipe, CL_INVALID_MEM_OBJECT);
4170     return pipe->dispatch->clGetPipeInfo(
4171         pipe,
4172         param_name,
4173         param_value_size,
4174         param_value,
4175         param_value_size_ret);
4176 }
4177 
4178 ///////////////////////////////////////////////////////////////////////////////
4179 #if defined(CL_ENABLE_LAYERS)
clGetPipeInfo_disp(cl_mem pipe,cl_pipe_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret)4180 static cl_int CL_API_CALL clGetPipeInfo_disp(
4181     cl_mem pipe,
4182     cl_pipe_info param_name,
4183     size_t param_value_size,
4184     void* param_value,
4185     size_t* param_value_size_ret)
4186 {
4187     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(pipe, CL_INVALID_MEM_OBJECT);
4188     return pipe->dispatch->clGetPipeInfo(
4189         pipe,
4190         param_name,
4191         param_value_size,
4192         param_value,
4193         param_value_size_ret);
4194 }
4195 #endif // defined(CL_ENABLE_LAYERS)
4196 
4197 ///////////////////////////////////////////////////////////////////////////////
4198 
clSVMAlloc(cl_context context,cl_svm_mem_flags flags,size_t size,cl_uint alignment)4199 CL_API_ENTRY void* CL_API_CALL clSVMAlloc(
4200     cl_context context,
4201     cl_svm_mem_flags flags,
4202     size_t size,
4203     cl_uint alignment)
4204 {
4205 #if defined(CL_ENABLE_LAYERS)
4206     if (khrFirstLayer)
4207         return khrFirstLayer->dispatch.clSVMAlloc(
4208             context,
4209             flags,
4210             size,
4211             alignment);
4212 #endif // defined(CL_ENABLE_LAYERS)
4213     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(context, NULL);
4214     return context->dispatch->clSVMAlloc(
4215         context,
4216         flags,
4217         size,
4218         alignment);
4219 }
4220 
4221 ///////////////////////////////////////////////////////////////////////////////
4222 #if defined(CL_ENABLE_LAYERS)
clSVMAlloc_disp(cl_context context,cl_svm_mem_flags flags,size_t size,cl_uint alignment)4223 static void* CL_API_CALL clSVMAlloc_disp(
4224     cl_context context,
4225     cl_svm_mem_flags flags,
4226     size_t size,
4227     cl_uint alignment)
4228 {
4229     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(context, NULL);
4230     return context->dispatch->clSVMAlloc(
4231         context,
4232         flags,
4233         size,
4234         alignment);
4235 }
4236 #endif // defined(CL_ENABLE_LAYERS)
4237 
4238 ///////////////////////////////////////////////////////////////////////////////
4239 
clSVMFree(cl_context context,void * svm_pointer)4240 CL_API_ENTRY void CL_API_CALL clSVMFree(
4241     cl_context context,
4242     void* svm_pointer)
4243 {
4244 #if defined(CL_ENABLE_LAYERS)
4245     if (khrFirstLayer)
4246     {
4247         khrFirstLayer->dispatch.clSVMFree(
4248             context,
4249             svm_pointer);
4250     }
4251     else
4252 #endif // defined(CL_ENABLE_LAYERS)
4253     if (context != NULL)
4254     context->dispatch->clSVMFree(
4255         context,
4256         svm_pointer);
4257 }
4258 
4259 ///////////////////////////////////////////////////////////////////////////////
4260 #if defined(CL_ENABLE_LAYERS)
clSVMFree_disp(cl_context context,void * svm_pointer)4261 static void CL_API_CALL clSVMFree_disp(
4262     cl_context context,
4263     void* svm_pointer)
4264 {
4265     if (context != NULL)
4266     context->dispatch->clSVMFree(
4267         context,
4268         svm_pointer);
4269 }
4270 #endif // defined(CL_ENABLE_LAYERS)
4271 
4272 ///////////////////////////////////////////////////////////////////////////////
4273 
clCreateSamplerWithProperties(cl_context context,const cl_sampler_properties * sampler_properties,cl_int * errcode_ret)4274 CL_API_ENTRY cl_sampler CL_API_CALL clCreateSamplerWithProperties(
4275     cl_context context,
4276     const cl_sampler_properties* sampler_properties,
4277     cl_int* errcode_ret)
4278 {
4279 #if defined(CL_ENABLE_LAYERS)
4280     if (khrFirstLayer)
4281         return khrFirstLayer->dispatch.clCreateSamplerWithProperties(
4282             context,
4283             sampler_properties,
4284             errcode_ret);
4285 #endif // defined(CL_ENABLE_LAYERS)
4286     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
4287     return context->dispatch->clCreateSamplerWithProperties(
4288         context,
4289         sampler_properties,
4290         errcode_ret);
4291 }
4292 
4293 ///////////////////////////////////////////////////////////////////////////////
4294 #if defined(CL_ENABLE_LAYERS)
clCreateSamplerWithProperties_disp(cl_context context,const cl_sampler_properties * sampler_properties,cl_int * errcode_ret)4295 static cl_sampler CL_API_CALL clCreateSamplerWithProperties_disp(
4296     cl_context context,
4297     const cl_sampler_properties* sampler_properties,
4298     cl_int* errcode_ret)
4299 {
4300     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
4301     return context->dispatch->clCreateSamplerWithProperties(
4302         context,
4303         sampler_properties,
4304         errcode_ret);
4305 }
4306 #endif // defined(CL_ENABLE_LAYERS)
4307 
4308 ///////////////////////////////////////////////////////////////////////////////
4309 
clSetKernelArgSVMPointer(cl_kernel kernel,cl_uint arg_index,const void * arg_value)4310 CL_API_ENTRY cl_int CL_API_CALL clSetKernelArgSVMPointer(
4311     cl_kernel kernel,
4312     cl_uint arg_index,
4313     const void* arg_value)
4314 {
4315 #if defined(CL_ENABLE_LAYERS)
4316     if (khrFirstLayer)
4317         return khrFirstLayer->dispatch.clSetKernelArgSVMPointer(
4318             kernel,
4319             arg_index,
4320             arg_value);
4321 #endif // defined(CL_ENABLE_LAYERS)
4322     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL);
4323     return kernel->dispatch->clSetKernelArgSVMPointer(
4324         kernel,
4325         arg_index,
4326         arg_value);
4327 }
4328 
4329 ///////////////////////////////////////////////////////////////////////////////
4330 #if defined(CL_ENABLE_LAYERS)
clSetKernelArgSVMPointer_disp(cl_kernel kernel,cl_uint arg_index,const void * arg_value)4331 static cl_int CL_API_CALL clSetKernelArgSVMPointer_disp(
4332     cl_kernel kernel,
4333     cl_uint arg_index,
4334     const void* arg_value)
4335 {
4336     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL);
4337     return kernel->dispatch->clSetKernelArgSVMPointer(
4338         kernel,
4339         arg_index,
4340         arg_value);
4341 }
4342 #endif // defined(CL_ENABLE_LAYERS)
4343 
4344 ///////////////////////////////////////////////////////////////////////////////
4345 
clSetKernelExecInfo(cl_kernel kernel,cl_kernel_exec_info param_name,size_t param_value_size,const void * param_value)4346 CL_API_ENTRY cl_int CL_API_CALL clSetKernelExecInfo(
4347     cl_kernel kernel,
4348     cl_kernel_exec_info param_name,
4349     size_t param_value_size,
4350     const void* param_value)
4351 {
4352 #if defined(CL_ENABLE_LAYERS)
4353     if (khrFirstLayer)
4354         return khrFirstLayer->dispatch.clSetKernelExecInfo(
4355             kernel,
4356             param_name,
4357             param_value_size,
4358             param_value);
4359 #endif // defined(CL_ENABLE_LAYERS)
4360     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL);
4361     return kernel->dispatch->clSetKernelExecInfo(
4362         kernel,
4363         param_name,
4364         param_value_size,
4365         param_value);
4366 }
4367 
4368 ///////////////////////////////////////////////////////////////////////////////
4369 #if defined(CL_ENABLE_LAYERS)
clSetKernelExecInfo_disp(cl_kernel kernel,cl_kernel_exec_info param_name,size_t param_value_size,const void * param_value)4370 static cl_int CL_API_CALL clSetKernelExecInfo_disp(
4371     cl_kernel kernel,
4372     cl_kernel_exec_info param_name,
4373     size_t param_value_size,
4374     const void* param_value)
4375 {
4376     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL);
4377     return kernel->dispatch->clSetKernelExecInfo(
4378         kernel,
4379         param_name,
4380         param_value_size,
4381         param_value);
4382 }
4383 #endif // defined(CL_ENABLE_LAYERS)
4384 
4385 ///////////////////////////////////////////////////////////////////////////////
4386 
clEnqueueSVMFree(cl_command_queue command_queue,cl_uint num_svm_pointers,void * svm_pointers[],void (CL_CALLBACK * pfn_free_func)(cl_command_queue queue,cl_uint num_svm_pointers,void * svm_pointers[],void * user_data),void * user_data,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)4387 CL_API_ENTRY cl_int CL_API_CALL clEnqueueSVMFree(
4388     cl_command_queue command_queue,
4389     cl_uint num_svm_pointers,
4390     void* svm_pointers[],
4391     void (CL_CALLBACK* pfn_free_func)(cl_command_queue queue, cl_uint num_svm_pointers, void* svm_pointers[], void* user_data),
4392     void* user_data,
4393     cl_uint num_events_in_wait_list,
4394     const cl_event* event_wait_list,
4395     cl_event* event)
4396 {
4397 #if defined(CL_ENABLE_LAYERS)
4398     if (khrFirstLayer)
4399         return khrFirstLayer->dispatch.clEnqueueSVMFree(
4400             command_queue,
4401             num_svm_pointers,
4402             svm_pointers,
4403             pfn_free_func,
4404             user_data,
4405             num_events_in_wait_list,
4406             event_wait_list,
4407             event);
4408 #endif // defined(CL_ENABLE_LAYERS)
4409     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
4410     return command_queue->dispatch->clEnqueueSVMFree(
4411         command_queue,
4412         num_svm_pointers,
4413         svm_pointers,
4414         pfn_free_func,
4415         user_data,
4416         num_events_in_wait_list,
4417         event_wait_list,
4418         event);
4419 }
4420 
4421 ///////////////////////////////////////////////////////////////////////////////
4422 #if defined(CL_ENABLE_LAYERS)
clEnqueueSVMFree_disp(cl_command_queue command_queue,cl_uint num_svm_pointers,void * svm_pointers[],void (CL_CALLBACK * pfn_free_func)(cl_command_queue queue,cl_uint num_svm_pointers,void * svm_pointers[],void * user_data),void * user_data,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)4423 static cl_int CL_API_CALL clEnqueueSVMFree_disp(
4424     cl_command_queue command_queue,
4425     cl_uint num_svm_pointers,
4426     void* svm_pointers[],
4427     void (CL_CALLBACK* pfn_free_func)(cl_command_queue queue, cl_uint num_svm_pointers, void* svm_pointers[], void* user_data),
4428     void* user_data,
4429     cl_uint num_events_in_wait_list,
4430     const cl_event* event_wait_list,
4431     cl_event* event)
4432 {
4433     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
4434     return command_queue->dispatch->clEnqueueSVMFree(
4435         command_queue,
4436         num_svm_pointers,
4437         svm_pointers,
4438         pfn_free_func,
4439         user_data,
4440         num_events_in_wait_list,
4441         event_wait_list,
4442         event);
4443 }
4444 #endif // defined(CL_ENABLE_LAYERS)
4445 
4446 ///////////////////////////////////////////////////////////////////////////////
4447 
clEnqueueSVMMemcpy(cl_command_queue command_queue,cl_bool blocking_copy,void * dst_ptr,const void * src_ptr,size_t size,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)4448 CL_API_ENTRY cl_int CL_API_CALL clEnqueueSVMMemcpy(
4449     cl_command_queue command_queue,
4450     cl_bool blocking_copy,
4451     void* dst_ptr,
4452     const void* src_ptr,
4453     size_t size,
4454     cl_uint num_events_in_wait_list,
4455     const cl_event* event_wait_list,
4456     cl_event* event)
4457 {
4458 #if defined(CL_ENABLE_LAYERS)
4459     if (khrFirstLayer)
4460         return khrFirstLayer->dispatch.clEnqueueSVMMemcpy(
4461             command_queue,
4462             blocking_copy,
4463             dst_ptr,
4464             src_ptr,
4465             size,
4466             num_events_in_wait_list,
4467             event_wait_list,
4468             event);
4469 #endif // defined(CL_ENABLE_LAYERS)
4470     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
4471     return command_queue->dispatch->clEnqueueSVMMemcpy(
4472         command_queue,
4473         blocking_copy,
4474         dst_ptr,
4475         src_ptr,
4476         size,
4477         num_events_in_wait_list,
4478         event_wait_list,
4479         event);
4480 }
4481 
4482 ///////////////////////////////////////////////////////////////////////////////
4483 #if defined(CL_ENABLE_LAYERS)
clEnqueueSVMMemcpy_disp(cl_command_queue command_queue,cl_bool blocking_copy,void * dst_ptr,const void * src_ptr,size_t size,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)4484 static cl_int CL_API_CALL clEnqueueSVMMemcpy_disp(
4485     cl_command_queue command_queue,
4486     cl_bool blocking_copy,
4487     void* dst_ptr,
4488     const void* src_ptr,
4489     size_t size,
4490     cl_uint num_events_in_wait_list,
4491     const cl_event* event_wait_list,
4492     cl_event* event)
4493 {
4494     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
4495     return command_queue->dispatch->clEnqueueSVMMemcpy(
4496         command_queue,
4497         blocking_copy,
4498         dst_ptr,
4499         src_ptr,
4500         size,
4501         num_events_in_wait_list,
4502         event_wait_list,
4503         event);
4504 }
4505 #endif // defined(CL_ENABLE_LAYERS)
4506 
4507 ///////////////////////////////////////////////////////////////////////////////
4508 
clEnqueueSVMMemFill(cl_command_queue command_queue,void * svm_ptr,const void * pattern,size_t pattern_size,size_t size,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)4509 CL_API_ENTRY cl_int CL_API_CALL clEnqueueSVMMemFill(
4510     cl_command_queue command_queue,
4511     void* svm_ptr,
4512     const void* pattern,
4513     size_t pattern_size,
4514     size_t size,
4515     cl_uint num_events_in_wait_list,
4516     const cl_event* event_wait_list,
4517     cl_event* event)
4518 {
4519 #if defined(CL_ENABLE_LAYERS)
4520     if (khrFirstLayer)
4521         return khrFirstLayer->dispatch.clEnqueueSVMMemFill(
4522             command_queue,
4523             svm_ptr,
4524             pattern,
4525             pattern_size,
4526             size,
4527             num_events_in_wait_list,
4528             event_wait_list,
4529             event);
4530 #endif // defined(CL_ENABLE_LAYERS)
4531     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
4532     return command_queue->dispatch->clEnqueueSVMMemFill(
4533         command_queue,
4534         svm_ptr,
4535         pattern,
4536         pattern_size,
4537         size,
4538         num_events_in_wait_list,
4539         event_wait_list,
4540         event);
4541 }
4542 
4543 ///////////////////////////////////////////////////////////////////////////////
4544 #if defined(CL_ENABLE_LAYERS)
clEnqueueSVMMemFill_disp(cl_command_queue command_queue,void * svm_ptr,const void * pattern,size_t pattern_size,size_t size,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)4545 static cl_int CL_API_CALL clEnqueueSVMMemFill_disp(
4546     cl_command_queue command_queue,
4547     void* svm_ptr,
4548     const void* pattern,
4549     size_t pattern_size,
4550     size_t size,
4551     cl_uint num_events_in_wait_list,
4552     const cl_event* event_wait_list,
4553     cl_event* event)
4554 {
4555     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
4556     return command_queue->dispatch->clEnqueueSVMMemFill(
4557         command_queue,
4558         svm_ptr,
4559         pattern,
4560         pattern_size,
4561         size,
4562         num_events_in_wait_list,
4563         event_wait_list,
4564         event);
4565 }
4566 #endif // defined(CL_ENABLE_LAYERS)
4567 
4568 ///////////////////////////////////////////////////////////////////////////////
4569 
clEnqueueSVMMap(cl_command_queue command_queue,cl_bool blocking_map,cl_map_flags flags,void * svm_ptr,size_t size,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)4570 CL_API_ENTRY cl_int CL_API_CALL clEnqueueSVMMap(
4571     cl_command_queue command_queue,
4572     cl_bool blocking_map,
4573     cl_map_flags flags,
4574     void* svm_ptr,
4575     size_t size,
4576     cl_uint num_events_in_wait_list,
4577     const cl_event* event_wait_list,
4578     cl_event* event)
4579 {
4580 #if defined(CL_ENABLE_LAYERS)
4581     if (khrFirstLayer)
4582         return khrFirstLayer->dispatch.clEnqueueSVMMap(
4583             command_queue,
4584             blocking_map,
4585             flags,
4586             svm_ptr,
4587             size,
4588             num_events_in_wait_list,
4589             event_wait_list,
4590             event);
4591 #endif // defined(CL_ENABLE_LAYERS)
4592     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
4593     return command_queue->dispatch->clEnqueueSVMMap(
4594         command_queue,
4595         blocking_map,
4596         flags,
4597         svm_ptr,
4598         size,
4599         num_events_in_wait_list,
4600         event_wait_list,
4601         event);
4602 }
4603 
4604 ///////////////////////////////////////////////////////////////////////////////
4605 #if defined(CL_ENABLE_LAYERS)
clEnqueueSVMMap_disp(cl_command_queue command_queue,cl_bool blocking_map,cl_map_flags flags,void * svm_ptr,size_t size,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)4606 static cl_int CL_API_CALL clEnqueueSVMMap_disp(
4607     cl_command_queue command_queue,
4608     cl_bool blocking_map,
4609     cl_map_flags flags,
4610     void* svm_ptr,
4611     size_t size,
4612     cl_uint num_events_in_wait_list,
4613     const cl_event* event_wait_list,
4614     cl_event* event)
4615 {
4616     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
4617     return command_queue->dispatch->clEnqueueSVMMap(
4618         command_queue,
4619         blocking_map,
4620         flags,
4621         svm_ptr,
4622         size,
4623         num_events_in_wait_list,
4624         event_wait_list,
4625         event);
4626 }
4627 #endif // defined(CL_ENABLE_LAYERS)
4628 
4629 ///////////////////////////////////////////////////////////////////////////////
4630 
clEnqueueSVMUnmap(cl_command_queue command_queue,void * svm_ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)4631 CL_API_ENTRY cl_int CL_API_CALL clEnqueueSVMUnmap(
4632     cl_command_queue command_queue,
4633     void* svm_ptr,
4634     cl_uint num_events_in_wait_list,
4635     const cl_event* event_wait_list,
4636     cl_event* event)
4637 {
4638 #if defined(CL_ENABLE_LAYERS)
4639     if (khrFirstLayer)
4640         return khrFirstLayer->dispatch.clEnqueueSVMUnmap(
4641             command_queue,
4642             svm_ptr,
4643             num_events_in_wait_list,
4644             event_wait_list,
4645             event);
4646 #endif // defined(CL_ENABLE_LAYERS)
4647     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
4648     return command_queue->dispatch->clEnqueueSVMUnmap(
4649         command_queue,
4650         svm_ptr,
4651         num_events_in_wait_list,
4652         event_wait_list,
4653         event);
4654 }
4655 
4656 ///////////////////////////////////////////////////////////////////////////////
4657 #if defined(CL_ENABLE_LAYERS)
clEnqueueSVMUnmap_disp(cl_command_queue command_queue,void * svm_ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)4658 static cl_int CL_API_CALL clEnqueueSVMUnmap_disp(
4659     cl_command_queue command_queue,
4660     void* svm_ptr,
4661     cl_uint num_events_in_wait_list,
4662     const cl_event* event_wait_list,
4663     cl_event* event)
4664 {
4665     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
4666     return command_queue->dispatch->clEnqueueSVMUnmap(
4667         command_queue,
4668         svm_ptr,
4669         num_events_in_wait_list,
4670         event_wait_list,
4671         event);
4672 }
4673 #endif // defined(CL_ENABLE_LAYERS)
4674 
4675 ///////////////////////////////////////////////////////////////////////////////
4676 
clSetDefaultDeviceCommandQueue(cl_context context,cl_device_id device,cl_command_queue command_queue)4677 CL_API_ENTRY cl_int CL_API_CALL clSetDefaultDeviceCommandQueue(
4678     cl_context context,
4679     cl_device_id device,
4680     cl_command_queue command_queue)
4681 {
4682 #if defined(CL_ENABLE_LAYERS)
4683     if (khrFirstLayer)
4684         return khrFirstLayer->dispatch.clSetDefaultDeviceCommandQueue(
4685             context,
4686             device,
4687             command_queue);
4688 #endif // defined(CL_ENABLE_LAYERS)
4689     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(context, CL_INVALID_CONTEXT);
4690     return context->dispatch->clSetDefaultDeviceCommandQueue(
4691         context,
4692         device,
4693         command_queue);
4694 }
4695 
4696 ///////////////////////////////////////////////////////////////////////////////
4697 #if defined(CL_ENABLE_LAYERS)
clSetDefaultDeviceCommandQueue_disp(cl_context context,cl_device_id device,cl_command_queue command_queue)4698 static cl_int CL_API_CALL clSetDefaultDeviceCommandQueue_disp(
4699     cl_context context,
4700     cl_device_id device,
4701     cl_command_queue command_queue)
4702 {
4703     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(context, CL_INVALID_CONTEXT);
4704     return context->dispatch->clSetDefaultDeviceCommandQueue(
4705         context,
4706         device,
4707         command_queue);
4708 }
4709 #endif // defined(CL_ENABLE_LAYERS)
4710 
4711 ///////////////////////////////////////////////////////////////////////////////
4712 
clGetDeviceAndHostTimer(cl_device_id device,cl_ulong * device_timestamp,cl_ulong * host_timestamp)4713 CL_API_ENTRY cl_int CL_API_CALL clGetDeviceAndHostTimer(
4714     cl_device_id device,
4715     cl_ulong* device_timestamp,
4716     cl_ulong* host_timestamp)
4717 {
4718 #if defined(CL_ENABLE_LAYERS)
4719     if (khrFirstLayer)
4720         return khrFirstLayer->dispatch.clGetDeviceAndHostTimer(
4721             device,
4722             device_timestamp,
4723             host_timestamp);
4724 #endif // defined(CL_ENABLE_LAYERS)
4725     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(device, CL_INVALID_DEVICE);
4726     return device->dispatch->clGetDeviceAndHostTimer(
4727         device,
4728         device_timestamp,
4729         host_timestamp);
4730 }
4731 
4732 ///////////////////////////////////////////////////////////////////////////////
4733 #if defined(CL_ENABLE_LAYERS)
clGetDeviceAndHostTimer_disp(cl_device_id device,cl_ulong * device_timestamp,cl_ulong * host_timestamp)4734 static cl_int CL_API_CALL clGetDeviceAndHostTimer_disp(
4735     cl_device_id device,
4736     cl_ulong* device_timestamp,
4737     cl_ulong* host_timestamp)
4738 {
4739     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(device, CL_INVALID_DEVICE);
4740     return device->dispatch->clGetDeviceAndHostTimer(
4741         device,
4742         device_timestamp,
4743         host_timestamp);
4744 }
4745 #endif // defined(CL_ENABLE_LAYERS)
4746 
4747 ///////////////////////////////////////////////////////////////////////////////
4748 
clGetHostTimer(cl_device_id device,cl_ulong * host_timestamp)4749 CL_API_ENTRY cl_int CL_API_CALL clGetHostTimer(
4750     cl_device_id device,
4751     cl_ulong* host_timestamp)
4752 {
4753 #if defined(CL_ENABLE_LAYERS)
4754     if (khrFirstLayer)
4755         return khrFirstLayer->dispatch.clGetHostTimer(
4756             device,
4757             host_timestamp);
4758 #endif // defined(CL_ENABLE_LAYERS)
4759     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(device, CL_INVALID_DEVICE);
4760     return device->dispatch->clGetHostTimer(
4761         device,
4762         host_timestamp);
4763 }
4764 
4765 ///////////////////////////////////////////////////////////////////////////////
4766 #if defined(CL_ENABLE_LAYERS)
clGetHostTimer_disp(cl_device_id device,cl_ulong * host_timestamp)4767 static cl_int CL_API_CALL clGetHostTimer_disp(
4768     cl_device_id device,
4769     cl_ulong* host_timestamp)
4770 {
4771     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(device, CL_INVALID_DEVICE);
4772     return device->dispatch->clGetHostTimer(
4773         device,
4774         host_timestamp);
4775 }
4776 #endif // defined(CL_ENABLE_LAYERS)
4777 
4778 ///////////////////////////////////////////////////////////////////////////////
4779 
clCreateProgramWithIL(cl_context context,const void * il,size_t length,cl_int * errcode_ret)4780 CL_API_ENTRY cl_program CL_API_CALL clCreateProgramWithIL(
4781     cl_context context,
4782     const void* il,
4783     size_t length,
4784     cl_int* errcode_ret)
4785 {
4786 #if defined(CL_ENABLE_LAYERS)
4787     if (khrFirstLayer)
4788         return khrFirstLayer->dispatch.clCreateProgramWithIL(
4789             context,
4790             il,
4791             length,
4792             errcode_ret);
4793 #endif // defined(CL_ENABLE_LAYERS)
4794     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
4795     return context->dispatch->clCreateProgramWithIL(
4796         context,
4797         il,
4798         length,
4799         errcode_ret);
4800 }
4801 
4802 ///////////////////////////////////////////////////////////////////////////////
4803 #if defined(CL_ENABLE_LAYERS)
clCreateProgramWithIL_disp(cl_context context,const void * il,size_t length,cl_int * errcode_ret)4804 static cl_program CL_API_CALL clCreateProgramWithIL_disp(
4805     cl_context context,
4806     const void* il,
4807     size_t length,
4808     cl_int* errcode_ret)
4809 {
4810     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
4811     return context->dispatch->clCreateProgramWithIL(
4812         context,
4813         il,
4814         length,
4815         errcode_ret);
4816 }
4817 #endif // defined(CL_ENABLE_LAYERS)
4818 
4819 ///////////////////////////////////////////////////////////////////////////////
4820 
clCloneKernel(cl_kernel source_kernel,cl_int * errcode_ret)4821 CL_API_ENTRY cl_kernel CL_API_CALL clCloneKernel(
4822     cl_kernel source_kernel,
4823     cl_int* errcode_ret)
4824 {
4825 #if defined(CL_ENABLE_LAYERS)
4826     if (khrFirstLayer)
4827         return khrFirstLayer->dispatch.clCloneKernel(
4828             source_kernel,
4829             errcode_ret);
4830 #endif // defined(CL_ENABLE_LAYERS)
4831     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(source_kernel, CL_INVALID_KERNEL);
4832     return source_kernel->dispatch->clCloneKernel(
4833         source_kernel,
4834         errcode_ret);
4835 }
4836 
4837 ///////////////////////////////////////////////////////////////////////////////
4838 #if defined(CL_ENABLE_LAYERS)
clCloneKernel_disp(cl_kernel source_kernel,cl_int * errcode_ret)4839 static cl_kernel CL_API_CALL clCloneKernel_disp(
4840     cl_kernel source_kernel,
4841     cl_int* errcode_ret)
4842 {
4843     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(source_kernel, CL_INVALID_KERNEL);
4844     return source_kernel->dispatch->clCloneKernel(
4845         source_kernel,
4846         errcode_ret);
4847 }
4848 #endif // defined(CL_ENABLE_LAYERS)
4849 
4850 ///////////////////////////////////////////////////////////////////////////////
4851 
clGetKernelSubGroupInfo(cl_kernel kernel,cl_device_id device,cl_kernel_sub_group_info param_name,size_t input_value_size,const void * input_value,size_t param_value_size,void * param_value,size_t * param_value_size_ret)4852 CL_API_ENTRY cl_int CL_API_CALL clGetKernelSubGroupInfo(
4853     cl_kernel kernel,
4854     cl_device_id device,
4855     cl_kernel_sub_group_info param_name,
4856     size_t input_value_size,
4857     const void* input_value,
4858     size_t param_value_size,
4859     void* param_value,
4860     size_t* param_value_size_ret)
4861 {
4862 #if defined(CL_ENABLE_LAYERS)
4863     if (khrFirstLayer)
4864         return khrFirstLayer->dispatch.clGetKernelSubGroupInfo(
4865             kernel,
4866             device,
4867             param_name,
4868             input_value_size,
4869             input_value,
4870             param_value_size,
4871             param_value,
4872             param_value_size_ret);
4873 #endif // defined(CL_ENABLE_LAYERS)
4874     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL);
4875     return kernel->dispatch->clGetKernelSubGroupInfo(
4876         kernel,
4877         device,
4878         param_name,
4879         input_value_size,
4880         input_value,
4881         param_value_size,
4882         param_value,
4883         param_value_size_ret);
4884 }
4885 
4886 ///////////////////////////////////////////////////////////////////////////////
4887 #if defined(CL_ENABLE_LAYERS)
clGetKernelSubGroupInfo_disp(cl_kernel kernel,cl_device_id device,cl_kernel_sub_group_info param_name,size_t input_value_size,const void * input_value,size_t param_value_size,void * param_value,size_t * param_value_size_ret)4888 static cl_int CL_API_CALL clGetKernelSubGroupInfo_disp(
4889     cl_kernel kernel,
4890     cl_device_id device,
4891     cl_kernel_sub_group_info param_name,
4892     size_t input_value_size,
4893     const void* input_value,
4894     size_t param_value_size,
4895     void* param_value,
4896     size_t* param_value_size_ret)
4897 {
4898     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(kernel, CL_INVALID_KERNEL);
4899     return kernel->dispatch->clGetKernelSubGroupInfo(
4900         kernel,
4901         device,
4902         param_name,
4903         input_value_size,
4904         input_value,
4905         param_value_size,
4906         param_value,
4907         param_value_size_ret);
4908 }
4909 #endif // defined(CL_ENABLE_LAYERS)
4910 
4911 ///////////////////////////////////////////////////////////////////////////////
4912 
clEnqueueSVMMigrateMem(cl_command_queue command_queue,cl_uint num_svm_pointers,const void ** svm_pointers,const size_t * sizes,cl_mem_migration_flags flags,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)4913 CL_API_ENTRY cl_int CL_API_CALL clEnqueueSVMMigrateMem(
4914     cl_command_queue command_queue,
4915     cl_uint num_svm_pointers,
4916     const void** svm_pointers,
4917     const size_t* sizes,
4918     cl_mem_migration_flags flags,
4919     cl_uint num_events_in_wait_list,
4920     const cl_event* event_wait_list,
4921     cl_event* event)
4922 {
4923 #if defined(CL_ENABLE_LAYERS)
4924     if (khrFirstLayer)
4925         return khrFirstLayer->dispatch.clEnqueueSVMMigrateMem(
4926             command_queue,
4927             num_svm_pointers,
4928             svm_pointers,
4929             sizes,
4930             flags,
4931             num_events_in_wait_list,
4932             event_wait_list,
4933             event);
4934 #endif // defined(CL_ENABLE_LAYERS)
4935     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
4936     return command_queue->dispatch->clEnqueueSVMMigrateMem(
4937         command_queue,
4938         num_svm_pointers,
4939         svm_pointers,
4940         sizes,
4941         flags,
4942         num_events_in_wait_list,
4943         event_wait_list,
4944         event);
4945 }
4946 
4947 ///////////////////////////////////////////////////////////////////////////////
4948 #if defined(CL_ENABLE_LAYERS)
clEnqueueSVMMigrateMem_disp(cl_command_queue command_queue,cl_uint num_svm_pointers,const void ** svm_pointers,const size_t * sizes,cl_mem_migration_flags flags,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)4949 static cl_int CL_API_CALL clEnqueueSVMMigrateMem_disp(
4950     cl_command_queue command_queue,
4951     cl_uint num_svm_pointers,
4952     const void** svm_pointers,
4953     const size_t* sizes,
4954     cl_mem_migration_flags flags,
4955     cl_uint num_events_in_wait_list,
4956     const cl_event* event_wait_list,
4957     cl_event* event)
4958 {
4959     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
4960     return command_queue->dispatch->clEnqueueSVMMigrateMem(
4961         command_queue,
4962         num_svm_pointers,
4963         svm_pointers,
4964         sizes,
4965         flags,
4966         num_events_in_wait_list,
4967         event_wait_list,
4968         event);
4969 }
4970 #endif // defined(CL_ENABLE_LAYERS)
4971 
4972 ///////////////////////////////////////////////////////////////////////////////
4973 
clSetProgramSpecializationConstant(cl_program program,cl_uint spec_id,size_t spec_size,const void * spec_value)4974 CL_API_ENTRY cl_int CL_API_CALL clSetProgramSpecializationConstant(
4975     cl_program program,
4976     cl_uint spec_id,
4977     size_t spec_size,
4978     const void* spec_value)
4979 {
4980 #if defined(CL_ENABLE_LAYERS)
4981     if (khrFirstLayer)
4982         return khrFirstLayer->dispatch.clSetProgramSpecializationConstant(
4983             program,
4984             spec_id,
4985             spec_size,
4986             spec_value);
4987 #endif // defined(CL_ENABLE_LAYERS)
4988     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM);
4989     return program->dispatch->clSetProgramSpecializationConstant(
4990         program,
4991         spec_id,
4992         spec_size,
4993         spec_value);
4994 }
4995 
4996 ///////////////////////////////////////////////////////////////////////////////
4997 #if defined(CL_ENABLE_LAYERS)
clSetProgramSpecializationConstant_disp(cl_program program,cl_uint spec_id,size_t spec_size,const void * spec_value)4998 static cl_int CL_API_CALL clSetProgramSpecializationConstant_disp(
4999     cl_program program,
5000     cl_uint spec_id,
5001     size_t spec_size,
5002     const void* spec_value)
5003 {
5004     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM);
5005     return program->dispatch->clSetProgramSpecializationConstant(
5006         program,
5007         spec_id,
5008         spec_size,
5009         spec_value);
5010 }
5011 #endif // defined(CL_ENABLE_LAYERS)
5012 
5013 ///////////////////////////////////////////////////////////////////////////////
5014 
clSetProgramReleaseCallback(cl_program program,void (CL_CALLBACK * pfn_notify)(cl_program program,void * user_data),void * user_data)5015 CL_API_ENTRY cl_int CL_API_CALL clSetProgramReleaseCallback(
5016     cl_program program,
5017     void (CL_CALLBACK* pfn_notify)(cl_program program, void* user_data),
5018     void* user_data)
5019 {
5020 #if defined(CL_ENABLE_LAYERS)
5021     if (khrFirstLayer)
5022         return khrFirstLayer->dispatch.clSetProgramReleaseCallback(
5023             program,
5024             pfn_notify,
5025             user_data);
5026 #endif // defined(CL_ENABLE_LAYERS)
5027     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM);
5028     return program->dispatch->clSetProgramReleaseCallback(
5029         program,
5030         pfn_notify,
5031         user_data);
5032 }
5033 
5034 ///////////////////////////////////////////////////////////////////////////////
5035 #if defined(CL_ENABLE_LAYERS)
clSetProgramReleaseCallback_disp(cl_program program,void (CL_CALLBACK * pfn_notify)(cl_program program,void * user_data),void * user_data)5036 static cl_int CL_API_CALL clSetProgramReleaseCallback_disp(
5037     cl_program program,
5038     void (CL_CALLBACK* pfn_notify)(cl_program program, void* user_data),
5039     void* user_data)
5040 {
5041     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(program, CL_INVALID_PROGRAM);
5042     return program->dispatch->clSetProgramReleaseCallback(
5043         program,
5044         pfn_notify,
5045         user_data);
5046 }
5047 #endif // defined(CL_ENABLE_LAYERS)
5048 
5049 ///////////////////////////////////////////////////////////////////////////////
5050 
clSetContextDestructorCallback(cl_context context,void (CL_CALLBACK * pfn_notify)(cl_context context,void * user_data),void * user_data)5051 CL_API_ENTRY cl_int CL_API_CALL clSetContextDestructorCallback(
5052     cl_context context,
5053     void (CL_CALLBACK* pfn_notify)(cl_context context, void* user_data),
5054     void* user_data)
5055 {
5056 #if defined(CL_ENABLE_LAYERS)
5057     if (khrFirstLayer)
5058         return khrFirstLayer->dispatch.clSetContextDestructorCallback(
5059             context,
5060             pfn_notify,
5061             user_data);
5062 #endif // defined(CL_ENABLE_LAYERS)
5063     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(context, CL_INVALID_CONTEXT);
5064     return context->dispatch->clSetContextDestructorCallback(
5065         context,
5066         pfn_notify,
5067         user_data);
5068 }
5069 
5070 ///////////////////////////////////////////////////////////////////////////////
5071 #if defined(CL_ENABLE_LAYERS)
clSetContextDestructorCallback_disp(cl_context context,void (CL_CALLBACK * pfn_notify)(cl_context context,void * user_data),void * user_data)5072 static cl_int CL_API_CALL clSetContextDestructorCallback_disp(
5073     cl_context context,
5074     void (CL_CALLBACK* pfn_notify)(cl_context context, void* user_data),
5075     void* user_data)
5076 {
5077     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(context, CL_INVALID_CONTEXT);
5078     return context->dispatch->clSetContextDestructorCallback(
5079         context,
5080         pfn_notify,
5081         user_data);
5082 }
5083 #endif // defined(CL_ENABLE_LAYERS)
5084 
5085 ///////////////////////////////////////////////////////////////////////////////
5086 
clCreateBufferWithProperties(cl_context context,const cl_mem_properties * properties,cl_mem_flags flags,size_t size,void * host_ptr,cl_int * errcode_ret)5087 CL_API_ENTRY cl_mem CL_API_CALL clCreateBufferWithProperties(
5088     cl_context context,
5089     const cl_mem_properties* properties,
5090     cl_mem_flags flags,
5091     size_t size,
5092     void* host_ptr,
5093     cl_int* errcode_ret)
5094 {
5095 #if defined(CL_ENABLE_LAYERS)
5096     if (khrFirstLayer)
5097         return khrFirstLayer->dispatch.clCreateBufferWithProperties(
5098             context,
5099             properties,
5100             flags,
5101             size,
5102             host_ptr,
5103             errcode_ret);
5104 #endif // defined(CL_ENABLE_LAYERS)
5105     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
5106     return context->dispatch->clCreateBufferWithProperties(
5107         context,
5108         properties,
5109         flags,
5110         size,
5111         host_ptr,
5112         errcode_ret);
5113 }
5114 
5115 ///////////////////////////////////////////////////////////////////////////////
5116 #if defined(CL_ENABLE_LAYERS)
clCreateBufferWithProperties_disp(cl_context context,const cl_mem_properties * properties,cl_mem_flags flags,size_t size,void * host_ptr,cl_int * errcode_ret)5117 static cl_mem CL_API_CALL clCreateBufferWithProperties_disp(
5118     cl_context context,
5119     const cl_mem_properties* properties,
5120     cl_mem_flags flags,
5121     size_t size,
5122     void* host_ptr,
5123     cl_int* errcode_ret)
5124 {
5125     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
5126     return context->dispatch->clCreateBufferWithProperties(
5127         context,
5128         properties,
5129         flags,
5130         size,
5131         host_ptr,
5132         errcode_ret);
5133 }
5134 #endif // defined(CL_ENABLE_LAYERS)
5135 
5136 ///////////////////////////////////////////////////////////////////////////////
5137 
clCreateImageWithProperties(cl_context context,const cl_mem_properties * properties,cl_mem_flags flags,const cl_image_format * image_format,const cl_image_desc * image_desc,void * host_ptr,cl_int * errcode_ret)5138 CL_API_ENTRY cl_mem CL_API_CALL clCreateImageWithProperties(
5139     cl_context context,
5140     const cl_mem_properties* properties,
5141     cl_mem_flags flags,
5142     const cl_image_format* image_format,
5143     const cl_image_desc* image_desc,
5144     void* host_ptr,
5145     cl_int* errcode_ret)
5146 {
5147 #if defined(CL_ENABLE_LAYERS)
5148     if (khrFirstLayer)
5149         return khrFirstLayer->dispatch.clCreateImageWithProperties(
5150             context,
5151             properties,
5152             flags,
5153             image_format,
5154             image_desc,
5155             host_ptr,
5156             errcode_ret);
5157 #endif // defined(CL_ENABLE_LAYERS)
5158     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
5159     return context->dispatch->clCreateImageWithProperties(
5160         context,
5161         properties,
5162         flags,
5163         image_format,
5164         image_desc,
5165         host_ptr,
5166         errcode_ret);
5167 }
5168 
5169 ///////////////////////////////////////////////////////////////////////////////
5170 #if defined(CL_ENABLE_LAYERS)
clCreateImageWithProperties_disp(cl_context context,const cl_mem_properties * properties,cl_mem_flags flags,const cl_image_format * image_format,const cl_image_desc * image_desc,void * host_ptr,cl_int * errcode_ret)5171 static cl_mem CL_API_CALL clCreateImageWithProperties_disp(
5172     cl_context context,
5173     const cl_mem_properties* properties,
5174     cl_mem_flags flags,
5175     const cl_image_format* image_format,
5176     const cl_image_desc* image_desc,
5177     void* host_ptr,
5178     cl_int* errcode_ret)
5179 {
5180     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
5181     return context->dispatch->clCreateImageWithProperties(
5182         context,
5183         properties,
5184         flags,
5185         image_format,
5186         image_desc,
5187         host_ptr,
5188         errcode_ret);
5189 }
5190 #endif // defined(CL_ENABLE_LAYERS)
5191 
5192 ///////////////////////////////////////////////////////////////////////////////
5193 
5194 // cl_ext_device_fission
5195 
clReleaseDeviceEXT(cl_device_id device)5196 CL_API_ENTRY cl_int CL_API_CALL clReleaseDeviceEXT(
5197     cl_device_id device)
5198 {
5199 #if defined(CL_ENABLE_LAYERS)
5200     if (khrFirstLayer)
5201         return khrFirstLayer->dispatch.clReleaseDeviceEXT(
5202             device);
5203 #endif // defined(CL_ENABLE_LAYERS)
5204     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(device, CL_INVALID_DEVICE);
5205     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(device->dispatch->clReleaseDeviceEXT);
5206     return device->dispatch->clReleaseDeviceEXT(
5207         device);
5208 }
5209 #if defined(CL_ENABLE_LAYERS)
clReleaseDeviceEXT_disp(cl_device_id device)5210 static cl_int CL_API_CALL clReleaseDeviceEXT_disp(
5211     cl_device_id device)
5212 {
5213     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(device, CL_INVALID_DEVICE);
5214     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(device->dispatch->clReleaseDeviceEXT);
5215     return device->dispatch->clReleaseDeviceEXT(
5216         device);
5217 }
5218 #endif // defined(CL_ENABLE_LAYERS)
5219 
clRetainDeviceEXT(cl_device_id device)5220 CL_API_ENTRY cl_int CL_API_CALL clRetainDeviceEXT(
5221     cl_device_id device)
5222 {
5223 #if defined(CL_ENABLE_LAYERS)
5224     if (khrFirstLayer)
5225         return khrFirstLayer->dispatch.clRetainDeviceEXT(
5226             device);
5227 #endif // defined(CL_ENABLE_LAYERS)
5228     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(device, CL_INVALID_DEVICE);
5229     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(device->dispatch->clRetainDeviceEXT);
5230     return device->dispatch->clRetainDeviceEXT(
5231         device);
5232 }
5233 #if defined(CL_ENABLE_LAYERS)
clRetainDeviceEXT_disp(cl_device_id device)5234 static cl_int CL_API_CALL clRetainDeviceEXT_disp(
5235     cl_device_id device)
5236 {
5237     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(device, CL_INVALID_DEVICE);
5238     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(device->dispatch->clRetainDeviceEXT);
5239     return device->dispatch->clRetainDeviceEXT(
5240         device);
5241 }
5242 #endif // defined(CL_ENABLE_LAYERS)
5243 
clCreateSubDevicesEXT(cl_device_id in_device,const cl_device_partition_property_ext * properties,cl_uint num_entries,cl_device_id * out_devices,cl_uint * num_devices)5244 CL_API_ENTRY cl_int CL_API_CALL clCreateSubDevicesEXT(
5245     cl_device_id in_device,
5246     const cl_device_partition_property_ext* properties,
5247     cl_uint num_entries,
5248     cl_device_id* out_devices,
5249     cl_uint* num_devices)
5250 {
5251 #if defined(CL_ENABLE_LAYERS)
5252     if (khrFirstLayer)
5253         return khrFirstLayer->dispatch.clCreateSubDevicesEXT(
5254             in_device,
5255             properties,
5256             num_entries,
5257             out_devices,
5258             num_devices);
5259 #endif // defined(CL_ENABLE_LAYERS)
5260     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(in_device, CL_INVALID_DEVICE);
5261     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(in_device->dispatch->clCreateSubDevicesEXT);
5262     return in_device->dispatch->clCreateSubDevicesEXT(
5263         in_device,
5264         properties,
5265         num_entries,
5266         out_devices,
5267         num_devices);
5268 }
5269 #if defined(CL_ENABLE_LAYERS)
clCreateSubDevicesEXT_disp(cl_device_id in_device,const cl_device_partition_property_ext * properties,cl_uint num_entries,cl_device_id * out_devices,cl_uint * num_devices)5270 static cl_int CL_API_CALL clCreateSubDevicesEXT_disp(
5271     cl_device_id in_device,
5272     const cl_device_partition_property_ext* properties,
5273     cl_uint num_entries,
5274     cl_device_id* out_devices,
5275     cl_uint* num_devices)
5276 {
5277     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(in_device, CL_INVALID_DEVICE);
5278     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(in_device->dispatch->clCreateSubDevicesEXT);
5279     return in_device->dispatch->clCreateSubDevicesEXT(
5280         in_device,
5281         properties,
5282         num_entries,
5283         out_devices,
5284         num_devices);
5285 }
5286 #endif // defined(CL_ENABLE_LAYERS)
5287 
5288 ///////////////////////////////////////////////////////////////////////////////
5289 
5290 // cl_khr_d3d10_sharing
5291 
5292 #if defined(_WIN32)
5293 
clGetDeviceIDsFromD3D10KHR(cl_platform_id platform,cl_d3d10_device_source_khr d3d_device_source,void * d3d_object,cl_d3d10_device_set_khr d3d_device_set,cl_uint num_entries,cl_device_id * devices,cl_uint * num_devices)5294 CL_API_ENTRY cl_int CL_API_CALL clGetDeviceIDsFromD3D10KHR(
5295     cl_platform_id platform,
5296     cl_d3d10_device_source_khr d3d_device_source,
5297     void* d3d_object,
5298     cl_d3d10_device_set_khr d3d_device_set,
5299     cl_uint num_entries,
5300     cl_device_id* devices,
5301     cl_uint* num_devices)
5302 {
5303 #if defined(CL_ENABLE_LAYERS)
5304     if (khrFirstLayer)
5305         return khrFirstLayer->dispatch.clGetDeviceIDsFromD3D10KHR(
5306             platform,
5307             d3d_device_source,
5308             d3d_object,
5309             d3d_device_set,
5310             num_entries,
5311             devices,
5312             num_devices);
5313 #endif // defined(CL_ENABLE_LAYERS)
5314     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(platform, CL_INVALID_PLATFORM);
5315     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(platform->dispatch->clGetDeviceIDsFromD3D10KHR);
5316     return platform->dispatch->clGetDeviceIDsFromD3D10KHR(
5317         platform,
5318         d3d_device_source,
5319         d3d_object,
5320         d3d_device_set,
5321         num_entries,
5322         devices,
5323         num_devices);
5324 }
5325 #if defined(CL_ENABLE_LAYERS)
clGetDeviceIDsFromD3D10KHR_disp(cl_platform_id platform,cl_d3d10_device_source_khr d3d_device_source,void * d3d_object,cl_d3d10_device_set_khr d3d_device_set,cl_uint num_entries,cl_device_id * devices,cl_uint * num_devices)5326 static cl_int CL_API_CALL clGetDeviceIDsFromD3D10KHR_disp(
5327     cl_platform_id platform,
5328     cl_d3d10_device_source_khr d3d_device_source,
5329     void* d3d_object,
5330     cl_d3d10_device_set_khr d3d_device_set,
5331     cl_uint num_entries,
5332     cl_device_id* devices,
5333     cl_uint* num_devices)
5334 {
5335     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(platform, CL_INVALID_PLATFORM);
5336     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(platform->dispatch->clGetDeviceIDsFromD3D10KHR);
5337     return platform->dispatch->clGetDeviceIDsFromD3D10KHR(
5338         platform,
5339         d3d_device_source,
5340         d3d_object,
5341         d3d_device_set,
5342         num_entries,
5343         devices,
5344         num_devices);
5345 }
5346 #endif // defined(CL_ENABLE_LAYERS)
5347 
clCreateFromD3D10BufferKHR(cl_context context,cl_mem_flags flags,ID3D10Buffer * resource,cl_int * errcode_ret)5348 CL_API_ENTRY cl_mem CL_API_CALL clCreateFromD3D10BufferKHR(
5349     cl_context context,
5350     cl_mem_flags flags,
5351     ID3D10Buffer* resource,
5352     cl_int* errcode_ret)
5353 {
5354 #if defined(CL_ENABLE_LAYERS)
5355     if (khrFirstLayer)
5356         return khrFirstLayer->dispatch.clCreateFromD3D10BufferKHR(
5357             context,
5358             flags,
5359             resource,
5360             errcode_ret);
5361 #endif // defined(CL_ENABLE_LAYERS)
5362     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
5363     KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(context->dispatch->clCreateFromD3D10BufferKHR);
5364     return context->dispatch->clCreateFromD3D10BufferKHR(
5365         context,
5366         flags,
5367         resource,
5368         errcode_ret);
5369 }
5370 #if defined(CL_ENABLE_LAYERS)
clCreateFromD3D10BufferKHR_disp(cl_context context,cl_mem_flags flags,ID3D10Buffer * resource,cl_int * errcode_ret)5371 static cl_mem CL_API_CALL clCreateFromD3D10BufferKHR_disp(
5372     cl_context context,
5373     cl_mem_flags flags,
5374     ID3D10Buffer* resource,
5375     cl_int* errcode_ret)
5376 {
5377     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
5378     KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(context->dispatch->clCreateFromD3D10BufferKHR);
5379     return context->dispatch->clCreateFromD3D10BufferKHR(
5380         context,
5381         flags,
5382         resource,
5383         errcode_ret);
5384 }
5385 #endif // defined(CL_ENABLE_LAYERS)
5386 
clCreateFromD3D10Texture2DKHR(cl_context context,cl_mem_flags flags,ID3D10Texture2D * resource,UINT subresource,cl_int * errcode_ret)5387 CL_API_ENTRY cl_mem CL_API_CALL clCreateFromD3D10Texture2DKHR(
5388     cl_context context,
5389     cl_mem_flags flags,
5390     ID3D10Texture2D* resource,
5391     UINT subresource,
5392     cl_int* errcode_ret)
5393 {
5394 #if defined(CL_ENABLE_LAYERS)
5395     if (khrFirstLayer)
5396         return khrFirstLayer->dispatch.clCreateFromD3D10Texture2DKHR(
5397             context,
5398             flags,
5399             resource,
5400             subresource,
5401             errcode_ret);
5402 #endif // defined(CL_ENABLE_LAYERS)
5403     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
5404     KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(context->dispatch->clCreateFromD3D10Texture2DKHR);
5405     return context->dispatch->clCreateFromD3D10Texture2DKHR(
5406         context,
5407         flags,
5408         resource,
5409         subresource,
5410         errcode_ret);
5411 }
5412 #if defined(CL_ENABLE_LAYERS)
clCreateFromD3D10Texture2DKHR_disp(cl_context context,cl_mem_flags flags,ID3D10Texture2D * resource,UINT subresource,cl_int * errcode_ret)5413 static cl_mem CL_API_CALL clCreateFromD3D10Texture2DKHR_disp(
5414     cl_context context,
5415     cl_mem_flags flags,
5416     ID3D10Texture2D* resource,
5417     UINT subresource,
5418     cl_int* errcode_ret)
5419 {
5420     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
5421     KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(context->dispatch->clCreateFromD3D10Texture2DKHR);
5422     return context->dispatch->clCreateFromD3D10Texture2DKHR(
5423         context,
5424         flags,
5425         resource,
5426         subresource,
5427         errcode_ret);
5428 }
5429 #endif // defined(CL_ENABLE_LAYERS)
5430 
clCreateFromD3D10Texture3DKHR(cl_context context,cl_mem_flags flags,ID3D10Texture3D * resource,UINT subresource,cl_int * errcode_ret)5431 CL_API_ENTRY cl_mem CL_API_CALL clCreateFromD3D10Texture3DKHR(
5432     cl_context context,
5433     cl_mem_flags flags,
5434     ID3D10Texture3D* resource,
5435     UINT subresource,
5436     cl_int* errcode_ret)
5437 {
5438 #if defined(CL_ENABLE_LAYERS)
5439     if (khrFirstLayer)
5440         return khrFirstLayer->dispatch.clCreateFromD3D10Texture3DKHR(
5441             context,
5442             flags,
5443             resource,
5444             subresource,
5445             errcode_ret);
5446 #endif // defined(CL_ENABLE_LAYERS)
5447     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
5448     KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(context->dispatch->clCreateFromD3D10Texture3DKHR);
5449     return context->dispatch->clCreateFromD3D10Texture3DKHR(
5450         context,
5451         flags,
5452         resource,
5453         subresource,
5454         errcode_ret);
5455 }
5456 #if defined(CL_ENABLE_LAYERS)
clCreateFromD3D10Texture3DKHR_disp(cl_context context,cl_mem_flags flags,ID3D10Texture3D * resource,UINT subresource,cl_int * errcode_ret)5457 static cl_mem CL_API_CALL clCreateFromD3D10Texture3DKHR_disp(
5458     cl_context context,
5459     cl_mem_flags flags,
5460     ID3D10Texture3D* resource,
5461     UINT subresource,
5462     cl_int* errcode_ret)
5463 {
5464     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
5465     KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(context->dispatch->clCreateFromD3D10Texture3DKHR);
5466     return context->dispatch->clCreateFromD3D10Texture3DKHR(
5467         context,
5468         flags,
5469         resource,
5470         subresource,
5471         errcode_ret);
5472 }
5473 #endif // defined(CL_ENABLE_LAYERS)
5474 
clEnqueueAcquireD3D10ObjectsKHR(cl_command_queue command_queue,cl_uint num_objects,const cl_mem * mem_objects,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)5475 CL_API_ENTRY cl_int CL_API_CALL clEnqueueAcquireD3D10ObjectsKHR(
5476     cl_command_queue command_queue,
5477     cl_uint num_objects,
5478     const cl_mem* mem_objects,
5479     cl_uint num_events_in_wait_list,
5480     const cl_event* event_wait_list,
5481     cl_event* event)
5482 {
5483 #if defined(CL_ENABLE_LAYERS)
5484     if (khrFirstLayer)
5485         return khrFirstLayer->dispatch.clEnqueueAcquireD3D10ObjectsKHR(
5486             command_queue,
5487             num_objects,
5488             mem_objects,
5489             num_events_in_wait_list,
5490             event_wait_list,
5491             event);
5492 #endif // defined(CL_ENABLE_LAYERS)
5493     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
5494     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(command_queue->dispatch->clEnqueueAcquireD3D10ObjectsKHR);
5495     return command_queue->dispatch->clEnqueueAcquireD3D10ObjectsKHR(
5496         command_queue,
5497         num_objects,
5498         mem_objects,
5499         num_events_in_wait_list,
5500         event_wait_list,
5501         event);
5502 }
5503 #if defined(CL_ENABLE_LAYERS)
clEnqueueAcquireD3D10ObjectsKHR_disp(cl_command_queue command_queue,cl_uint num_objects,const cl_mem * mem_objects,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)5504 static cl_int CL_API_CALL clEnqueueAcquireD3D10ObjectsKHR_disp(
5505     cl_command_queue command_queue,
5506     cl_uint num_objects,
5507     const cl_mem* mem_objects,
5508     cl_uint num_events_in_wait_list,
5509     const cl_event* event_wait_list,
5510     cl_event* event)
5511 {
5512     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
5513     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(command_queue->dispatch->clEnqueueAcquireD3D10ObjectsKHR);
5514     return command_queue->dispatch->clEnqueueAcquireD3D10ObjectsKHR(
5515         command_queue,
5516         num_objects,
5517         mem_objects,
5518         num_events_in_wait_list,
5519         event_wait_list,
5520         event);
5521 }
5522 #endif // defined(CL_ENABLE_LAYERS)
5523 
clEnqueueReleaseD3D10ObjectsKHR(cl_command_queue command_queue,cl_uint num_objects,const cl_mem * mem_objects,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)5524 CL_API_ENTRY cl_int CL_API_CALL clEnqueueReleaseD3D10ObjectsKHR(
5525     cl_command_queue command_queue,
5526     cl_uint num_objects,
5527     const cl_mem* mem_objects,
5528     cl_uint num_events_in_wait_list,
5529     const cl_event* event_wait_list,
5530     cl_event* event)
5531 {
5532 #if defined(CL_ENABLE_LAYERS)
5533     if (khrFirstLayer)
5534         return khrFirstLayer->dispatch.clEnqueueReleaseD3D10ObjectsKHR(
5535             command_queue,
5536             num_objects,
5537             mem_objects,
5538             num_events_in_wait_list,
5539             event_wait_list,
5540             event);
5541 #endif // defined(CL_ENABLE_LAYERS)
5542     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
5543     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(command_queue->dispatch->clEnqueueReleaseD3D10ObjectsKHR);
5544     return command_queue->dispatch->clEnqueueReleaseD3D10ObjectsKHR(
5545         command_queue,
5546         num_objects,
5547         mem_objects,
5548         num_events_in_wait_list,
5549         event_wait_list,
5550         event);
5551 }
5552 #if defined(CL_ENABLE_LAYERS)
clEnqueueReleaseD3D10ObjectsKHR_disp(cl_command_queue command_queue,cl_uint num_objects,const cl_mem * mem_objects,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)5553 static cl_int CL_API_CALL clEnqueueReleaseD3D10ObjectsKHR_disp(
5554     cl_command_queue command_queue,
5555     cl_uint num_objects,
5556     const cl_mem* mem_objects,
5557     cl_uint num_events_in_wait_list,
5558     const cl_event* event_wait_list,
5559     cl_event* event)
5560 {
5561     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
5562     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(command_queue->dispatch->clEnqueueReleaseD3D10ObjectsKHR);
5563     return command_queue->dispatch->clEnqueueReleaseD3D10ObjectsKHR(
5564         command_queue,
5565         num_objects,
5566         mem_objects,
5567         num_events_in_wait_list,
5568         event_wait_list,
5569         event);
5570 }
5571 #endif // defined(CL_ENABLE_LAYERS)
5572 
5573 #endif // defined(_WIN32)
5574 
5575 ///////////////////////////////////////////////////////////////////////////////
5576 
5577 // cl_khr_d3d11_sharing
5578 
5579 #if defined(_WIN32)
5580 
clGetDeviceIDsFromD3D11KHR(cl_platform_id platform,cl_d3d11_device_source_khr d3d_device_source,void * d3d_object,cl_d3d11_device_set_khr d3d_device_set,cl_uint num_entries,cl_device_id * devices,cl_uint * num_devices)5581 CL_API_ENTRY cl_int CL_API_CALL clGetDeviceIDsFromD3D11KHR(
5582     cl_platform_id platform,
5583     cl_d3d11_device_source_khr d3d_device_source,
5584     void* d3d_object,
5585     cl_d3d11_device_set_khr d3d_device_set,
5586     cl_uint num_entries,
5587     cl_device_id* devices,
5588     cl_uint* num_devices)
5589 {
5590 #if defined(CL_ENABLE_LAYERS)
5591     if (khrFirstLayer)
5592         return khrFirstLayer->dispatch.clGetDeviceIDsFromD3D11KHR(
5593             platform,
5594             d3d_device_source,
5595             d3d_object,
5596             d3d_device_set,
5597             num_entries,
5598             devices,
5599             num_devices);
5600 #endif // defined(CL_ENABLE_LAYERS)
5601     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(platform, CL_INVALID_PLATFORM);
5602     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(platform->dispatch->clGetDeviceIDsFromD3D11KHR);
5603     return platform->dispatch->clGetDeviceIDsFromD3D11KHR(
5604         platform,
5605         d3d_device_source,
5606         d3d_object,
5607         d3d_device_set,
5608         num_entries,
5609         devices,
5610         num_devices);
5611 }
5612 #if defined(CL_ENABLE_LAYERS)
clGetDeviceIDsFromD3D11KHR_disp(cl_platform_id platform,cl_d3d11_device_source_khr d3d_device_source,void * d3d_object,cl_d3d11_device_set_khr d3d_device_set,cl_uint num_entries,cl_device_id * devices,cl_uint * num_devices)5613 static cl_int CL_API_CALL clGetDeviceIDsFromD3D11KHR_disp(
5614     cl_platform_id platform,
5615     cl_d3d11_device_source_khr d3d_device_source,
5616     void* d3d_object,
5617     cl_d3d11_device_set_khr d3d_device_set,
5618     cl_uint num_entries,
5619     cl_device_id* devices,
5620     cl_uint* num_devices)
5621 {
5622     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(platform, CL_INVALID_PLATFORM);
5623     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(platform->dispatch->clGetDeviceIDsFromD3D11KHR);
5624     return platform->dispatch->clGetDeviceIDsFromD3D11KHR(
5625         platform,
5626         d3d_device_source,
5627         d3d_object,
5628         d3d_device_set,
5629         num_entries,
5630         devices,
5631         num_devices);
5632 }
5633 #endif // defined(CL_ENABLE_LAYERS)
5634 
clCreateFromD3D11BufferKHR(cl_context context,cl_mem_flags flags,ID3D11Buffer * resource,cl_int * errcode_ret)5635 CL_API_ENTRY cl_mem CL_API_CALL clCreateFromD3D11BufferKHR(
5636     cl_context context,
5637     cl_mem_flags flags,
5638     ID3D11Buffer* resource,
5639     cl_int* errcode_ret)
5640 {
5641 #if defined(CL_ENABLE_LAYERS)
5642     if (khrFirstLayer)
5643         return khrFirstLayer->dispatch.clCreateFromD3D11BufferKHR(
5644             context,
5645             flags,
5646             resource,
5647             errcode_ret);
5648 #endif // defined(CL_ENABLE_LAYERS)
5649     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
5650     KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(context->dispatch->clCreateFromD3D11BufferKHR);
5651     return context->dispatch->clCreateFromD3D11BufferKHR(
5652         context,
5653         flags,
5654         resource,
5655         errcode_ret);
5656 }
5657 #if defined(CL_ENABLE_LAYERS)
clCreateFromD3D11BufferKHR_disp(cl_context context,cl_mem_flags flags,ID3D11Buffer * resource,cl_int * errcode_ret)5658 static cl_mem CL_API_CALL clCreateFromD3D11BufferKHR_disp(
5659     cl_context context,
5660     cl_mem_flags flags,
5661     ID3D11Buffer* resource,
5662     cl_int* errcode_ret)
5663 {
5664     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
5665     KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(context->dispatch->clCreateFromD3D11BufferKHR);
5666     return context->dispatch->clCreateFromD3D11BufferKHR(
5667         context,
5668         flags,
5669         resource,
5670         errcode_ret);
5671 }
5672 #endif // defined(CL_ENABLE_LAYERS)
5673 
clCreateFromD3D11Texture2DKHR(cl_context context,cl_mem_flags flags,ID3D11Texture2D * resource,UINT subresource,cl_int * errcode_ret)5674 CL_API_ENTRY cl_mem CL_API_CALL clCreateFromD3D11Texture2DKHR(
5675     cl_context context,
5676     cl_mem_flags flags,
5677     ID3D11Texture2D* resource,
5678     UINT subresource,
5679     cl_int* errcode_ret)
5680 {
5681 #if defined(CL_ENABLE_LAYERS)
5682     if (khrFirstLayer)
5683         return khrFirstLayer->dispatch.clCreateFromD3D11Texture2DKHR(
5684             context,
5685             flags,
5686             resource,
5687             subresource,
5688             errcode_ret);
5689 #endif // defined(CL_ENABLE_LAYERS)
5690     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
5691     KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(context->dispatch->clCreateFromD3D11Texture2DKHR);
5692     return context->dispatch->clCreateFromD3D11Texture2DKHR(
5693         context,
5694         flags,
5695         resource,
5696         subresource,
5697         errcode_ret);
5698 }
5699 #if defined(CL_ENABLE_LAYERS)
clCreateFromD3D11Texture2DKHR_disp(cl_context context,cl_mem_flags flags,ID3D11Texture2D * resource,UINT subresource,cl_int * errcode_ret)5700 static cl_mem CL_API_CALL clCreateFromD3D11Texture2DKHR_disp(
5701     cl_context context,
5702     cl_mem_flags flags,
5703     ID3D11Texture2D* resource,
5704     UINT subresource,
5705     cl_int* errcode_ret)
5706 {
5707     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
5708     KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(context->dispatch->clCreateFromD3D11Texture2DKHR);
5709     return context->dispatch->clCreateFromD3D11Texture2DKHR(
5710         context,
5711         flags,
5712         resource,
5713         subresource,
5714         errcode_ret);
5715 }
5716 #endif // defined(CL_ENABLE_LAYERS)
5717 
clCreateFromD3D11Texture3DKHR(cl_context context,cl_mem_flags flags,ID3D11Texture3D * resource,UINT subresource,cl_int * errcode_ret)5718 CL_API_ENTRY cl_mem CL_API_CALL clCreateFromD3D11Texture3DKHR(
5719     cl_context context,
5720     cl_mem_flags flags,
5721     ID3D11Texture3D* resource,
5722     UINT subresource,
5723     cl_int* errcode_ret)
5724 {
5725 #if defined(CL_ENABLE_LAYERS)
5726     if (khrFirstLayer)
5727         return khrFirstLayer->dispatch.clCreateFromD3D11Texture3DKHR(
5728             context,
5729             flags,
5730             resource,
5731             subresource,
5732             errcode_ret);
5733 #endif // defined(CL_ENABLE_LAYERS)
5734     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
5735     KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(context->dispatch->clCreateFromD3D11Texture3DKHR);
5736     return context->dispatch->clCreateFromD3D11Texture3DKHR(
5737         context,
5738         flags,
5739         resource,
5740         subresource,
5741         errcode_ret);
5742 }
5743 #if defined(CL_ENABLE_LAYERS)
clCreateFromD3D11Texture3DKHR_disp(cl_context context,cl_mem_flags flags,ID3D11Texture3D * resource,UINT subresource,cl_int * errcode_ret)5744 static cl_mem CL_API_CALL clCreateFromD3D11Texture3DKHR_disp(
5745     cl_context context,
5746     cl_mem_flags flags,
5747     ID3D11Texture3D* resource,
5748     UINT subresource,
5749     cl_int* errcode_ret)
5750 {
5751     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
5752     KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(context->dispatch->clCreateFromD3D11Texture3DKHR);
5753     return context->dispatch->clCreateFromD3D11Texture3DKHR(
5754         context,
5755         flags,
5756         resource,
5757         subresource,
5758         errcode_ret);
5759 }
5760 #endif // defined(CL_ENABLE_LAYERS)
5761 
clEnqueueAcquireD3D11ObjectsKHR(cl_command_queue command_queue,cl_uint num_objects,const cl_mem * mem_objects,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)5762 CL_API_ENTRY cl_int CL_API_CALL clEnqueueAcquireD3D11ObjectsKHR(
5763     cl_command_queue command_queue,
5764     cl_uint num_objects,
5765     const cl_mem* mem_objects,
5766     cl_uint num_events_in_wait_list,
5767     const cl_event* event_wait_list,
5768     cl_event* event)
5769 {
5770 #if defined(CL_ENABLE_LAYERS)
5771     if (khrFirstLayer)
5772         return khrFirstLayer->dispatch.clEnqueueAcquireD3D11ObjectsKHR(
5773             command_queue,
5774             num_objects,
5775             mem_objects,
5776             num_events_in_wait_list,
5777             event_wait_list,
5778             event);
5779 #endif // defined(CL_ENABLE_LAYERS)
5780     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
5781     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(command_queue->dispatch->clEnqueueAcquireD3D11ObjectsKHR);
5782     return command_queue->dispatch->clEnqueueAcquireD3D11ObjectsKHR(
5783         command_queue,
5784         num_objects,
5785         mem_objects,
5786         num_events_in_wait_list,
5787         event_wait_list,
5788         event);
5789 }
5790 #if defined(CL_ENABLE_LAYERS)
clEnqueueAcquireD3D11ObjectsKHR_disp(cl_command_queue command_queue,cl_uint num_objects,const cl_mem * mem_objects,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)5791 static cl_int CL_API_CALL clEnqueueAcquireD3D11ObjectsKHR_disp(
5792     cl_command_queue command_queue,
5793     cl_uint num_objects,
5794     const cl_mem* mem_objects,
5795     cl_uint num_events_in_wait_list,
5796     const cl_event* event_wait_list,
5797     cl_event* event)
5798 {
5799     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
5800     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(command_queue->dispatch->clEnqueueAcquireD3D11ObjectsKHR);
5801     return command_queue->dispatch->clEnqueueAcquireD3D11ObjectsKHR(
5802         command_queue,
5803         num_objects,
5804         mem_objects,
5805         num_events_in_wait_list,
5806         event_wait_list,
5807         event);
5808 }
5809 #endif // defined(CL_ENABLE_LAYERS)
5810 
clEnqueueReleaseD3D11ObjectsKHR(cl_command_queue command_queue,cl_uint num_objects,const cl_mem * mem_objects,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)5811 CL_API_ENTRY cl_int CL_API_CALL clEnqueueReleaseD3D11ObjectsKHR(
5812     cl_command_queue command_queue,
5813     cl_uint num_objects,
5814     const cl_mem* mem_objects,
5815     cl_uint num_events_in_wait_list,
5816     const cl_event* event_wait_list,
5817     cl_event* event)
5818 {
5819 #if defined(CL_ENABLE_LAYERS)
5820     if (khrFirstLayer)
5821         return khrFirstLayer->dispatch.clEnqueueReleaseD3D11ObjectsKHR(
5822             command_queue,
5823             num_objects,
5824             mem_objects,
5825             num_events_in_wait_list,
5826             event_wait_list,
5827             event);
5828 #endif // defined(CL_ENABLE_LAYERS)
5829     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
5830     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(command_queue->dispatch->clEnqueueReleaseD3D11ObjectsKHR);
5831     return command_queue->dispatch->clEnqueueReleaseD3D11ObjectsKHR(
5832         command_queue,
5833         num_objects,
5834         mem_objects,
5835         num_events_in_wait_list,
5836         event_wait_list,
5837         event);
5838 }
5839 #if defined(CL_ENABLE_LAYERS)
clEnqueueReleaseD3D11ObjectsKHR_disp(cl_command_queue command_queue,cl_uint num_objects,const cl_mem * mem_objects,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)5840 static cl_int CL_API_CALL clEnqueueReleaseD3D11ObjectsKHR_disp(
5841     cl_command_queue command_queue,
5842     cl_uint num_objects,
5843     const cl_mem* mem_objects,
5844     cl_uint num_events_in_wait_list,
5845     const cl_event* event_wait_list,
5846     cl_event* event)
5847 {
5848     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
5849     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(command_queue->dispatch->clEnqueueReleaseD3D11ObjectsKHR);
5850     return command_queue->dispatch->clEnqueueReleaseD3D11ObjectsKHR(
5851         command_queue,
5852         num_objects,
5853         mem_objects,
5854         num_events_in_wait_list,
5855         event_wait_list,
5856         event);
5857 }
5858 #endif // defined(CL_ENABLE_LAYERS)
5859 
5860 #endif // defined(_WIN32)
5861 
5862 ///////////////////////////////////////////////////////////////////////////////
5863 
5864 // cl_khr_dx9_media_sharing
5865 
5866 #if defined(_WIN32)
5867 
clGetDeviceIDsFromDX9MediaAdapterKHR(cl_platform_id platform,cl_uint num_media_adapters,cl_dx9_media_adapter_type_khr * media_adapter_type,void * media_adapters,cl_dx9_media_adapter_set_khr media_adapter_set,cl_uint num_entries,cl_device_id * devices,cl_uint * num_devices)5868 CL_API_ENTRY cl_int CL_API_CALL clGetDeviceIDsFromDX9MediaAdapterKHR(
5869     cl_platform_id platform,
5870     cl_uint num_media_adapters,
5871     cl_dx9_media_adapter_type_khr* media_adapter_type,
5872     void* media_adapters,
5873     cl_dx9_media_adapter_set_khr media_adapter_set,
5874     cl_uint num_entries,
5875     cl_device_id* devices,
5876     cl_uint* num_devices)
5877 {
5878 #if defined(CL_ENABLE_LAYERS)
5879     if (khrFirstLayer)
5880         return khrFirstLayer->dispatch.clGetDeviceIDsFromDX9MediaAdapterKHR(
5881             platform,
5882             num_media_adapters,
5883             media_adapter_type,
5884             media_adapters,
5885             media_adapter_set,
5886             num_entries,
5887             devices,
5888             num_devices);
5889 #endif // defined(CL_ENABLE_LAYERS)
5890     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(platform, CL_INVALID_PLATFORM);
5891     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(platform->dispatch->clGetDeviceIDsFromDX9MediaAdapterKHR);
5892     return platform->dispatch->clGetDeviceIDsFromDX9MediaAdapterKHR(
5893         platform,
5894         num_media_adapters,
5895         media_adapter_type,
5896         media_adapters,
5897         media_adapter_set,
5898         num_entries,
5899         devices,
5900         num_devices);
5901 }
5902 #if defined(CL_ENABLE_LAYERS)
clGetDeviceIDsFromDX9MediaAdapterKHR_disp(cl_platform_id platform,cl_uint num_media_adapters,cl_dx9_media_adapter_type_khr * media_adapter_type,void * media_adapters,cl_dx9_media_adapter_set_khr media_adapter_set,cl_uint num_entries,cl_device_id * devices,cl_uint * num_devices)5903 static cl_int CL_API_CALL clGetDeviceIDsFromDX9MediaAdapterKHR_disp(
5904     cl_platform_id platform,
5905     cl_uint num_media_adapters,
5906     cl_dx9_media_adapter_type_khr* media_adapter_type,
5907     void* media_adapters,
5908     cl_dx9_media_adapter_set_khr media_adapter_set,
5909     cl_uint num_entries,
5910     cl_device_id* devices,
5911     cl_uint* num_devices)
5912 {
5913     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(platform, CL_INVALID_PLATFORM);
5914     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(platform->dispatch->clGetDeviceIDsFromDX9MediaAdapterKHR);
5915     return platform->dispatch->clGetDeviceIDsFromDX9MediaAdapterKHR(
5916         platform,
5917         num_media_adapters,
5918         media_adapter_type,
5919         media_adapters,
5920         media_adapter_set,
5921         num_entries,
5922         devices,
5923         num_devices);
5924 }
5925 #endif // defined(CL_ENABLE_LAYERS)
5926 
clCreateFromDX9MediaSurfaceKHR(cl_context context,cl_mem_flags flags,cl_dx9_media_adapter_type_khr adapter_type,void * surface_info,cl_uint plane,cl_int * errcode_ret)5927 CL_API_ENTRY cl_mem CL_API_CALL clCreateFromDX9MediaSurfaceKHR(
5928     cl_context context,
5929     cl_mem_flags flags,
5930     cl_dx9_media_adapter_type_khr adapter_type,
5931     void* surface_info,
5932     cl_uint plane,
5933     cl_int* errcode_ret)
5934 {
5935 #if defined(CL_ENABLE_LAYERS)
5936     if (khrFirstLayer)
5937         return khrFirstLayer->dispatch.clCreateFromDX9MediaSurfaceKHR(
5938             context,
5939             flags,
5940             adapter_type,
5941             surface_info,
5942             plane,
5943             errcode_ret);
5944 #endif // defined(CL_ENABLE_LAYERS)
5945     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
5946     KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(context->dispatch->clCreateFromDX9MediaSurfaceKHR);
5947     return context->dispatch->clCreateFromDX9MediaSurfaceKHR(
5948         context,
5949         flags,
5950         adapter_type,
5951         surface_info,
5952         plane,
5953         errcode_ret);
5954 }
5955 #if defined(CL_ENABLE_LAYERS)
clCreateFromDX9MediaSurfaceKHR_disp(cl_context context,cl_mem_flags flags,cl_dx9_media_adapter_type_khr adapter_type,void * surface_info,cl_uint plane,cl_int * errcode_ret)5956 static cl_mem CL_API_CALL clCreateFromDX9MediaSurfaceKHR_disp(
5957     cl_context context,
5958     cl_mem_flags flags,
5959     cl_dx9_media_adapter_type_khr adapter_type,
5960     void* surface_info,
5961     cl_uint plane,
5962     cl_int* errcode_ret)
5963 {
5964     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
5965     KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(context->dispatch->clCreateFromDX9MediaSurfaceKHR);
5966     return context->dispatch->clCreateFromDX9MediaSurfaceKHR(
5967         context,
5968         flags,
5969         adapter_type,
5970         surface_info,
5971         plane,
5972         errcode_ret);
5973 }
5974 #endif // defined(CL_ENABLE_LAYERS)
5975 
clEnqueueAcquireDX9MediaSurfacesKHR(cl_command_queue command_queue,cl_uint num_objects,const cl_mem * mem_objects,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)5976 CL_API_ENTRY cl_int CL_API_CALL clEnqueueAcquireDX9MediaSurfacesKHR(
5977     cl_command_queue command_queue,
5978     cl_uint num_objects,
5979     const cl_mem* mem_objects,
5980     cl_uint num_events_in_wait_list,
5981     const cl_event* event_wait_list,
5982     cl_event* event)
5983 {
5984 #if defined(CL_ENABLE_LAYERS)
5985     if (khrFirstLayer)
5986         return khrFirstLayer->dispatch.clEnqueueAcquireDX9MediaSurfacesKHR(
5987             command_queue,
5988             num_objects,
5989             mem_objects,
5990             num_events_in_wait_list,
5991             event_wait_list,
5992             event);
5993 #endif // defined(CL_ENABLE_LAYERS)
5994     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
5995     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(command_queue->dispatch->clEnqueueAcquireDX9MediaSurfacesKHR);
5996     return command_queue->dispatch->clEnqueueAcquireDX9MediaSurfacesKHR(
5997         command_queue,
5998         num_objects,
5999         mem_objects,
6000         num_events_in_wait_list,
6001         event_wait_list,
6002         event);
6003 }
6004 #if defined(CL_ENABLE_LAYERS)
clEnqueueAcquireDX9MediaSurfacesKHR_disp(cl_command_queue command_queue,cl_uint num_objects,const cl_mem * mem_objects,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)6005 static cl_int CL_API_CALL clEnqueueAcquireDX9MediaSurfacesKHR_disp(
6006     cl_command_queue command_queue,
6007     cl_uint num_objects,
6008     const cl_mem* mem_objects,
6009     cl_uint num_events_in_wait_list,
6010     const cl_event* event_wait_list,
6011     cl_event* event)
6012 {
6013     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
6014     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(command_queue->dispatch->clEnqueueAcquireDX9MediaSurfacesKHR);
6015     return command_queue->dispatch->clEnqueueAcquireDX9MediaSurfacesKHR(
6016         command_queue,
6017         num_objects,
6018         mem_objects,
6019         num_events_in_wait_list,
6020         event_wait_list,
6021         event);
6022 }
6023 #endif // defined(CL_ENABLE_LAYERS)
6024 
clEnqueueReleaseDX9MediaSurfacesKHR(cl_command_queue command_queue,cl_uint num_objects,const cl_mem * mem_objects,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)6025 CL_API_ENTRY cl_int CL_API_CALL clEnqueueReleaseDX9MediaSurfacesKHR(
6026     cl_command_queue command_queue,
6027     cl_uint num_objects,
6028     const cl_mem* mem_objects,
6029     cl_uint num_events_in_wait_list,
6030     const cl_event* event_wait_list,
6031     cl_event* event)
6032 {
6033 #if defined(CL_ENABLE_LAYERS)
6034     if (khrFirstLayer)
6035         return khrFirstLayer->dispatch.clEnqueueReleaseDX9MediaSurfacesKHR(
6036             command_queue,
6037             num_objects,
6038             mem_objects,
6039             num_events_in_wait_list,
6040             event_wait_list,
6041             event);
6042 #endif // defined(CL_ENABLE_LAYERS)
6043     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
6044     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(command_queue->dispatch->clEnqueueReleaseDX9MediaSurfacesKHR);
6045     return command_queue->dispatch->clEnqueueReleaseDX9MediaSurfacesKHR(
6046         command_queue,
6047         num_objects,
6048         mem_objects,
6049         num_events_in_wait_list,
6050         event_wait_list,
6051         event);
6052 }
6053 #if defined(CL_ENABLE_LAYERS)
clEnqueueReleaseDX9MediaSurfacesKHR_disp(cl_command_queue command_queue,cl_uint num_objects,const cl_mem * mem_objects,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)6054 static cl_int CL_API_CALL clEnqueueReleaseDX9MediaSurfacesKHR_disp(
6055     cl_command_queue command_queue,
6056     cl_uint num_objects,
6057     const cl_mem* mem_objects,
6058     cl_uint num_events_in_wait_list,
6059     const cl_event* event_wait_list,
6060     cl_event* event)
6061 {
6062     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
6063     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(command_queue->dispatch->clEnqueueReleaseDX9MediaSurfacesKHR);
6064     return command_queue->dispatch->clEnqueueReleaseDX9MediaSurfacesKHR(
6065         command_queue,
6066         num_objects,
6067         mem_objects,
6068         num_events_in_wait_list,
6069         event_wait_list,
6070         event);
6071 }
6072 #endif // defined(CL_ENABLE_LAYERS)
6073 
6074 #endif // defined(_WIN32)
6075 
6076 ///////////////////////////////////////////////////////////////////////////////
6077 
6078 // cl_khr_egl_event
6079 
clCreateEventFromEGLSyncKHR(cl_context context,CLeglSyncKHR sync,CLeglDisplayKHR display,cl_int * errcode_ret)6080 CL_API_ENTRY cl_event CL_API_CALL clCreateEventFromEGLSyncKHR(
6081     cl_context context,
6082     CLeglSyncKHR sync,
6083     CLeglDisplayKHR display,
6084     cl_int* errcode_ret)
6085 {
6086 #if defined(CL_ENABLE_LAYERS)
6087     if (khrFirstLayer)
6088         return khrFirstLayer->dispatch.clCreateEventFromEGLSyncKHR(
6089             context,
6090             sync,
6091             display,
6092             errcode_ret);
6093 #endif // defined(CL_ENABLE_LAYERS)
6094     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
6095     KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(context->dispatch->clCreateEventFromEGLSyncKHR);
6096     return context->dispatch->clCreateEventFromEGLSyncKHR(
6097         context,
6098         sync,
6099         display,
6100         errcode_ret);
6101 }
6102 #if defined(CL_ENABLE_LAYERS)
clCreateEventFromEGLSyncKHR_disp(cl_context context,CLeglSyncKHR sync,CLeglDisplayKHR display,cl_int * errcode_ret)6103 static cl_event CL_API_CALL clCreateEventFromEGLSyncKHR_disp(
6104     cl_context context,
6105     CLeglSyncKHR sync,
6106     CLeglDisplayKHR display,
6107     cl_int* errcode_ret)
6108 {
6109     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
6110     KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(context->dispatch->clCreateEventFromEGLSyncKHR);
6111     return context->dispatch->clCreateEventFromEGLSyncKHR(
6112         context,
6113         sync,
6114         display,
6115         errcode_ret);
6116 }
6117 #endif // defined(CL_ENABLE_LAYERS)
6118 
6119 ///////////////////////////////////////////////////////////////////////////////
6120 
6121 // cl_khr_egl_image
6122 
clCreateFromEGLImageKHR(cl_context context,CLeglDisplayKHR egldisplay,CLeglImageKHR eglimage,cl_mem_flags flags,const cl_egl_image_properties_khr * properties,cl_int * errcode_ret)6123 CL_API_ENTRY cl_mem CL_API_CALL clCreateFromEGLImageKHR(
6124     cl_context context,
6125     CLeglDisplayKHR egldisplay,
6126     CLeglImageKHR eglimage,
6127     cl_mem_flags flags,
6128     const cl_egl_image_properties_khr* properties,
6129     cl_int* errcode_ret)
6130 {
6131 #if defined(CL_ENABLE_LAYERS)
6132     if (khrFirstLayer)
6133         return khrFirstLayer->dispatch.clCreateFromEGLImageKHR(
6134             context,
6135             egldisplay,
6136             eglimage,
6137             flags,
6138             properties,
6139             errcode_ret);
6140 #endif // defined(CL_ENABLE_LAYERS)
6141     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
6142     KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(context->dispatch->clCreateFromEGLImageKHR);
6143     return context->dispatch->clCreateFromEGLImageKHR(
6144         context,
6145         egldisplay,
6146         eglimage,
6147         flags,
6148         properties,
6149         errcode_ret);
6150 }
6151 #if defined(CL_ENABLE_LAYERS)
clCreateFromEGLImageKHR_disp(cl_context context,CLeglDisplayKHR egldisplay,CLeglImageKHR eglimage,cl_mem_flags flags,const cl_egl_image_properties_khr * properties,cl_int * errcode_ret)6152 static cl_mem CL_API_CALL clCreateFromEGLImageKHR_disp(
6153     cl_context context,
6154     CLeglDisplayKHR egldisplay,
6155     CLeglImageKHR eglimage,
6156     cl_mem_flags flags,
6157     const cl_egl_image_properties_khr* properties,
6158     cl_int* errcode_ret)
6159 {
6160     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
6161     KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(context->dispatch->clCreateFromEGLImageKHR);
6162     return context->dispatch->clCreateFromEGLImageKHR(
6163         context,
6164         egldisplay,
6165         eglimage,
6166         flags,
6167         properties,
6168         errcode_ret);
6169 }
6170 #endif // defined(CL_ENABLE_LAYERS)
6171 
clEnqueueAcquireEGLObjectsKHR(cl_command_queue command_queue,cl_uint num_objects,const cl_mem * mem_objects,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)6172 CL_API_ENTRY cl_int CL_API_CALL clEnqueueAcquireEGLObjectsKHR(
6173     cl_command_queue command_queue,
6174     cl_uint num_objects,
6175     const cl_mem* mem_objects,
6176     cl_uint num_events_in_wait_list,
6177     const cl_event* event_wait_list,
6178     cl_event* event)
6179 {
6180 #if defined(CL_ENABLE_LAYERS)
6181     if (khrFirstLayer)
6182         return khrFirstLayer->dispatch.clEnqueueAcquireEGLObjectsKHR(
6183             command_queue,
6184             num_objects,
6185             mem_objects,
6186             num_events_in_wait_list,
6187             event_wait_list,
6188             event);
6189 #endif // defined(CL_ENABLE_LAYERS)
6190     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
6191     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(command_queue->dispatch->clEnqueueAcquireEGLObjectsKHR);
6192     return command_queue->dispatch->clEnqueueAcquireEGLObjectsKHR(
6193         command_queue,
6194         num_objects,
6195         mem_objects,
6196         num_events_in_wait_list,
6197         event_wait_list,
6198         event);
6199 }
6200 #if defined(CL_ENABLE_LAYERS)
clEnqueueAcquireEGLObjectsKHR_disp(cl_command_queue command_queue,cl_uint num_objects,const cl_mem * mem_objects,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)6201 static cl_int CL_API_CALL clEnqueueAcquireEGLObjectsKHR_disp(
6202     cl_command_queue command_queue,
6203     cl_uint num_objects,
6204     const cl_mem* mem_objects,
6205     cl_uint num_events_in_wait_list,
6206     const cl_event* event_wait_list,
6207     cl_event* event)
6208 {
6209     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
6210     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(command_queue->dispatch->clEnqueueAcquireEGLObjectsKHR);
6211     return command_queue->dispatch->clEnqueueAcquireEGLObjectsKHR(
6212         command_queue,
6213         num_objects,
6214         mem_objects,
6215         num_events_in_wait_list,
6216         event_wait_list,
6217         event);
6218 }
6219 #endif // defined(CL_ENABLE_LAYERS)
6220 
clEnqueueReleaseEGLObjectsKHR(cl_command_queue command_queue,cl_uint num_objects,const cl_mem * mem_objects,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)6221 CL_API_ENTRY cl_int CL_API_CALL clEnqueueReleaseEGLObjectsKHR(
6222     cl_command_queue command_queue,
6223     cl_uint num_objects,
6224     const cl_mem* mem_objects,
6225     cl_uint num_events_in_wait_list,
6226     const cl_event* event_wait_list,
6227     cl_event* event)
6228 {
6229 #if defined(CL_ENABLE_LAYERS)
6230     if (khrFirstLayer)
6231         return khrFirstLayer->dispatch.clEnqueueReleaseEGLObjectsKHR(
6232             command_queue,
6233             num_objects,
6234             mem_objects,
6235             num_events_in_wait_list,
6236             event_wait_list,
6237             event);
6238 #endif // defined(CL_ENABLE_LAYERS)
6239     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
6240     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(command_queue->dispatch->clEnqueueReleaseEGLObjectsKHR);
6241     return command_queue->dispatch->clEnqueueReleaseEGLObjectsKHR(
6242         command_queue,
6243         num_objects,
6244         mem_objects,
6245         num_events_in_wait_list,
6246         event_wait_list,
6247         event);
6248 }
6249 #if defined(CL_ENABLE_LAYERS)
clEnqueueReleaseEGLObjectsKHR_disp(cl_command_queue command_queue,cl_uint num_objects,const cl_mem * mem_objects,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)6250 static cl_int CL_API_CALL clEnqueueReleaseEGLObjectsKHR_disp(
6251     cl_command_queue command_queue,
6252     cl_uint num_objects,
6253     const cl_mem* mem_objects,
6254     cl_uint num_events_in_wait_list,
6255     const cl_event* event_wait_list,
6256     cl_event* event)
6257 {
6258     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
6259     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(command_queue->dispatch->clEnqueueReleaseEGLObjectsKHR);
6260     return command_queue->dispatch->clEnqueueReleaseEGLObjectsKHR(
6261         command_queue,
6262         num_objects,
6263         mem_objects,
6264         num_events_in_wait_list,
6265         event_wait_list,
6266         event);
6267 }
6268 #endif // defined(CL_ENABLE_LAYERS)
6269 
6270 ///////////////////////////////////////////////////////////////////////////////
6271 
6272 // cl_khr_gl_event
6273 
clCreateEventFromGLsyncKHR(cl_context context,cl_GLsync sync,cl_int * errcode_ret)6274 CL_API_ENTRY cl_event CL_API_CALL clCreateEventFromGLsyncKHR(
6275     cl_context context,
6276     cl_GLsync sync,
6277     cl_int* errcode_ret)
6278 {
6279 #if defined(CL_ENABLE_LAYERS)
6280     if (khrFirstLayer)
6281         return khrFirstLayer->dispatch.clCreateEventFromGLsyncKHR(
6282             context,
6283             sync,
6284             errcode_ret);
6285 #endif // defined(CL_ENABLE_LAYERS)
6286     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
6287     KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(context->dispatch->clCreateEventFromGLsyncKHR);
6288     return context->dispatch->clCreateEventFromGLsyncKHR(
6289         context,
6290         sync,
6291         errcode_ret);
6292 }
6293 #if defined(CL_ENABLE_LAYERS)
clCreateEventFromGLsyncKHR_disp(cl_context context,cl_GLsync sync,cl_int * errcode_ret)6294 static cl_event CL_API_CALL clCreateEventFromGLsyncKHR_disp(
6295     cl_context context,
6296     cl_GLsync sync,
6297     cl_int* errcode_ret)
6298 {
6299     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
6300     KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(context->dispatch->clCreateEventFromGLsyncKHR);
6301     return context->dispatch->clCreateEventFromGLsyncKHR(
6302         context,
6303         sync,
6304         errcode_ret);
6305 }
6306 #endif // defined(CL_ENABLE_LAYERS)
6307 
6308 ///////////////////////////////////////////////////////////////////////////////
6309 
6310 // cl_khr_gl_sharing
6311 
clGetGLContextInfoKHR(const cl_context_properties * properties,cl_gl_context_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret)6312 CL_API_ENTRY cl_int CL_API_CALL clGetGLContextInfoKHR(
6313     const cl_context_properties* properties,
6314     cl_gl_context_info param_name,
6315     size_t param_value_size,
6316     void* param_value,
6317     size_t* param_value_size_ret)
6318 {
6319 #if defined(CL_ENABLE_LAYERS)
6320     if (khrFirstLayer)
6321         return khrFirstLayer->dispatch.clGetGLContextInfoKHR(
6322             properties,
6323             param_name,
6324             param_value_size,
6325             param_value,
6326             param_value_size_ret);
6327 #endif // defined(CL_ENABLE_LAYERS)
6328     cl_platform_id platform = NULL;
6329     khrIcdContextPropertiesGetPlatform(properties, &platform);
6330     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(platform, CL_INVALID_PLATFORM);
6331     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(platform->dispatch->clGetGLContextInfoKHR);
6332     return platform->dispatch->clGetGLContextInfoKHR(
6333         properties,
6334         param_name,
6335         param_value_size,
6336         param_value,
6337         param_value_size_ret);
6338 }
6339 #if defined(CL_ENABLE_LAYERS)
clGetGLContextInfoKHR_disp(const cl_context_properties * properties,cl_gl_context_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret)6340 static cl_int CL_API_CALL clGetGLContextInfoKHR_disp(
6341     const cl_context_properties* properties,
6342     cl_gl_context_info param_name,
6343     size_t param_value_size,
6344     void* param_value,
6345     size_t* param_value_size_ret)
6346 {
6347     cl_platform_id platform = NULL;
6348     khrIcdContextPropertiesGetPlatform(properties, &platform);
6349     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(platform, CL_INVALID_PLATFORM);
6350     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(platform->dispatch->clGetGLContextInfoKHR);
6351     return platform->dispatch->clGetGLContextInfoKHR(
6352         properties,
6353         param_name,
6354         param_value_size,
6355         param_value,
6356         param_value_size_ret);
6357 }
6358 #endif // defined(CL_ENABLE_LAYERS)
6359 
clCreateFromGLBuffer(cl_context context,cl_mem_flags flags,cl_GLuint bufobj,cl_int * errcode_ret)6360 CL_API_ENTRY cl_mem CL_API_CALL clCreateFromGLBuffer(
6361     cl_context context,
6362     cl_mem_flags flags,
6363     cl_GLuint bufobj,
6364     cl_int* errcode_ret)
6365 {
6366 #if defined(CL_ENABLE_LAYERS)
6367     if (khrFirstLayer)
6368         return khrFirstLayer->dispatch.clCreateFromGLBuffer(
6369             context,
6370             flags,
6371             bufobj,
6372             errcode_ret);
6373 #endif // defined(CL_ENABLE_LAYERS)
6374     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
6375     KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(context->dispatch->clCreateFromGLBuffer);
6376     return context->dispatch->clCreateFromGLBuffer(
6377         context,
6378         flags,
6379         bufobj,
6380         errcode_ret);
6381 }
6382 #if defined(CL_ENABLE_LAYERS)
clCreateFromGLBuffer_disp(cl_context context,cl_mem_flags flags,cl_GLuint bufobj,cl_int * errcode_ret)6383 static cl_mem CL_API_CALL clCreateFromGLBuffer_disp(
6384     cl_context context,
6385     cl_mem_flags flags,
6386     cl_GLuint bufobj,
6387     cl_int* errcode_ret)
6388 {
6389     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
6390     KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(context->dispatch->clCreateFromGLBuffer);
6391     return context->dispatch->clCreateFromGLBuffer(
6392         context,
6393         flags,
6394         bufobj,
6395         errcode_ret);
6396 }
6397 #endif // defined(CL_ENABLE_LAYERS)
6398 
clCreateFromGLTexture(cl_context context,cl_mem_flags flags,cl_GLenum target,cl_GLint miplevel,cl_GLuint texture,cl_int * errcode_ret)6399 CL_API_ENTRY cl_mem CL_API_CALL clCreateFromGLTexture(
6400     cl_context context,
6401     cl_mem_flags flags,
6402     cl_GLenum target,
6403     cl_GLint miplevel,
6404     cl_GLuint texture,
6405     cl_int* errcode_ret)
6406 {
6407 #if defined(CL_ENABLE_LAYERS)
6408     if (khrFirstLayer)
6409         return khrFirstLayer->dispatch.clCreateFromGLTexture(
6410             context,
6411             flags,
6412             target,
6413             miplevel,
6414             texture,
6415             errcode_ret);
6416 #endif // defined(CL_ENABLE_LAYERS)
6417     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
6418     KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(context->dispatch->clCreateFromGLTexture);
6419     return context->dispatch->clCreateFromGLTexture(
6420         context,
6421         flags,
6422         target,
6423         miplevel,
6424         texture,
6425         errcode_ret);
6426 }
6427 #if defined(CL_ENABLE_LAYERS)
clCreateFromGLTexture_disp(cl_context context,cl_mem_flags flags,cl_GLenum target,cl_GLint miplevel,cl_GLuint texture,cl_int * errcode_ret)6428 static cl_mem CL_API_CALL clCreateFromGLTexture_disp(
6429     cl_context context,
6430     cl_mem_flags flags,
6431     cl_GLenum target,
6432     cl_GLint miplevel,
6433     cl_GLuint texture,
6434     cl_int* errcode_ret)
6435 {
6436     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
6437     KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(context->dispatch->clCreateFromGLTexture);
6438     return context->dispatch->clCreateFromGLTexture(
6439         context,
6440         flags,
6441         target,
6442         miplevel,
6443         texture,
6444         errcode_ret);
6445 }
6446 #endif // defined(CL_ENABLE_LAYERS)
6447 
clCreateFromGLRenderbuffer(cl_context context,cl_mem_flags flags,cl_GLuint renderbuffer,cl_int * errcode_ret)6448 CL_API_ENTRY cl_mem CL_API_CALL clCreateFromGLRenderbuffer(
6449     cl_context context,
6450     cl_mem_flags flags,
6451     cl_GLuint renderbuffer,
6452     cl_int* errcode_ret)
6453 {
6454 #if defined(CL_ENABLE_LAYERS)
6455     if (khrFirstLayer)
6456         return khrFirstLayer->dispatch.clCreateFromGLRenderbuffer(
6457             context,
6458             flags,
6459             renderbuffer,
6460             errcode_ret);
6461 #endif // defined(CL_ENABLE_LAYERS)
6462     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
6463     KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(context->dispatch->clCreateFromGLRenderbuffer);
6464     return context->dispatch->clCreateFromGLRenderbuffer(
6465         context,
6466         flags,
6467         renderbuffer,
6468         errcode_ret);
6469 }
6470 #if defined(CL_ENABLE_LAYERS)
clCreateFromGLRenderbuffer_disp(cl_context context,cl_mem_flags flags,cl_GLuint renderbuffer,cl_int * errcode_ret)6471 static cl_mem CL_API_CALL clCreateFromGLRenderbuffer_disp(
6472     cl_context context,
6473     cl_mem_flags flags,
6474     cl_GLuint renderbuffer,
6475     cl_int* errcode_ret)
6476 {
6477     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
6478     KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(context->dispatch->clCreateFromGLRenderbuffer);
6479     return context->dispatch->clCreateFromGLRenderbuffer(
6480         context,
6481         flags,
6482         renderbuffer,
6483         errcode_ret);
6484 }
6485 #endif // defined(CL_ENABLE_LAYERS)
6486 
clGetGLObjectInfo(cl_mem memobj,cl_gl_object_type * gl_object_type,cl_GLuint * gl_object_name)6487 CL_API_ENTRY cl_int CL_API_CALL clGetGLObjectInfo(
6488     cl_mem memobj,
6489     cl_gl_object_type* gl_object_type,
6490     cl_GLuint* gl_object_name)
6491 {
6492 #if defined(CL_ENABLE_LAYERS)
6493     if (khrFirstLayer)
6494         return khrFirstLayer->dispatch.clGetGLObjectInfo(
6495             memobj,
6496             gl_object_type,
6497             gl_object_name);
6498 #endif // defined(CL_ENABLE_LAYERS)
6499     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(memobj, CL_INVALID_MEM_OBJECT);
6500     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(memobj->dispatch->clGetGLObjectInfo);
6501     return memobj->dispatch->clGetGLObjectInfo(
6502         memobj,
6503         gl_object_type,
6504         gl_object_name);
6505 }
6506 #if defined(CL_ENABLE_LAYERS)
clGetGLObjectInfo_disp(cl_mem memobj,cl_gl_object_type * gl_object_type,cl_GLuint * gl_object_name)6507 static cl_int CL_API_CALL clGetGLObjectInfo_disp(
6508     cl_mem memobj,
6509     cl_gl_object_type* gl_object_type,
6510     cl_GLuint* gl_object_name)
6511 {
6512     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(memobj, CL_INVALID_MEM_OBJECT);
6513     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(memobj->dispatch->clGetGLObjectInfo);
6514     return memobj->dispatch->clGetGLObjectInfo(
6515         memobj,
6516         gl_object_type,
6517         gl_object_name);
6518 }
6519 #endif // defined(CL_ENABLE_LAYERS)
6520 
clGetGLTextureInfo(cl_mem memobj,cl_gl_texture_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret)6521 CL_API_ENTRY cl_int CL_API_CALL clGetGLTextureInfo(
6522     cl_mem memobj,
6523     cl_gl_texture_info param_name,
6524     size_t param_value_size,
6525     void* param_value,
6526     size_t* param_value_size_ret)
6527 {
6528 #if defined(CL_ENABLE_LAYERS)
6529     if (khrFirstLayer)
6530         return khrFirstLayer->dispatch.clGetGLTextureInfo(
6531             memobj,
6532             param_name,
6533             param_value_size,
6534             param_value,
6535             param_value_size_ret);
6536 #endif // defined(CL_ENABLE_LAYERS)
6537     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(memobj, CL_INVALID_MEM_OBJECT);
6538     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(memobj->dispatch->clGetGLTextureInfo);
6539     return memobj->dispatch->clGetGLTextureInfo(
6540         memobj,
6541         param_name,
6542         param_value_size,
6543         param_value,
6544         param_value_size_ret);
6545 }
6546 #if defined(CL_ENABLE_LAYERS)
clGetGLTextureInfo_disp(cl_mem memobj,cl_gl_texture_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret)6547 static cl_int CL_API_CALL clGetGLTextureInfo_disp(
6548     cl_mem memobj,
6549     cl_gl_texture_info param_name,
6550     size_t param_value_size,
6551     void* param_value,
6552     size_t* param_value_size_ret)
6553 {
6554     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(memobj, CL_INVALID_MEM_OBJECT);
6555     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(memobj->dispatch->clGetGLTextureInfo);
6556     return memobj->dispatch->clGetGLTextureInfo(
6557         memobj,
6558         param_name,
6559         param_value_size,
6560         param_value,
6561         param_value_size_ret);
6562 }
6563 #endif // defined(CL_ENABLE_LAYERS)
6564 
clEnqueueAcquireGLObjects(cl_command_queue command_queue,cl_uint num_objects,const cl_mem * mem_objects,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)6565 CL_API_ENTRY cl_int CL_API_CALL clEnqueueAcquireGLObjects(
6566     cl_command_queue command_queue,
6567     cl_uint num_objects,
6568     const cl_mem* mem_objects,
6569     cl_uint num_events_in_wait_list,
6570     const cl_event* event_wait_list,
6571     cl_event* event)
6572 {
6573 #if defined(CL_ENABLE_LAYERS)
6574     if (khrFirstLayer)
6575         return khrFirstLayer->dispatch.clEnqueueAcquireGLObjects(
6576             command_queue,
6577             num_objects,
6578             mem_objects,
6579             num_events_in_wait_list,
6580             event_wait_list,
6581             event);
6582 #endif // defined(CL_ENABLE_LAYERS)
6583     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
6584     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(command_queue->dispatch->clEnqueueAcquireGLObjects);
6585     return command_queue->dispatch->clEnqueueAcquireGLObjects(
6586         command_queue,
6587         num_objects,
6588         mem_objects,
6589         num_events_in_wait_list,
6590         event_wait_list,
6591         event);
6592 }
6593 #if defined(CL_ENABLE_LAYERS)
clEnqueueAcquireGLObjects_disp(cl_command_queue command_queue,cl_uint num_objects,const cl_mem * mem_objects,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)6594 static cl_int CL_API_CALL clEnqueueAcquireGLObjects_disp(
6595     cl_command_queue command_queue,
6596     cl_uint num_objects,
6597     const cl_mem* mem_objects,
6598     cl_uint num_events_in_wait_list,
6599     const cl_event* event_wait_list,
6600     cl_event* event)
6601 {
6602     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
6603     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(command_queue->dispatch->clEnqueueAcquireGLObjects);
6604     return command_queue->dispatch->clEnqueueAcquireGLObjects(
6605         command_queue,
6606         num_objects,
6607         mem_objects,
6608         num_events_in_wait_list,
6609         event_wait_list,
6610         event);
6611 }
6612 #endif // defined(CL_ENABLE_LAYERS)
6613 
clEnqueueReleaseGLObjects(cl_command_queue command_queue,cl_uint num_objects,const cl_mem * mem_objects,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)6614 CL_API_ENTRY cl_int CL_API_CALL clEnqueueReleaseGLObjects(
6615     cl_command_queue command_queue,
6616     cl_uint num_objects,
6617     const cl_mem* mem_objects,
6618     cl_uint num_events_in_wait_list,
6619     const cl_event* event_wait_list,
6620     cl_event* event)
6621 {
6622 #if defined(CL_ENABLE_LAYERS)
6623     if (khrFirstLayer)
6624         return khrFirstLayer->dispatch.clEnqueueReleaseGLObjects(
6625             command_queue,
6626             num_objects,
6627             mem_objects,
6628             num_events_in_wait_list,
6629             event_wait_list,
6630             event);
6631 #endif // defined(CL_ENABLE_LAYERS)
6632     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
6633     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(command_queue->dispatch->clEnqueueReleaseGLObjects);
6634     return command_queue->dispatch->clEnqueueReleaseGLObjects(
6635         command_queue,
6636         num_objects,
6637         mem_objects,
6638         num_events_in_wait_list,
6639         event_wait_list,
6640         event);
6641 }
6642 #if defined(CL_ENABLE_LAYERS)
clEnqueueReleaseGLObjects_disp(cl_command_queue command_queue,cl_uint num_objects,const cl_mem * mem_objects,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event)6643 static cl_int CL_API_CALL clEnqueueReleaseGLObjects_disp(
6644     cl_command_queue command_queue,
6645     cl_uint num_objects,
6646     const cl_mem* mem_objects,
6647     cl_uint num_events_in_wait_list,
6648     const cl_event* event_wait_list,
6649     cl_event* event)
6650 {
6651     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(command_queue, CL_INVALID_COMMAND_QUEUE);
6652     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(command_queue->dispatch->clEnqueueReleaseGLObjects);
6653     return command_queue->dispatch->clEnqueueReleaseGLObjects(
6654         command_queue,
6655         num_objects,
6656         mem_objects,
6657         num_events_in_wait_list,
6658         event_wait_list,
6659         event);
6660 }
6661 #endif // defined(CL_ENABLE_LAYERS)
6662 
clCreateFromGLTexture2D(cl_context context,cl_mem_flags flags,cl_GLenum target,cl_GLint miplevel,cl_GLuint texture,cl_int * errcode_ret)6663 CL_API_ENTRY cl_mem CL_API_CALL clCreateFromGLTexture2D(
6664     cl_context context,
6665     cl_mem_flags flags,
6666     cl_GLenum target,
6667     cl_GLint miplevel,
6668     cl_GLuint texture,
6669     cl_int* errcode_ret)
6670 {
6671 #if defined(CL_ENABLE_LAYERS)
6672     if (khrFirstLayer)
6673         return khrFirstLayer->dispatch.clCreateFromGLTexture2D(
6674             context,
6675             flags,
6676             target,
6677             miplevel,
6678             texture,
6679             errcode_ret);
6680 #endif // defined(CL_ENABLE_LAYERS)
6681     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
6682     KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(context->dispatch->clCreateFromGLTexture2D);
6683     return context->dispatch->clCreateFromGLTexture2D(
6684         context,
6685         flags,
6686         target,
6687         miplevel,
6688         texture,
6689         errcode_ret);
6690 }
6691 #if defined(CL_ENABLE_LAYERS)
clCreateFromGLTexture2D_disp(cl_context context,cl_mem_flags flags,cl_GLenum target,cl_GLint miplevel,cl_GLuint texture,cl_int * errcode_ret)6692 static cl_mem CL_API_CALL clCreateFromGLTexture2D_disp(
6693     cl_context context,
6694     cl_mem_flags flags,
6695     cl_GLenum target,
6696     cl_GLint miplevel,
6697     cl_GLuint texture,
6698     cl_int* errcode_ret)
6699 {
6700     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
6701     KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(context->dispatch->clCreateFromGLTexture2D);
6702     return context->dispatch->clCreateFromGLTexture2D(
6703         context,
6704         flags,
6705         target,
6706         miplevel,
6707         texture,
6708         errcode_ret);
6709 }
6710 #endif // defined(CL_ENABLE_LAYERS)
6711 
clCreateFromGLTexture3D(cl_context context,cl_mem_flags flags,cl_GLenum target,cl_GLint miplevel,cl_GLuint texture,cl_int * errcode_ret)6712 CL_API_ENTRY cl_mem CL_API_CALL clCreateFromGLTexture3D(
6713     cl_context context,
6714     cl_mem_flags flags,
6715     cl_GLenum target,
6716     cl_GLint miplevel,
6717     cl_GLuint texture,
6718     cl_int* errcode_ret)
6719 {
6720 #if defined(CL_ENABLE_LAYERS)
6721     if (khrFirstLayer)
6722         return khrFirstLayer->dispatch.clCreateFromGLTexture3D(
6723             context,
6724             flags,
6725             target,
6726             miplevel,
6727             texture,
6728             errcode_ret);
6729 #endif // defined(CL_ENABLE_LAYERS)
6730     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
6731     KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(context->dispatch->clCreateFromGLTexture3D);
6732     return context->dispatch->clCreateFromGLTexture3D(
6733         context,
6734         flags,
6735         target,
6736         miplevel,
6737         texture,
6738         errcode_ret);
6739 }
6740 #if defined(CL_ENABLE_LAYERS)
clCreateFromGLTexture3D_disp(cl_context context,cl_mem_flags flags,cl_GLenum target,cl_GLint miplevel,cl_GLuint texture,cl_int * errcode_ret)6741 static cl_mem CL_API_CALL clCreateFromGLTexture3D_disp(
6742     cl_context context,
6743     cl_mem_flags flags,
6744     cl_GLenum target,
6745     cl_GLint miplevel,
6746     cl_GLuint texture,
6747     cl_int* errcode_ret)
6748 {
6749     KHR_ICD_VALIDATE_HANDLE_RETURN_HANDLE(context, CL_INVALID_CONTEXT);
6750     KHR_ICD_VALIDATE_POINTER_RETURN_HANDLE(context->dispatch->clCreateFromGLTexture3D);
6751     return context->dispatch->clCreateFromGLTexture3D(
6752         context,
6753         flags,
6754         target,
6755         miplevel,
6756         texture,
6757         errcode_ret);
6758 }
6759 #endif // defined(CL_ENABLE_LAYERS)
6760 
6761 ///////////////////////////////////////////////////////////////////////////////
6762 
6763 // cl_khr_subgroups
6764 
clGetKernelSubGroupInfoKHR(cl_kernel in_kernel,cl_device_id in_device,cl_kernel_sub_group_info param_name,size_t input_value_size,const void * input_value,size_t param_value_size,void * param_value,size_t * param_value_size_ret)6765 CL_API_ENTRY cl_int CL_API_CALL clGetKernelSubGroupInfoKHR(
6766     cl_kernel in_kernel,
6767     cl_device_id in_device,
6768     cl_kernel_sub_group_info param_name,
6769     size_t input_value_size,
6770     const void* input_value,
6771     size_t param_value_size,
6772     void* param_value,
6773     size_t* param_value_size_ret)
6774 {
6775 #if defined(CL_ENABLE_LAYERS)
6776     if (khrFirstLayer)
6777         return khrFirstLayer->dispatch.clGetKernelSubGroupInfoKHR(
6778             in_kernel,
6779             in_device,
6780             param_name,
6781             input_value_size,
6782             input_value,
6783             param_value_size,
6784             param_value,
6785             param_value_size_ret);
6786 #endif // defined(CL_ENABLE_LAYERS)
6787     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(in_kernel, CL_INVALID_KERNEL);
6788     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(in_kernel->dispatch->clGetKernelSubGroupInfoKHR);
6789     return in_kernel->dispatch->clGetKernelSubGroupInfoKHR(
6790         in_kernel,
6791         in_device,
6792         param_name,
6793         input_value_size,
6794         input_value,
6795         param_value_size,
6796         param_value,
6797         param_value_size_ret);
6798 }
6799 #if defined(CL_ENABLE_LAYERS)
clGetKernelSubGroupInfoKHR_disp(cl_kernel in_kernel,cl_device_id in_device,cl_kernel_sub_group_info param_name,size_t input_value_size,const void * input_value,size_t param_value_size,void * param_value,size_t * param_value_size_ret)6800 static cl_int CL_API_CALL clGetKernelSubGroupInfoKHR_disp(
6801     cl_kernel in_kernel,
6802     cl_device_id in_device,
6803     cl_kernel_sub_group_info param_name,
6804     size_t input_value_size,
6805     const void* input_value,
6806     size_t param_value_size,
6807     void* param_value,
6808     size_t* param_value_size_ret)
6809 {
6810     KHR_ICD_VALIDATE_HANDLE_RETURN_ERROR(in_kernel, CL_INVALID_KERNEL);
6811     KHR_ICD_VALIDATE_POINTER_RETURN_ERROR(in_kernel->dispatch->clGetKernelSubGroupInfoKHR);
6812     return in_kernel->dispatch->clGetKernelSubGroupInfoKHR(
6813         in_kernel,
6814         in_device,
6815         param_name,
6816         input_value_size,
6817         input_value,
6818         param_value_size,
6819         param_value,
6820         param_value_size_ret);
6821 }
6822 #endif // defined(CL_ENABLE_LAYERS)
6823 
6824 ///////////////////////////////////////////////////////////////////////////////
6825 
6826 #if defined(CL_ENABLE_LAYERS)
6827 struct _cl_icd_dispatch khrMasterDispatch = {
6828     &clGetPlatformIDs_disp,
6829     &clGetPlatformInfo_disp,
6830     &clGetDeviceIDs_disp,
6831     &clGetDeviceInfo_disp,
6832     &clCreateContext_disp,
6833     &clCreateContextFromType_disp,
6834     &clRetainContext_disp,
6835     &clReleaseContext_disp,
6836     &clGetContextInfo_disp,
6837     &clCreateCommandQueue_disp,
6838     &clRetainCommandQueue_disp,
6839     &clReleaseCommandQueue_disp,
6840     &clGetCommandQueueInfo_disp,
6841     &clSetCommandQueueProperty_disp,
6842     &clCreateBuffer_disp,
6843     &clCreateImage2D_disp,
6844     &clCreateImage3D_disp,
6845     &clRetainMemObject_disp,
6846     &clReleaseMemObject_disp,
6847     &clGetSupportedImageFormats_disp,
6848     &clGetMemObjectInfo_disp,
6849     &clGetImageInfo_disp,
6850     &clCreateSampler_disp,
6851     &clRetainSampler_disp,
6852     &clReleaseSampler_disp,
6853     &clGetSamplerInfo_disp,
6854     &clCreateProgramWithSource_disp,
6855     &clCreateProgramWithBinary_disp,
6856     &clRetainProgram_disp,
6857     &clReleaseProgram_disp,
6858     &clBuildProgram_disp,
6859     &clUnloadCompiler_disp,
6860     &clGetProgramInfo_disp,
6861     &clGetProgramBuildInfo_disp,
6862     &clCreateKernel_disp,
6863     &clCreateKernelsInProgram_disp,
6864     &clRetainKernel_disp,
6865     &clReleaseKernel_disp,
6866     &clSetKernelArg_disp,
6867     &clGetKernelInfo_disp,
6868     &clGetKernelWorkGroupInfo_disp,
6869     &clWaitForEvents_disp,
6870     &clGetEventInfo_disp,
6871     &clRetainEvent_disp,
6872     &clReleaseEvent_disp,
6873     &clGetEventProfilingInfo_disp,
6874     &clFlush_disp,
6875     &clFinish_disp,
6876     &clEnqueueReadBuffer_disp,
6877     &clEnqueueWriteBuffer_disp,
6878     &clEnqueueCopyBuffer_disp,
6879     &clEnqueueReadImage_disp,
6880     &clEnqueueWriteImage_disp,
6881     &clEnqueueCopyImage_disp,
6882     &clEnqueueCopyImageToBuffer_disp,
6883     &clEnqueueCopyBufferToImage_disp,
6884     &clEnqueueMapBuffer_disp,
6885     &clEnqueueMapImage_disp,
6886     &clEnqueueUnmapMemObject_disp,
6887     &clEnqueueNDRangeKernel_disp,
6888     &clEnqueueTask_disp,
6889     &clEnqueueNativeKernel_disp,
6890     &clEnqueueMarker_disp,
6891     &clEnqueueWaitForEvents_disp,
6892     &clEnqueueBarrier_disp,
6893     &clGetExtensionFunctionAddress_disp,
6894     &clCreateFromGLBuffer_disp,
6895     &clCreateFromGLTexture2D_disp,
6896     &clCreateFromGLTexture3D_disp,
6897     &clCreateFromGLRenderbuffer_disp,
6898     &clGetGLObjectInfo_disp,
6899     &clGetGLTextureInfo_disp,
6900     &clEnqueueAcquireGLObjects_disp,
6901     &clEnqueueReleaseGLObjects_disp,
6902     &clGetGLContextInfoKHR_disp,
6903 
6904   /* cl_khr_d3d10_sharing */
6905 #if defined(_WIN32)
6906     &clGetDeviceIDsFromD3D10KHR_disp,
6907     &clCreateFromD3D10BufferKHR_disp,
6908     &clCreateFromD3D10Texture2DKHR_disp,
6909     &clCreateFromD3D10Texture3DKHR_disp,
6910     &clEnqueueAcquireD3D10ObjectsKHR_disp,
6911     &clEnqueueReleaseD3D10ObjectsKHR_disp,
6912 #else
6913     NULL,
6914     NULL,
6915     NULL,
6916     NULL,
6917     NULL,
6918     NULL,
6919 #endif
6920 
6921   /* OpenCL 1.1 */
6922     &clSetEventCallback_disp,
6923     &clCreateSubBuffer_disp,
6924     &clSetMemObjectDestructorCallback_disp,
6925     &clCreateUserEvent_disp,
6926     &clSetUserEventStatus_disp,
6927     &clEnqueueReadBufferRect_disp,
6928     &clEnqueueWriteBufferRect_disp,
6929     &clEnqueueCopyBufferRect_disp,
6930 
6931   /* cl_ext_device_fission */
6932     &clCreateSubDevicesEXT_disp,
6933     &clRetainDeviceEXT_disp,
6934     &clReleaseDeviceEXT_disp,
6935 
6936   /* cl_khr_gl_event */
6937     &clCreateEventFromGLsyncKHR_disp,
6938 
6939   /* OpenCL 1.2 */
6940     &clCreateSubDevices_disp,
6941     &clRetainDevice_disp,
6942     &clReleaseDevice_disp,
6943     &clCreateImage_disp,
6944     &clCreateProgramWithBuiltInKernels_disp,
6945     &clCompileProgram_disp,
6946     &clLinkProgram_disp,
6947     &clUnloadPlatformCompiler_disp,
6948     &clGetKernelArgInfo_disp,
6949     &clEnqueueFillBuffer_disp,
6950     &clEnqueueFillImage_disp,
6951     &clEnqueueMigrateMemObjects_disp,
6952     &clEnqueueMarkerWithWaitList_disp,
6953     &clEnqueueBarrierWithWaitList_disp,
6954     &clGetExtensionFunctionAddressForPlatform_disp,
6955     &clCreateFromGLTexture_disp,
6956 
6957   /* cl_khr_d3d11_sharing */
6958 #if defined(_WIN32)
6959     &clGetDeviceIDsFromD3D11KHR_disp,
6960     &clCreateFromD3D11BufferKHR_disp,
6961     &clCreateFromD3D11Texture2DKHR_disp,
6962     &clCreateFromD3D11Texture3DKHR_disp,
6963     &clCreateFromDX9MediaSurfaceKHR_disp,
6964     &clEnqueueAcquireD3D11ObjectsKHR_disp,
6965     &clEnqueueReleaseD3D11ObjectsKHR_disp,
6966 #else
6967     NULL,
6968     NULL,
6969     NULL,
6970     NULL,
6971     NULL,
6972     NULL,
6973     NULL,
6974 #endif
6975 
6976   /* cl_khr_dx9_media_sharing */
6977 #if defined(_WIN32)
6978     &clGetDeviceIDsFromDX9MediaAdapterKHR_disp,
6979     &clEnqueueAcquireDX9MediaSurfacesKHR_disp,
6980     &clEnqueueReleaseDX9MediaSurfacesKHR_disp,
6981 #else
6982     NULL,
6983     NULL,
6984     NULL,
6985 #endif
6986 
6987   /* cl_khr_egl_image */
6988     &clCreateFromEGLImageKHR_disp,
6989     &clEnqueueAcquireEGLObjectsKHR_disp,
6990     &clEnqueueReleaseEGLObjectsKHR_disp,
6991 
6992   /* cl_khr_egl_event */
6993     &clCreateEventFromEGLSyncKHR_disp,
6994 
6995   /* OpenCL 2.0 */
6996     &clCreateCommandQueueWithProperties_disp,
6997     &clCreatePipe_disp,
6998     &clGetPipeInfo_disp,
6999     &clSVMAlloc_disp,
7000     &clSVMFree_disp,
7001     &clEnqueueSVMFree_disp,
7002     &clEnqueueSVMMemcpy_disp,
7003     &clEnqueueSVMMemFill_disp,
7004     &clEnqueueSVMMap_disp,
7005     &clEnqueueSVMUnmap_disp,
7006     &clCreateSamplerWithProperties_disp,
7007     &clSetKernelArgSVMPointer_disp,
7008     &clSetKernelExecInfo_disp,
7009 
7010   /* cl_khr_sub_groups */
7011     &clGetKernelSubGroupInfoKHR_disp,
7012 
7013   /* OpenCL 2.1 */
7014     &clCloneKernel_disp,
7015     &clCreateProgramWithIL_disp,
7016     &clEnqueueSVMMigrateMem_disp,
7017     &clGetDeviceAndHostTimer_disp,
7018     &clGetHostTimer_disp,
7019     &clGetKernelSubGroupInfo_disp,
7020     &clSetDefaultDeviceCommandQueue_disp,
7021 
7022   /* OpenCL 2.2 */
7023     &clSetProgramReleaseCallback_disp,
7024     &clSetProgramSpecializationConstant_disp,
7025 
7026   /* OpenCL 3.0 */
7027     &clCreateBufferWithProperties_disp,
7028     &clCreateImageWithProperties_disp,
7029     &clSetContextDestructorCallback_disp
7030 };
7031 #endif // defined(CL_ENABLE_LAYERS)
7032 #ifdef __cplusplus
7033 }
7034 #endif
7035