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
{
"doc/ExtensionSupport.md":
"26ed834d77af164e60e4304d029779f7",
"scripts/egl_angle_ext.xml":
"7ae2be7840b4dbf9db875688847606d4",
"scripts/extension_data/intel_630_linux.json":
"3b86832de6a7095f4617e273cba6d45e",
"scripts/extension_data/intel_630_win10.json":
"fc9c4e87009c66ffb9e0f2d26de055d6",
"scripts/extension_data/nvidia_1660_linux.json":
"9ca2a4e2b9bf326bd4d9d4110a7f23c2",
"scripts/extension_data/nvidia_1660_win10.json":
"6044d5441d881b3653f6424bf04a4276",
"scripts/extension_data/pixel_4_android_11.json":
"9f2d767c010f8d49b6bd9d6062ccbeac",
"scripts/extension_data/pixel_6_android_13.json":
"e72dfc607e0dbcac4037cc4279793242",
"scripts/extension_data/swiftshader_win10.json":
"1a70a2074355ac6001972c5b3a3292dd",
"scripts/extension_data/swiftshader_win10_gles1.json":
"bea8e2106d62e1ea0e8938f150865a37",
"scripts/gl_angle_ext.xml":
"49a0bf469d6f44c532098ef3a9fd087f",
"scripts/registry_xml.py":
"2175daaec34d2e6fe763d0c3efa93dea",
"src/libANGLE/gen_extensions.py":
"6ea1cb1733c4df98b527bbf2752e118b",
"src/libANGLE/gles_extensions_autogen.cpp":
"e340c75264626982366d1212028fabbe",
"src/libANGLE/gles_extensions_autogen.h":
"b76f1ea0977ea2931137189b14907c9c",
"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"
}