vulkan: Driver device extension enumeration and filtering
- Return VK_ERROR_EXTENSION_NOT_PRESENT if a requested device
extension is not supported by the loader, driver, or any enabled
device layer.
- Filter out device extensions not supported by the driver when
creating the driver device.
- Enumerate device extensions supported by the driver or loader.
Change-Id: I538e37bc74cc7f0eb27b1211b9324fb3b8a06e14
(cherry picked from commit 35873021f4f79ded0f584e433076c2675c6aed69)
diff --git a/vulkan/libvulkan/loader.h b/vulkan/libvulkan/loader.h
index 375396e..3e2d1c4 100644
--- a/vulkan/libvulkan/loader.h
+++ b/vulkan/libvulkan/loader.h
@@ -31,6 +31,13 @@
};
typedef std::bitset<kInstanceExtensionCount> InstanceExtensionSet;
+enum DeviceExtension {
+ kKHR_swapchain,
+ kANDROID_native_buffer,
+ kDeviceExtensionCount
+};
+typedef std::bitset<kDeviceExtensionCount> DeviceExtensionSet;
+
inline const InstanceDispatchTable& GetDispatchTable(VkInstance instance) {
return **reinterpret_cast<InstanceDispatchTable**>(instance);
}
@@ -149,6 +156,8 @@
PFN_vkGetInstanceProcAddr GetGetInstanceProcAddr() const;
PFN_vkGetDeviceProcAddr GetGetDeviceProcAddr() const;
+ bool SupportsExtension(const char* name) const;
+
private:
Layer* layer_;
};
@@ -166,6 +175,7 @@
LayerRef GetDeviceLayerRef(const char* name);
InstanceExtension InstanceExtensionFromName(const char* name);
+DeviceExtension DeviceExtensionFromName(const char* name);
} // namespace vulkan