xref: /aosp_15_r20/external/OpenCL-ICD-Loader/test/driver_stub/cl_ext.c (revision 1cddb830dba8aa7c1cc1039338e56b3b9fa24952)
1 #include <string.h>
2 
3 #define CL_USE_DEPRECATED_OPENCL_1_1_APIS
4 #include "CL/cl.h"
5 #include "CL/cl_ext.h"
6 
7 struct driverStubextFunc_st
8 {
9     const char *name;
10     void *func;
11 };
12 
13 #define EXT_FUNC(name) { #name, (void*)(intptr_t)(name) }
14 
15 static struct driverStubextFunc_st clExtensions[] =
16 {
17     EXT_FUNC(clIcdGetPlatformIDsKHR),
18 };
19 
20 static const int clExtensionCount = sizeof(clExtensions) / sizeof(clExtensions[0]);
21 
22 CL_API_ENTRY void * CL_API_CALL
clGetExtensionFunctionAddress(const char * name)23 clGetExtensionFunctionAddress(const char *name)
24 {
25     int ii;
26 
27     for (ii = 0; ii < clExtensionCount; ii++) {
28         if (!strcmp(name, clExtensions[ii].name)) {
29             return clExtensions[ii].func;
30         }
31     }
32 
33     return NULL;
34 }
35 
36