C Specification
To acquire an available presentable image to use, and retrieve the index of that image, call:
// Provided by VK_KHR_swapchain
VkResult vkAcquireNextImageKHR(
VkDevice device,
VkSwapchainKHR swapchain,
uint64_t timeout,
VkSemaphore semaphore,
VkFence fence,
uint32_t* pImageIndex);
Parameters
-
device
is the device associated withswapchain
. -
swapchain
is the non-retired swapchain from which an image is being acquired. -
timeout
specifies how long the function waits, in nanoseconds, if no image is available. -
semaphore
is VK_NULL_HANDLE or a semaphore to signal. -
fence
is VK_NULL_HANDLE or a fence to signal. -
pImageIndex
is a pointer to auint32_t
in which the index of the next image to use (i.e. an index into the array of images returned byvkGetSwapchainImagesKHR
) is returned.
Description
If the swapchain
has been created with the
VK_SWAPCHAIN_CREATE_DEFERRED_MEMORY_ALLOCATION_BIT_EXT
flag, the image
whose index is returned in pImageIndex
will be fully backed by memory
before this call returns to the application, as if it is bound completely
and contiguously to a single VkDeviceMemory
object.
Document Notes
For more information, see the Vulkan Specification
This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.