Commit 1c64319e authored by Eric Anholt's avatar Eric Anholt

Include enum.spec along with enumext.spec for piglit-dispatch.

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.
Reviewed-by: default avatarChad Versace <chad.versace@linux.intel.com>
parent c9f744f2
......@@ -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
)
......
......@@ -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())
......@@ -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)
......
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