blob: f401beeedc6dd6547cfa937bc57be7e0542f23d0 [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",
Olli Etuaho064458a2018-08-30 14:02:02 +030070 "GL_OES_texture_storage_multisample_2d_array",
Jamie Madillfa920eb2018-01-04 11:45:50 -050071 "GL_OES_vertex_array_object",
jchen1082af6202018-06-22 10:59:52 +080072 "GL_KHR_parallel_shader_compile",
Jamie Madillfa920eb2018-01-04 11:45:50 -050073])
74
Brandon Jones2b0cdcc2018-05-02 08:02:50 -070075# The EGL_ANGLE_explicit_context extension is generated differently from other extensions.
76# Toggle generation here.
77support_EGL_ANGLE_explicit_context = True
78
Jamie Madillfa920eb2018-01-04 11:45:50 -050079# This is a list of exceptions for entry points which don't want to have
80# the EVENT macro. This is required for some debug marker entry points.
81no_event_marker_exceptions_list = sorted([
82 "glPushGroupMarkerEXT",
83 "glPopGroupMarkerEXT",
84 "glInsertEventMarkerEXT",
85])
86
87# Strip these suffixes from Context entry point names. NV is excluded (for now).
Brandon Jones416aaf92018-04-10 08:10:16 -070088strip_suffixes = ["ANGLE", "EXT", "KHR", "OES", "CHROMIUM"]
Jamie Madillfa920eb2018-01-04 11:45:50 -050089
Jamie Madill2e16d962017-04-19 14:06:36 -040090template_entry_point_header = """// GENERATED FILE - DO NOT EDIT.
91// Generated by {script_name} using data from {data_source_name}.
92//
93// Copyright {year} The ANGLE Project Authors. All rights reserved.
94// Use of this source code is governed by a BSD-style license that can be
95// found in the LICENSE file.
96//
Jamie Madillc8c9a242018-01-02 13:39:00 -050097// entry_points_gles_{annotation_lower}_autogen.h:
98// Defines the GLES {comment} entry points.
Jamie Madill2e16d962017-04-19 14:06:36 -040099
Jamie Madillc8c9a242018-01-02 13:39:00 -0500100#ifndef LIBGLESV2_ENTRY_POINTS_GLES_{annotation_upper}_AUTOGEN_H_
101#define LIBGLESV2_ENTRY_POINTS_GLES_{annotation_upper}_AUTOGEN_H_
Jamie Madill2e16d962017-04-19 14:06:36 -0400102
Jamie Madillc8c9a242018-01-02 13:39:00 -0500103{includes}
104
Jamie Madill2e16d962017-04-19 14:06:36 -0400105namespace gl
106{{
107{entry_points}
108}} // namespace gl
109
Jamie Madillc8c9a242018-01-02 13:39:00 -0500110#endif // LIBGLESV2_ENTRY_POINTS_GLES_{annotation_upper}_AUTOGEN_H_
Jamie Madill2e16d962017-04-19 14:06:36 -0400111"""
112
Jamie Madillee769dd2017-05-04 11:38:30 -0400113template_entry_point_source = """// GENERATED FILE - DO NOT EDIT.
114// Generated by {script_name} using data from {data_source_name}.
115//
116// Copyright {year} The ANGLE Project Authors. All rights reserved.
117// Use of this source code is governed by a BSD-style license that can be
118// found in the LICENSE file.
119//
Jamie Madillc8c9a242018-01-02 13:39:00 -0500120// entry_points_gles_{annotation_lower}_autogen.cpp:
121// Defines the GLES {comment} entry points.
Jamie Madillee769dd2017-05-04 11:38:30 -0400122
Jamie Madillc8c9a242018-01-02 13:39:00 -0500123{includes}
Jamie Madillee769dd2017-05-04 11:38:30 -0400124
125namespace gl
126{{
127{entry_points}}} // namespace gl
128"""
129
130template_entry_points_enum_header = """// GENERATED FILE - DO NOT EDIT.
131// Generated by {script_name} using data from {data_source_name}.
132//
133// Copyright {year} The ANGLE Project Authors. All rights reserved.
134// Use of this source code is governed by a BSD-style license that can be
135// found in the LICENSE file.
136//
137// entry_points_enum_autogen.h:
138// Defines the GLES entry points enumeration.
139
140#ifndef LIBGLESV2_ENTRYPOINTSENUM_AUTOGEN_H_
141#define LIBGLESV2_ENTRYPOINTSENUM_AUTOGEN_H_
142
143namespace gl
144{{
145enum class EntryPoint
146{{
147{entry_points_list}
148}};
149}} // namespace gl
150#endif // LIBGLESV2_ENTRY_POINTS_ENUM_AUTOGEN_H_
151"""
152
Brandon Jones41e59f52018-05-02 12:45:28 -0700153template_libgles_entry_point_source = """// GENERATED FILE - DO NOT EDIT.
154// Generated by {script_name} using data from {data_source_name}.
155//
156// Copyright {year} The ANGLE Project Authors. All rights reserved.
157// Use of this source code is governed by a BSD-style license that can be
158// found in the LICENSE file.
159//
160// libGLESv2.cpp: Implements the exported OpenGL ES functions.
161
162{includes}
163extern "C" {{
164{entry_points}
165}} // extern "C"
166"""
167
168template_libgles_entry_point_export = """; GENERATED FILE - DO NOT EDIT.
169; Generated by {script_name} using data from {data_source_name}.
170;
171; Copyright {year} The ANGLE Project Authors. All rights reserved.
172; Use of this source code is governed by a BSD-style license that can be
173; found in the LICENSE file.
174LIBRARY libGLESv2
175EXPORTS
176{exports}
177"""
178
Jamie Madill2e16d962017-04-19 14:06:36 -0400179template_entry_point_decl = """ANGLE_EXPORT {return_type}GL_APIENTRY {name}({params});"""
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700180template_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 -0400181
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700182template_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 -0400183{{
Jamie Madillfa920eb2018-01-04 11:45:50 -0500184 {event_comment}EVENT("({format_params})"{comma_if_needed}{pass_params});
Jamie Madillee769dd2017-05-04 11:38:30 -0400185
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700186 Context *context = {context_getter};
Jamie Madillee769dd2017-05-04 11:38:30 -0400187 if (context)
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700188 {{{assert_explicit_context}{packed_gl_enum_conversions}
Corentin Wallez2e568cf2017-09-18 17:05:22 -0400189 context->gatherParams<EntryPoint::{name}>({internal_params});
Jamie Madillee769dd2017-05-04 11:38:30 -0400190
Jamie Madill53d38412017-04-20 11:33:00 -0400191 if (context->skipValidation() || Validate{name}({validate_params}))
Jamie Madillee769dd2017-05-04 11:38:30 -0400192 {{
Jamie Madillc8c9a242018-01-02 13:39:00 -0500193 {return_if_needed}context->{name_lower_no_suffix}({internal_params});
Jamie Madillee769dd2017-05-04 11:38:30 -0400194 }}
Jamie Madillee769dd2017-05-04 11:38:30 -0400195 }}
196{default_return_if_needed}}}
197"""
198
Lingfeng Yanga0648782018-03-12 14:45:25 -0700199context_gles_header = """// GENERATED FILE - DO NOT EDIT.
200// Generated by {script_name} using data from {data_source_name}.
201//
202// Copyright {year} The ANGLE Project Authors. All rights reserved.
203// Use of this source code is governed by a BSD-style license that can be
204// found in the LICENSE file.
205//
206// Context_gles_{annotation_lower}_autogen.h: Creates a macro for interfaces in Context.
207
208#ifndef ANGLE_CONTEXT_GLES_{annotation_upper}_AUTOGEN_H_
209#define ANGLE_CONTEXT_GLES_{annotation_upper}_AUTOGEN_H_
210
211#define ANGLE_GLES1_CONTEXT_API \\
212{interface}
213
214#endif // ANGLE_CONTEXT_API_{annotation_upper}_AUTOGEN_H_
215"""
216
217context_gles_decl = """ {return_type} {name_lower_no_suffix}({internal_params}); \\"""
218
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700219libgles_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 -0700220{{
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700221 return gl::{name}{explicit_context_suffix}({explicit_context_internal_param}{explicit_context_comma}{internal_params});
Brandon Jones41e59f52018-05-02 12:45:28 -0700222}}
223"""
224
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700225libgles_entry_point_export = """ {name}{explicit_context_suffix}{spaces}@{ordinal}"""
226
227template_glext_explicit_context_inc = """// GENERATED FILE - DO NOT EDIT.
228// Generated by {script_name} using data from {data_source_name}.
229//
230// Copyright {year} The ANGLE Project Authors. All rights reserved.
231// Use of this source code is governed by a BSD-style license that can be
232// found in the LICENSE file.
233//
234// gl{version}ext_explicit_context_autogen.inc:
235// Function declarations for the EGL_ANGLE_explicit_context extension
236
237{function_pointers}
238#ifdef GL_GLEXT_PROTOTYPES
239{function_prototypes}
240#endif
241"""
242
243template_glext_function_pointer = """typedef {return_type}(GL_APIENTRYP PFN{name_upper}{explicit_context_suffix_upper})({explicit_context_param}{explicit_context_comma}{params});"""
244template_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 -0700245
Jamie Madill16daadb2017-08-26 23:34:31 -0400246def script_relative(path):
247 return os.path.join(os.path.dirname(sys.argv[0]), path)
248
249tree = etree.parse(script_relative('gl.xml'))
250root = tree.getroot()
Jamie Madill2e16d962017-04-19 14:06:36 -0400251commands = root.find(".//commands[@namespace='GL']")
Jamie Madill2e16d962017-04-19 14:06:36 -0400252
Corentin Wallez2e568cf2017-09-18 17:05:22 -0400253with open(script_relative('entry_point_packed_gl_enums.json')) as f:
254 cmd_packed_gl_enums = json.loads(f.read())
255
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700256def format_entry_point_decl(cmd_name, proto, params, is_explicit_context):
257 comma_if_needed = ", " if len(params) > 0 else ""
Jamie Madill2e16d962017-04-19 14:06:36 -0400258 return template_entry_point_decl.format(
259 name = cmd_name[2:],
260 return_type = proto[:-len(cmd_name)],
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700261 params = ", ".join(params),
262 comma_if_needed = comma_if_needed,
263 explicit_context_suffix = "ContextANGLE" if is_explicit_context else "",
264 explicit_context_param = "GLeglContext ctx" if is_explicit_context else "",
265 explicit_context_comma = ", " if is_explicit_context and len(params) > 0 else "")
Jamie Madill2e16d962017-04-19 14:06:36 -0400266
Jamie Madillee769dd2017-05-04 11:38:30 -0400267def type_name_sep_index(param):
268 space = param.rfind(" ")
269 pointer = param.rfind("*")
270 return max(space, pointer)
271
272def just_the_type(param):
Lingfeng Yanga0648782018-03-12 14:45:25 -0700273 if "*" in param:
274 return param[:type_name_sep_index(param) + 1]
Jamie Madillee769dd2017-05-04 11:38:30 -0400275 return param[:type_name_sep_index(param)]
276
277def just_the_name(param):
278 return param[type_name_sep_index(param)+1:]
279
Lingfeng Yanga0648782018-03-12 14:45:25 -0700280def make_param(param_type, param_name):
281 return param_type + " " + param_name
282
283def just_the_type_packed(param, entry):
284 name = just_the_name(param)
285 if entry.has_key(name):
286 return entry[name]
287 else:
288 return just_the_type(param)
289
Corentin Wallez2e568cf2017-09-18 17:05:22 -0400290def just_the_name_packed(param, reserved_set):
291 name = just_the_name(param)
292 if name in reserved_set:
293 return name + 'Packed'
294 else:
295 return name
296
Jamie Madillee769dd2017-05-04 11:38:30 -0400297format_dict = {
298 "GLbitfield": "0x%X",
299 "GLboolean": "%u",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500300 "GLclampx": "0x%X",
Jamie Madillee769dd2017-05-04 11:38:30 -0400301 "GLenum": "0x%X",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500302 "GLfixed": "0x%X",
Jamie Madillee769dd2017-05-04 11:38:30 -0400303 "GLfloat": "%f",
304 "GLint": "%d",
305 "GLintptr": "%d",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500306 "GLshort": "%d",
Jamie Madillee769dd2017-05-04 11:38:30 -0400307 "GLsizei": "%d",
308 "GLsizeiptr": "%d",
Jamie Madill16daadb2017-08-26 23:34:31 -0400309 "GLsync": "0x%0.8p",
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500310 "GLubyte": "%d",
Jamie Madillff161f82017-08-26 23:49:10 -0400311 "GLuint": "%u",
Jamie Madillfa920eb2018-01-04 11:45:50 -0500312 "GLuint64": "%llu",
313 "GLDEBUGPROC": "0x%0.8p",
314 "GLDEBUGPROCKHR": "0x%0.8p",
315 "GLeglImageOES": "0x%0.8p",
Jamie Madillee769dd2017-05-04 11:38:30 -0400316}
317
318def param_format_string(param):
319 if "*" in param:
320 return param + " = 0x%0.8p"
321 else:
Jamie Madill16daadb2017-08-26 23:34:31 -0400322 type_only = just_the_type(param)
323 if type_only not in format_dict:
324 raise Exception(type_only + " is not a known type in 'format_dict'")
325
326 return param + " = " + format_dict[type_only]
Jamie Madillee769dd2017-05-04 11:38:30 -0400327
Jamie Madill2e29b132017-08-28 17:22:11 -0400328def default_return_value(cmd_name, return_type):
Jamie Madillee769dd2017-05-04 11:38:30 -0400329 if return_type == "void":
330 return ""
Jamie Madill2e29b132017-08-28 17:22:11 -0400331 return "GetDefaultReturnValue<EntryPoint::" + cmd_name[2:] + ", " + return_type + ">()"
Jamie Madillee769dd2017-05-04 11:38:30 -0400332
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700333def get_context_getter_function(cmd_name, is_explicit_context):
Geoff Langcae72d62017-06-01 11:53:45 -0400334 if cmd_name == "glGetError":
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700335 return "GetGlobalContext()"
336 elif is_explicit_context:
337 return "static_cast<gl::Context *>(ctx)"
Geoff Langcae72d62017-06-01 11:53:45 -0400338 else:
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700339 return "GetValidGlobalContext()"
Geoff Langcae72d62017-06-01 11:53:45 -0400340
Jamie Madillfa920eb2018-01-04 11:45:50 -0500341template_event_comment = """// Don't run an EVENT() macro on the EXT_debug_marker entry points.
342 // It can interfere with the debug events being set by the caller.
343 // """
344
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700345def format_entry_point_def(cmd_name, proto, params, is_explicit_context):
Corentin Wallez2e568cf2017-09-18 17:05:22 -0400346 packed_gl_enums = cmd_packed_gl_enums.get(cmd_name, {})
347 internal_params = [just_the_name_packed(param, packed_gl_enums) for param in params]
348 packed_gl_enum_conversions = []
349 for param in params:
350 name = just_the_name(param)
351 if name in packed_gl_enums:
352 internal_name = name + "Packed"
353 internal_type = packed_gl_enums[name]
354 packed_gl_enum_conversions += ["\n " + internal_type + " " + internal_name +" = FromGLenum<" +
355 internal_type + ">(" + name + ");"]
356
Jamie Madillee769dd2017-05-04 11:38:30 -0400357 pass_params = [just_the_name(param) for param in params]
358 format_params = [param_format_string(param) for param in params]
359 return_type = proto[:-len(cmd_name)]
Jamie Madill2e29b132017-08-28 17:22:11 -0400360 default_return = default_return_value(cmd_name, return_type.strip())
Jamie Madillfa920eb2018-01-04 11:45:50 -0500361 event_comment = template_event_comment if cmd_name in no_event_marker_exceptions_list else ""
Jamie Madillc8c9a242018-01-02 13:39:00 -0500362 name_lower_no_suffix = cmd_name[2:3].lower() + cmd_name[3:]
363
Jamie Madillfa920eb2018-01-04 11:45:50 -0500364 for suffix in strip_suffixes:
365 if name_lower_no_suffix.endswith(suffix):
366 name_lower_no_suffix = name_lower_no_suffix[0:-len(suffix)]
367
Jamie Madillee769dd2017-05-04 11:38:30 -0400368 return template_entry_point_def.format(
369 name = cmd_name[2:],
Jamie Madillc8c9a242018-01-02 13:39:00 -0500370 name_lower_no_suffix = name_lower_no_suffix,
Jamie Madillee769dd2017-05-04 11:38:30 -0400371 return_type = return_type,
372 params = ", ".join(params),
Corentin Wallez2e568cf2017-09-18 17:05:22 -0400373 internal_params = ", ".join(internal_params),
374 packed_gl_enum_conversions = "".join(packed_gl_enum_conversions),
Jamie Madillee769dd2017-05-04 11:38:30 -0400375 pass_params = ", ".join(pass_params),
376 comma_if_needed = ", " if len(params) > 0 else "",
Corentin Wallez2e568cf2017-09-18 17:05:22 -0400377 validate_params = ", ".join(["context"] + internal_params),
Jamie Madillee769dd2017-05-04 11:38:30 -0400378 format_params = ", ".join(format_params),
Jamie Madillee769dd2017-05-04 11:38:30 -0400379 return_if_needed = "" if default_return == "" else "return ",
Geoff Langcae72d62017-06-01 11:53:45 -0400380 default_return_if_needed = "" if default_return == "" else "\n return " + default_return + ";\n",
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700381 context_getter = get_context_getter_function(cmd_name, is_explicit_context),
382 event_comment = event_comment,
383 explicit_context_suffix = "ContextANGLE" if is_explicit_context else "",
384 explicit_context_param = "GLeglContext ctx" if is_explicit_context else "",
385 explicit_context_comma = ", " if is_explicit_context and len(params) > 0 else "",
386 assert_explicit_context = "\nASSERT(context == GetValidGlobalContext());"
387 if is_explicit_context else "")
Jamie Madillee769dd2017-05-04 11:38:30 -0400388
Lingfeng Yanga0648782018-03-12 14:45:25 -0700389def format_context_gles_decl(cmd_name, proto, params):
390 packed_gl_enums = cmd_packed_gl_enums.get(cmd_name, {})
391 internal_params = ", ".join([make_param(just_the_type_packed(param, packed_gl_enums),
392 just_the_name_packed(param, packed_gl_enums)) for param in params])
393
394 return_type = proto[:-len(cmd_name)]
395 name_lower_no_suffix = cmd_name[2:3].lower() + cmd_name[3:]
396
397 for suffix in strip_suffixes:
398 if name_lower_no_suffix.endswith(suffix):
399 name_lower_no_suffix = name_lower_no_suffix[0:-len(suffix)]
400
401 return context_gles_decl.format(
402 return_type = return_type,
403 name_lower_no_suffix = name_lower_no_suffix,
404 internal_params = internal_params)
405
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700406def format_libgles_entry_point_def(cmd_name, proto, params, is_explicit_context):
Brandon Jones41e59f52018-05-02 12:45:28 -0700407 internal_params = [just_the_name(param) for param in params]
408 return_type = proto[:-len(cmd_name)]
409
410 return libgles_entry_point_def.format(
411 name = cmd_name[2:],
412 return_type = return_type,
413 params = ", ".join(params),
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700414 internal_params = ", ".join(internal_params),
415 explicit_context_suffix = "ContextANGLE" if is_explicit_context else "",
416 explicit_context_param = "GLeglContext ctx" if is_explicit_context else "",
417 explicit_context_comma = ", " if is_explicit_context and len(params) > 0 else "",
418 explicit_context_internal_param = "ctx" if is_explicit_context else "")
Brandon Jones41e59f52018-05-02 12:45:28 -0700419
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700420def format_libgles_entry_point_export(cmd_name, ordinal, is_explicit_context):
Brandon Jones41e59f52018-05-02 12:45:28 -0700421 return libgles_entry_point_export.format(
422 name = cmd_name,
423 ordinal = ordinal,
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700424 spaces = " "*(50 - len(cmd_name)),
425 explicit_context_suffix = "ContextANGLE" if is_explicit_context else "")
Brandon Jones41e59f52018-05-02 12:45:28 -0700426
Jiajia Qincb59a902017-11-22 13:03:42 +0800427def path_to(folder, file):
428 return os.path.join(script_relative(".."), "src", folder, file)
Jamie Madill2e16d962017-04-19 14:06:36 -0400429
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700430def get_entry_points(all_commands, gles_commands, ordinal, is_explicit_context):
Jamie Madillc8c9a242018-01-02 13:39:00 -0500431 decls = []
432 defs = []
Brandon Jones41e59f52018-05-02 12:45:28 -0700433 export_defs = []
434 exports = []
435
Jamie Madillffa2cd02017-12-28 14:57:53 -0500436 for command in all_commands:
437 proto = command.find('proto')
438 cmd_name = proto.find('name').text
439
440 if cmd_name not in gles_commands:
441 continue
442
443 param_text = ["".join(param.itertext()) for param in command.findall('param')]
444 proto_text = "".join(proto.itertext())
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700445 decls.append(format_entry_point_decl(cmd_name, proto_text, param_text,
446 is_explicit_context))
447 defs.append(format_entry_point_def(cmd_name, proto_text, param_text, is_explicit_context))
Brandon Jones41e59f52018-05-02 12:45:28 -0700448
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700449 export_defs.append(format_libgles_entry_point_def(cmd_name, proto_text, param_text,
450 is_explicit_context))
451 exports.append(format_libgles_entry_point_export(cmd_name, ordinal, is_explicit_context))
Brandon Jones41e59f52018-05-02 12:45:28 -0700452 ordinal = ordinal + 1
453
454 return decls, defs, export_defs, exports
Jamie Madill16daadb2017-08-26 23:34:31 -0400455
Lingfeng Yanga0648782018-03-12 14:45:25 -0700456def get_gles1_decls(all_commands, gles_commands):
457 decls = []
458 for command in all_commands:
459 proto = command.find('proto')
460 cmd_name = proto.find('name').text
461
462 if cmd_name not in gles_commands:
463 continue
464
465 if cmd_name in gles1_overloaded:
466 continue
467
468 param_text = ["".join(param.itertext()) for param in command.findall('param')]
469 proto_text = "".join(proto.itertext())
470 decls.append(format_context_gles_decl(cmd_name, proto_text, param_text))
471
472 return decls
473
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700474def get_glext_decls(all_commands, gles_commands, version, is_explicit_context):
475 glext_ptrs = []
476 glext_protos = []
477 is_gles1 = False
478
479 if(version == ""):
480 is_gles1 = True
481
482 for command in all_commands:
483 proto = command.find('proto')
484 cmd_name = proto.find('name').text
485
486 if cmd_name not in gles_commands:
487 continue
488
489 param_text = ["".join(param.itertext()) for param in command.findall('param')]
490 proto_text = "".join(proto.itertext())
491
492 return_type = proto_text[:-len(cmd_name)]
493 params = ", ".join(param_text)
494
495 format_params = {
496 "apicall": "GL_API" if is_gles1 else "GL_APICALL",
497 "name": cmd_name,
498 "name_upper": cmd_name.upper(),
499 "return_type": return_type,
500 "params": params,
501 "explicit_context_comma": ", " if is_explicit_context and len(params) > 0 else "",
502 "explicit_context_suffix": "ContextANGLE" if is_explicit_context else "",
503 "explicit_context_suffix_upper": "CONTEXTANGLE" if is_explicit_context else "",
504 "explicit_context_param": "GLeglContext ctx" if is_explicit_context else ""}
505
506 glext_ptrs.append(template_glext_function_pointer.format(
507 **format_params))
508 glext_protos.append(template_glext_function_prototype.format(
509 **format_params))
510
511 return glext_ptrs, glext_protos
512
Brandon Jones416aaf92018-04-10 08:10:16 -0700513def write_file(annotation, comment, template, entry_points, suffix, includes, file):
Jiajia Qincb59a902017-11-22 13:03:42 +0800514
Jamie Madillc8c9a242018-01-02 13:39:00 -0500515 content = template.format(
516 script_name = os.path.basename(sys.argv[0]),
Brandon Jones416aaf92018-04-10 08:10:16 -0700517 data_source_name = file,
Jamie Madillc8c9a242018-01-02 13:39:00 -0500518 year = date.today().year,
519 annotation_lower = annotation.lower(),
520 annotation_upper = annotation.upper(),
521 comment = comment,
522 includes = includes,
523 entry_points = entry_points)
Jiajia Qincb59a902017-11-22 13:03:42 +0800524
Jamie Madillc8c9a242018-01-02 13:39:00 -0500525 path = path_to("libGLESv2", "entry_points_gles_{}_autogen.{}".format(
526 annotation.lower(), suffix))
527
528 with open(path, "w") as out:
529 out.write(content)
530 out.close()
531
Brandon Jones41e59f52018-05-02 12:45:28 -0700532def write_export_files(entry_points, includes, exports):
533
534 content = template_libgles_entry_point_source.format(
535 script_name = os.path.basename(sys.argv[0]),
536 data_source_name = "gl.xml and gl_angle_ext.xml",
537 year = date.today().year,
538 includes = includes,
539 entry_points = entry_points)
540
541 path = path_to("libGLESv2", "libGLESv2_autogen.cpp")
542
543 with open(path, "w") as out:
544 out.write(content)
545 out.close()
546
547 content = template_libgles_entry_point_export.format(
548 script_name = os.path.basename(sys.argv[0]),
549 data_source_name = "gl.xml and gl_angle_ext.xml",
550 exports = exports,
551 year = date.today().year)
552
553 path = path_to("libGLESv2", "libGLESv2_autogen.def")
554
555 with open(path, "w") as out:
556 out.write(content)
557 out.close()
558
Lingfeng Yanga0648782018-03-12 14:45:25 -0700559def write_context_api_decls(annotation, template, decls):
560
561 interface_lines = []
562
563 for i in decls['core']:
564 interface_lines.append(i)
565
566 for extname in sorted(decls['exts'].keys()):
567 interface_lines.append(" /* " + extname + " */ \\")
568 interface_lines.extend(decls['exts'][extname])
569
570 content = template.format(
571 annotation_lower = annotation.lower(),
572 annotation_upper = annotation.upper(),
573 script_name = os.path.basename(sys.argv[0]),
574 data_source_name = "gl.xml",
575 year = date.today().year,
576 interface = "\n".join(interface_lines))
577
578 path = path_to("libANGLE", "Context_gles_%s_autogen.h" % annotation.lower())
579
580 with open(path, "w") as out:
581 out.write(content)
582 out.close()
583
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700584def write_glext_explicit_context_inc(version, ptrs, protos):
585 folder_version = version if version != "31" else "3"
586
587 content = template_glext_explicit_context_inc.format(
588 script_name = os.path.basename(sys.argv[0]),
589 data_source_name = "gl.xml and gl_angle_ext.xml",
590 year = date.today().year,
591 version = version,
592 function_pointers = ptrs,
593 function_prototypes = protos)
594
Brandon Jones795ab712018-05-24 15:45:40 -0700595 path = os.path.join(script_relative(".."), "include", "GLES{}".format(folder_version),
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700596 "gl{}ext_explicit_context_autogen.inc".format(version))
597
598 with open(path, "w") as out:
599 out.write(content)
600 out.close()
601
Brandon Jones416aaf92018-04-10 08:10:16 -0700602def append_angle_extensions(base_root):
603 angle_ext_tree = etree.parse(script_relative('gl_angle_ext.xml'))
604 angle_ext_root = angle_ext_tree.getroot()
605
606 insertion_point = base_root.findall("./commands")[0]
607 for command in angle_ext_root.iter('commands'):
608 insertion_point.extend(command)
609
610 insertion_point = base_root.findall("./extensions")[0]
611 for extension in angle_ext_root.iter('extensions'):
612 insertion_point.extend(extension)
613 return base_root
614
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700615class GLCommandNames:
616 def __init__(self):
617 self.command_names = {}
618
619 def get_commands(self, version):
620 return self.command_names[version]
621
622 def get_all_commands(self):
623 cmd_names = []
624 # Combine all the version lists into a single list
625 for version, version_cmd_names in sorted(self.command_names.iteritems()):
626 cmd_names += version_cmd_names
627
628 return cmd_names
629
630 def add_commands(self, version, commands):
631 # Add key if it doesn't exist
632 if version not in self.command_names:
633 self.command_names[version] = []
634 # Add the commands that aren't duplicates
635 self.command_names[version] += commands
636
Brandon Jones416aaf92018-04-10 08:10:16 -0700637root = append_angle_extensions(root)
638
Jamie Madillc8c9a242018-01-02 13:39:00 -0500639all_commands = root.findall('commands/command')
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700640all_cmd_names = GLCommandNames()
Jamie Madillc8c9a242018-01-02 13:39:00 -0500641
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500642template_header_includes = """#include <GLES{major}/gl{major}{minor}.h>
Jamie Madillc8c9a242018-01-02 13:39:00 -0500643#include <export.h>"""
644
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500645template_sources_includes = """#include "libGLESv2/entry_points_gles_{}_autogen.h"
646
647#include "libANGLE/Context.h"
Jamie Madillc8c9a242018-01-02 13:39:00 -0500648#include "libANGLE/validationES{}{}.h"
649#include "libGLESv2/global_state.h"
650"""
651
Lingfeng Yanga0648782018-03-12 14:45:25 -0700652gles1decls = {}
653
654gles1decls['core'] = []
655gles1decls['exts'] = {}
656
Brandon Jones41e59f52018-05-02 12:45:28 -0700657libgles_ep_defs = []
658libgles_ep_exports = []
659
660ordinal_start = 1
661
Lingfeng Yanga0648782018-03-12 14:45:25 -0700662# First run through the main GLES entry points. Since ES2+ is the primary use
663# case, we go through those first and then add ES1-only APIs at the end.
664for major_version, minor_version in [[2, 0], [3, 0], [3, 1], [1, 0]]:
Jamie Madillc8c9a242018-01-02 13:39:00 -0500665 annotation = "{}_{}".format(major_version, minor_version)
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500666 name_prefix = "GL_ES_VERSION_"
Lingfeng Yanga0648782018-03-12 14:45:25 -0700667
668 is_gles1 = major_version == 1
669 if is_gles1:
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500670 name_prefix = "GL_VERSION_ES_CM_"
Lingfeng Yanga0648782018-03-12 14:45:25 -0700671
Jamie Madillc8c9a242018-01-02 13:39:00 -0500672 comment = annotation.replace("_", ".")
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500673 gles_xpath = ".//feature[@name='{}{}']//command".format(name_prefix, annotation)
Jamie Madillc8c9a242018-01-02 13:39:00 -0500674 gles_commands = [cmd.attrib['name'] for cmd in root.findall(gles_xpath)]
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500675
676 # Remove commands that have already been processed
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700677 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 -0500678
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700679 all_cmd_names.add_commands(annotation, gles_commands)
Jamie Madillc8c9a242018-01-02 13:39:00 -0500680
Brandon Jones41e59f52018-05-02 12:45:28 -0700681 decls, defs, libgles_defs, libgles_exports = get_entry_points(
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700682 all_commands, gles_commands, ordinal_start, False)
Brandon Jones41e59f52018-05-02 12:45:28 -0700683
684 # Increment the ordinal before inserting the version comment
685 ordinal_start += len(libgles_exports)
686
687 # Write the version as a comment before the first EP.
688 libgles_defs.insert(0, "\n// OpenGL ES {}.{}".format(major_version, minor_version))
689 libgles_exports.insert(0, "\n ; OpenGL ES {}.{}".format(major_version, minor_version))
690
691 libgles_ep_defs += libgles_defs
692 libgles_ep_exports += libgles_exports
Jamie Madillc8c9a242018-01-02 13:39:00 -0500693
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500694 major_if_not_one = major_version if major_version != 1 else ""
Jamie Madillc8c9a242018-01-02 13:39:00 -0500695 minor_if_not_zero = minor_version if minor_version != 0 else ""
696
697 header_includes = template_header_includes.format(
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500698 major=major_if_not_one, minor=minor_if_not_zero)
Jamie Madillc8c9a242018-01-02 13:39:00 -0500699
700 # We include the platform.h header since it undefines the conflicting MemoryBarrier macro.
701 if major_version == 3 and minor_version == 1:
702 header_includes += "\n#include \"common/platform.h\"\n"
703
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500704 source_includes = template_sources_includes.format(
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700705 annotation.lower(), major_version, minor_if_not_zero)
Jamie Madillc8c9a242018-01-02 13:39:00 -0500706
707 write_file(annotation, comment, template_entry_point_header,
Brandon Jones416aaf92018-04-10 08:10:16 -0700708 "\n".join(decls), "h", header_includes, "gl.xml")
Jamie Madillc8c9a242018-01-02 13:39:00 -0500709 write_file(annotation, comment, template_entry_point_source,
Brandon Jones416aaf92018-04-10 08:10:16 -0700710 "\n".join(defs), "cpp", source_includes, "gl.xml")
Lingfeng Yanga0648782018-03-12 14:45:25 -0700711 if is_gles1:
712 gles1decls['core'] = get_gles1_decls(all_commands, gles_commands)
713
Jamie Madill57ae8c12017-08-30 12:14:29 -0400714
Jamie Madillfa920eb2018-01-04 11:45:50 -0500715# After we finish with the main entry points, we process the extensions.
716extension_defs = []
717extension_decls = []
718
719# Use a first step to run through the extensions so we can generate them
720# in sorted order.
721ext_data = {}
722
Lingfeng Yanga0648782018-03-12 14:45:25 -0700723for gles1ext in gles1_extensions:
724 gles1decls['exts'][gles1ext] = []
725
Jamie Madillfa920eb2018-01-04 11:45:50 -0500726for extension in root.findall("extensions/extension"):
727 extension_name = extension.attrib['name']
728 if not extension_name in supported_extensions:
729 continue
730
731 ext_cmd_names = []
732
733 # There's an extra step here to filter out 'api=gl' extensions. This
734 # is necessary for handling KHR extensions, which have separate entry
735 # point signatures (without the suffix) for desktop GL. Note that this
736 # extra step is necessary because of Etree's limited Xpath support.
737 for require in extension.findall('require'):
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500738 if 'api' in require.attrib and require.attrib['api'] != 'gles2' and require.attrib['api'] != 'gles1':
Jamie Madillfa920eb2018-01-04 11:45:50 -0500739 continue
740
741 # Another special case for EXT_texture_storage
742 filter_out_comment = "Supported only if GL_EXT_direct_state_access is supported"
743 if 'comment' in require.attrib and require.attrib['comment'] == filter_out_comment:
744 continue
745
746 extension_commands = require.findall('command')
747 ext_cmd_names += [command.attrib['name'] for command in extension_commands]
748
749 ext_data[extension_name] = sorted(ext_cmd_names)
750
751for extension_name, ext_cmd_names in sorted(ext_data.iteritems()):
752
753 # Detect and filter duplicate extensions.
754 dupes = []
755 for ext_cmd in ext_cmd_names:
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700756 if ext_cmd in all_cmd_names.get_all_commands():
Jamie Madillfa920eb2018-01-04 11:45:50 -0500757 dupes.append(ext_cmd)
758
759 for dupe in dupes:
760 ext_cmd_names.remove(dupe)
761
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700762 if extension_name in gles1_extensions:
763 all_cmd_names.add_commands("glext", ext_cmd_names)
764 else:
765 all_cmd_names.add_commands("gl2ext", ext_cmd_names)
Jamie Madillfa920eb2018-01-04 11:45:50 -0500766
Brandon Jones41e59f52018-05-02 12:45:28 -0700767 decls, defs, libgles_defs, libgles_exports = get_entry_points(
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700768 all_commands, ext_cmd_names, ordinal_start, False)
Jamie Madillfa920eb2018-01-04 11:45:50 -0500769
770 # Avoid writing out entry points defined by a prior extension.
771 for dupe in dupes:
772 msg = "// {} is already defined.\n".format(dupe[2:])
773 defs.append(msg)
774
Brandon Jones41e59f52018-05-02 12:45:28 -0700775 # Increment starting ordinal before adding extension comment
776 ordinal_start += len(libgles_exports)
777
Jamie Madillfa920eb2018-01-04 11:45:50 -0500778 # Write the extension name as a comment before the first EP.
779 comment = "\n// {}".format(extension_name)
780 defs.insert(0, comment)
781 decls.insert(0, comment)
Brandon Jones41e59f52018-05-02 12:45:28 -0700782 libgles_defs.insert(0, comment)
783 libgles_exports.insert(0, "\n ; {}".format(extension_name))
Jamie Madillfa920eb2018-01-04 11:45:50 -0500784
785 extension_defs += defs
786 extension_decls += decls
787
Brandon Jones41e59f52018-05-02 12:45:28 -0700788 libgles_ep_defs += libgles_defs
789 libgles_ep_exports += libgles_exports
790
Lingfeng Yanga0648782018-03-12 14:45:25 -0700791 if extension_name in gles1_extensions:
792 if extension_name not in gles1_no_context_decl_extensions:
793 gles1decls['exts'][extension_name] = get_gles1_decls(all_commands, ext_cmd_names)
794
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700795# Special handling for EGL_ANGLE_explicit_context extension
796if support_EGL_ANGLE_explicit_context:
797 comment = "\n// EGL_ANGLE_explicit_context"
798 extension_defs.append(comment)
799 extension_decls.append(comment)
800 libgles_ep_defs.append(comment)
801 libgles_ep_exports.append("\n ; EGL_ANGLE_explicit_context")
802
803 # Get the explicit context entry points
804 decls, defs, libgles_defs, libgles_exports = get_entry_points(all_commands,
805 all_cmd_names.get_all_commands(), ordinal_start, True)
806
807 # Append the explicit context entry points
808 extension_decls += decls
809 extension_defs += defs
810 libgles_ep_defs += libgles_defs
811 libgles_ep_exports += libgles_exports
812
813 # Generate .inc files for extension function pointers and declarations
814 for major, minor in [[2, 0], [3, 0], [3, 1], [1, 0]]:
815 annotation = "{}_{}".format(major, minor)
816
817 major_if_not_one = major if major != 1 else ""
818 minor_if_not_zero = minor if minor != 0 else ""
819 version = "{}{}".format(major_if_not_one, minor_if_not_zero)
820
821 glext_ptrs, glext_protos = get_glext_decls(all_commands,
822 all_cmd_names.get_commands(annotation), version, True)
823
824 glext_ext_ptrs = []
825 glext_ext_protos = []
826
827 # Append extensions for 1.0 and 2.0
828 if(annotation == "1_0"):
829 glext_ext_ptrs, glext_ext_protos = get_glext_decls(all_commands,
830 all_cmd_names.get_commands("glext"), version, True)
831 elif(annotation == "2_0"):
832 glext_ext_ptrs, glext_ext_protos = get_glext_decls(all_commands,
833 all_cmd_names.get_commands("gl2ext"), version, True)
834
835 glext_ptrs += glext_ext_ptrs
836 glext_protos += glext_ext_protos
837
838 write_glext_explicit_context_inc(version, "\n".join(glext_ptrs), "\n".join(glext_protos))
839
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500840header_includes = template_header_includes.format(
841 major="", minor="")
842header_includes += """
843#include <GLES/gl.h>
844#include <GLES/glext.h>
845#include <GLES2/gl2.h>
846#include <GLES2/gl2ext.h>
847"""
Jamie Madillfa920eb2018-01-04 11:45:50 -0500848
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500849source_includes = template_sources_includes.format("ext", "", "")
850source_includes += """
851#include "libANGLE/validationES.h"
852#include "libANGLE/validationES1.h"
Jamie Madillfa920eb2018-01-04 11:45:50 -0500853#include "libANGLE/validationES3.h"
854#include "libANGLE/validationES31.h"
855"""
856
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500857write_file("ext", "extension", template_entry_point_header,
Brandon Jones416aaf92018-04-10 08:10:16 -0700858 "\n".join([item for item in extension_decls]), "h", header_includes,
859 "gl.xml and gl_angle_ext.xml")
Geoff Lang2aaa7b42018-01-12 17:17:27 -0500860write_file("ext", "extension", template_entry_point_source,
Brandon Jones416aaf92018-04-10 08:10:16 -0700861 "\n".join([item for item in extension_defs]), "cpp", source_includes,
862 "gl.xml and gl_angle_ext.xml")
Jamie Madillc8c9a242018-01-02 13:39:00 -0500863
Lingfeng Yanga0648782018-03-12 14:45:25 -0700864write_context_api_decls("1_0", context_gles_header, gles1decls)
865
Brandon Jones2b0cdcc2018-05-02 08:02:50 -0700866sorted_cmd_names = ["Invalid"] + [cmd[2:] for cmd in sorted(all_cmd_names.get_all_commands())]
Jamie Madillc8c9a242018-01-02 13:39:00 -0500867
Jamie Madillee769dd2017-05-04 11:38:30 -0400868entry_points_enum = template_entry_points_enum_header.format(
869 script_name = os.path.basename(sys.argv[0]),
Brandon Jones416aaf92018-04-10 08:10:16 -0700870 data_source_name = "gl.xml and gl_angle_ext.xml",
Jamie Madillee769dd2017-05-04 11:38:30 -0400871 year = date.today().year,
Jamie Madillc8c9a242018-01-02 13:39:00 -0500872 entry_points_list = ",\n".join([" " + cmd for cmd in sorted_cmd_names]))
Jamie Madillee769dd2017-05-04 11:38:30 -0400873
Jamie Madillee769dd2017-05-04 11:38:30 -0400874entry_points_enum_header_path = path_to("libANGLE", "entry_points_enum_autogen.h")
Jamie Madillee769dd2017-05-04 11:38:30 -0400875with open(entry_points_enum_header_path, "w") as out:
876 out.write(entry_points_enum)
Geoff Langcae72d62017-06-01 11:53:45 -0400877 out.close()
Brandon Jones41e59f52018-05-02 12:45:28 -0700878
879source_includes = """
880#include "angle_gl.h"
881
882#include "libGLESv2/entry_points_gles_1_0_autogen.h"
883#include "libGLESv2/entry_points_gles_2_0_autogen.h"
884#include "libGLESv2/entry_points_gles_3_0_autogen.h"
885#include "libGLESv2/entry_points_gles_3_1_autogen.h"
886#include "libGLESv2/entry_points_gles_ext_autogen.h"
887
888#include "common/event_tracer.h"
889"""
890
jchen1082af6202018-06-22 10:59:52 +0800891write_export_files("\n".join([item for item in libgles_ep_defs]), source_includes, "\n".join([item for item in libgles_ep_exports]))