[Piglit] [PATCH 11/14] glapi: Add parsing of GLES2/gl2ext.h.
Eric Anholt
eric at anholt.net
Wed Jun 5 16:14:28 PDT 2013
Weirdly, the gl3ext.h has no entries currently, and to access
extensions from GLES3 you need to include this GLES2 header.
We now have code-generated piglit-dispatch support for all of desktop,
GLES2, and GLES3.
---
cmake/piglit_glapi.cmake | 1 +
glapi/parse_glspec.py | 25 ++++++++++++++++++++++++-
tests/util/piglit-dispatch.h | 4 ++++
3 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/cmake/piglit_glapi.cmake b/cmake/piglit_glapi.cmake
index 899c7ee..59d4d42 100644
--- a/cmake/piglit_glapi.cmake
+++ b/cmake/piglit_glapi.cmake
@@ -35,6 +35,7 @@ set(piglit_glapi_inputs
${piglit_glapi_src_dir}/enum.spec
${piglit_glapi_src_dir}/enumext.spec
${piglit_glapi_src_dir}/GLES3/gl3.h
+ ${piglit_glapi_src_dir}/GLES2/gl2ext.h
)
add_custom_command(
diff --git a/glapi/parse_glspec.py b/glapi/parse_glspec.py
index 163de70..8952850 100644
--- a/glapi/parse_glspec.py
+++ b/glapi/parse_glspec.py
@@ -453,10 +453,17 @@ class Api(object):
# The GLES gl3.h has typedefs, tokens, and prototypes,
# each listed after a comment indicating whether they're
# part of 2.0 core or 3.0 core.
+ #
+ # The gl2ext.h is split into groups of functions prefixed
+ # by the extension name in a comment.
if re.match(r'/\* OpenGL ES 2.0 \*/', line):
category = 'GL_ES_VERSION_2_0'
elif re.match(r'/\* OpenGL ES 3.0 \*/', line):
category = 'GL_ES_VERSION_3_0'
+ else:
+ m = re.match(r'/\* (GL_.*) \*/', line)
+ if m:
+ category = m.group(1).replace('GL_', '')
m = re.match(r'GL_APICALL', line)
if m:
@@ -484,6 +491,20 @@ class Api(object):
self.add_function(name, return_type, param_names, param_types, category)
+ # Since we don't have alias information for
+ # extensions, assume that pretty much anything
+ # with the same base name as a core function is
+ # aliased with it.
+ #
+ # glTexImage3DOES is an exception because it
+ # doesn't have the border argument.
+ if name != 'TexImage3DOES':
+ corename = name
+ for suffix in ('ARB', 'EXT', 'KHR', 'OES', 'NV', 'AMD', 'IMG', 'QCOM', 'INTEL'):
+ corename = corename.replace(suffix, '')
+ if corename in self.functions:
+ self.synonyms.add_alias(corename, name)
+
# Convert each line in the enumext.spec file into a key/value pair
# in self.enums, mapping an enum name to a dict. For example, the
# following enumext.spec input:
@@ -534,5 +555,7 @@ if __name__ == '__main__':
api.read_enumext_spec(f)
with open(sys.argv[5]) as f:
api.read_gles_header(f)
- with open(sys.argv[6], 'w') as f:
+ with open(sys.argv[6]) as f:
+ api.read_gles_header(f)
+ with open(sys.argv[7], 'w') as f:
f.write(api.to_json())
diff --git a/tests/util/piglit-dispatch.h b/tests/util/piglit-dispatch.h
index 0b00891..669aecc 100644
--- a/tests/util/piglit-dispatch.h
+++ b/tests/util/piglit-dispatch.h
@@ -122,12 +122,16 @@ struct _cl_event;
typedef GLintptr GLvdpauSurfaceNV;
typedef unsigned short GLhalfNV;
+typedef void *GLeglImageOES;
+
typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam);
typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam);
typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam);
+typedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam);
+
typedef void (APIENTRY *piglit_dispatch_function_ptr)(void);
typedef piglit_dispatch_function_ptr (*piglit_get_core_proc_address_function_ptr)(const char *, int);
--
1.8.3.rc0
More information about the Piglit
mailing list