blob: 72aba444c7c72b36aa6165a6d15e04207f5c6cd3 [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",
Jiawei Shao5f9482f2018-05-18 09:00:09 +080060 "GL_EXT_geometry_shader",
Jamie Madillfa920eb2018-01-04 11:45:50 -050061 "GL_EXT_map_buffer_range",
62 "GL_EXT_occlusion_query_boolean",
63 "GL_EXT_robustness",
64 "GL_EXT_texture_storage",
65 "GL_KHR_debug",
66 "GL_NV_fence",
67 "GL_OES_EGL_image",
68 "GL_OES_get_program_binary",
69 "GL_OES_mapbuffer",
70 "GL_OES_vertex_array_object",
71])
72
Brandon Jones2b0cdcc2018-05-02 08:02:50 -070073# The EGL_ANGLE_explicit_context extension is generated differently from other extensions.
74# Toggle generation here.
75support_EGL_ANGLE_explicit_context = True
76
Jamie Madillfa920eb2018-01-04 11:45:50 -050077# This is a list of exceptions for entry points which don't want to have
78# the EVENT macro. This is required for some debug marker entry points.
79no_event_marker_exceptions_list = sorted([
80 "glPushGroupMarkerEXT",
81 "glPopGroupMarkerEXT",
82 "glInsertEventMarkerEXT",
83])
84
85# Strip these suffixes from Context entry point names. NV is excluded (for now).
Brandon Jones416aaf92018-04-10 08:10:16 -070086strip_suffixes = ["ANGLE", "EXT", "KHR", "OES", "CHROMIUM"]
Jamie Madillfa920eb2018-01-04 11:45:50 -050087
Jamie Madill2e16d962017-04-19 14:06:36 -040088template_entry_point_header = """// GENERATED FILE - DO NOT EDIT.
89// Generated by {script_name} using data from {data_source_name}.
90//
91// Copyright {year} The ANGLE Project Authors. All rights reserved.
92// Use of this source code is governed by a BSD-style license that can be
93// found in the LICENSE file.
94//
Jamie Madillc8c9a242018-01-02 13:39:00 -050095// entry_points_gles_{annotation_lower}_autogen.h:
96// Defines the GLES {comment} entry points.
Jamie Madill2e16d962017-04-19 14:06:36 -040097
Jamie Madillc8c9a242018-01-02 13:39:00 -050098#ifndef LIBGLESV2_ENTRY_POINTS_GLES_{annotation_upper}_AUTOGEN_H_
99#define LIBGLESV2_ENTRY_POINTS_GLES_{annotation_upper}_AUTOGEN_H_
Jamie Madill2e16d962017-04-19 14:06:36 -0400100
Jamie Madillc8c9a242018-01-02 13:39:00 -0500101{includes}
102
Jamie Madill2e16d962017-04-19 14:06:36 -0400103namespace gl
104{{
105{entry_points}
106}} // namespace gl
107
Jamie Madillc8c9a242018-01-02 13:39:00 -0500108#endif // LIBGLESV2_ENTRY_POINTS_GLES_{annotation_upper}_AUTOGEN_H_
Jamie Madill2e16d962017-04-19 14:06:36 -0400109"""
110
Jamie Madillee769dd2017-05-04 11:38:30 -0400111template_entry_point_source = """// GENERATED FILE - DO NOT EDIT.
112// Generated by {script_name} using data from {data_source_name}.
113//
114// Copyright {year} The ANGLE Project Authors. All rights reserved.
115// Use of this source code is governed by a BSD-style license that can be
116// found in the LICENSE file.
117//
Jamie Madillc8c9a242018-01-02 13:39:00 -0500118// entry_points_gles_{annotation_lower}_autogen.cpp:
119// Defines the GLES {comment} entry points.
Jamie Madillee769dd2017-05-04 11:38:30 -0400120
Jamie Madillc8c9a242018-01-02 13:39:00 -0500121{includes}
Jamie Madillee769dd2017-05-04 11:38:30 -0400122
123namespace gl
124{{
125{entry_points}}} // namespace gl
126"""
127
128template_entry_points_enum_header = """// GENERATED FILE - DO NOT EDIT.
129// Generated by {script_name} using data from {data_source_name}.
130//
131// Copyright {year} The ANGLE Project Authors. All rights reserved.
132// Use of this source code is governed by a BSD-style license that can be
133// found in the LICENSE file.
134//
135// entry_points_enum_autogen.h:
136// Defines the GLES entry points enumeration.
137
138#ifndef LIBGLESV2_ENTRYPOINTSENUM_AUTOGEN_H_
139#define LIBGLESV2_ENTRYPOINTSENUM_AUTOGEN_H_
140
141namespace gl
142{{
143enum class EntryPoint
144{{
145{entry_points_list}
146}};
147}} // namespace gl
148#endif // LIBGLESV2_ENTRY_POINTS_ENUM_AUTOGEN_H_
149"""
150
Brandon Jones41e59f52018-05-02 12:45:28 -0700151template_libgles_entry_point_source = """// GENERATED FILE - DO NOT EDIT.
152// Generated by {script_name} using data from {data_source_name}.
153//
154// Copyright {year} The ANGLE Project Authors. All rights reserved.
155// Use of this source code is governed by a BSD-style license that can be
156// found in the LICENSE file.
157//
158// libGLESv2.cpp: Implements the exported OpenGL ES functions.
159
160{includes}
161extern "C" {{
162{entry_points}
163}} // extern "C"
164"""
165
166template_libgles_entry_point_export = """; GENERATED FILE - DO NOT EDIT.
167; Generated by {script_name} using data from {data_source_name}.
168;
169; Copyright {year} The ANGLE Project Authors. All rights reserved.
170; Use of this source code is governed by a BSD-style license that can be
171; found in the LICENSE file.
172LIBRARY libGLESv2
173EXPORTS
174{exports}
175"""
176
Jamie Madill2e16d962017-04-19 14:06:36 -0400177template_entry_point_decl = """ANGLE_EXPORT {return_type}GL_APIENTRY {name}({params});"""
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700178template_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 -0400179
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700180template_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 -0400181{{
Jamie Madillfa920eb2018-01-04 11:45:50 -0500182 {event_comment}EVENT("({format_params})"{comma_if_needed}{pass_params});
Jamie Madillee769dd2017-05-04 11:38:30 -0400183
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700184 Context *context = {context_getter};
Jamie Madillee769dd2017-05-04 11:38:30 -0400185 if (context)
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700186 {{{assert_explicit_context}{packed_gl_enum_conversions}
Corentin Wallez2e568cf2017-09-18 17:05:22 -0400187 context->gatherParams<EntryPoint::{name}>({internal_params});
Jamie Madillee769dd2017-05-04 11:38:30 -0400188
Jamie Madill53d38412017-04-20 11:33:00 -0400189 if (context->skipValidation() || Validate{name}({validate_params}))
Jamie Madillee769dd2017-05-04 11:38:30 -0400190 {{
Jamie Madillc8c9a242018-01-02 13:39:00 -0500191 {return_if_needed}context->{name_lower_no_suffix}({internal_params});
Jamie Madillee769dd2017-05-04 11:38:30 -0400192 }}
Jamie Madillee769dd2017-05-04 11:38:30 -0400193 }}
194{default_return_if_needed}}}
195"""
196
Lingfeng Yanga0648782018-03-12 14:45:25 -0700197context_gles_header = """// GENERATED FILE - DO NOT EDIT.
198// Generated by {script_name} using data from {data_source_name}.
199//
200// Copyright {year} The ANGLE Project Authors. All rights reserved.
201// Use of this source code is governed by a BSD-style license that can be
202// found in the LICENSE file.
203//
204// Context_gles_{annotation_lower}_autogen.h: Creates a macro for interfaces in Context.
205
206#ifndef ANGLE_CONTEXT_GLES_{annotation_upper}_AUTOGEN_H_
207#define ANGLE_CONTEXT_GLES_{annotation_upper}_AUTOGEN_H_
208
209#define ANGLE_GLES1_CONTEXT_API \\
210{interface}
211
212#endif // ANGLE_CONTEXT_API_{annotation_upper}_AUTOGEN_H_
213"""
214
215context_gles_decl = """ {return_type} {name_lower_no_suffix}({internal_params}); \\"""
216
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700217libgles_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 -0700218{{
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700219 return gl::{name}{explicit_context_suffix}({explicit_context_internal_param}{explicit_context_comma}{internal_params});
Brandon Jones41e59f52018-05-02 12:45:28 -0700220}}
221"""
222
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700223libgles_entry_point_export = """ {name}{explicit_context_suffix}{spaces}@{ordinal}"""
224
225template_glext_explicit_context_inc = """// GENERATED FILE - DO NOT EDIT.
226// Generated by {script_name} using data from {data_source_name}.
227//
228// Copyright {year} The ANGLE Project Authors. All rights reserved.
229// Use of this source code is governed by a BSD-style license that can be
230// found in the LICENSE file.
231//
232// gl{version}ext_explicit_context_autogen.inc:
233// Function declarations for the EGL_ANGLE_explicit_context extension
234
235{function_pointers}
236#ifdef GL_GLEXT_PROTOTYPES
237{function_prototypes}
238#endif
239"""
240
241template_glext_function_pointer = """typedef {return_type}(GL_APIENTRYP PFN{name_upper}{explicit_context_suffix_upper})({explicit_context_param}{explicit_context_comma}{params});"""
242template_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 -0700243
Jamie Madill16daadb2017-08-26 23:34:31 -0400244def script_relative(path):
245 return os.path.join(os.path.dirname(sys.argv[0]), path)
246
247tree = etree.parse(script_relative('gl.xml'))
248root = tree.getroot()
Jamie Madill2e16d962017-04-19 14:06:36 -0400249commands = root.find(".//commands[@namespace='GL']")
Jamie Madill2e16d962017-04-19 14:06:36 -0400250
Corentin Wallez2e568cf2017-09-18 17:05:22 -0400251with open(script_relative('entry_point_packed_gl_enums.json')) as f:
252 cmd_packed_gl_enums = json.loads(f.read())
253
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700254def format_entry_point_decl(cmd_name, proto, params, is_explicit_context):
255 comma_if_needed = ", " if len(params) > 0 else ""
Jamie Madill2e16d962017-04-19 14:06:36 -0400256 return template_entry_point_decl.format(
257 name = cmd_name[2:],
258 return_type = proto[:-len(cmd_name)],
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700259 params = ", ".join(params),
260 comma_if_needed = comma_if_needed,
261 explicit_context_suffix = "ContextANGLE" if is_explicit_context else "",
262 explicit_context_param = "GLeglContext ctx" if is_explicit_context else "",
263 explicit_context_comma = ", " if is_explicit_context and len(params) > 0 else "")
Jamie Madill2e16d962017-04-19 14:06:36 -0400264
Jamie Madillee769dd2017-05-04 11:38:30 -0400265def type_name_sep_index(param):
266 space = param.rfind(" ")
267 pointer = param.rfind("*")
268 return max(space, pointer)
269
270def just_the_type(param):
Lingfeng Yanga0648782018-03-12 14:45:25 -0700271 if "*" in param:
272 return param[:type_name_sep_index(param) + 1]
Jamie Madillee769dd2017-05-04 11:38:30 -0400273 return param[:type_name_sep_index(param)]
274
275def just_the_name(param):
276 return param[type_name_sep_index(param)+1:]
277
Lingfeng Yanga0648782018-03-12 14:45:25 -0700278def make_param(param_type, param_name):
279 return param_type + " " + param_name
280
281def just_the_type_packed(param, entry):
282 name = just_the_name(param)
283 if entry.has_key(name):
284 return entry[name]
285 else:
286 return just_the_type(param)
287
Corentin Wallez2e568cf2017-09-18 17:05:22 -0400288def just_the_name_packed(param, reserved_set):
289 name = just_the_name(param)
290 if name in reserved_set:
291 return name + 'Packed'
292 else:
293 return name
294
Jamie Madillee769dd2017-05-04 11:38:30 -0400295format_dict = {
296 "GLbitfield": "0x%X",
297 "GLboolean": "%u",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500298 "GLclampx": "0x%X",
Jamie Madillee769dd2017-05-04 11:38:30 -0400299 "GLenum": "0x%X",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500300 "GLfixed": "0x%X",
Jamie Madillee769dd2017-05-04 11:38:30 -0400301 "GLfloat": "%f",
302 "GLint": "%d",
303 "GLintptr": "%d",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500304 "GLshort": "%d",
Jamie Madillee769dd2017-05-04 11:38:30 -0400305 "GLsizei": "%d",
306 "GLsizeiptr": "%d",
Jamie Madill16daadb2017-08-26 23:34:31 -0400307 "GLsync": "0x%0.8p",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500308 "GLubyte": "%d",
Jamie Madillff161f82017-08-26 23:49:10 -0400309 "GLuint": "%u",
Jamie Madillfa920eb2018-01-04 11:45:50 -0500310 "GLuint64": "%llu",
311 "GLDEBUGPROC": "0x%0.8p",
312 "GLDEBUGPROCKHR": "0x%0.8p",
313 "GLeglImageOES": "0x%0.8p",
Jamie Madillee769dd2017-05-04 11:38:30 -0400314}
315
316def param_format_string(param):
317 if "*" in param:
318 return param + " = 0x%0.8p"
319 else:
Jamie Madill16daadb2017-08-26 23:34:31 -0400320 type_only = just_the_type(param)
321 if type_only not in format_dict:
322 raise Exception(type_only + " is not a known type in 'format_dict'")
323
324 return param + " = " + format_dict[type_only]
Jamie Madillee769dd2017-05-04 11:38:30 -0400325
Jamie Madill2e29b132017-08-28 17:22:11 -0400326def default_return_value(cmd_name, return_type):
Jamie Madillee769dd2017-05-04 11:38:30 -0400327 if return_type == "void":
328 return ""
Jamie Madill2e29b132017-08-28 17:22:11 -0400329 return "GetDefaultReturnValue<EntryPoint::" + cmd_name[2:] + ", " + return_type + ">()"
Jamie Madillee769dd2017-05-04 11:38:30 -0400330
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700331def get_context_getter_function(cmd_name, is_explicit_context):
Geoff Langcae72d62017-06-01 11:53:45 -0400332 if cmd_name == "glGetError":
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700333 return "GetGlobalContext()"
334 elif is_explicit_context:
335 return "static_cast<gl::Context *>(ctx)"
Geoff Langcae72d62017-06-01 11:53:45 -0400336 else:
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700337 return "GetValidGlobalContext()"
Geoff Langcae72d62017-06-01 11:53:45 -0400338
Jamie Madillfa920eb2018-01-04 11:45:50 -0500339template_event_comment = """// Don't run an EVENT() macro on the EXT_debug_marker entry points.
340 // It can interfere with the debug events being set by the caller.
341 // """
342
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700343def format_entry_point_def(cmd_name, proto, params, is_explicit_context):
Corentin Wallez2e568cf2017-09-18 17:05:22 -0400344 packed_gl_enums = cmd_packed_gl_enums.get(cmd_name, {})
345 internal_params = [just_the_name_packed(param, packed_gl_enums) for param in params]
346 packed_gl_enum_conversions = []
347 for param in params:
348 name = just_the_name(param)
349 if name in packed_gl_enums:
350 internal_name = name + "Packed"
351 internal_type = packed_gl_enums[name]
352 packed_gl_enum_conversions += ["\n " + internal_type + " " + internal_name +" = FromGLenum<" +
353 internal_type + ">(" + name + ");"]
354
Jamie Madillee769dd2017-05-04 11:38:30 -0400355 pass_params = [just_the_name(param) for param in params]
356 format_params = [param_format_string(param) for param in params]
357 return_type = proto[:-len(cmd_name)]
Jamie Madill2e29b132017-08-28 17:22:11 -0400358 default_return = default_return_value(cmd_name, return_type.strip())
Jamie Madillfa920eb2018-01-04 11:45:50 -0500359 event_comment = template_event_comment if cmd_name in no_event_marker_exceptions_list else ""
Jamie Madillc8c9a242018-01-02 13:39:00 -0500360 name_lower_no_suffix = cmd_name[2:3].lower() + cmd_name[3:]
361
Jamie Madillfa920eb2018-01-04 11:45:50 -0500362 for suffix in strip_suffixes:
363 if name_lower_no_suffix.endswith(suffix):
364 name_lower_no_suffix = name_lower_no_suffix[0:-len(suffix)]
365
Jamie Madillee769dd2017-05-04 11:38:30 -0400366 return template_entry_point_def.format(
367 name = cmd_name[2:],
Jamie Madillc8c9a242018-01-02 13:39:00 -0500368 name_lower_no_suffix = name_lower_no_suffix,
Jamie Madillee769dd2017-05-04 11:38:30 -0400369 return_type = return_type,
370 params = ", ".join(params),
Corentin Wallez2e568cf2017-09-18 17:05:22 -0400371 internal_params = ", ".join(internal_params),
372 packed_gl_enum_conversions = "".join(packed_gl_enum_conversions),
Jamie Madillee769dd2017-05-04 11:38:30 -0400373 pass_params = ", ".join(pass_params),
374 comma_if_needed = ", " if len(params) > 0 else "",
Corentin Wallez2e568cf2017-09-18 17:05:22 -0400375 validate_params = ", ".join(["context"] + internal_params),
Jamie Madillee769dd2017-05-04 11:38:30 -0400376 format_params = ", ".join(format_params),
Jamie Madillee769dd2017-05-04 11:38:30 -0400377 return_if_needed = "" if default_return == "" else "return ",
Geoff Langcae72d62017-06-01 11:53:45 -0400378 default_return_if_needed = "" if default_return == "" else "\n return " + default_return + ";\n",
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700379 context_getter = get_context_getter_function(cmd_name, is_explicit_context),
380 event_comment = event_comment,
381 explicit_context_suffix = "ContextANGLE" if is_explicit_context else "",
382 explicit_context_param = "GLeglContext ctx" if is_explicit_context else "",
383 explicit_context_comma = ", " if is_explicit_context and len(params) > 0 else "",
384 assert_explicit_context = "\nASSERT(context == GetValidGlobalContext());"
385 if is_explicit_context else "")
Jamie Madillee769dd2017-05-04 11:38:30 -0400386
Lingfeng Yanga0648782018-03-12 14:45:25 -0700387def format_context_gles_decl(cmd_name, proto, params):
388 packed_gl_enums = cmd_packed_gl_enums.get(cmd_name, {})
389 internal_params = ", ".join([make_param(just_the_type_packed(param, packed_gl_enums),
390 just_the_name_packed(param, packed_gl_enums)) for param in params])
391
392 return_type = proto[:-len(cmd_name)]
393 name_lower_no_suffix = cmd_name[2:3].lower() + cmd_name[3:]
394
395 for suffix in strip_suffixes:
396 if name_lower_no_suffix.endswith(suffix):
397 name_lower_no_suffix = name_lower_no_suffix[0:-len(suffix)]
398
399 return context_gles_decl.format(
400 return_type = return_type,
401 name_lower_no_suffix = name_lower_no_suffix,
402 internal_params = internal_params)
403
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700404def format_libgles_entry_point_def(cmd_name, proto, params, is_explicit_context):
Brandon Jones41e59f52018-05-02 12:45:28 -0700405 internal_params = [just_the_name(param) for param in params]
406 return_type = proto[:-len(cmd_name)]
407
408 return libgles_entry_point_def.format(
409 name = cmd_name[2:],
410 return_type = return_type,
411 params = ", ".join(params),
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700412 internal_params = ", ".join(internal_params),
413 explicit_context_suffix = "ContextANGLE" if is_explicit_context else "",
414 explicit_context_param = "GLeglContext ctx" if is_explicit_context else "",
415 explicit_context_comma = ", " if is_explicit_context and len(params) > 0 else "",
416 explicit_context_internal_param = "ctx" if is_explicit_context else "")
Brandon Jones41e59f52018-05-02 12:45:28 -0700417
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700418def format_libgles_entry_point_export(cmd_name, ordinal, is_explicit_context):
Brandon Jones41e59f52018-05-02 12:45:28 -0700419 return libgles_entry_point_export.format(
420 name = cmd_name,
421 ordinal = ordinal,
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700422 spaces = " "*(50 - len(cmd_name)),
423 explicit_context_suffix = "ContextANGLE" if is_explicit_context else "")
Brandon Jones41e59f52018-05-02 12:45:28 -0700424
Jiajia Qincb59a902017-11-22 13:03:42 +0800425def path_to(folder, file):
426 return os.path.join(script_relative(".."), "src", folder, file)
Jamie Madill2e16d962017-04-19 14:06:36 -0400427
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700428def get_entry_points(all_commands, gles_commands, ordinal, is_explicit_context):
Jamie Madillc8c9a242018-01-02 13:39:00 -0500429 decls = []
430 defs = []
Brandon Jones41e59f52018-05-02 12:45:28 -0700431 export_defs = []
432 exports = []
433
Jamie Madillffa2cd02017-12-28 14:57:53 -0500434 for command in all_commands:
435 proto = command.find('proto')
436 cmd_name = proto.find('name').text
437
438 if cmd_name not in gles_commands:
439 continue
440
441 param_text = ["".join(param.itertext()) for param in command.findall('param')]
442 proto_text = "".join(proto.itertext())
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700443 decls.append(format_entry_point_decl(cmd_name, proto_text, param_text,
444 is_explicit_context))
445 defs.append(format_entry_point_def(cmd_name, proto_text, param_text, is_explicit_context))
Brandon Jones41e59f52018-05-02 12:45:28 -0700446
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700447 export_defs.append(format_libgles_entry_point_def(cmd_name, proto_text, param_text,
448 is_explicit_context))
449 exports.append(format_libgles_entry_point_export(cmd_name, ordinal, is_explicit_context))
Brandon Jones41e59f52018-05-02 12:45:28 -0700450 ordinal = ordinal + 1
451
452 return decls, defs, export_defs, exports
Jamie Madill16daadb2017-08-26 23:34:31 -0400453
Lingfeng Yanga0648782018-03-12 14:45:25 -0700454def get_gles1_decls(all_commands, gles_commands):
455 decls = []
456 for command in all_commands:
457 proto = command.find('proto')
458 cmd_name = proto.find('name').text
459
460 if cmd_name not in gles_commands:
461 continue
462
463 if cmd_name in gles1_overloaded:
464 continue
465
466 param_text = ["".join(param.itertext()) for param in command.findall('param')]
467 proto_text = "".join(proto.itertext())
468 decls.append(format_context_gles_decl(cmd_name, proto_text, param_text))
469
470 return decls
471
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700472def get_glext_decls(all_commands, gles_commands, version, is_explicit_context):
473 glext_ptrs = []
474 glext_protos = []
475 is_gles1 = False
476
477 if(version == ""):
478 is_gles1 = True
479
480 for command in all_commands:
481 proto = command.find('proto')
482 cmd_name = proto.find('name').text
483
484 if cmd_name not in gles_commands:
485 continue
486
487 param_text = ["".join(param.itertext()) for param in command.findall('param')]
488 proto_text = "".join(proto.itertext())
489
490 return_type = proto_text[:-len(cmd_name)]
491 params = ", ".join(param_text)
492
493 format_params = {
494 "apicall": "GL_API" if is_gles1 else "GL_APICALL",
495 "name": cmd_name,
496 "name_upper": cmd_name.upper(),
497 "return_type": return_type,
498 "params": params,
499 "explicit_context_comma": ", " if is_explicit_context and len(params) > 0 else "",
500 "explicit_context_suffix": "ContextANGLE" if is_explicit_context else "",
501 "explicit_context_suffix_upper": "CONTEXTANGLE" if is_explicit_context else "",
502 "explicit_context_param": "GLeglContext ctx" if is_explicit_context else ""}
503
504 glext_ptrs.append(template_glext_function_pointer.format(
505 **format_params))
506 glext_protos.append(template_glext_function_prototype.format(
507 **format_params))
508
509 return glext_ptrs, glext_protos
510
Brandon Jones416aaf92018-04-10 08:10:16 -0700511def write_file(annotation, comment, template, entry_points, suffix, includes, file):
Jiajia Qincb59a902017-11-22 13:03:42 +0800512
Jamie Madillc8c9a242018-01-02 13:39:00 -0500513 content = template.format(
514 script_name = os.path.basename(sys.argv[0]),
Brandon Jones416aaf92018-04-10 08:10:16 -0700515 data_source_name = file,
Jamie Madillc8c9a242018-01-02 13:39:00 -0500516 year = date.today().year,
517 annotation_lower = annotation.lower(),
518 annotation_upper = annotation.upper(),
519 comment = comment,
520 includes = includes,
521 entry_points = entry_points)
Jiajia Qincb59a902017-11-22 13:03:42 +0800522
Jamie Madillc8c9a242018-01-02 13:39:00 -0500523 path = path_to("libGLESv2", "entry_points_gles_{}_autogen.{}".format(
524 annotation.lower(), suffix))
525
526 with open(path, "w") as out:
527 out.write(content)
528 out.close()
529
Brandon Jones41e59f52018-05-02 12:45:28 -0700530def write_export_files(entry_points, includes, exports):
531
532 content = template_libgles_entry_point_source.format(
533 script_name = os.path.basename(sys.argv[0]),
534 data_source_name = "gl.xml and gl_angle_ext.xml",
535 year = date.today().year,
536 includes = includes,
537 entry_points = entry_points)
538
539 path = path_to("libGLESv2", "libGLESv2_autogen.cpp")
540
541 with open(path, "w") as out:
542 out.write(content)
543 out.close()
544
545 content = template_libgles_entry_point_export.format(
546 script_name = os.path.basename(sys.argv[0]),
547 data_source_name = "gl.xml and gl_angle_ext.xml",
548 exports = exports,
549 year = date.today().year)
550
551 path = path_to("libGLESv2", "libGLESv2_autogen.def")
552
553 with open(path, "w") as out:
554 out.write(content)
555 out.close()
556
Lingfeng Yanga0648782018-03-12 14:45:25 -0700557def write_context_api_decls(annotation, template, decls):
558
559 interface_lines = []
560
561 for i in decls['core']:
562 interface_lines.append(i)
563
564 for extname in sorted(decls['exts'].keys()):
565 interface_lines.append(" /* " + extname + " */ \\")
566 interface_lines.extend(decls['exts'][extname])
567
568 content = template.format(
569 annotation_lower = annotation.lower(),
570 annotation_upper = annotation.upper(),
571 script_name = os.path.basename(sys.argv[0]),
572 data_source_name = "gl.xml",
573 year = date.today().year,
574 interface = "\n".join(interface_lines))
575
576 path = path_to("libANGLE", "Context_gles_%s_autogen.h" % annotation.lower())
577
578 with open(path, "w") as out:
579 out.write(content)
580 out.close()
581
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700582def write_glext_explicit_context_inc(version, ptrs, protos):
583 folder_version = version if version != "31" else "3"
584
585 content = template_glext_explicit_context_inc.format(
586 script_name = os.path.basename(sys.argv[0]),
587 data_source_name = "gl.xml and gl_angle_ext.xml",
588 year = date.today().year,
589 version = version,
590 function_pointers = ptrs,
591 function_prototypes = protos)
592
Brandon Jones795ab712018-05-24 15:45:40 -0700593 path = os.path.join(script_relative(".."), "include", "GLES{}".format(folder_version),
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700594 "gl{}ext_explicit_context_autogen.inc".format(version))
595
596 with open(path, "w") as out:
597 out.write(content)
598 out.close()
599
Brandon Jones416aaf92018-04-10 08:10:16 -0700600def append_angle_extensions(base_root):
601 angle_ext_tree = etree.parse(script_relative('gl_angle_ext.xml'))
602 angle_ext_root = angle_ext_tree.getroot()
603
604 insertion_point = base_root.findall("./commands")[0]
605 for command in angle_ext_root.iter('commands'):
606 insertion_point.extend(command)
607
608 insertion_point = base_root.findall("./extensions")[0]
609 for extension in angle_ext_root.iter('extensions'):
610 insertion_point.extend(extension)
611 return base_root
612
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700613class GLCommandNames:
614 def __init__(self):
615 self.command_names = {}
616
617 def get_commands(self, version):
618 return self.command_names[version]
619
620 def get_all_commands(self):
621 cmd_names = []
622 # Combine all the version lists into a single list
623 for version, version_cmd_names in sorted(self.command_names.iteritems()):
624 cmd_names += version_cmd_names
625
626 return cmd_names
627
628 def add_commands(self, version, commands):
629 # Add key if it doesn't exist
630 if version not in self.command_names:
631 self.command_names[version] = []
632 # Add the commands that aren't duplicates
633 self.command_names[version] += commands
634
Brandon Jones416aaf92018-04-10 08:10:16 -0700635root = append_angle_extensions(root)
636
Jamie Madillc8c9a242018-01-02 13:39:00 -0500637all_commands = root.findall('commands/command')
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700638all_cmd_names = GLCommandNames()
Jamie Madillc8c9a242018-01-02 13:39:00 -0500639
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500640template_header_includes = """#include <GLES{major}/gl{major}{minor}.h>
Jamie Madillc8c9a242018-01-02 13:39:00 -0500641#include <export.h>"""
642
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500643template_sources_includes = """#include "libGLESv2/entry_points_gles_{}_autogen.h"
644
645#include "libANGLE/Context.h"
Jamie Madillc8c9a242018-01-02 13:39:00 -0500646#include "libANGLE/validationES{}{}.h"
647#include "libGLESv2/global_state.h"
648"""
649
Lingfeng Yanga0648782018-03-12 14:45:25 -0700650gles1decls = {}
651
652gles1decls['core'] = []
653gles1decls['exts'] = {}
654
Brandon Jones41e59f52018-05-02 12:45:28 -0700655libgles_ep_defs = []
656libgles_ep_exports = []
657
658ordinal_start = 1
659
Lingfeng Yanga0648782018-03-12 14:45:25 -0700660# First run through the main GLES entry points. Since ES2+ is the primary use
661# case, we go through those first and then add ES1-only APIs at the end.
662for major_version, minor_version in [[2, 0], [3, 0], [3, 1], [1, 0]]:
Jamie Madillc8c9a242018-01-02 13:39:00 -0500663 annotation = "{}_{}".format(major_version, minor_version)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500664 name_prefix = "GL_ES_VERSION_"
Lingfeng Yanga0648782018-03-12 14:45:25 -0700665
666 is_gles1 = major_version == 1
667 if is_gles1:
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500668 name_prefix = "GL_VERSION_ES_CM_"
Lingfeng Yanga0648782018-03-12 14:45:25 -0700669
Jamie Madillc8c9a242018-01-02 13:39:00 -0500670 comment = annotation.replace("_", ".")
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500671 gles_xpath = ".//feature[@name='{}{}']//command".format(name_prefix, annotation)
Jamie Madillc8c9a242018-01-02 13:39:00 -0500672 gles_commands = [cmd.attrib['name'] for cmd in root.findall(gles_xpath)]
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500673
674 # Remove commands that have already been processed
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700675 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 -0500676
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700677 all_cmd_names.add_commands(annotation, gles_commands)
Jamie Madillc8c9a242018-01-02 13:39:00 -0500678
Brandon Jones41e59f52018-05-02 12:45:28 -0700679 decls, defs, libgles_defs, libgles_exports = get_entry_points(
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700680 all_commands, gles_commands, ordinal_start, False)
Brandon Jones41e59f52018-05-02 12:45:28 -0700681
682 # Increment the ordinal before inserting the version comment
683 ordinal_start += len(libgles_exports)
684
685 # Write the version as a comment before the first EP.
686 libgles_defs.insert(0, "\n// OpenGL ES {}.{}".format(major_version, minor_version))
687 libgles_exports.insert(0, "\n ; OpenGL ES {}.{}".format(major_version, minor_version))
688
689 libgles_ep_defs += libgles_defs
690 libgles_ep_exports += libgles_exports
Jamie Madillc8c9a242018-01-02 13:39:00 -0500691
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500692 major_if_not_one = major_version if major_version != 1 else ""
Jamie Madillc8c9a242018-01-02 13:39:00 -0500693 minor_if_not_zero = minor_version if minor_version != 0 else ""
694
695 header_includes = template_header_includes.format(
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500696 major=major_if_not_one, minor=minor_if_not_zero)
Jamie Madillc8c9a242018-01-02 13:39:00 -0500697
698 # We include the platform.h header since it undefines the conflicting MemoryBarrier macro.
699 if major_version == 3 and minor_version == 1:
700 header_includes += "\n#include \"common/platform.h\"\n"
701
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500702 source_includes = template_sources_includes.format(
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700703 annotation.lower(), major_version, minor_if_not_zero)
Jamie Madillc8c9a242018-01-02 13:39:00 -0500704
705 write_file(annotation, comment, template_entry_point_header,
Brandon Jones416aaf92018-04-10 08:10:16 -0700706 "\n".join(decls), "h", header_includes, "gl.xml")
Jamie Madillc8c9a242018-01-02 13:39:00 -0500707 write_file(annotation, comment, template_entry_point_source,
Brandon Jones416aaf92018-04-10 08:10:16 -0700708 "\n".join(defs), "cpp", source_includes, "gl.xml")
Lingfeng Yanga0648782018-03-12 14:45:25 -0700709 if is_gles1:
710 gles1decls['core'] = get_gles1_decls(all_commands, gles_commands)
711
Jamie Madill57ae8c12017-08-30 12:14:29 -0400712
Jamie Madillfa920eb2018-01-04 11:45:50 -0500713# After we finish with the main entry points, we process the extensions.
714extension_defs = []
715extension_decls = []
716
717# Use a first step to run through the extensions so we can generate them
718# in sorted order.
719ext_data = {}
720
Lingfeng Yanga0648782018-03-12 14:45:25 -0700721for gles1ext in gles1_extensions:
722 gles1decls['exts'][gles1ext] = []
723
Jamie Madillfa920eb2018-01-04 11:45:50 -0500724for extension in root.findall("extensions/extension"):
725 extension_name = extension.attrib['name']
726 if not extension_name in supported_extensions:
727 continue
728
729 ext_cmd_names = []
730
731 # There's an extra step here to filter out 'api=gl' extensions. This
732 # is necessary for handling KHR extensions, which have separate entry
733 # point signatures (without the suffix) for desktop GL. Note that this
734 # extra step is necessary because of Etree's limited Xpath support.
735 for require in extension.findall('require'):
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500736 if 'api' in require.attrib and require.attrib['api'] != 'gles2' and require.attrib['api'] != 'gles1':
Jamie Madillfa920eb2018-01-04 11:45:50 -0500737 continue
738
739 # Another special case for EXT_texture_storage
740 filter_out_comment = "Supported only if GL_EXT_direct_state_access is supported"
741 if 'comment' in require.attrib and require.attrib['comment'] == filter_out_comment:
742 continue
743
744 extension_commands = require.findall('command')
745 ext_cmd_names += [command.attrib['name'] for command in extension_commands]
746
747 ext_data[extension_name] = sorted(ext_cmd_names)
748
749for extension_name, ext_cmd_names in sorted(ext_data.iteritems()):
750
751 # Detect and filter duplicate extensions.
752 dupes = []
753 for ext_cmd in ext_cmd_names:
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700754 if ext_cmd in all_cmd_names.get_all_commands():
Jamie Madillfa920eb2018-01-04 11:45:50 -0500755 dupes.append(ext_cmd)
756
757 for dupe in dupes:
758 ext_cmd_names.remove(dupe)
759
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700760 if extension_name in gles1_extensions:
761 all_cmd_names.add_commands("glext", ext_cmd_names)
762 else:
763 all_cmd_names.add_commands("gl2ext", ext_cmd_names)
Jamie Madillfa920eb2018-01-04 11:45:50 -0500764
Brandon Jones41e59f52018-05-02 12:45:28 -0700765 decls, defs, libgles_defs, libgles_exports = get_entry_points(
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700766 all_commands, ext_cmd_names, ordinal_start, False)
Jamie Madillfa920eb2018-01-04 11:45:50 -0500767
768 # Avoid writing out entry points defined by a prior extension.
769 for dupe in dupes:
770 msg = "// {} is already defined.\n".format(dupe[2:])
771 defs.append(msg)
772
Brandon Jones41e59f52018-05-02 12:45:28 -0700773 # Increment starting ordinal before adding extension comment
774 ordinal_start += len(libgles_exports)
775
Jamie Madillfa920eb2018-01-04 11:45:50 -0500776 # Write the extension name as a comment before the first EP.
777 comment = "\n// {}".format(extension_name)
778 defs.insert(0, comment)
779 decls.insert(0, comment)
Brandon Jones41e59f52018-05-02 12:45:28 -0700780 libgles_defs.insert(0, comment)
781 libgles_exports.insert(0, "\n ; {}".format(extension_name))
Jamie Madillfa920eb2018-01-04 11:45:50 -0500782
783 extension_defs += defs
784 extension_decls += decls
785
Brandon Jones41e59f52018-05-02 12:45:28 -0700786 libgles_ep_defs += libgles_defs
787 libgles_ep_exports += libgles_exports
788
Lingfeng Yanga0648782018-03-12 14:45:25 -0700789 if extension_name in gles1_extensions:
790 if extension_name not in gles1_no_context_decl_extensions:
791 gles1decls['exts'][extension_name] = get_gles1_decls(all_commands, ext_cmd_names)
792
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700793# Special handling for EGL_ANGLE_explicit_context extension
794if support_EGL_ANGLE_explicit_context:
795 comment = "\n// EGL_ANGLE_explicit_context"
796 extension_defs.append(comment)
797 extension_decls.append(comment)
798 libgles_ep_defs.append(comment)
799 libgles_ep_exports.append("\n ; EGL_ANGLE_explicit_context")
800
801 # Get the explicit context entry points
802 decls, defs, libgles_defs, libgles_exports = get_entry_points(all_commands,
803 all_cmd_names.get_all_commands(), ordinal_start, True)
804
805 # Append the explicit context entry points
806 extension_decls += decls
807 extension_defs += defs
808 libgles_ep_defs += libgles_defs
809 libgles_ep_exports += libgles_exports
810
811 # Generate .inc files for extension function pointers and declarations
812 for major, minor in [[2, 0], [3, 0], [3, 1], [1, 0]]:
813 annotation = "{}_{}".format(major, minor)
814
815 major_if_not_one = major if major != 1 else ""
816 minor_if_not_zero = minor if minor != 0 else ""
817 version = "{}{}".format(major_if_not_one, minor_if_not_zero)
818
819 glext_ptrs, glext_protos = get_glext_decls(all_commands,
820 all_cmd_names.get_commands(annotation), version, True)
821
822 glext_ext_ptrs = []
823 glext_ext_protos = []
824
825 # Append extensions for 1.0 and 2.0
826 if(annotation == "1_0"):
827 glext_ext_ptrs, glext_ext_protos = get_glext_decls(all_commands,
828 all_cmd_names.get_commands("glext"), version, True)
829 elif(annotation == "2_0"):
830 glext_ext_ptrs, glext_ext_protos = get_glext_decls(all_commands,
831 all_cmd_names.get_commands("gl2ext"), version, True)
832
833 glext_ptrs += glext_ext_ptrs
834 glext_protos += glext_ext_protos
835
836 write_glext_explicit_context_inc(version, "\n".join(glext_ptrs), "\n".join(glext_protos))
837
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500838header_includes = template_header_includes.format(
839 major="", minor="")
840header_includes += """
841#include <GLES/gl.h>
842#include <GLES/glext.h>
843#include <GLES2/gl2.h>
844#include <GLES2/gl2ext.h>
845"""
Jamie Madillfa920eb2018-01-04 11:45:50 -0500846
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500847source_includes = template_sources_includes.format("ext", "", "")
848source_includes += """
849#include "libANGLE/validationES.h"
850#include "libANGLE/validationES1.h"
Jamie Madillfa920eb2018-01-04 11:45:50 -0500851#include "libANGLE/validationES3.h"
852#include "libANGLE/validationES31.h"
853"""
854
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500855write_file("ext", "extension", template_entry_point_header,
Brandon Jones416aaf92018-04-10 08:10:16 -0700856 "\n".join([item for item in extension_decls]), "h", header_includes,
857 "gl.xml and gl_angle_ext.xml")
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500858write_file("ext", "extension", template_entry_point_source,
Brandon Jones416aaf92018-04-10 08:10:16 -0700859 "\n".join([item for item in extension_defs]), "cpp", source_includes,
860 "gl.xml and gl_angle_ext.xml")
Jamie Madillc8c9a242018-01-02 13:39:00 -0500861
Lingfeng Yanga0648782018-03-12 14:45:25 -0700862write_context_api_decls("1_0", context_gles_header, gles1decls)
863
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700864sorted_cmd_names = ["Invalid"] + [cmd[2:] for cmd in sorted(all_cmd_names.get_all_commands())]
Jamie Madillc8c9a242018-01-02 13:39:00 -0500865
Jamie Madillee769dd2017-05-04 11:38:30 -0400866entry_points_enum = template_entry_points_enum_header.format(
867 script_name = os.path.basename(sys.argv[0]),
Brandon Jones416aaf92018-04-10 08:10:16 -0700868 data_source_name = "gl.xml and gl_angle_ext.xml",
Jamie Madillee769dd2017-05-04 11:38:30 -0400869 year = date.today().year,
Jamie Madillc8c9a242018-01-02 13:39:00 -0500870 entry_points_list = ",\n".join([" " + cmd for cmd in sorted_cmd_names]))
Jamie Madillee769dd2017-05-04 11:38:30 -0400871
Jamie Madillee769dd2017-05-04 11:38:30 -0400872entry_points_enum_header_path = path_to("libANGLE", "entry_points_enum_autogen.h")
Jamie Madillee769dd2017-05-04 11:38:30 -0400873with open(entry_points_enum_header_path, "w") as out:
874 out.write(entry_points_enum)
Geoff Langcae72d62017-06-01 11:53:45 -0400875 out.close()
Brandon Jones41e59f52018-05-02 12:45:28 -0700876
877source_includes = """
878#include "angle_gl.h"
879
880#include "libGLESv2/entry_points_gles_1_0_autogen.h"
881#include "libGLESv2/entry_points_gles_2_0_autogen.h"
882#include "libGLESv2/entry_points_gles_3_0_autogen.h"
883#include "libGLESv2/entry_points_gles_3_1_autogen.h"
884#include "libGLESv2/entry_points_gles_ext_autogen.h"
885
886#include "common/event_tracer.h"
887"""
888
889write_export_files("\n".join([item for item in libgles_ep_defs]), source_includes, "\n".join([item for item in libgles_ep_exports]))