Hash :
a01a566c
Author :
Date :
2023-06-09T00:31:06
extension xmls: fix incorrect use of <ptype> tags
I was having trouble using some GL/EGL loader generators because of some
errors in the XML definitions for ANGLE.
The first major problem is the content of the <ptype> tags. Let's refer
to the Khronos registry XML schema (which is annoyingly a PDF rather
than an xsd that we can test against, though I don't know if an xsd
would catch this anyway):
https://raw.githubusercontent.com/KhronosGroup/OpenGL-Registry/master/xml/readme.pdf
In section 12.4.2, "Contents of <param> tags" it states:
The <ptype> tag is optional, and contains text which is a valid type
name found in <type> tag, and indicates that this type must be
previously defined for the definition of the command to succeed.
Builtin C types, and any derived types which are expected to be
found in other header files, should not be wrapped in <ptype> tags
Note that the above is repeated for the contents of <proto> tags as
well.
The extension XML files currently have a bunch of <ptype> tags which
don't meet the expectations described above. The correct transformation
for them would be, for example:
<ptype>GLfloat *</ptype> -> <ptype>GLfloat</ptype> *
<ptype>void *</ptype> -> void *
<ptype>const char *</ptype> -> const char *
<ptype>EGLAttrib *</ptype> -> <ptype>EGLAttrib</ptype> *
The next issue is that some tags have some typos, such as "<pytpe>"
instead of "<ptype>". (Now *that* is something an .xsd would catch...)
The last issue is the use of the typename "GLvoid" which is not as
serious a problem. It is still defined in Khronos' gl.xml <types> block,
but Khronos no longer uses it in their XML registries. The comment for
the "GLvoid" type in their <types> block states:
<type comment="Not an actual GL type, though used in headers in the past">typedef void <name>GLvoid</name>;</type>
So we might as well replace those with just plain "void".
Anyway, long story short: to apply these transformations, I used Perl
regular expressions, and applied these expressions in order:
- Fix the tag misspellings:
s#<(/?)pytpe>#<\1ptype>#g
- Move the const qualifiers (if present) and pointer asterisk(s) (if
any) outside the <ptype> tag itself:
s#<ptype>(const )?([A-Za-z0-9]+)[ ]?(\*\*?)</ptype> #\1<ptype>\2</ptype> \3#g
- Replace "GLvoid", "char", and "void" inside ptype tags to normal
C types outside tags:
s#<ptype>(GLvoid|void|char)</ptype>#\1#g
Bug: angleproject:8190
Change-Id: Ib0bea79fecb7e714910b6e92124bb9f52994d0fb
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/4603709
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
{
"scripts/egl_angle_ext.xml":
"7ae2be7840b4dbf9db875688847606d4",
"scripts/generate_loader.py":
"93c78a8d11323fa311fed5118fbcf083",
"scripts/gl_angle_ext.xml":
"49a0bf469d6f44c532098ef3a9fd087f",
"scripts/registry_xml.py":
"2175daaec34d2e6fe763d0c3efa93dea",
"src/libEGL/egl_loader_autogen.cpp":
"8a743c210f7dbe7e306849203dff7889",
"src/libEGL/egl_loader_autogen.h":
"68bf81ecadd3c41b5be477bdcaaaf694",
"third_party/EGL-Registry/src/api/egl.xml":
"2056d54ea07156f1988ca1366bdee21a",
"third_party/OpenCL-Docs/src/xml/cl.xml":
"6d0bf09e20a8f8c3ae440d79eda08bf9",
"third_party/OpenGL-Registry/src/xml/gl.xml":
"49f0afe5cac23951c74420e457b0cb23",
"third_party/OpenGL-Registry/src/xml/glx.xml":
"94f3eee4b076801d117804eb466714b7",
"third_party/OpenGL-Registry/src/xml/wgl.xml":
"eae784bf4d1b983a42af5671b140b7c4",
"util/capture/trace_egl_loader_autogen.cpp":
"33ced581dcda5af6c9125e05be7bf56c",
"util/capture/trace_egl_loader_autogen.h":
"b16a510534ee9ee49152fca12b97bd9a",
"util/capture/trace_gles_loader_autogen.cpp":
"dbb04b96a4d4926d79c6d02c7ba1c015",
"util/capture/trace_gles_loader_autogen.h":
"8e4c0b495b19dda81d466b2595ed934e",
"util/egl_loader_autogen.cpp":
"f98a6cfc104fc468efc90ae3789ddba5",
"util/egl_loader_autogen.h":
"84247f7f49720e169703fbeffc267023",
"util/gles_loader_autogen.cpp":
"d45d5d1a9f2570ced062e7f2130aec7d",
"util/gles_loader_autogen.h":
"9c2321f4473e7be1096d94f68b665b10",
"util/windows/wgl_loader_autogen.cpp":
"373b062587eab8a163121255f54597dc",
"util/windows/wgl_loader_autogen.h":
"0551e9c28a8d3902bcd5d6e5b1ed3c6f"
}