Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 06bc009c authored by Chris Forbes's avatar Chris Forbes Committed by Jesse Hall
Browse files

vulkan: Implement usage flags query for KHR_shared_presentable_image

This was a late addition to the spec. Until we have a reason to do
otherwise, report the same set of supported usage flags for shared
present modes as for all other modes.

Test: build
Change-Id: I66c13b20a1a0f5aa9be13bc16a323f42874ba45a
parent 2452cf7e
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -657,6 +657,28 @@ VkResult GetPhysicalDeviceSurfaceCapabilities2KHR(
        physicalDevice, pSurfaceInfo->surface,
        &pSurfaceCapabilities->surfaceCapabilities);

    VkSurfaceCapabilities2KHR* caps = pSurfaceCapabilities;
    while (caps->pNext) {
        caps = reinterpret_cast<VkSurfaceCapabilities2KHR*>(caps->pNext);

        switch (caps->sType) {
            case VK_STRUCTURE_TYPE_SHARED_PRESENT_SURFACE_CAPABILITIES_KHR: {
                VkSharedPresentSurfaceCapabilitiesKHR* shared_caps =
                    reinterpret_cast<VkSharedPresentSurfaceCapabilitiesKHR*>(
                        caps);
                // Claim same set of usage flags are supported for
                // shared present modes as for other modes.
                shared_caps->sharedPresentSupportedUsageFlags =
                    pSurfaceCapabilities->surfaceCapabilities
                        .supportedUsageFlags;
            } break;

            default:
                // Ignore all other extension structs
                break;
        }
    }

    return result;
}