Getting handles of swapchain images
When the swapchain object is created, it may be very useful to acquire the number and handles of all images that were created along with the swapchain.
How to do it...
- Take the handle of a created logical device object. Store it in a variable of type
VkDevice
namedlogical_device
. - Assign the handle of a created swapchain to a variable of type
VkSwapchainKHR
namedswapchain
. - Create a variable of type
uint32_t
namedimages_count
. - Call
vkGetSwapchainImagesKHR(logical_device, swapchain, &images_count, nullptr)
for which provide the handle to the created logical device in the first parameter, the handle of the swapchain in the second, and a pointer to theimages_count
variable in the third parameter. Provide anullptr
value in the last parameter. - If the call is successful, meaning that the returned value is equal to
VK_SUCCESS
, theimages_count
variable will contain the total number of images created for a given swapchain object. - Create a
std::vector
with elements...