vulkan: Implement V7 of ANDROID_native_buffer in nulldrv
Walks the struct chain in GPDP2, and claims support for shared
presentable image. This is enough to have libvulkan expose the
extension for us.
Change-Id: Id22593932cd567e79d18aae788935148d6278b3f
Test: setprop ro.hardware.vulkan default, observe extension exposed
diff --git a/vulkan/nulldrv/null_driver.cpp b/vulkan/nulldrv/null_driver.cpp
index e03ee0a..6714779 100644
--- a/vulkan/nulldrv/null_driver.cpp
+++ b/vulkan/nulldrv/null_driver.cpp
@@ -513,6 +513,28 @@
void GetPhysicalDeviceProperties2KHR(VkPhysicalDevice physical_device,
VkPhysicalDeviceProperties2KHR* properties) {
GetPhysicalDeviceProperties(physical_device, &properties->properties);
+
+ while (properties->pNext) {
+ properties = reinterpret_cast<VkPhysicalDeviceProperties2KHR *>(properties->pNext);
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wold-style-cast"
+ switch ((VkFlags)properties->sType) {
+ case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENTATION_PROPERTIES_ANDROID: {
+ VkPhysicalDevicePresentationPropertiesANDROID *presentation_properties =
+ reinterpret_cast<VkPhysicalDevicePresentationPropertiesANDROID *>(properties);
+#pragma clang diagnostic pop
+
+ // Claim that we do all the right things for the loader to
+ // expose KHR_shared_presentable_image on our behalf.
+ presentation_properties->sharedImage = VK_TRUE;
+ } break;
+
+ default:
+ // Silently ignore other extension query structs
+ break;
+ }
+ }
}
void GetPhysicalDeviceQueueFamilyProperties(