From 7fa2a605d054d7030b98c7ad2a267f4e4f5939b0 Mon Sep 17 00:00:00 2001 From: PancakeTAS Date: Thu, 10 Jul 2025 22:27:04 +0200 Subject: [PATCH] force enable vsync again --- src/hooks.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/hooks.cpp b/src/hooks.cpp index 826c817..7eff7a9 100644 --- a/src/hooks.cpp +++ b/src/hooks.cpp @@ -210,6 +210,20 @@ namespace { auto& deviceInfo = devices.at(swapchainToDeviceTable.at(*pPresentInfo->pSwapchains)); auto& swapchain = swapchains.at(*pPresentInfo->pSwapchains); + // patch vsync NOLINTBEGIN + const VkSwapchainPresentModeInfoEXT* presentModeInfo = + reinterpret_cast(pPresentInfo->pNext); + while (presentModeInfo) { + if (presentModeInfo->sType == VK_STRUCTURE_TYPE_SWAPCHAIN_PRESENT_MODE_INFO_EXT) { + for (size_t i = 0; i < presentModeInfo->swapchainCount; i++) + const_cast(presentModeInfo->pPresentModes)[i] = + VK_PRESENT_MODE_FIFO_KHR; + } + presentModeInfo = + reinterpret_cast(presentModeInfo->pNext); + } // NOLINTEND + + // present the next frame Log::debug("hooks2", "Presenting swapchain: {:x} on queue: {:x}", reinterpret_cast(*pPresentInfo->pSwapchains), reinterpret_cast(queue));