Vulkan: factor base extension name into a function

Bug: 134185757
Test: ./scripts/code_generator.py && build
Change-Id: I839adc28b94a6e429ea25753f2f8c3e469449c24
diff --git a/vulkan/scripts/driver_generator.py b/vulkan/scripts/driver_generator.py
index 1f3fd8e..0be0491 100644
--- a/vulkan/scripts/driver_generator.py
+++ b/vulkan/scripts/driver_generator.py
@@ -174,8 +174,8 @@
     };
     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 @@
 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 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):