<div dir="ltr">On 5 June 2013 16:14, Eric Anholt <span dir="ltr"><<a href="mailto:eric@anholt.net" target="_blank">eric@anholt.net</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Weirdly, the gl3ext.h has no entries currently, and to access<br>
extensions from GLES3 you need to include this GLES2 header.<br>
<br>
We now have code-generated piglit-dispatch support for all of desktop,<br>
GLES2, and GLES3.<br>
---<br>
cmake/piglit_glapi.cmake | 1 +<br>
glapi/parse_glspec.py | 25 ++++++++++++++++++++++++-<br>
tests/util/piglit-dispatch.h | 4 ++++<br>
3 files changed, 29 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/cmake/piglit_glapi.cmake b/cmake/piglit_glapi.cmake<br>
index 899c7ee..59d4d42 100644<br>
--- a/cmake/piglit_glapi.cmake<br>
+++ b/cmake/piglit_glapi.cmake<br>
@@ -35,6 +35,7 @@ set(piglit_glapi_inputs<br>
${piglit_glapi_src_dir}/enum.spec<br>
${piglit_glapi_src_dir}/enumext.spec<br>
${piglit_glapi_src_dir}/GLES3/gl3.h<br>
+ ${piglit_glapi_src_dir}/GLES2/gl2ext.h<br>
)<br>
<br>
add_custom_command(<br>
diff --git a/glapi/parse_glspec.py b/glapi/parse_glspec.py<br>
index 163de70..8952850 100644<br>
--- a/glapi/parse_glspec.py<br>
+++ b/glapi/parse_glspec.py<br>
@@ -453,10 +453,17 @@ class Api(object):<br>
# The GLES gl3.h has typedefs, tokens, and prototypes,<br>
# each listed after a comment indicating whether they're<br>
# part of 2.0 core or 3.0 core.<br>
+ #<br>
+ # The gl2ext.h is split into groups of functions prefixed<br>
+ # by the extension name in a comment.<br>
if re.match(r'/\* OpenGL ES 2.0 \*/', line):<br>
category = 'GL_ES_VERSION_2_0'<br>
elif re.match(r'/\* OpenGL ES 3.0 \*/', line):<br>
category = 'GL_ES_VERSION_3_0'<br>
+ else:<br>
+ m = re.match(r'/\* (GL_.*) \*/', line)<br>
+ if m:<br>
+ category = m.group(1).replace('GL_', '')<br>
<br>
m = re.match(r'GL_APICALL', line)<br>
if m:<br>
@@ -484,6 +491,20 @@ class Api(object):<br>
<br>
self.add_function(name, return_type, param_names, param_types, category)<br>
<br>
+ # Since we don't have alias information for<br>
+ # extensions, assume that pretty much anything<br>
+ # with the same base name as a core function is<br>
+ # aliased with it.<br>
+ #<br>
+ # glTexImage3DOES is an exception because it<br>
+ # doesn't have the border argument.<br>
+ if name != 'TexImage3DOES':<br>
+ corename = name<br>
+ for suffix in ('ARB', 'EXT', 'KHR', 'OES', 'NV', 'AMD', 'IMG', 'QCOM', 'INTEL'):<br>
+ corename = corename.replace(suffix, '')<br>
+ if corename in self.functions:<br>
+ self.synonyms.add_alias(corename, name)<br>
+<br></blockquote><div><br></div><div>I'd feel slightly more comfortable if we can (a) reduce the number of hardcoded strings in the body of the code, and (b) only match these suffixes when they appear at the end of the function name. How about something like this instead?<br>
<br></div><div>(At the top of parse_glspec.py, with the other regexps)<br><br></div><div>EXTENSION_SUFFIX_REGEXP = re.compile(r'(ARB|EXT|KHR|OES|NV|AMD|IMG|QCOM|INTEL)$')<br><br></div><div>And then instead of the three lines above beginning "corename = name", do this:<br>
<br></div><div>corename = EXTENSION_SUFFIX_REGEXP.sub('', name)<br><br></div><div>With that change, this patch is:<br><br></div><div>Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
# Convert each line in the enumext.spec file into a key/value pair<br>
# in self.enums, mapping an enum name to a dict. For example, the<br>
# following enumext.spec input:<br>
@@ -534,5 +555,7 @@ if __name__ == '__main__':<br>
api.read_enumext_spec(f)<br>
with open(sys.argv[5]) as f:<br>
api.read_gles_header(f)<br>
- with open(sys.argv[6], 'w') as f:<br>
+ with open(sys.argv[6]) as f:<br>
+ api.read_gles_header(f)<br>
+ with open(sys.argv[7], 'w') as f:<br>
f.write(api.to_json())<br>
diff --git a/tests/util/piglit-dispatch.h b/tests/util/piglit-dispatch.h<br>
index 0b00891..669aecc 100644<br>
--- a/tests/util/piglit-dispatch.h<br>
+++ b/tests/util/piglit-dispatch.h<br>
@@ -122,12 +122,16 @@ struct _cl_event;<br>
typedef GLintptr GLvdpauSurfaceNV;<br>
typedef unsigned short GLhalfNV;<br>
<br>
+typedef void *GLeglImageOES;<br>
+<br>
typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam);<br>
<br>
typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam);<br>
<br>
typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam);<br>
<br>
+typedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam);<br>
+<br>
typedef void (APIENTRY *piglit_dispatch_function_ptr)(void);<br>
<br>
typedef piglit_dispatch_function_ptr (*piglit_get_core_proc_address_function_ptr)(const char *, int);<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.8.3.rc0<br>
<br>
_______________________________________________<br>
Piglit mailing list<br>
<a href="mailto:Piglit@lists.freedesktop.org">Piglit@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/piglit" target="_blank">http://lists.freedesktop.org/mailman/listinfo/piglit</a><br>
</font></span></blockquote></div><br></div></div>