Class KHRPresentWait

java.lang.Object
org.lwjgl.vulkan.KHRPresentWait

public class KHRPresentWait extends Object
This device extension allows an application that uses the VK_KHR_swapchain extension to wait for present operations to complete. An application can use this to monitor and control the pacing of the application by managing the number of outstanding images yet to be presented.
Name String
VK_KHR_present_wait
Extension Type
Device extension
Registered Extension Number
249
Revision
1
Extension and Version Dependencies
VK_KHR_swapchain and VK_KHR_present_id
Contact
Other Extension Metadata
Last Modified Date
2019-05-15
IP Status
No known IP claims.
Contributors
  • Keith Packard, Valve
  • Ian Elliott, Google
  • Tobias Hector, AMD
  • Daniel Stone, Collabora
  • Field Details

    • VK_KHR_PRESENT_WAIT_SPEC_VERSION

      public static final int VK_KHR_PRESENT_WAIT_SPEC_VERSION
      The extension specification version.
      See Also:
    • VK_KHR_PRESENT_WAIT_EXTENSION_NAME

      public static final String VK_KHR_PRESENT_WAIT_EXTENSION_NAME
      The extension name.
      See Also:
    • VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_WAIT_FEATURES_KHR

      public static final int VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_WAIT_FEATURES_KHR
      Extends VkStructureType.
      See Also:
  • Method Details

    • vkWaitForPresentKHR

      public static int vkWaitForPresentKHR(org.lwjgl.vulkan.VkDevice device, long swapchain, long presentId, long timeout)
      Wait for presentation.
      C Specification

      When the presentWait feature is enabled, 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 VkPresentIdKHR structure to the pNext chain of the VkPresentInfoKHR structure and then waiting for that presentation to complete by calling:

      
       VkResult vkWaitForPresentKHR(
           VkDevice                                    device,
           VkSwapchainKHR                              swapchain,
           uint64_t                                    presentId,
           uint64_t                                    timeout);
      Description

      vkWaitForPresentKHR waits for the presentId associated with swapchain to be increased in value so that it is at least equal to presentId.

      For PRESENT_MODE_MAILBOX_KHR (or other present mode where images may be replaced in the presentation queue) any wait of this type associated with such an image must be signaled no later than a wait associated with the replacing image would be signaled.

      When the presentation has completed, the presentId associated with the related pSwapchains entry will be increased in value so that it is at least equal to the value provided in the VkPresentIdKHR structure.

      There is no requirement for any precise timing relationship between the presentation of the image to the user and the update of the presentId value, but implementations should make this as close as possible to the presentation of the first pixel in the next image being presented to the user.

      The call to vkWaitForPresentKHR will block until either the presentId associated with swapchain is greater than or equal to presentId, or timeout nanoseconds passes. When the swapchain becomes OUT_OF_DATE, the call will either return SUCCESS (if the image was delivered to the presentation engine and may have been presented to the user) or will return early with status ERROR_OUT_OF_DATE_KHR (if the image was not presented to the user).

      As an exception to the normal rules for objects which are externally synchronized, the swapchain passed to vkWaitForPresentKHR may be simultaneously used by other threads in calls to functions other than DestroySwapchainKHR. Access to the swapchain data associated with this extension must be atomic within the implementation.

      Valid Usage
      • swapchain must not be in the retired state
      • The presentWait feature must be enabled
      Valid Usage (Implicit)
      • device must be a valid VkDevice handle
      • swapchain must be a valid VkSwapchainKHR handle
      • swapchain must have been created, allocated, or retrieved from device
      Host Synchronization
      • Host access to swapchain must be externally synchronized
      Return Codes
      On success, this command returns
      On failure, this command returns
      Parameters:
      device - the device associated with swapchain.
      swapchain - the non-retired swapchain on which an image was queued for presentation.
      presentId - the presentation presentId to wait for.
      timeout - the timeout period in units of nanoseconds. timeout is adjusted to the closest value allowed by the implementation-dependent timeout accuracy, which may be substantially longer than one nanosecond, and may be longer than the requested period.