diff options
| -rw-r--r-- | vulkan/scripts/driver_generator.py | 10 | ||||
| -rw-r--r-- | vulkan/scripts/generator_common.py | 21 |
2 files changed, 20 insertions, 11 deletions
diff --git a/vulkan/scripts/driver_generator.py b/vulkan/scripts/driver_generator.py index 1f3fd8e6ba..0be049186e 100644 --- a/vulkan/scripts/driver_generator.py +++ b/vulkan/scripts/driver_generator.py @@ -174,8 +174,8 @@ struct ProcHook { }; enum Extension {\n""") - for exts in _KNOWN_EXTENSIONS: - f.write(gencom.indent(2) + exts[3:] + ',\n') + for ext in _KNOWN_EXTENSIONS: + f.write(gencom.indent(2) + gencom.base_ext_name(ext) + ',\n') f.write(""" EXTENSION_CORE, // valid bit @@ -441,9 +441,9 @@ const ProcHook* GetProcHook(const char* name) { ProcHook::Extension GetProcHookExtension(const char* name) { // clang-format off\n""") - for exts in _KNOWN_EXTENSIONS: - f.write(gencom.indent(1) + 'if (strcmp(name, \"' + exts + - '\") == 0) return ProcHook::' + exts[3:] + ';\n') + for ext in _KNOWN_EXTENSIONS: + f.write(gencom.indent(1) + 'if (strcmp(name, \"' + ext + + '\") == 0) return ProcHook::' + gencom.base_ext_name(ext) + ';\n') f.write("""\ // clang-format on diff --git a/vulkan/scripts/generator_common.py b/vulkan/scripts/generator_common.py index bc37b84e12..5bfa9ecb52 100644 --- a/vulkan/scripts/generator_common.py +++ b/vulkan/scripts/generator_common.py @@ -142,15 +142,15 @@ def run_clang_format(args): subprocess.check_call(clang_call) -def is_extension_internal(extension_name): +def is_extension_internal(ext): """Returns true if an extension is internal to the loader and drivers. The loader should not enumerate this extension. Args: - extension_name: Vulkan extension name. + ext: Vulkan extension name. """ - return extension_name == 'VK_ANDROID_native_buffer' + return ext == 'VK_ANDROID_native_buffer' def base_name(cmd): @@ -162,6 +162,15 @@ def base_name(cmd): return cmd[2:] +def base_ext_name(ext): + """Returns an extension name without the 'VK_' prefix. + + Args: + ext: Vulkan extension name. + """ + return ext[3:] + + def is_function_supported(cmd): """Returns true if a function is core or from a supportable extension. @@ -221,15 +230,15 @@ def is_device_dispatched(cmd): return is_function_supported(cmd) and get_dispatch_table_type(cmd) == 'Device' -def is_extension_exported(extension_name): +def is_extension_exported(ext): """Returns true if an extension has functions exported by the loader. E.g. applications can directly link to an extension function. Args: - extension_name: Vulkan extension name. + ext: Vulkan extension name. """ - return extension_name in _EXPORTED_EXTENSIONS + return ext in _EXPORTED_EXTENSIONS def is_function_exported(cmd): |