vulkan: rework DriverDispatchTable
Generate {Instance,Device}DriverTable from code-generator.tmpl to replace
dispatch.tmpl entirely. The new code avoids initializing
VK_ANDROID_native_buffer entries when the extension is not enabled. The
separation of instance and device driver tables also allows us to
initialize the device driver table with vkGetDeviceProcAddr, which is
expected to return more efficient function pointers on properly
implemented HALs.
CreateInstance_Bottom always has a potential resource leak when the
HAL-created instance does not contain HWVULKAN_DISPATCH_MAGIC.
CreateDevice_Bottom now has the same issue. Both of them will be fixed in
following commits.
Change-Id: If7800ef23098121f1fff643a2c5224c2c9be0711
diff --git a/vulkan/libvulkan/loader.h b/vulkan/libvulkan/loader.h
index 15b773d..a2c7e83 100644
--- a/vulkan/libvulkan/loader.h
+++ b/vulkan/libvulkan/loader.h
@@ -18,8 +18,9 @@
#define LIBVULKAN_LOADER_H 1
#include <bitset>
-#include "dispatch_gen.h"
+#include <vulkan/vulkan.h>
#include "debug_report.h"
+#include "driver.h"
struct hwvulkan_device_t;
@@ -41,14 +42,6 @@
typedef std::bitset<kDeviceExtensionCount> DeviceExtensionSet;
// -----------------------------------------------------------------------------
-// dispatch_gen.cpp
-
-bool LoadDriverDispatchTable(VkInstance instance,
- PFN_vkGetInstanceProcAddr get_proc_addr,
- const InstanceExtensionSet& extensions,
- DriverDispatchTable& dispatch);
-
-// -----------------------------------------------------------------------------
// loader.cpp
bool InitLoader(hwvulkan_device_t* dev);
@@ -67,9 +60,9 @@
const VkAllocationCallbacks* GetAllocator(VkInstance instance);
const VkAllocationCallbacks* GetAllocator(VkDevice device);
VkInstance GetDriverInstance(VkInstance instance);
-const DriverDispatchTable& GetDriverDispatch(VkInstance instance);
-const DriverDispatchTable& GetDriverDispatch(VkDevice device);
-const DriverDispatchTable& GetDriverDispatch(VkQueue queue);
+const driver::InstanceDriverTable& GetDriverDispatch(VkInstance instance);
+const driver::DeviceDriverTable& GetDriverDispatch(VkDevice device);
+const driver::DeviceDriverTable& GetDriverDispatch(VkQueue queue);
DebugReportCallbackList& GetDebugReportCallbacks(VkInstance instance);
// -----------------------------------------------------------------------------