Presenting images
Presenting an image onto the screen isn’t automatic in Vulkan. You need to call the vkQueuePresentKHR
function along with an instance of the VkPresentInfoKHR
structure.
In this recipe, you will learn how to queue an image for presentation once it has finished rendering.
Getting ready
The presentation in our code is done in the VulkanCore::Swapchain::present()
method.
How to do it…
Requesting an acquired image to be presented is done by calling vkQueuePresentKHR
.
This time, we need to provide the imageRendered
semaphore, which indicates when the rendering process has finished using the image:
const VkPresentInfoKHR presentInfo{ .sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR, .waitSemaphoreCount = 1, .pWaitSemaphores = &imageRendered_, .swapchainCount = 1, .pSwapchains = &swapchain_, ...