diff options
| author | Mike Schuchardt <mikes@lunarg.com> | 2021-09-15 08:53:19 -0700 |
|---|---|---|
| committer | Mike Schuchardt <mikes@lunarg.com> | 2021-09-15 10:29:01 -0700 |
| commit | a12d15bd45312fb6d3c3d20bf686fdc695483e66 (patch) | |
| tree | 5847136e2f4ff00c65bdfeec9b7d77c600183844 /scripts/generate_vulkan_wrapper.py | |
| parent | f4974ccd170cf2338c0582f607af5d8dfc3dac51 (diff) | |
| download | usermoji-a12d15bd45312fb6d3c3d20bf686fdc695483e66.tar.xz | |
scripts: Ignore compatibility constants in wrapper
When the working group changes the name of a constant:
VK_KHR_MAINTENANCE1_SPEC_VERSION ->
VK_KHR_MAINTENANCE_1_SPEC_VERSION
they will still #define the original name to maintain backward
compatibility with existing code that uses it:
#define VK_KHR_MAINTENANCE_1_SPEC_VERSION 2
#define VK_KHR_MAINTENANCE_1_EXTENSION_NAME "VK_KHR_maintenance1"
#define VK_KHR_MAINTENANCE1_SPEC_VERSION VK_KHR_MAINTENANCE_1_SPEC_VERSION
#define VK_KHR_MAINTENANCE1_EXTENSION_NAME VK_KHR_MAINTENANCE_1_EXTENSION_NAME
In this case, we need to ignore the non-numeric _SPEC_VERSION and
unquoted _EXTENSION_NAME constants because they don't define a separate
extension.
Diffstat (limited to 'scripts/generate_vulkan_wrapper.py')
| -rwxr-xr-x | scripts/generate_vulkan_wrapper.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/scripts/generate_vulkan_wrapper.py b/scripts/generate_vulkan_wrapper.py index 5abdc279..09be2ca4 100755 --- a/scripts/generate_vulkan_wrapper.py +++ b/scripts/generate_vulkan_wrapper.py @@ -1800,14 +1800,19 @@ def parse_subheader(filename, ext_guard): current_ext.add_command(Command.from_c_typedef(line)) elif line.startswith("#define") and "SPEC_VERSION " in line: version_begin = line.rfind(" ") + 1 - spec_version = int(line[version_begin:]) + version_str = line[version_begin:] + # Non-numeric versions are used for backward compatibility and should be ignored + if version_str.isdigit(): + spec_version = int(version_str) elif line.startswith("#define") and "EXTENSION_NAME " in line: name_end = line.rfind("\"") - name_begin = line.rfind("\"", 0, name_end) + 1 - name = line[name_begin:name_end] - # add extension - current_ext = Extension(name, spec_version, ext_guard) - sub_extensions.append(current_ext) + name_begin = line.rfind("\"", 0, name_end) + # Unquoted names are used for backward compatibility and should be ignored + if name_begin != -1 and name_end != -1: + name = line[name_begin + 1:name_end] + # add extension + current_ext = Extension(name, spec_version, ext_guard) + sub_extensions.append(current_ext) return sub_extensions; |
