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

Commit 0f2ac2e5 authored by Chris Forbes's avatar Chris Forbes
Browse files

vulkan: Add function stub & plumbing for KHR_swapchain_front_buffered

Test: build
Change-Id: I6ea2e33e708067f11069bda19c4b5ea167158913
parent 2e12cb80
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -705,6 +705,7 @@ VK_KHR_incremental_present
VK_KHR_surface
VK_KHR_swapchain
VK_GOOGLE_display_timing
VK_KHR_swapchain_front_buffered
{{end}}


+17 −0
Original line number Diff line number Diff line
@@ -93,6 +93,15 @@ VKAPI_ATTR VkResult checkedGetPastPresentationTimingGOOGLE(VkDevice device, VkSw
    }
}

VKAPI_ATTR VkResult checkedGetSwapchainStatusKHR(VkDevice device, VkSwapchainKHR swapchain) {
    if (GetData(device).hook_extensions[ProcHook::KHR_swapchain_front_buffered]) {
        return GetSwapchainStatusKHR(device, swapchain);
    } else {
        Logger(device).Err(device, "VK_KHR_swapchain_front_buffered not enabled. vkGetSwapchainStatusKHR not executed.");
        return VK_SUCCESS;
    }
}

// clang-format on

const ProcHook g_proc_hooks[] = {
@@ -300,6 +309,13 @@ const ProcHook g_proc_hooks[] = {
        reinterpret_cast<PFN_vkVoidFunction>(GetSwapchainImagesKHR),
        reinterpret_cast<PFN_vkVoidFunction>(checkedGetSwapchainImagesKHR),
    },
    {
        "vkGetSwapchainStatusKHR",
        ProcHook::DEVICE,
        ProcHook::KHR_swapchain_front_buffered,
        reinterpret_cast<PFN_vkVoidFunction>(GetSwapchainStatusKHR),
        reinterpret_cast<PFN_vkVoidFunction>(checkedGetSwapchainStatusKHR),
    },
    {
        "vkQueuePresentKHR",
        ProcHook::DEVICE,
@@ -338,6 +354,7 @@ ProcHook::Extension GetProcHookExtension(const char* name) {
    if (strcmp(name, "VK_KHR_surface") == 0) return ProcHook::KHR_surface;
    if (strcmp(name, "VK_KHR_swapchain") == 0) return ProcHook::KHR_swapchain;
    if (strcmp(name, "VK_GOOGLE_display_timing") == 0) return ProcHook::GOOGLE_display_timing;
    if (strcmp(name, "VK_KHR_swapchain_front_buffered") == 0) return ProcHook::KHR_swapchain_front_buffered;
    // clang-format on
    return ProcHook::EXTENSION_UNKNOWN;
}
+1 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ struct ProcHook {
        KHR_surface,
        KHR_swapchain,
        GOOGLE_display_timing,
        KHR_swapchain_front_buffered,

        EXTENSION_CORE,  // valid bit
        EXTENSION_COUNT,
+11 −0
Original line number Diff line number Diff line
@@ -1077,5 +1077,16 @@ VkResult GetPastPresentationTimingGOOGLE(
    return result;
}

VKAPI_ATTR
VkResult GetSwapchainStatusKHR(
    VkDevice,
    VkSwapchainKHR) {
    VkResult result = VK_SUCCESS;

    // TODO(chrisforbes): Implement this function properly

    return result;
}

}  // namespace driver
}  // namespace vulkan
+1 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ VKAPI_ATTR VkResult AcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchai
VKAPI_ATTR VkResult QueuePresentKHR(VkQueue queue, const VkPresentInfoKHR* present_info);
VKAPI_ATTR VkResult GetRefreshCycleDurationGOOGLE(VkDevice device, VkSwapchainKHR swapchain, VkRefreshCycleDurationGOOGLE* pDisplayTimingProperties);
VKAPI_ATTR VkResult GetPastPresentationTimingGOOGLE(VkDevice device, VkSwapchainKHR swapchain, uint32_t* pPresentationTimingCount, VkPastPresentationTimingGOOGLE* pPresentationTimings);
VKAPI_ATTR VkResult GetSwapchainStatusKHR(VkDevice device, VkSwapchainKHR swapchain);
// clang-format on

}  // namespace driver