From 3a6458ab7a7ca695e6807fc70f4b098f3a00b210 Mon Sep 17 00:00:00 2001 From: PancakeTAS Date: Wed, 2 Jul 2025 11:39:14 +0200 Subject: [PATCH] pass pNext to present --- include/application.hpp | 6 ++++-- src/application.cpp | 8 ++++---- src/hooks.cpp | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/include/application.hpp b/include/application.hpp index 19f2775..5133a04 100644 --- a/include/application.hpp +++ b/include/application.hpp @@ -52,11 +52,12 @@ public: /// @param queue The Vulkan queue to present the frame on. /// @param semaphores The semaphores to wait on before presenting. /// @param idx The index of the swapchain image to present. + /// @param pNext Pointer to the next structure in a chain, if any. /// /// @throws LSFG::vulkan_error if any Vulkan call fails. /// void presentSwapchain(VkSwapchainKHR handle, VkQueue queue, - const std::vector& semaphores, uint32_t idx); + const std::vector& semaphores, uint32_t idx, const void* pNext); /// /// Remove a swapchain from the application. @@ -120,11 +121,12 @@ public: /// @param queue The Vulkan queue to present the frame on. /// @param semaphores The semaphores to wait on before presenting. /// @param idx The index of the swapchain image to present. + /// @param pNext Pointer to the next structure in a chain, if any. /// /// @throws LSFG::vulkan_error if any Vulkan call fails. /// void present(const Application& app, VkQueue queue, - const std::vector& semaphores, uint32_t idx); + const std::vector& semaphores, uint32_t idx, const void* pNext); /// Get the Vulkan swapchain handle. [[nodiscard]] VkSwapchainKHR handle() const { return this->swapchain; } diff --git a/src/application.cpp b/src/application.cpp index c9623b2..216019a 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -65,17 +65,16 @@ SwapchainContext::SwapchainContext(const Application& app, VkSwapchainKHR swapch } void Application::presentSwapchain(VkSwapchainKHR handle, VkQueue queue, - const std::vector& semaphores, uint32_t idx) { + const std::vector& semaphores, uint32_t idx, const void* pNext) { auto it = this->swapchains.find(handle); if (it == this->swapchains.end()) throw std::logic_error("Swapchain not found"); - it->second.present(*this, queue, semaphores, idx); + it->second.present(*this, queue, semaphores, idx, pNext); } void SwapchainContext::present(const Application& app, VkQueue queue, - const std::vector& semaphores, uint32_t idx) { - + const std::vector& semaphores, uint32_t idx, const void* pNext) { // present deferred frame if any if (this->deferredIdx.has_value()) { VkSemaphore deferredSemaphore = this->copySemaphores2.at((this->frameIdx - 1) % 8).handle(); @@ -283,6 +282,7 @@ void SwapchainContext::present(const Application& app, VkQueue queue, VkSemaphore presentSemaphoreHandle = presentSemaphore.handle(); const VkPresentInfoKHR presentInfo = { .sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR, + .pNext = pNext, .waitSemaphoreCount = 1, .pWaitSemaphores = &presentSemaphoreHandle, .swapchainCount = 1, diff --git a/src/hooks.cpp b/src/hooks.cpp index fe45493..97d78cd 100644 --- a/src/hooks.cpp +++ b/src/hooks.cpp @@ -179,7 +179,7 @@ namespace { std::copy_n(pPresentInfo->pWaitSemaphores, waitSemaphores.size(), waitSemaphores.data()); application->presentSwapchain(*pPresentInfo->pSwapchains, - queue, waitSemaphores, *pPresentInfo->pImageIndices); + queue, waitSemaphores, *pPresentInfo->pImageIndices, pPresentInfo->pNext); Log::info("lsfg-vk(hooks): Frame presented successfully"); } catch (const LSFG::vulkan_error& e) {