From 908518c92ee00af1d7787daf3e222d817770d7e1 Mon Sep 17 00:00:00 2001 From: Lior Dekel Date: Wed, 7 Sep 2022 13:42:33 +0300 Subject: [PATCH] Adding VK_KHR_shared_presentable_image basic support To comply with ICDs that expose the VK_KHR_shared_presentable_image extension, the Layer needs to handle VkSharedPresentSurfaceCapabilitiesKHR struct (holds sType=VK_STRUCTURE_TYPE_SHARED_PRESENT_SURFACE_CAPABILITIES_KHR) for queries on the VkSurfaces managed by the Layer. A simple implementation that sets the minimum required flags is provided in this commit. Since no WSI layer swapchain will support the shared presentable modes, no other functionality is required. VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT must be included in the sharedPresentSupportedUsageFlags field but implementations may support additional usages. Signed-off-by: Lior Dekel Change-Id: I73b29e54a84376c663b3cada989c910d1ba27293 --- layer/surface_api.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/layer/surface_api.cpp b/layer/surface_api.cpp index 4140c03..6e11840 100644 --- a/layer/surface_api.cpp +++ b/layer/surface_api.cpp @@ -63,6 +63,13 @@ wsi_layer_vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice physicalDe wsi::surface_properties *props = wsi::get_surface_properties(instance, pSurfaceInfo->surface); assert(props != nullptr); + auto shared_present_surface_cap_struct = util::find_extension( + VK_STRUCTURE_TYPE_SHARED_PRESENT_SURFACE_CAPABILITIES_KHR, pSurfaceCapabilities); + if (shared_present_surface_cap_struct != nullptr) + { + shared_present_surface_cap_struct->sharedPresentSupportedUsageFlags = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; + } + /* * Any of the extensions that extend pSurfaceInfo are not supported by the * swapchain implementation so it is safe to ignore pNext here, even if