Vulkan: factor base extension name into a function
Bug: 134185757
Test: ./scripts/code_generator.py && build
Change-Id: I839adc28b94a6e429ea25753f2f8c3e469449c24
diff --git a/vulkan/scripts/generator_common.py b/vulkan/scripts/generator_common.py
index bc37b84..5bfa9ec 100644
--- a/vulkan/scripts/generator_common.py
+++ b/vulkan/scripts/generator_common.py
@@ -142,15 +142,15 @@
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 @@
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 @@
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):