Commit c211c2f5 by Clemen Deng Committed by Commit Bot

Make proc table autogen use gl.xml data

Instead having the proc table be generated from proc_table_data.json which needed to be manually updated with changes, the proc table is now generated from data in gl.xml and egl.xml Bug: angleproject:3533 Change-Id: I773ea7615cc4ec1c9901def629b089d8d17328eb Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1660645 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 3f8975e1
......@@ -742,14 +742,7 @@ def main():
# auto_script parameters.
if len(sys.argv) > 1:
inputs = [
'egl.xml',
'egl_angle_ext.xml',
'entry_point_packed_gl_enums.json',
'gl.xml',
'gl_angle_ext.xml',
'registry_xml.py',
]
inputs = ['entry_point_packed_gl_enums.json'] + registry_xml.xml_inputs
outputs = [
'../src/libANGLE/Context_gles_1_0_autogen.h',
'../src/libANGLE/Context_gles_2_0_autogen.h',
......
......@@ -13,6 +13,14 @@
import sys, os
import xml.etree.ElementTree as etree
xml_inputs = [
'gl.xml',
'gl_angle_ext.xml',
'egl.xml',
'egl_angle_ext.xml',
'registry_xml.py',
]
angle_extensions = [
# ANGLE extensions
"GL_CHROMIUM_bind_uniform_location",
......
......@@ -94,13 +94,13 @@
"GL/EGL entry points:scripts/entry_point_packed_gl_enums.json":
"28238b0f52826c3794eaa1aa940238bf",
"GL/EGL entry points:scripts/generate_entry_points.py":
"1bd848cc592db50a4d3a5cea26a7b077",
"df89665814d74ffd16c70f017f0ef4d7",
"GL/EGL entry points:scripts/gl.xml":
"b470cb06b06cbbe7adb2c8129ec85708",
"GL/EGL entry points:scripts/gl_angle_ext.xml":
"11e1eb2cbe51ae6e7b8705d3506846d5",
"GL/EGL entry points:scripts/registry_xml.py":
"be904202ce40755daac33faf4123b9b9",
"ea05778a62045f5413031611566a4db2",
"GL/EGL entry points:src/libANGLE/Context_gles_1_0_autogen.h":
"f30ed90e4ec23f886bda9344d82dd529",
"GL/EGL entry points:src/libANGLE/Context_gles_2_0_autogen.h":
......@@ -154,7 +154,7 @@
"GL/EGL/WGL loader:scripts/generate_loader.py":
"5a7cd014230fe04664d9613e65399d42",
"GL/EGL/WGL loader:scripts/registry_xml.py":
"be904202ce40755daac33faf4123b9b9",
"ea05778a62045f5413031611566a4db2",
"GL/EGL/WGL loader:scripts/wgl.xml":
"aa96419c582af2f6673430e2847693f4",
"GL/EGL/WGL loader:src/libEGL/egl_loader_autogen.cpp":
......@@ -451,12 +451,20 @@
"5f591d220ee53b6e54a27d1523a3ab79",
"packed enum:src/common/packed_gl_enums.json":
"3f730faeebe986cd3017432ad56cf203",
"proc table:scripts/egl.xml":
"842e24514c4cfe09fba703c17a0fd292",
"proc table:scripts/egl_angle_ext.xml":
"fc2e249239fb1365f6d145cdf1a3cfcf",
"proc table:scripts/gl.xml":
"b470cb06b06cbbe7adb2c8129ec85708",
"proc table:scripts/gl_angle_ext.xml":
"11e1eb2cbe51ae6e7b8705d3506846d5",
"proc table:scripts/registry_xml.py":
"ea05778a62045f5413031611566a4db2",
"proc table:src/libGLESv2/gen_proc_table.py":
"3be3e8ed7fad58e8cc6fcf348da7b17d",
"c3e4abfa19077cea098cb19bbfed4471",
"proc table:src/libGLESv2/proc_table_autogen.cpp":
"7cf8dbd79fddffd89d2348d1210ba4ca",
"proc table:src/libGLESv2/proc_table_data.json":
"4dfc7f64b7a44b93c83504d1c5332814",
"11da3d411200208212c36f1d401beb72",
"uniform type:src/common/gen_uniform_type_table.py":
"9dd389f2b5793ba635169d61cef2dde9",
"uniform type:src/common/uniform_type_info_autogen.cpp":
......
......@@ -11,8 +11,9 @@
import sys
from datetime import date
sys.path.append('../../scripts')
import registry_xml
data_source_name = "proc_table_data.json"
out_file_name = "proc_table_autogen.cpp"
# The EGL_ANGLE_explicit_context extension is generated differently from other extensions.
......@@ -61,9 +62,8 @@ def main():
# auto_script parameters.
if len(sys.argv) > 1:
inputs = [data_source_name]
inputs = ['../../scripts/' + source for source in registry_xml.xml_inputs]
outputs = [out_file_name]
if sys.argv[1] == 'inputs':
print ','.join(inputs)
elif sys.argv[1] == 'outputs':
......@@ -73,22 +73,49 @@ def main():
return 1
return 0
json_data = angle_format.load_json(data_source_name)
glxml = registry_xml.RegistryXML('../../scripts/gl.xml', '../../scripts/gl_angle_ext.xml')
for annotation in ["2_0", "3_0", "3_1", "1_0"]:
name_prefix = "GL_ES_VERSION_"
if annotation[0] == '1':
name_prefix = "GL_VERSION_ES_CM_"
feature_name = "{}{}".format(name_prefix, annotation)
glxml.AddCommands(feature_name, annotation)
glxml.AddExtensionCommands(registry_xml.supported_extensions, ['gles2', 'gles1'])
data = glxml.all_cmd_names.get_all_commands()
eglxml = registry_xml.RegistryXML('../../scripts/egl.xml', '../../scripts/egl_angle_ext.xml')
for annotation in ["1_0", "1_1", "1_2", "1_3", "1_4", "1_5"]:
name_prefix = "EGL_VERSION_"
feature_name = "{}{}".format(name_prefix, annotation)
eglxml.AddCommands(feature_name, annotation)
eglxml.AddExtensionCommands(registry_xml.supported_egl_extensions, ['gles2', 'gles1'])
data.extend(eglxml.all_cmd_names.get_all_commands())
data.append("ANGLEGetDisplayPlatform")
data.append("ANGLEResetDisplayPlatform")
all_functions = {}
for description, functions in json_data.iteritems():
for function in functions:
if function.startswith("gl"):
all_functions[function] = "gl::" + function[2:]
# Special handling for EGL_ANGLE_explicit_context extension
if support_egl_ANGLE_explicit_context:
all_functions[function +
"ContextANGLE"] = "gl::" + function[2:] + "ContextANGLE"
elif function.startswith("egl"):
all_functions[function] = "EGL_" + function[3:]
else:
all_functions[function] = function
for function in data:
if function.startswith("gl"):
all_functions[function] = "gl::" + function[2:]
# Special handling for EGL_ANGLE_explicit_context extension
if support_egl_ANGLE_explicit_context:
all_functions[function + "ContextANGLE"] = "gl::" + function[2:] + "ContextANGLE"
elif function.startswith("egl"):
all_functions[function] = "EGL_" + function[3:]
else:
all_functions[function] = function
proc_data = [(' {"%s", P(%s)}' % (func, angle_func))
for func, angle_func in sorted(all_functions.iteritems())]
......@@ -96,7 +123,7 @@ def main():
with open(out_file_name, 'w') as out_file:
output_cpp = template_cpp.format(
script_name=sys.argv[0],
data_source_name=data_source_name,
data_source_name="gl.xml, gl_angle_ext.xml, egl.xml, egl_angle_ext.xml",
copyright_year=date.today().year,
proc_data=",\n".join(proc_data),
num_procs=len(proc_data))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment