blob: 98c074f420b8b810eaf02a9160d4a9311fb9ab52 [file] [log] [blame]
Jeff Gilbert1b605ee2017-10-30 18:41:46 -07001#!/usr/bin/python2
Jamie Madill2e16d962017-04-19 14:06:36 -04002#
3# Copyright 2017 The ANGLE Project Authors. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6#
7# generate_entry_points.py:
8# Generates the OpenGL bindings and entry point layers for ANGLE.
9
Corentin Wallez2e568cf2017-09-18 17:05:22 -040010import sys, os, pprint, json
Jamie Madill2e16d962017-04-19 14:06:36 -040011import xml.etree.ElementTree as etree
12from datetime import date
13
Jamie Madillfa920eb2018-01-04 11:45:50 -050014# List of supported extensions. Add to this list to enable new extensions
15# available in gl.xml.
Brandon Jones416aaf92018-04-10 08:10:16 -070016
17angle_extensions = [
18 # ANGLE extensions
19 "GL_CHROMIUM_bind_uniform_location",
20 "GL_CHROMIUM_framebuffer_mixed_samples",
21 "GL_CHROMIUM_path_rendering",
22 "GL_CHROMIUM_copy_texture",
23 "GL_CHROMIUM_copy_compressed_texture",
24 "GL_ANGLE_request_extension",
25 "GL_ANGLE_robust_client_memory",
26 "GL_ANGLE_multiview",
27]
28
Lingfeng Yanga0648782018-03-12 14:45:25 -070029gles1_extensions = [
30 # ES1 (Possibly the min set of extensions needed by Android)
31 "GL_OES_draw_texture",
32 "GL_OES_framebuffer_object",
33 "GL_OES_matrix_palette",
Geoff Lang2aaa7b42018-01-12 17:17:27 -050034 "GL_OES_point_size_array",
35 "GL_OES_query_matrix",
Lingfeng Yanga0648782018-03-12 14:45:25 -070036 "GL_OES_texture_cube_map",
37]
38
39# List of GLES1 extensions for which we don't need to add Context.h decls.
40gles1_no_context_decl_extensions = [
41 "GL_OES_framebuffer_object",
42]
43
44# List of GLES1 API calls that have had their semantics changed in later GLES versions, but the
45# name was kept the same
46gles1_overloaded = [
47 "glGetPointerv",
48]
49
Brandon Jones416aaf92018-04-10 08:10:16 -070050supported_extensions = sorted(angle_extensions + gles1_extensions + [
Geoff Lang2aaa7b42018-01-12 17:17:27 -050051 # ES2+
Jamie Madillfa920eb2018-01-04 11:45:50 -050052 "GL_ANGLE_framebuffer_blit",
53 "GL_ANGLE_framebuffer_multisample",
54 "GL_ANGLE_instanced_arrays",
55 "GL_ANGLE_translated_shader_source",
56 "GL_EXT_debug_marker",
57 "GL_EXT_discard_framebuffer",
58 "GL_EXT_disjoint_timer_query",
59 "GL_EXT_draw_buffers",
60 "GL_EXT_map_buffer_range",
61 "GL_EXT_occlusion_query_boolean",
62 "GL_EXT_robustness",
63 "GL_EXT_texture_storage",
64 "GL_KHR_debug",
65 "GL_NV_fence",
66 "GL_OES_EGL_image",
67 "GL_OES_get_program_binary",
68 "GL_OES_mapbuffer",
69 "GL_OES_vertex_array_object",
70])
71
Brandon Jones2b0cdcc2018-05-02 08:02:50 -070072# The EGL_ANGLE_explicit_context extension is generated differently from other extensions.
73# Toggle generation here.
74support_EGL_ANGLE_explicit_context = True
75
Jamie Madillfa920eb2018-01-04 11:45:50 -050076# This is a list of exceptions for entry points which don't want to have
77# the EVENT macro. This is required for some debug marker entry points.
78no_event_marker_exceptions_list = sorted([
79 "glPushGroupMarkerEXT",
80 "glPopGroupMarkerEXT",
81 "glInsertEventMarkerEXT",
82])
83
84# Strip these suffixes from Context entry point names. NV is excluded (for now).
Brandon Jones416aaf92018-04-10 08:10:16 -070085strip_suffixes = ["ANGLE", "EXT", "KHR", "OES", "CHROMIUM"]
Jamie Madillfa920eb2018-01-04 11:45:50 -050086
Jamie Madill2e16d962017-04-19 14:06:36 -040087template_entry_point_header = """// GENERATED FILE - DO NOT EDIT.
88// Generated by {script_name} using data from {data_source_name}.
89//
90// Copyright {year} The ANGLE Project Authors. All rights reserved.
91// Use of this source code is governed by a BSD-style license that can be
92// found in the LICENSE file.
93//
Jamie Madillc8c9a242018-01-02 13:39:00 -050094// entry_points_gles_{annotation_lower}_autogen.h:
95// Defines the GLES {comment} entry points.
Jamie Madill2e16d962017-04-19 14:06:36 -040096
Jamie Madillc8c9a242018-01-02 13:39:00 -050097#ifndef LIBGLESV2_ENTRY_POINTS_GLES_{annotation_upper}_AUTOGEN_H_
98#define LIBGLESV2_ENTRY_POINTS_GLES_{annotation_upper}_AUTOGEN_H_
Jamie Madill2e16d962017-04-19 14:06:36 -040099
Jamie Madillc8c9a242018-01-02 13:39:00 -0500100{includes}
101
Jamie Madill2e16d962017-04-19 14:06:36 -0400102namespace gl
103{{
104{entry_points}
105}} // namespace gl
106
Jamie Madillc8c9a242018-01-02 13:39:00 -0500107#endif // LIBGLESV2_ENTRY_POINTS_GLES_{annotation_upper}_AUTOGEN_H_
Jamie Madill2e16d962017-04-19 14:06:36 -0400108"""
109
Jamie Madillee769dd2017-05-04 11:38:30 -0400110template_entry_point_source = """// GENERATED FILE - DO NOT EDIT.
111// Generated by {script_name} using data from {data_source_name}.
112//
113// Copyright {year} The ANGLE Project Authors. All rights reserved.
114// Use of this source code is governed by a BSD-style license that can be
115// found in the LICENSE file.
116//
Jamie Madillc8c9a242018-01-02 13:39:00 -0500117// entry_points_gles_{annotation_lower}_autogen.cpp:
118// Defines the GLES {comment} entry points.
Jamie Madillee769dd2017-05-04 11:38:30 -0400119
Jamie Madillc8c9a242018-01-02 13:39:00 -0500120{includes}
Jamie Madillee769dd2017-05-04 11:38:30 -0400121
122namespace gl
123{{
124{entry_points}}} // namespace gl
125"""
126
127template_entry_points_enum_header = """// GENERATED FILE - DO NOT EDIT.
128// Generated by {script_name} using data from {data_source_name}.
129//
130// Copyright {year} The ANGLE Project Authors. All rights reserved.
131// Use of this source code is governed by a BSD-style license that can be
132// found in the LICENSE file.
133//
134// entry_points_enum_autogen.h:
135// Defines the GLES entry points enumeration.
136
137#ifndef LIBGLESV2_ENTRYPOINTSENUM_AUTOGEN_H_
138#define LIBGLESV2_ENTRYPOINTSENUM_AUTOGEN_H_
139
140namespace gl
141{{
142enum class EntryPoint
143{{
144{entry_points_list}
145}};
146}} // namespace gl
147#endif // LIBGLESV2_ENTRY_POINTS_ENUM_AUTOGEN_H_
148"""
149
Brandon Jones41e59f52018-05-02 12:45:28 -0700150template_libgles_entry_point_source = """// GENERATED FILE - DO NOT EDIT.
151// Generated by {script_name} using data from {data_source_name}.
152//
153// Copyright {year} The ANGLE Project Authors. All rights reserved.
154// Use of this source code is governed by a BSD-style license that can be
155// found in the LICENSE file.
156//
157// libGLESv2.cpp: Implements the exported OpenGL ES functions.
158
159{includes}
160extern "C" {{
161{entry_points}
162}} // extern "C"
163"""
164
165template_libgles_entry_point_export = """; GENERATED FILE - DO NOT EDIT.
166; Generated by {script_name} using data from {data_source_name}.
167;
168; Copyright {year} The ANGLE Project Authors. All rights reserved.
169; Use of this source code is governed by a BSD-style license that can be
170; found in the LICENSE file.
171LIBRARY libGLESv2
172EXPORTS
173{exports}
174"""
175
Jamie Madill2e16d962017-04-19 14:06:36 -0400176template_entry_point_decl = """ANGLE_EXPORT {return_type}GL_APIENTRY {name}({params});"""
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700177template_entry_point_decl = """ANGLE_EXPORT {return_type}GL_APIENTRY {name}{explicit_context_suffix}({explicit_context_param}{explicit_context_comma}{params});"""
Jamie Madill2e16d962017-04-19 14:06:36 -0400178
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700179template_entry_point_def = """{return_type}GL_APIENTRY {name}{explicit_context_suffix}({explicit_context_param}{explicit_context_comma}{params})
Jamie Madillee769dd2017-05-04 11:38:30 -0400180{{
Jamie Madillfa920eb2018-01-04 11:45:50 -0500181 {event_comment}EVENT("({format_params})"{comma_if_needed}{pass_params});
Jamie Madillee769dd2017-05-04 11:38:30 -0400182
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700183 Context *context = {context_getter};
Jamie Madillee769dd2017-05-04 11:38:30 -0400184 if (context)
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700185 {{{assert_explicit_context}{packed_gl_enum_conversions}
Corentin Wallez2e568cf2017-09-18 17:05:22 -0400186 context->gatherParams<EntryPoint::{name}>({internal_params});
Jamie Madillee769dd2017-05-04 11:38:30 -0400187
Jamie Madill53d38412017-04-20 11:33:00 -0400188 if (context->skipValidation() || Validate{name}({validate_params}))
Jamie Madillee769dd2017-05-04 11:38:30 -0400189 {{
Jamie Madillc8c9a242018-01-02 13:39:00 -0500190 {return_if_needed}context->{name_lower_no_suffix}({internal_params});
Jamie Madillee769dd2017-05-04 11:38:30 -0400191 }}
Jamie Madillee769dd2017-05-04 11:38:30 -0400192 }}
193{default_return_if_needed}}}
194"""
195
Lingfeng Yanga0648782018-03-12 14:45:25 -0700196context_gles_header = """// GENERATED FILE - DO NOT EDIT.
197// Generated by {script_name} using data from {data_source_name}.
198//
199// Copyright {year} The ANGLE Project Authors. All rights reserved.
200// Use of this source code is governed by a BSD-style license that can be
201// found in the LICENSE file.
202//
203// Context_gles_{annotation_lower}_autogen.h: Creates a macro for interfaces in Context.
204
205#ifndef ANGLE_CONTEXT_GLES_{annotation_upper}_AUTOGEN_H_
206#define ANGLE_CONTEXT_GLES_{annotation_upper}_AUTOGEN_H_
207
208#define ANGLE_GLES1_CONTEXT_API \\
209{interface}
210
211#endif // ANGLE_CONTEXT_API_{annotation_upper}_AUTOGEN_H_
212"""
213
214context_gles_decl = """ {return_type} {name_lower_no_suffix}({internal_params}); \\"""
215
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700216libgles_entry_point_def = """{return_type}GL_APIENTRY gl{name}{explicit_context_suffix}({explicit_context_param}{explicit_context_comma}{params})
Brandon Jones41e59f52018-05-02 12:45:28 -0700217{{
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700218 return gl::{name}{explicit_context_suffix}({explicit_context_internal_param}{explicit_context_comma}{internal_params});
Brandon Jones41e59f52018-05-02 12:45:28 -0700219}}
220"""
221
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700222libgles_entry_point_export = """ {name}{explicit_context_suffix}{spaces}@{ordinal}"""
223
224template_glext_explicit_context_inc = """// GENERATED FILE - DO NOT EDIT.
225// Generated by {script_name} using data from {data_source_name}.
226//
227// Copyright {year} The ANGLE Project Authors. All rights reserved.
228// Use of this source code is governed by a BSD-style license that can be
229// found in the LICENSE file.
230//
231// gl{version}ext_explicit_context_autogen.inc:
232// Function declarations for the EGL_ANGLE_explicit_context extension
233
234{function_pointers}
235#ifdef GL_GLEXT_PROTOTYPES
236{function_prototypes}
237#endif
238"""
239
240template_glext_function_pointer = """typedef {return_type}(GL_APIENTRYP PFN{name_upper}{explicit_context_suffix_upper})({explicit_context_param}{explicit_context_comma}{params});"""
241template_glext_function_prototype = """{apicall} {return_type}GL_APIENTRY {name}{explicit_context_suffix}({explicit_context_param}{explicit_context_comma}{params});"""
Brandon Jones41e59f52018-05-02 12:45:28 -0700242
Jamie Madill16daadb2017-08-26 23:34:31 -0400243def script_relative(path):
244 return os.path.join(os.path.dirname(sys.argv[0]), path)
245
246tree = etree.parse(script_relative('gl.xml'))
247root = tree.getroot()
Jamie Madill2e16d962017-04-19 14:06:36 -0400248commands = root.find(".//commands[@namespace='GL']")
Jamie Madill2e16d962017-04-19 14:06:36 -0400249
Corentin Wallez2e568cf2017-09-18 17:05:22 -0400250with open(script_relative('entry_point_packed_gl_enums.json')) as f:
251 cmd_packed_gl_enums = json.loads(f.read())
252
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700253def format_entry_point_decl(cmd_name, proto, params, is_explicit_context):
254 comma_if_needed = ", " if len(params) > 0 else ""
Jamie Madill2e16d962017-04-19 14:06:36 -0400255 return template_entry_point_decl.format(
256 name = cmd_name[2:],
257 return_type = proto[:-len(cmd_name)],
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700258 params = ", ".join(params),
259 comma_if_needed = comma_if_needed,
260 explicit_context_suffix = "ContextANGLE" if is_explicit_context else "",
261 explicit_context_param = "GLeglContext ctx" if is_explicit_context else "",
262 explicit_context_comma = ", " if is_explicit_context and len(params) > 0 else "")
Jamie Madill2e16d962017-04-19 14:06:36 -0400263
Jamie Madillee769dd2017-05-04 11:38:30 -0400264def type_name_sep_index(param):
265 space = param.rfind(" ")
266 pointer = param.rfind("*")
267 return max(space, pointer)
268
269def just_the_type(param):
Lingfeng Yanga0648782018-03-12 14:45:25 -0700270 if "*" in param:
271 return param[:type_name_sep_index(param) + 1]
Jamie Madillee769dd2017-05-04 11:38:30 -0400272 return param[:type_name_sep_index(param)]
273
274def just_the_name(param):
275 return param[type_name_sep_index(param)+1:]
276
Lingfeng Yanga0648782018-03-12 14:45:25 -0700277def make_param(param_type, param_name):
278 return param_type + " " + param_name
279
280def just_the_type_packed(param, entry):
281 name = just_the_name(param)
282 if entry.has_key(name):
283 return entry[name]
284 else:
285 return just_the_type(param)
286
Corentin Wallez2e568cf2017-09-18 17:05:22 -0400287def just_the_name_packed(param, reserved_set):
288 name = just_the_name(param)
289 if name in reserved_set:
290 return name + 'Packed'
291 else:
292 return name
293
Jamie Madillee769dd2017-05-04 11:38:30 -0400294format_dict = {
295 "GLbitfield": "0x%X",
296 "GLboolean": "%u",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500297 "GLclampx": "0x%X",
Jamie Madillee769dd2017-05-04 11:38:30 -0400298 "GLenum": "0x%X",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500299 "GLfixed": "0x%X",
Jamie Madillee769dd2017-05-04 11:38:30 -0400300 "GLfloat": "%f",
301 "GLint": "%d",
302 "GLintptr": "%d",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500303 "GLshort": "%d",
Jamie Madillee769dd2017-05-04 11:38:30 -0400304 "GLsizei": "%d",
305 "GLsizeiptr": "%d",
Jamie Madill16daadb2017-08-26 23:34:31 -0400306 "GLsync": "0x%0.8p",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500307 "GLubyte": "%d",
Jamie Madillff161f82017-08-26 23:49:10 -0400308 "GLuint": "%u",
Jamie Madillfa920eb2018-01-04 11:45:50 -0500309 "GLuint64": "%llu",
310 "GLDEBUGPROC": "0x%0.8p",
311 "GLDEBUGPROCKHR": "0x%0.8p",
312 "GLeglImageOES": "0x%0.8p",
Jamie Madillee769dd2017-05-04 11:38:30 -0400313}
314
315def param_format_string(param):
316 if "*" in param:
317 return param + " = 0x%0.8p"
318 else:
Jamie Madill16daadb2017-08-26 23:34:31 -0400319 type_only = just_the_type(param)
320 if type_only not in format_dict:
321 raise Exception(type_only + " is not a known type in 'format_dict'")
322
323 return param + " = " + format_dict[type_only]
Jamie Madillee769dd2017-05-04 11:38:30 -0400324
Jamie Madill2e29b132017-08-28 17:22:11 -0400325def default_return_value(cmd_name, return_type):
Jamie Madillee769dd2017-05-04 11:38:30 -0400326 if return_type == "void":
327 return ""
Jamie Madill2e29b132017-08-28 17:22:11 -0400328 return "GetDefaultReturnValue<EntryPoint::" + cmd_name[2:] + ", " + return_type + ">()"
Jamie Madillee769dd2017-05-04 11:38:30 -0400329
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700330def get_context_getter_function(cmd_name, is_explicit_context):
Geoff Langcae72d62017-06-01 11:53:45 -0400331 if cmd_name == "glGetError":
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700332 return "GetGlobalContext()"
333 elif is_explicit_context:
334 return "static_cast<gl::Context *>(ctx)"
Geoff Langcae72d62017-06-01 11:53:45 -0400335 else:
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700336 return "GetValidGlobalContext()"
Geoff Langcae72d62017-06-01 11:53:45 -0400337
Jamie Madillfa920eb2018-01-04 11:45:50 -0500338template_event_comment = """// Don't run an EVENT() macro on the EXT_debug_marker entry points.
339 // It can interfere with the debug events being set by the caller.
340 // """
341
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700342def format_entry_point_def(cmd_name, proto, params, is_explicit_context):
Corentin Wallez2e568cf2017-09-18 17:05:22 -0400343 packed_gl_enums = cmd_packed_gl_enums.get(cmd_name, {})
344 internal_params = [just_the_name_packed(param, packed_gl_enums) for param in params]
345 packed_gl_enum_conversions = []
346 for param in params:
347 name = just_the_name(param)
348 if name in packed_gl_enums:
349 internal_name = name + "Packed"
350 internal_type = packed_gl_enums[name]
351 packed_gl_enum_conversions += ["\n " + internal_type + " " + internal_name +" = FromGLenum<" +
352 internal_type + ">(" + name + ");"]
353
Jamie Madillee769dd2017-05-04 11:38:30 -0400354 pass_params = [just_the_name(param) for param in params]
355 format_params = [param_format_string(param) for param in params]
356 return_type = proto[:-len(cmd_name)]
Jamie Madill2e29b132017-08-28 17:22:11 -0400357 default_return = default_return_value(cmd_name, return_type.strip())
Jamie Madillfa920eb2018-01-04 11:45:50 -0500358 event_comment = template_event_comment if cmd_name in no_event_marker_exceptions_list else ""
Jamie Madillc8c9a242018-01-02 13:39:00 -0500359 name_lower_no_suffix = cmd_name[2:3].lower() + cmd_name[3:]
360
Jamie Madillfa920eb2018-01-04 11:45:50 -0500361 for suffix in strip_suffixes:
362 if name_lower_no_suffix.endswith(suffix):
363 name_lower_no_suffix = name_lower_no_suffix[0:-len(suffix)]
364
Jamie Madillee769dd2017-05-04 11:38:30 -0400365 return template_entry_point_def.format(
366 name = cmd_name[2:],
Jamie Madillc8c9a242018-01-02 13:39:00 -0500367 name_lower_no_suffix = name_lower_no_suffix,
Jamie Madillee769dd2017-05-04 11:38:30 -0400368 return_type = return_type,
369 params = ", ".join(params),
Corentin Wallez2e568cf2017-09-18 17:05:22 -0400370 internal_params = ", ".join(internal_params),
371 packed_gl_enum_conversions = "".join(packed_gl_enum_conversions),
Jamie Madillee769dd2017-05-04 11:38:30 -0400372 pass_params = ", ".join(pass_params),
373 comma_if_needed = ", " if len(params) > 0 else "",
Corentin Wallez2e568cf2017-09-18 17:05:22 -0400374 validate_params = ", ".join(["context"] + internal_params),
Jamie Madillee769dd2017-05-04 11:38:30 -0400375 format_params = ", ".join(format_params),
Jamie Madillee769dd2017-05-04 11:38:30 -0400376 return_if_needed = "" if default_return == "" else "return ",
Geoff Langcae72d62017-06-01 11:53:45 -0400377 default_return_if_needed = "" if default_return == "" else "\n return " + default_return + ";\n",
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700378 context_getter = get_context_getter_function(cmd_name, is_explicit_context),
379 event_comment = event_comment,
380 explicit_context_suffix = "ContextANGLE" if is_explicit_context else "",
381 explicit_context_param = "GLeglContext ctx" if is_explicit_context else "",
382 explicit_context_comma = ", " if is_explicit_context and len(params) > 0 else "",
383 assert_explicit_context = "\nASSERT(context == GetValidGlobalContext());"
384 if is_explicit_context else "")
Jamie Madillee769dd2017-05-04 11:38:30 -0400385
Lingfeng Yanga0648782018-03-12 14:45:25 -0700386def format_context_gles_decl(cmd_name, proto, params):
387 packed_gl_enums = cmd_packed_gl_enums.get(cmd_name, {})
388 internal_params = ", ".join([make_param(just_the_type_packed(param, packed_gl_enums),
389 just_the_name_packed(param, packed_gl_enums)) for param in params])
390
391 return_type = proto[:-len(cmd_name)]
392 name_lower_no_suffix = cmd_name[2:3].lower() + cmd_name[3:]
393
394 for suffix in strip_suffixes:
395 if name_lower_no_suffix.endswith(suffix):
396 name_lower_no_suffix = name_lower_no_suffix[0:-len(suffix)]
397
398 return context_gles_decl.format(
399 return_type = return_type,
400 name_lower_no_suffix = name_lower_no_suffix,
401 internal_params = internal_params)
402
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700403def format_libgles_entry_point_def(cmd_name, proto, params, is_explicit_context):
Brandon Jones41e59f52018-05-02 12:45:28 -0700404 internal_params = [just_the_name(param) for param in params]
405 return_type = proto[:-len(cmd_name)]
406
407 return libgles_entry_point_def.format(
408 name = cmd_name[2:],
409 return_type = return_type,
410 params = ", ".join(params),
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700411 internal_params = ", ".join(internal_params),
412 explicit_context_suffix = "ContextANGLE" if is_explicit_context else "",
413 explicit_context_param = "GLeglContext ctx" if is_explicit_context else "",
414 explicit_context_comma = ", " if is_explicit_context and len(params) > 0 else "",
415 explicit_context_internal_param = "ctx" if is_explicit_context else "")
Brandon Jones41e59f52018-05-02 12:45:28 -0700416
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700417def format_libgles_entry_point_export(cmd_name, ordinal, is_explicit_context):
Brandon Jones41e59f52018-05-02 12:45:28 -0700418 return libgles_entry_point_export.format(
419 name = cmd_name,
420 ordinal = ordinal,
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700421 spaces = " "*(50 - len(cmd_name)),
422 explicit_context_suffix = "ContextANGLE" if is_explicit_context else "")
Brandon Jones41e59f52018-05-02 12:45:28 -0700423
Jiajia Qincb59a902017-11-22 13:03:42 +0800424def path_to(folder, file):
425 return os.path.join(script_relative(".."), "src", folder, file)
Jamie Madill2e16d962017-04-19 14:06:36 -0400426
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700427def get_entry_points(all_commands, gles_commands, ordinal, is_explicit_context):
Jamie Madillc8c9a242018-01-02 13:39:00 -0500428 decls = []
429 defs = []
Brandon Jones41e59f52018-05-02 12:45:28 -0700430 export_defs = []
431 exports = []
432
Jamie Madillffa2cd02017-12-28 14:57:53 -0500433 for command in all_commands:
434 proto = command.find('proto')
435 cmd_name = proto.find('name').text
436
437 if cmd_name not in gles_commands:
438 continue
439
440 param_text = ["".join(param.itertext()) for param in command.findall('param')]
441 proto_text = "".join(proto.itertext())
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700442 decls.append(format_entry_point_decl(cmd_name, proto_text, param_text,
443 is_explicit_context))
444 defs.append(format_entry_point_def(cmd_name, proto_text, param_text, is_explicit_context))
Brandon Jones41e59f52018-05-02 12:45:28 -0700445
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700446 export_defs.append(format_libgles_entry_point_def(cmd_name, proto_text, param_text,
447 is_explicit_context))
448 exports.append(format_libgles_entry_point_export(cmd_name, ordinal, is_explicit_context))
Brandon Jones41e59f52018-05-02 12:45:28 -0700449 ordinal = ordinal + 1
450
451 return decls, defs, export_defs, exports
Jamie Madill16daadb2017-08-26 23:34:31 -0400452
Lingfeng Yanga0648782018-03-12 14:45:25 -0700453def get_gles1_decls(all_commands, gles_commands):
454 decls = []
455 for command in all_commands:
456 proto = command.find('proto')
457 cmd_name = proto.find('name').text
458
459 if cmd_name not in gles_commands:
460 continue
461
462 if cmd_name in gles1_overloaded:
463 continue
464
465 param_text = ["".join(param.itertext()) for param in command.findall('param')]
466 proto_text = "".join(proto.itertext())
467 decls.append(format_context_gles_decl(cmd_name, proto_text, param_text))
468
469 return decls
470
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700471def get_glext_decls(all_commands, gles_commands, version, is_explicit_context):
472 glext_ptrs = []
473 glext_protos = []
474 is_gles1 = False
475
476 if(version == ""):
477 is_gles1 = True
478
479 for command in all_commands:
480 proto = command.find('proto')
481 cmd_name = proto.find('name').text
482
483 if cmd_name not in gles_commands:
484 continue
485
486 param_text = ["".join(param.itertext()) for param in command.findall('param')]
487 proto_text = "".join(proto.itertext())
488
489 return_type = proto_text[:-len(cmd_name)]
490 params = ", ".join(param_text)
491
492 format_params = {
493 "apicall": "GL_API" if is_gles1 else "GL_APICALL",
494 "name": cmd_name,
495 "name_upper": cmd_name.upper(),
496 "return_type": return_type,
497 "params": params,
498 "explicit_context_comma": ", " if is_explicit_context and len(params) > 0 else "",
499 "explicit_context_suffix": "ContextANGLE" if is_explicit_context else "",
500 "explicit_context_suffix_upper": "CONTEXTANGLE" if is_explicit_context else "",
501 "explicit_context_param": "GLeglContext ctx" if is_explicit_context else ""}
502
503 glext_ptrs.append(template_glext_function_pointer.format(
504 **format_params))
505 glext_protos.append(template_glext_function_prototype.format(
506 **format_params))
507
508 return glext_ptrs, glext_protos
509
Brandon Jones416aaf92018-04-10 08:10:16 -0700510def write_file(annotation, comment, template, entry_points, suffix, includes, file):
Jiajia Qincb59a902017-11-22 13:03:42 +0800511
Jamie Madillc8c9a242018-01-02 13:39:00 -0500512 content = template.format(
513 script_name = os.path.basename(sys.argv[0]),
Brandon Jones416aaf92018-04-10 08:10:16 -0700514 data_source_name = file,
Jamie Madillc8c9a242018-01-02 13:39:00 -0500515 year = date.today().year,
516 annotation_lower = annotation.lower(),
517 annotation_upper = annotation.upper(),
518 comment = comment,
519 includes = includes,
520 entry_points = entry_points)
Jiajia Qincb59a902017-11-22 13:03:42 +0800521
Jamie Madillc8c9a242018-01-02 13:39:00 -0500522 path = path_to("libGLESv2", "entry_points_gles_{}_autogen.{}".format(
523 annotation.lower(), suffix))
524
525 with open(path, "w") as out:
526 out.write(content)
527 out.close()
528
Brandon Jones41e59f52018-05-02 12:45:28 -0700529def write_export_files(entry_points, includes, exports):
530
531 content = template_libgles_entry_point_source.format(
532 script_name = os.path.basename(sys.argv[0]),
533 data_source_name = "gl.xml and gl_angle_ext.xml",
534 year = date.today().year,
535 includes = includes,
536 entry_points = entry_points)
537
538 path = path_to("libGLESv2", "libGLESv2_autogen.cpp")
539
540 with open(path, "w") as out:
541 out.write(content)
542 out.close()
543
544 content = template_libgles_entry_point_export.format(
545 script_name = os.path.basename(sys.argv[0]),
546 data_source_name = "gl.xml and gl_angle_ext.xml",
547 exports = exports,
548 year = date.today().year)
549
550 path = path_to("libGLESv2", "libGLESv2_autogen.def")
551
552 with open(path, "w") as out:
553 out.write(content)
554 out.close()
555
Lingfeng Yanga0648782018-03-12 14:45:25 -0700556def write_context_api_decls(annotation, template, decls):
557
558 interface_lines = []
559
560 for i in decls['core']:
561 interface_lines.append(i)
562
563 for extname in sorted(decls['exts'].keys()):
564 interface_lines.append(" /* " + extname + " */ \\")
565 interface_lines.extend(decls['exts'][extname])
566
567 content = template.format(
568 annotation_lower = annotation.lower(),
569 annotation_upper = annotation.upper(),
570 script_name = os.path.basename(sys.argv[0]),
571 data_source_name = "gl.xml",
572 year = date.today().year,
573 interface = "\n".join(interface_lines))
574
575 path = path_to("libANGLE", "Context_gles_%s_autogen.h" % annotation.lower())
576
577 with open(path, "w") as out:
578 out.write(content)
579 out.close()
580
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700581def write_glext_explicit_context_inc(version, ptrs, protos):
582 folder_version = version if version != "31" else "3"
583
584 content = template_glext_explicit_context_inc.format(
585 script_name = os.path.basename(sys.argv[0]),
586 data_source_name = "gl.xml and gl_angle_ext.xml",
587 year = date.today().year,
588 version = version,
589 function_pointers = ptrs,
590 function_prototypes = protos)
591
Brandon Jones795ab712018-05-24 15:45:40 -0700592 path = os.path.join(script_relative(".."), "include", "GLES{}".format(folder_version),
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700593 "gl{}ext_explicit_context_autogen.inc".format(version))
594
595 with open(path, "w") as out:
596 out.write(content)
597 out.close()
598
Brandon Jones416aaf92018-04-10 08:10:16 -0700599def append_angle_extensions(base_root):
600 angle_ext_tree = etree.parse(script_relative('gl_angle_ext.xml'))
601 angle_ext_root = angle_ext_tree.getroot()
602
603 insertion_point = base_root.findall("./commands")[0]
604 for command in angle_ext_root.iter('commands'):
605 insertion_point.extend(command)
606
607 insertion_point = base_root.findall("./extensions")[0]
608 for extension in angle_ext_root.iter('extensions'):
609 insertion_point.extend(extension)
610 return base_root
611
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700612class GLCommandNames:
613 def __init__(self):
614 self.command_names = {}
615
616 def get_commands(self, version):
617 return self.command_names[version]
618
619 def get_all_commands(self):
620 cmd_names = []
621 # Combine all the version lists into a single list
622 for version, version_cmd_names in sorted(self.command_names.iteritems()):
623 cmd_names += version_cmd_names
624
625 return cmd_names
626
627 def add_commands(self, version, commands):
628 # Add key if it doesn't exist
629 if version not in self.command_names:
630 self.command_names[version] = []
631 # Add the commands that aren't duplicates
632 self.command_names[version] += commands
633
Brandon Jones416aaf92018-04-10 08:10:16 -0700634root = append_angle_extensions(root)
635
Jamie Madillc8c9a242018-01-02 13:39:00 -0500636all_commands = root.findall('commands/command')
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700637all_cmd_names = GLCommandNames()
Jamie Madillc8c9a242018-01-02 13:39:00 -0500638
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500639template_header_includes = """#include <GLES{major}/gl{major}{minor}.h>
Jamie Madillc8c9a242018-01-02 13:39:00 -0500640#include <export.h>"""
641
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500642template_sources_includes = """#include "libGLESv2/entry_points_gles_{}_autogen.h"
643
644#include "libANGLE/Context.h"
Jamie Madillc8c9a242018-01-02 13:39:00 -0500645#include "libANGLE/validationES{}{}.h"
646#include "libGLESv2/global_state.h"
647"""
648
Lingfeng Yanga0648782018-03-12 14:45:25 -0700649gles1decls = {}
650
651gles1decls['core'] = []
652gles1decls['exts'] = {}
653
Brandon Jones41e59f52018-05-02 12:45:28 -0700654libgles_ep_defs = []
655libgles_ep_exports = []
656
657ordinal_start = 1
658
Lingfeng Yanga0648782018-03-12 14:45:25 -0700659# First run through the main GLES entry points. Since ES2+ is the primary use
660# case, we go through those first and then add ES1-only APIs at the end.
661for major_version, minor_version in [[2, 0], [3, 0], [3, 1], [1, 0]]:
Jamie Madillc8c9a242018-01-02 13:39:00 -0500662 annotation = "{}_{}".format(major_version, minor_version)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500663 name_prefix = "GL_ES_VERSION_"
Lingfeng Yanga0648782018-03-12 14:45:25 -0700664
665 is_gles1 = major_version == 1
666 if is_gles1:
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500667 name_prefix = "GL_VERSION_ES_CM_"
Lingfeng Yanga0648782018-03-12 14:45:25 -0700668
Jamie Madillc8c9a242018-01-02 13:39:00 -0500669 comment = annotation.replace("_", ".")
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500670 gles_xpath = ".//feature[@name='{}{}']//command".format(name_prefix, annotation)
Jamie Madillc8c9a242018-01-02 13:39:00 -0500671 gles_commands = [cmd.attrib['name'] for cmd in root.findall(gles_xpath)]
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500672
673 # Remove commands that have already been processed
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700674 gles_commands = [cmd for cmd in gles_commands if cmd not in all_cmd_names.get_all_commands()]
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500675
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700676 all_cmd_names.add_commands(annotation, gles_commands)
Jamie Madillc8c9a242018-01-02 13:39:00 -0500677
Brandon Jones41e59f52018-05-02 12:45:28 -0700678 decls, defs, libgles_defs, libgles_exports = get_entry_points(
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700679 all_commands, gles_commands, ordinal_start, False)
Brandon Jones41e59f52018-05-02 12:45:28 -0700680
681 # Increment the ordinal before inserting the version comment
682 ordinal_start += len(libgles_exports)
683
684 # Write the version as a comment before the first EP.
685 libgles_defs.insert(0, "\n// OpenGL ES {}.{}".format(major_version, minor_version))
686 libgles_exports.insert(0, "\n ; OpenGL ES {}.{}".format(major_version, minor_version))
687
688 libgles_ep_defs += libgles_defs
689 libgles_ep_exports += libgles_exports
Jamie Madillc8c9a242018-01-02 13:39:00 -0500690
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500691 major_if_not_one = major_version if major_version != 1 else ""
Jamie Madillc8c9a242018-01-02 13:39:00 -0500692 minor_if_not_zero = minor_version if minor_version != 0 else ""
693
694 header_includes = template_header_includes.format(
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500695 major=major_if_not_one, minor=minor_if_not_zero)
Jamie Madillc8c9a242018-01-02 13:39:00 -0500696
697 # We include the platform.h header since it undefines the conflicting MemoryBarrier macro.
698 if major_version == 3 and minor_version == 1:
699 header_includes += "\n#include \"common/platform.h\"\n"
700
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500701 source_includes = template_sources_includes.format(
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700702 annotation.lower(), major_version, minor_if_not_zero)
Jamie Madillc8c9a242018-01-02 13:39:00 -0500703
704 write_file(annotation, comment, template_entry_point_header,
Brandon Jones416aaf92018-04-10 08:10:16 -0700705 "\n".join(decls), "h", header_includes, "gl.xml")
Jamie Madillc8c9a242018-01-02 13:39:00 -0500706 write_file(annotation, comment, template_entry_point_source,
Brandon Jones416aaf92018-04-10 08:10:16 -0700707 "\n".join(defs), "cpp", source_includes, "gl.xml")
Lingfeng Yanga0648782018-03-12 14:45:25 -0700708 if is_gles1:
709 gles1decls['core'] = get_gles1_decls(all_commands, gles_commands)
710
Jamie Madill57ae8c12017-08-30 12:14:29 -0400711
Jamie Madillfa920eb2018-01-04 11:45:50 -0500712# After we finish with the main entry points, we process the extensions.
713extension_defs = []
714extension_decls = []
715
716# Use a first step to run through the extensions so we can generate them
717# in sorted order.
718ext_data = {}
719
Lingfeng Yanga0648782018-03-12 14:45:25 -0700720for gles1ext in gles1_extensions:
721 gles1decls['exts'][gles1ext] = []
722
Jamie Madillfa920eb2018-01-04 11:45:50 -0500723for extension in root.findall("extensions/extension"):
724 extension_name = extension.attrib['name']
725 if not extension_name in supported_extensions:
726 continue
727
728 ext_cmd_names = []
729
730 # There's an extra step here to filter out 'api=gl' extensions. This
731 # is necessary for handling KHR extensions, which have separate entry
732 # point signatures (without the suffix) for desktop GL. Note that this
733 # extra step is necessary because of Etree's limited Xpath support.
734 for require in extension.findall('require'):
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500735 if 'api' in require.attrib and require.attrib['api'] != 'gles2' and require.attrib['api'] != 'gles1':
Jamie Madillfa920eb2018-01-04 11:45:50 -0500736 continue
737
738 # Another special case for EXT_texture_storage
739 filter_out_comment = "Supported only if GL_EXT_direct_state_access is supported"
740 if 'comment' in require.attrib and require.attrib['comment'] == filter_out_comment:
741 continue
742
743 extension_commands = require.findall('command')
744 ext_cmd_names += [command.attrib['name'] for command in extension_commands]
745
746 ext_data[extension_name] = sorted(ext_cmd_names)
747
748for extension_name, ext_cmd_names in sorted(ext_data.iteritems()):
749
750 # Detect and filter duplicate extensions.
751 dupes = []
752 for ext_cmd in ext_cmd_names:
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700753 if ext_cmd in all_cmd_names.get_all_commands():
Jamie Madillfa920eb2018-01-04 11:45:50 -0500754 dupes.append(ext_cmd)
755
756 for dupe in dupes:
757 ext_cmd_names.remove(dupe)
758
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700759 if extension_name in gles1_extensions:
760 all_cmd_names.add_commands("glext", ext_cmd_names)
761 else:
762 all_cmd_names.add_commands("gl2ext", ext_cmd_names)
Jamie Madillfa920eb2018-01-04 11:45:50 -0500763
Brandon Jones41e59f52018-05-02 12:45:28 -0700764 decls, defs, libgles_defs, libgles_exports = get_entry_points(
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700765 all_commands, ext_cmd_names, ordinal_start, False)
Jamie Madillfa920eb2018-01-04 11:45:50 -0500766
767 # Avoid writing out entry points defined by a prior extension.
768 for dupe in dupes:
769 msg = "// {} is already defined.\n".format(dupe[2:])
770 defs.append(msg)
771
Brandon Jones41e59f52018-05-02 12:45:28 -0700772 # Increment starting ordinal before adding extension comment
773 ordinal_start += len(libgles_exports)
774
Jamie Madillfa920eb2018-01-04 11:45:50 -0500775 # Write the extension name as a comment before the first EP.
776 comment = "\n// {}".format(extension_name)
777 defs.insert(0, comment)
778 decls.insert(0, comment)
Brandon Jones41e59f52018-05-02 12:45:28 -0700779 libgles_defs.insert(0, comment)
780 libgles_exports.insert(0, "\n ; {}".format(extension_name))
Jamie Madillfa920eb2018-01-04 11:45:50 -0500781
782 extension_defs += defs
783 extension_decls += decls
784
Brandon Jones41e59f52018-05-02 12:45:28 -0700785 libgles_ep_defs += libgles_defs
786 libgles_ep_exports += libgles_exports
787
Lingfeng Yanga0648782018-03-12 14:45:25 -0700788 if extension_name in gles1_extensions:
789 if extension_name not in gles1_no_context_decl_extensions:
790 gles1decls['exts'][extension_name] = get_gles1_decls(all_commands, ext_cmd_names)
791
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700792# Special handling for EGL_ANGLE_explicit_context extension
793if support_EGL_ANGLE_explicit_context:
794 comment = "\n// EGL_ANGLE_explicit_context"
795 extension_defs.append(comment)
796 extension_decls.append(comment)
797 libgles_ep_defs.append(comment)
798 libgles_ep_exports.append("\n ; EGL_ANGLE_explicit_context")
799
800 # Get the explicit context entry points
801 decls, defs, libgles_defs, libgles_exports = get_entry_points(all_commands,
802 all_cmd_names.get_all_commands(), ordinal_start, True)
803
804 # Append the explicit context entry points
805 extension_decls += decls
806 extension_defs += defs
807 libgles_ep_defs += libgles_defs
808 libgles_ep_exports += libgles_exports
809
810 # Generate .inc files for extension function pointers and declarations
811 for major, minor in [[2, 0], [3, 0], [3, 1], [1, 0]]:
812 annotation = "{}_{}".format(major, minor)
813
814 major_if_not_one = major if major != 1 else ""
815 minor_if_not_zero = minor if minor != 0 else ""
816 version = "{}{}".format(major_if_not_one, minor_if_not_zero)
817
818 glext_ptrs, glext_protos = get_glext_decls(all_commands,
819 all_cmd_names.get_commands(annotation), version, True)
820
821 glext_ext_ptrs = []
822 glext_ext_protos = []
823
824 # Append extensions for 1.0 and 2.0
825 if(annotation == "1_0"):
826 glext_ext_ptrs, glext_ext_protos = get_glext_decls(all_commands,
827 all_cmd_names.get_commands("glext"), version, True)
828 elif(annotation == "2_0"):
829 glext_ext_ptrs, glext_ext_protos = get_glext_decls(all_commands,
830 all_cmd_names.get_commands("gl2ext"), version, True)
831
832 glext_ptrs += glext_ext_ptrs
833 glext_protos += glext_ext_protos
834
835 write_glext_explicit_context_inc(version, "\n".join(glext_ptrs), "\n".join(glext_protos))
836
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500837header_includes = template_header_includes.format(
838 major="", minor="")
839header_includes += """
840#include <GLES/gl.h>
841#include <GLES/glext.h>
842#include <GLES2/gl2.h>
843#include <GLES2/gl2ext.h>
844"""
Jamie Madillfa920eb2018-01-04 11:45:50 -0500845
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500846source_includes = template_sources_includes.format("ext", "", "")
847source_includes += """
848#include "libANGLE/validationES.h"
849#include "libANGLE/validationES1.h"
Jamie Madillfa920eb2018-01-04 11:45:50 -0500850#include "libANGLE/validationES3.h"
851#include "libANGLE/validationES31.h"
852"""
853
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500854write_file("ext", "extension", template_entry_point_header,
Brandon Jones416aaf92018-04-10 08:10:16 -0700855 "\n".join([item for item in extension_decls]), "h", header_includes,
856 "gl.xml and gl_angle_ext.xml")
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500857write_file("ext", "extension", template_entry_point_source,
Brandon Jones416aaf92018-04-10 08:10:16 -0700858 "\n".join([item for item in extension_defs]), "cpp", source_includes,
859 "gl.xml and gl_angle_ext.xml")
Jamie Madillc8c9a242018-01-02 13:39:00 -0500860
Lingfeng Yanga0648782018-03-12 14:45:25 -0700861write_context_api_decls("1_0", context_gles_header, gles1decls)
862
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700863sorted_cmd_names = ["Invalid"] + [cmd[2:] for cmd in sorted(all_cmd_names.get_all_commands())]
Jamie Madillc8c9a242018-01-02 13:39:00 -0500864
Jamie Madillee769dd2017-05-04 11:38:30 -0400865entry_points_enum = template_entry_points_enum_header.format(
866 script_name = os.path.basename(sys.argv[0]),
Brandon Jones416aaf92018-04-10 08:10:16 -0700867 data_source_name = "gl.xml and gl_angle_ext.xml",
Jamie Madillee769dd2017-05-04 11:38:30 -0400868 year = date.today().year,
Jamie Madillc8c9a242018-01-02 13:39:00 -0500869 entry_points_list = ",\n".join([" " + cmd for cmd in sorted_cmd_names]))
Jamie Madillee769dd2017-05-04 11:38:30 -0400870
Jamie Madillee769dd2017-05-04 11:38:30 -0400871entry_points_enum_header_path = path_to("libANGLE", "entry_points_enum_autogen.h")
Jamie Madillee769dd2017-05-04 11:38:30 -0400872with open(entry_points_enum_header_path, "w") as out:
873 out.write(entry_points_enum)
Geoff Langcae72d62017-06-01 11:53:45 -0400874 out.close()
Brandon Jones41e59f52018-05-02 12:45:28 -0700875
876source_includes = """
877#include "angle_gl.h"
878
879#include "libGLESv2/entry_points_gles_1_0_autogen.h"
880#include "libGLESv2/entry_points_gles_2_0_autogen.h"
881#include "libGLESv2/entry_points_gles_3_0_autogen.h"
882#include "libGLESv2/entry_points_gles_3_1_autogen.h"
883#include "libGLESv2/entry_points_gles_ext_autogen.h"
884
885#include "common/event_tracer.h"
886"""
887
888write_export_files("\n".join([item for item in libgles_ep_defs]), source_includes, "\n".join([item for item in libgles_ep_exports]))