Preparing a single frame of animation
Usually, when we create 3D applications that render images, we would like images to be displayed on screen. For this purpose, a swapchain object is created in Vulkan. We know how to acquire images from a swapchain. We have also learned how to present them. Here, we will see how to connect image acquiring and presentation, how to record a command buffer in between, and how we should synchronize all of these operations to render a single frame of animation.
How to do it...
- Take the handle of a logical device and store it in a variable of type
VkDevice
namedlogical_device
. - Use a handle of a created swapchain to initialize a variable of type
VkSwapchainKHR
namedswapchain
. - Prepare a semaphore handle in a variable of type
VkSemaphore
namedimage_acquired_semaphore
. Make sure the semaphore is unsignaled or isn't being used in any previous submissions that haven't completed yet.
- Create a variable of type
uint32_t
namedimage_index
. - Acquire an image from the
swapchain...