Generate Vulkan framework from Vulkan registry (Part 4)
Instead of using the manually created vulkan.api file for generating the
Vulkan driver framework, we generate it directly from the vulkan
registry (vk.xml)
Bug: 134711355
Test: Build and flash, dEQP tests
Change-Id: Ie38d93c51ff16d2108cbe9a9a717a0bea24947df
diff --git a/vulkan/scripts/api_generator.py b/vulkan/scripts/api_generator.py
index 05dc995..a0c648c 100644
--- a/vulkan/scripts/api_generator.py
+++ b/vulkan/scripts/api_generator.py
@@ -63,7 +63,7 @@
#endif // LIBVULKAN_API_GEN_H
"""
- genfile = os.path.join(os.path.dirname(__file__),'..','libvulkan','api_gen2.h')
+ genfile = os.path.join(os.path.dirname(__file__),'..','libvulkan','api_gen.h')
with open(genfile, 'w') as f:
instanceDispatchTableEntries = []
deviceDispatchTableEntries = []
@@ -93,6 +93,7 @@
f.write (tail)
f.close()
+ gencom.runClangFormat(genfile)
def defineInitProc(name, f):
f.write ('#define UNLIKELY(expr) __builtin_expect((expr), 0)\n')
@@ -233,7 +234,7 @@
def api_gencpp():
- genfile = os.path.join(os.path.dirname(__file__),'..','libvulkan','api_gen2.cpp')
+ genfile = os.path.join(os.path.dirname(__file__),'..','libvulkan','api_gen.cpp')
header = """#include <log/log.h>
#include <string.h>
@@ -341,4 +342,5 @@
f.write ('}\n\n')
gencom.clang_on(f, 0)
-
+ f.close()
+ gencom.runClangFormat(genfile)
diff --git a/vulkan/scripts/driver_generator.py b/vulkan/scripts/driver_generator.py
index 92326ca..04d9f23 100644
--- a/vulkan/scripts/driver_generator.py
+++ b/vulkan/scripts/driver_generator.py
@@ -132,7 +132,7 @@
namespace vulkan {
namespace driver {\n\n"""
- genfile = os.path.join(os.path.dirname(__file__),'..','libvulkan','driver_gen2.h')
+ genfile = os.path.join(os.path.dirname(__file__),'..','libvulkan','driver_gen.h')
with open(genfile, 'w') as f:
f.write (gencom.copyright)
f.write (gencom.warning)
@@ -166,6 +166,8 @@
} // namespace vulkan
#endif // LIBVULKAN_DRIVER_TABLE_H\n""")
+ f.close()
+ gencom.runClangFormat(genfile)
def isIntercepted(functionName):
switchCase = {
@@ -317,7 +319,7 @@
// clang-format off\n\n"""
- genfile = os.path.join(os.path.dirname(__file__),'..','libvulkan','driver_gen2.cpp')
+ genfile = os.path.join(os.path.dirname(__file__),'..','libvulkan','driver_gen.cpp')
with open(genfile, 'w') as f:
f.write (gencom.copyright)
@@ -390,4 +392,5 @@
f.write ('\n' + gencom.clang_off_spaces + 'return success;\n')
f.write ('}\n\n} // namespace driver\n} // namespace vulkan\n\n')
gencom.clang_on(f, 0)
-
+ f.close()
+ gencom.runClangFormat(genfile)
diff --git a/vulkan/scripts/generator_common.py b/vulkan/scripts/generator_common.py
index 163fba3..d9f97e1 100644
--- a/vulkan/scripts/generator_common.py
+++ b/vulkan/scripts/generator_common.py
@@ -17,6 +17,8 @@
# This script provides the common functions for generating the
# vulkan framework directly from the vulkan registry (vk.xml).
+from subprocess import check_call
+
copyright = """/*
* Copyright 2016 The Android Open Source Project
*
@@ -75,6 +77,10 @@
'VK_ANDROID_external_memory_android_hardware_buffer'
]
+def runClangFormat(args):
+ clang_call = ["clang-format", "--style", "file", "-i", args]
+ check_call (clang_call)
+
def isExtensionInternal(extensionName):
if extensionName == 'VK_ANDROID_native_buffer':
return True
diff --git a/vulkan/scripts/null_generator.py b/vulkan/scripts/null_generator.py
index fcbaf39..ee8762e 100644
--- a/vulkan/scripts/null_generator.py
+++ b/vulkan/scripts/null_generator.py
@@ -67,7 +67,7 @@
PFN_vkVoidFunction GetInstanceProcAddr(const char* name);
"""
- genfile = os.path.join(os.path.dirname(__file__),'..','nulldrv','null_driver_gen2.h')
+ genfile = os.path.join(os.path.dirname(__file__),'..','nulldrv','null_driver_gen.h')
with open(genfile, 'w') as f:
f.write (copyright)
f.write (gencom.warning)
@@ -85,6 +85,8 @@
f.write ('\n} // namespace null_driver\n')
f.write ('\n#endif // NULLDRV_NULL_DRIVER_H\n')
+ f.close()
+ gencom.runClangFormat(genfile)
def null_driver_gencpp():
header = """#include <algorithm>
@@ -118,7 +120,7 @@
const NameProc kGlobalProcs[] = {
"""
- genfile = os.path.join(os.path.dirname(__file__),'..','nulldrv','null_driver_gen2.cpp')
+ genfile = os.path.join(os.path.dirname(__file__),'..','nulldrv','null_driver_gen.cpp')
with open(genfile, 'w') as f:
f.write (copyright)
f.write (gencom.warning)
@@ -151,4 +153,6 @@
}
} // namespace null_driver\n""")
+ f.close()
+ gencom.runClangFormat(genfile)