Module: Mesa Branch: main Commit: 1b3fca17085ac45195c88085aa33eecd55b37813 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1b3fca17085ac45195c88085aa33eecd55b37813
Author: Eric Engestrom <[email protected]> Date: Sun Dec 3 08:53:32 2023 +0000 vk/update-aliases.py: enforce correct list order Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26484> --- src/vulkan/registry/update-aliases.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/vulkan/registry/update-aliases.py b/src/vulkan/registry/update-aliases.py index c2321fb9ef3..41aaed3ceac 100755 --- a/src/vulkan/registry/update-aliases.py +++ b/src/vulkan/registry/update-aliases.py @@ -61,6 +61,7 @@ def main(paths: list[str]): Entrypoint; perform the search for all the aliases and replace them. """ def prepare_identifier(identifier: str) -> str: + prefixes_seen = [] for prefix in [ # Various macros prepend these, so they will not appear in the code using them. # List generated using this command: @@ -86,12 +87,12 @@ def main(paths: list[str]): 'VK_PERFORMANCE_COUNTER_UNIT_', 'VK_PIPELINE_BIND_POINT_', 'VK_SAMPLER_ADDRESS_MODE_', - 'VK_SHADER_STAGE_', 'VK_SHADER_STAGE_TESSELLATION_', + 'VK_SHADER_STAGE_', 'VK_STENCIL_OP_', - 'VK_STRUCTURE_TYPE_', - 'VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_', 'VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_', + 'VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_', + 'VK_STRUCTURE_TYPE_', 'VK_USE_PLATFORM_', 'VK_VERSION_', @@ -101,7 +102,14 @@ def main(paths: list[str]): 'Vk', 'vk', ]: + # The order matters! A shorter substring will match before a longer + # one, hiding its matches. + for prefix_seen in prefixes_seen: + assert not prefix.startswith(prefix_seen), f'{prefix_seen} must come before {prefix}' + prefixes_seen.append(prefix) + identifier = remove_prefix(identifier, prefix) + return identifier aliases = {}
