C Specification
When the VkSurfaceCapabilitiesPresentWait2KHR
surface capability is
present for a given surface, an application can wait for an image to be
presented to the user by first specifying a presentId
for the target
presentation by adding a VkPresentId2KHR
structure to the pNext
chain of the VkPresentInfoKHR structure and then waiting for that
presentation to complete by calling:
// Provided by VK_KHR_present_wait2
VkResult vkWaitForPresent2KHR(
VkDevice device,
VkSwapchainKHR swapchain,
const VkPresentWait2InfoKHR* pPresentWait2Info);
Parameters
-
device
is the device associated withswapchain
. -
swapchain
is the non-retired swapchain on which an image was queued for presentation. -
pPresentWait2Info
is a pointer to a VkPresentWait2InfoKHR structure specifying the parameters of the wait.
Description
vkWaitForPresent2KHR
waits for the presentation engine to have begun
presentation of the presentation request associated with the
VkPresentWait2InfoKHR::presentId
on swapchain
, or for
VkPresentWait2InfoKHR::timeout
to have expired.
The wait request will complete when the timeout expires, or after the corresponding presentation request has either taken effect within the presentation engine or has been replaced without presentation.
The timing relationship between the presentation of the image to the user and the wait request completing is implementation-dependent due to variations in window system implementations.
If the swapchain
becomes VK_ERROR_OUT_OF_DATE_KHR
either before
or during this call, the call may either return VK_SUCCESS
(if the
image was delivered to the presentation engine and may have been presented
to the user) or return early with status VK_ERROR_OUT_OF_DATE_KHR
(if
the image could not be presented to the user).
As an exception to the normal rules for objects which are externally
synchronized, the swapchain
passed to vkWaitForPresent2KHR
may
be simultaneously used by other threads in calls to functions other than
vkDestroySwapchainKHR.
Access to the swapchain data associated with this extension must be atomic
within the implementation.
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.