From 52045a1dde72133b04b8199b22c243843a592c33 Mon Sep 17 00:00:00 2001 From: saschawillems Date: Sun, 6 Mar 2016 16:18:29 +0100 Subject: [PATCH] queuePresent overload for passing a wait semaphore (#65) --- base/vulkanswapchain.hpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/base/vulkanswapchain.hpp b/base/vulkanswapchain.hpp index f7dafb18..9f454bd2 100644 --- a/base/vulkanswapchain.hpp +++ b/base/vulkanswapchain.hpp @@ -399,6 +399,24 @@ public: return fpQueuePresentKHR(queue, &presentInfo); } + // Present the current image to the queue + VkResult queuePresent(VkQueue queue, uint32_t currentBuffer, VkSemaphore waitSemaphore) + { + VkPresentInfoKHR presentInfo = {}; + presentInfo.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR; + presentInfo.pNext = NULL; + presentInfo.swapchainCount = 1; + presentInfo.pSwapchains = &swapChain; + presentInfo.pImageIndices = ¤tBuffer; + if (waitSemaphore != VK_NULL_HANDLE) + { + presentInfo.pWaitSemaphores = &waitSemaphore; + presentInfo.waitSemaphoreCount = 1; + } + return fpQueuePresentKHR(queue, &presentInfo); + } + + // Free all Vulkan resources used by the swap chain void cleanup() {