[Piglit] [PATCH] Include enum.spec along with enumext.spec for piglit-dispatch.
Eric Anholt
eric at anholt.net
Wed Jun 5 14:19:20 PDT 2013
There are three differences between the two (as verified by sort, sed,
uniq, and diff):
- enum.spec includes GLES extension enums (since it's used for
maintaining uniqueness of enums in the registry), which we want to
include for cross-API compatibility.
- enum.spec includes some entries for known GL versions and GL extensions.
- enumext.spec has a few more synonyms for enums (since it's the
file used for generating the official glext.h for desktop).
This change only introduces new #define lines to generated-dispatch.h.
v2: Make the statement about "only introduces new #define lines"
actually true by continuing to emit based on the categories we
collected during parsing, except with them defined to '1' instead
of '', to match actual glext definitions and what gets
autogenerated from enum.ext.
---
I swear I had diffed the generated header files when I was writing the
change. Maybe I just suck at reading.
cmake/piglit_glapi.cmake | 1 +
glapi/parse_glspec.py | 4 +++-
tests/util/gen_dispatch.py | 14 ++++++++++----
3 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/cmake/piglit_glapi.cmake b/cmake/piglit_glapi.cmake
index bdc0390..368c1ca 100644
--- a/cmake/piglit_glapi.cmake
+++ b/cmake/piglit_glapi.cmake
@@ -32,6 +32,7 @@ set(piglit_glapi_inputs
${piglit_glapi_src_dir}/parse_glspec.py
${piglit_glapi_src_dir}/gl.tm
${piglit_glapi_src_dir}/gl.spec
+ ${piglit_glapi_src_dir}/enum.spec
${piglit_glapi_src_dir}/enumext.spec
)
diff --git a/glapi/parse_glspec.py b/glapi/parse_glspec.py
index 9be39f9..460512a 100644
--- a/glapi/parse_glspec.py
+++ b/glapi/parse_glspec.py
@@ -465,5 +465,7 @@ if __name__ == '__main__':
api.read_gl_spec(f)
with open(sys.argv[3]) as f:
api.read_enumext_spec(f)
- with open(sys.argv[4], 'w') as f:
+ with open(sys.argv[4]) as f:
+ api.read_enumext_spec(f)
+ with open(sys.argv[5], 'w') as f:
f.write(api.to_json())
diff --git a/tests/util/gen_dispatch.py b/tests/util/gen_dispatch.py
index 46e96fd..b644507 100644
--- a/tests/util/gen_dispatch.py
+++ b/tests/util/gen_dispatch.py
@@ -83,11 +83,11 @@
#
# - A #define for each extension, e.g.:
#
-# #define GL_ARB_vertex_buffer_object
+# #define GL_ARB_vertex_buffer_object 1
#
# - A #define for each known GL version, e.g.:
#
-# #define GL_VERSION_1_5
+# #define GL_VERSION_1_5 1
#
#
# The generated C file consists of the following:
@@ -631,14 +631,20 @@ def generate_code(api):
h_contents.append('#define GL_{0} {1}\n'.format(name, value))
# Emit extension #defines
+ #
+ # While enum.ext lists some old extension names (defined to 1), it
+ # doesn't contain the full set that appears in glext.h.
h_contents.append('\n')
for ext in api.extensions:
- h_contents.append('#define {0}\n'.format(ext))
+ h_contents.append('#define {0} 1\n'.format(ext))
# Emit GL version #defines
+ #
+ # While enum.ext lists GL versions up to 3.2, it didn't continue
+ # adding them for later GL versions.
h_contents.append('\n')
for ver in api.gl_versions:
- h_contents.append('#define GL_VERSION_{0}_{1}\n'.format(
+ h_contents.append('#define GL_VERSION_{0}_{1} 1\n'.format(
ver // 10, ver % 10))
return ''.join(c_contents), ''.join(h_contents)
--
1.8.3.rc0
More information about the Piglit
mailing list