From ad71d584cfbe588c54b2b3eaa2e6aa94af68e305 Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Wed, 30 Nov 2022 17:17:39 +0100 Subject: [PATCH] wsi/common: Add function to modify present mode. Signed-off-by: Hans-Kristian Arntzen Reviewed-by: Joshua Ashton Part-of: --- src/vulkan/wsi/wsi_common.c | 6 ++++++ src/vulkan/wsi/wsi_common_private.h | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c index a355967..36c53ac 100644 --- a/src/vulkan/wsi/wsi_common.c +++ b/src/vulkan/wsi/wsi_common.c @@ -1232,12 +1232,18 @@ wsi_common_queue_present(const struct wsi_device *wsi, vk_find_struct_const(pPresentInfo->pNext, PRESENT_ID_KHR); const VkSwapchainPresentFenceInfoEXT *present_fence_info = vk_find_struct_const(pPresentInfo->pNext, SWAPCHAIN_PRESENT_FENCE_INFO_EXT); + const VkSwapchainPresentModeInfoEXT *present_mode_info = + vk_find_struct_const(pPresentInfo->pNext, SWAPCHAIN_PRESENT_MODE_INFO_EXT); for (uint32_t i = 0; i < pPresentInfo->swapchainCount; i++) { VK_FROM_HANDLE(wsi_swapchain, swapchain, pPresentInfo->pSwapchains[i]); uint32_t image_index = pPresentInfo->pImageIndices[i]; VkResult result; + /* Update the present mode for this present and any subsequent present. */ + if (present_mode_info && present_mode_info->pPresentModes && swapchain->set_present_mode) + swapchain->set_present_mode(swapchain, present_mode_info->pPresentModes[i]); + if (swapchain->fences[image_index] == VK_NULL_HANDLE) { const VkFenceCreateInfo fence_info = { .sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO, diff --git a/src/vulkan/wsi/wsi_common_private.h b/src/vulkan/wsi/wsi_common_private.h index 148d6db..b31961a 100644 --- a/src/vulkan/wsi/wsi_common_private.h +++ b/src/vulkan/wsi/wsi_common_private.h @@ -191,6 +191,8 @@ struct wsi_swapchain { VkResult (*release_images)(struct wsi_swapchain *swap_chain, uint32_t count, const uint32_t *indices); + void (*set_present_mode)(struct wsi_swapchain *swap_chain, + VkPresentModeKHR mode); }; bool -- 2.7.4