libvulkan: Only load driver functions for enabled extensions
Change-Id: I4105291bd42583a10420681b729f03ecd7a91724
(cherry picked from commit 1c77ae2acda376b791932beffcb931c378e8ee36)
diff --git a/vulkan/libvulkan/loader.h b/vulkan/libvulkan/loader.h
index 6e32785..b7edb73 100644
--- a/vulkan/libvulkan/loader.h
+++ b/vulkan/libvulkan/loader.h
@@ -17,10 +17,19 @@
#ifndef LIBVULKAN_LOADER_H
#define LIBVULKAN_LOADER_H 1
+#include <bitset>
#include "dispatch_gen.h"
namespace vulkan {
+enum InstanceExtension {
+ kKHR_surface,
+ kKHR_android_surface,
+ kEXT_debug_report,
+ kInstanceExtensionCount
+};
+typedef std::bitset<kInstanceExtensionCount> InstanceExtensionSet;
+
inline const InstanceDispatchTable& GetDispatchTable(VkInstance instance) {
return **reinterpret_cast<InstanceDispatchTable**>(instance);
}
@@ -62,6 +71,7 @@
DeviceDispatchTable& dispatch);
bool LoadDriverDispatchTable(VkInstance instance,
PFN_vkGetInstanceProcAddr get_proc_addr,
+ const InstanceExtensionSet& extensions,
DriverDispatchTable& dispatch);
// -----------------------------------------------------------------------------
@@ -146,6 +156,8 @@
uint32_t* count);
LayerRef GetLayerRef(const char* name);
+InstanceExtension InstanceExtensionFromName(const char* name);
+
} // namespace vulkan
#endif // LIBVULKAN_LOADER_H