forked from KhronosGroup/OpenCL-ICD-Loader
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathicd_print_layer_generated.c.mako
More file actions
110 lines (103 loc) · 2.8 KB
/
icd_print_layer_generated.c.mako
File metadata and controls
110 lines (103 loc) · 2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<%
from mako.template import Template
table_template = Template(filename='dispatch_table.mako')
%>/*
* Copyright (c) 2020-2026 The Khronos Group Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* OpenCL is a trademark of Apple Inc. used under license by Khronos.
*/
#include "icd_print_layer.h"
///////////////////////////////////////////////////////////////////////////////
// Core APIs:
%for apis in coreapis.values():
%for api in apis:
static ${api.RetType} CL_API_CALL ${api.Name + "_wrap"}(
%for i, param in enumerate(api.Params):
% if i < len(api.Params)-1:
${param.Type} ${param.Name}${param.TypeEnd},
% else:
${param.Type} ${param.Name}${param.TypeEnd}) ${api.Suffix}
% endif
%endfor
{
printf("${api.Name}\n");
% if api.Name == "clSVMFree":
tdispatch->${api.Name}(
% else:
return tdispatch->${api.Name}(
% endif
%for i, param in enumerate(api.Params):
% if i < len(api.Params)-1:
${param.Name},
% else:
${param.Name});
% endif
%endfor
}
///////////////////////////////////////////////////////////////////////////////
%endfor
%endfor
<%
icdextensions = [
'cl_ext_device_fission',
'cl_khr_d3d10_sharing',
'cl_khr_d3d11_sharing',
'cl_khr_dx9_media_sharing',
'cl_khr_egl_event',
'cl_khr_egl_image',
'cl_khr_gl_event',
'cl_khr_gl_sharing',
'cl_khr_subgroups'
]
win32extensions = {
'cl_khr_d3d10_sharing',
'cl_khr_d3d11_sharing',
'cl_khr_dx9_media_sharing',
}
%>
%for extension in icdextensions:
<%
apis = extapis[extension]
%>// ${extension}
%if extension in win32extensions:
#if defined(_WIN32)
%endif
%for api in apis:
static ${api.RetType} CL_API_CALL ${api.Name + "_wrap"}(
%for i, param in enumerate(api.Params):
% if i < len(api.Params)-1:
${param.Type} ${param.Name}${param.TypeEnd},
% else:
${param.Type} ${param.Name}${param.TypeEnd}) ${api.Suffix}
% endif
%endfor
{
printf("${api.Name}\n");
return tdispatch->${api.Name}(
%for i, param in enumerate(api.Params):
% if i < len(api.Params)-1:
${param.Name},
% else:
${param.Name});
% endif
%endfor
}
%endfor
%if extension in win32extensions:
#endif // defined(_WIN32)
%endif
///////////////////////////////////////////////////////////////////////////////
%endfor
struct _cl_icd_dispatch dispatch = ${table_template.render(suffix = 'wrap')};