| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Vulkan.Extensions.VK_KHR_present_wait2
Description
Name
VK_KHR_present_wait2 - device extension
VK_KHR_present_wait2
- Name String
VK_KHR_present_wait2
- Extension Type
- Device extension
- Registered Extension Number
- 481
- Revision
- 1
- Ratification Status
- Ratified
- Extension and Version Dependencies
- VK_KHR_get_surface_capabilities2 and VK_KHR_surface and VK_KHR_swapchain and VK_KHR_present_id2
- Contact
- Daniel Stone
- Extension Proposal
- VK_KHR_present_wait2
Other Extension Metadata
- Last Modified Date
- 2025-05-30
- IP Status
- No known IP claims.
- Contributors
- Hans-Kristian Arntzen, Valve
- James Jones, NVIDIA
- Daniel Stone, Collabora
- Derek Foreman, Collabora
- /contributors to `VK_KHR_present_wait`/
Description
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.
New Commands
New Structures
Extending
PhysicalDeviceFeatures2,DeviceCreateInfo:Extending
SurfaceCapabilities2KHR:
New Enum Constants
KHR_PRESENT_WAIT_2_SPEC_VERSIONExtending
StructureType:Extending
SwapchainCreateFlagBitsKHR:
Issues
1) When does the wait finish?
RESOLVED. 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. Additionally, a wait may complete immediately if the swapchain becomes out of date.
In circumstances outside the application’s control, this wait may be particularly long. For example, a user session may have the display locked and switched off for multiple days. During this time, the latest image presented through the WSI will never be presented to the user (because nothing is being presented), or replaced (because nothing newer has been queued by the application). Each operating system may have a separate mechanism to inform the application of states such as these, however it is out of scope of the Vulkan WSI.
There is no requirement for any precise timing relationship between the presentation of the image to the user and the end of the wait.
This extension is not intended for time-to-light estimation, which is better solved by a separate extension dedicated to present-timing feedback for audio/visual/input synchronization.
2) Should this use fences or other existing synchronization mechanism?
RESOLVED. VkFence is a legacy primitive. Building a new API around a legacy primitive is undesirable.
Other existing synchronization mechanisms may lack a platform-provided framework for sharing synchronization objects between display and render drivers.
For these reasons, this extension will provide a separate synchronization API.
3) Should this extension share present identification with other extensions?
RESOLVED. Yes. A new extension, VK_KHR_present_id2, should be
created to provide a shared structure for presentation identifiers.
4) What happens when presentations complete out of order with respect to calls to vkQueuePresent? This could happen if the semaphores for the presentations were ready out of order.
OPTION A: Require that when a PresentId is set that the driver ensure that images are always presented in the order of calls to vkQueuePresent.
OPTION B: Finish both waits when the earliest present completes. This will complete the later present wait earlier than the actual presentation. This should be the easiest to implement as the driver need only track the largest present ID completed. This is also the 'natural' consequence of interpreting the existing vkWaitForPresentKHR specification.
OPTION C: Finish both waits when both have completed. This will complete the earlier presentation later than the actual presentation time. This is allowed by the current specification as there is no precise timing requirement for when the presentId value is updated. This requires slightly more complexity in the driver as it will need to track all outstanding presentId values.
OPTION D: The order of completion between outstanding
waitForPresent2KHR calls is always undefined. However, a
SUCCESS return value in
PresentWait2InfoKHR::presentId implies that future calls to
waitForPresent2KHR where PresentWait2InfoKHR::presentId is less
than or equal to N will complete immediately.
RESOLVED. OPTION D: This option ensures implementations do not need to create complex internal queues to generate signals in the right order.
5) Should this extension deviate from VK_KHR_present_wait and require
the presentation engine to provide the presentId values?
RESOLVED. No. This extension is intended to be a bugfix of
VK_KHR_present_wait, and existing low-latency apis require an
application provided id. At least on some platforms, a mapping mechanism
would be required to translate between presentation engine and
application ids. This exceeds the intended scope of this extension.
When needed in the future, we can introduce an independent presentation engine driven id and a mechanism for mapping presentation engine ids to application provided ids.
Version History
Revision 1, 2022-10-05 (Daniel Stone)
- Repurposed from VK_KHR_present_wait to be based on surface capabilities
- Reworded wait finish section to avoid time-to-light
See Also
No cross-references are available
Document Notes
For more information, see the Vulkan Specification.
This page is a generated document. Fixes and changes should be made to the generator scripts, not directly.
Synopsis
- waitForPresent2KHR :: MonadIO io => Device -> SwapchainKHR -> PresentWait2InfoKHR -> io Result
- waitForPresent2KHRSafe :: MonadIO io => Device -> SwapchainKHR -> PresentWait2InfoKHR -> io Result
- data PresentWait2InfoKHR = PresentWait2InfoKHR {}
- data PhysicalDevicePresentWait2FeaturesKHR = PhysicalDevicePresentWait2FeaturesKHR {
- presentWait2 :: Bool
- data SurfaceCapabilitiesPresentWait2KHR = SurfaceCapabilitiesPresentWait2KHR {}
- type KHR_PRESENT_WAIT_2_SPEC_VERSION = 1
- pattern KHR_PRESENT_WAIT_2_SPEC_VERSION :: Integral a => a
- type KHR_PRESENT_WAIT_2_EXTENSION_NAME = "VK_KHR_present_wait2"
- pattern KHR_PRESENT_WAIT_2_EXTENSION_NAME :: (Eq a, IsString a) => a
- newtype SwapchainKHR = SwapchainKHR Word64
- newtype SwapchainCreateFlagBitsKHR where
- SwapchainCreateFlagBitsKHR Flags
- pattern SWAPCHAIN_CREATE_DEFERRED_MEMORY_ALLOCATION_BIT_KHR :: SwapchainCreateFlagBitsKHR
- pattern SWAPCHAIN_CREATE_MUTABLE_FORMAT_BIT_KHR :: SwapchainCreateFlagBitsKHR
- pattern SWAPCHAIN_CREATE_PRESENT_ID_2_BIT_KHR :: SwapchainCreateFlagBitsKHR
- pattern SWAPCHAIN_CREATE_PRESENT_TIMING_BIT_EXT :: SwapchainCreateFlagBitsKHR
- pattern SWAPCHAIN_CREATE_PRESENT_WAIT_2_BIT_KHR :: SwapchainCreateFlagBitsKHR
- pattern SWAPCHAIN_CREATE_PROTECTED_BIT_KHR :: SwapchainCreateFlagBitsKHR
- pattern SWAPCHAIN_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT_KHR :: SwapchainCreateFlagBitsKHR
- type SwapchainCreateFlagsKHR = SwapchainCreateFlagBitsKHR
Documentation
Arguments
| :: MonadIO io | |
| => Device |
|
| -> SwapchainKHR |
|
| -> PresentWait2InfoKHR |
|
| -> io Result |
vkWaitForPresent2KHR - Wait for presentation
Description
waitForPresent2KHR waits for the presentation engine to have begun
presentation of the presentation request associated with the
PresentWait2InfoKHR::presentId on swapchain, or for
PresentWait2InfoKHR::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
ERROR_OUT_OF_DATE_KHR either before or
during this call, the call may either return
SUCCESS (if the image was delivered to the
presentation engine and may have been presented to the user) or return
early with status 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 waitForPresent2KHR 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
- The presentWait2 feature must be enabled
- The
SurfaceCapabilitiesPresentWait2KHRsurface capability must be present for the underlying surface - The swapchain must have been
created with
SWAPCHAIN_CREATE_PRESENT_WAIT_2_BIT_KHRbit set in theSwapchainCreateFlagBitsKHRfield - The
presentIdvalue must have been associated with aqueuePresentKHRrequest on theswapchainwhich returned a non-error value
Valid Usage (Implicit)
-
devicemust be a validDevicehandle
-
swapchainmust be a validSwapchainKHRhandle -
pPresentWait2Infomust be a valid pointer to a validPresentWait2InfoKHRstructure -
swapchainmust have been created, allocated, or retrieved fromdevice
Host Synchronization
- Host access to
swapchainmust be externally synchronized
Return Codes
See Also
VK_KHR_present_wait2,
Device, PresentWait2InfoKHR,
SwapchainKHR
waitForPresent2KHRSafe Source #
Arguments
| :: MonadIO io | |
| => Device |
|
| -> SwapchainKHR |
|
| -> PresentWait2InfoKHR |
|
| -> io Result |
A variant of waitForPresent2KHR which makes a *safe* FFI call
data PresentWait2InfoKHR Source #
VkPresentWait2InfoKHR - Structure describing parameters of a presentation wait
Valid Usage (Implicit)
See Also
Constructors
| PresentWait2InfoKHR | |
Fields
| |
Instances
data PhysicalDevicePresentWait2FeaturesKHR Source #
VkPhysicalDevicePresentWait2FeaturesKHR - Structure indicating support for present wait 2
Members
This structure describes the following feature:
Description
If the PhysicalDevicePresentWait2FeaturesKHR structure is included in
the pNext chain of the
PhysicalDeviceFeatures2
structure passed to
getPhysicalDeviceFeatures2,
it is filled in to indicate whether each corresponding feature is
supported. If the application wishes to use a
Device with any features described by
PhysicalDevicePresentWait2FeaturesKHR, it must add an instance of
the structure, with the desired feature members set to
TRUE, to the pNext chain of
DeviceCreateInfo when creating the
Device.
Valid Usage (Implicit)
See Also
Constructors
| PhysicalDevicePresentWait2FeaturesKHR | |
Fields
| |
Instances
data SurfaceCapabilitiesPresentWait2KHR Source #
VkSurfaceCapabilitiesPresentWait2KHR - Structure describing presentation-wait capabilities of a surface
Description
This structure can be included in the pNext chain of
SurfaceCapabilities2KHR
to determine support for present-wait. If presentWait2Supported is
FALSE, it indicates that waiting for
presentation is not possible for this surface.
Applications must not attempt to call waitForPresent2KHR on a
swapchain if presentWait2Supported is
FALSE.
Valid Usage (Implicit)
See Also
Constructors
| SurfaceCapabilitiesPresentWait2KHR | |
Fields
| |
Instances
type KHR_PRESENT_WAIT_2_SPEC_VERSION = 1 Source #
pattern KHR_PRESENT_WAIT_2_SPEC_VERSION :: Integral a => a Source #
type KHR_PRESENT_WAIT_2_EXTENSION_NAME = "VK_KHR_present_wait2" Source #
pattern KHR_PRESENT_WAIT_2_EXTENSION_NAME :: (Eq a, IsString a) => a Source #
newtype SwapchainKHR Source #
VkSwapchainKHR - Opaque handle to a swapchain object
Description
A swapchain is an abstraction for an array of presentable images that
are associated with a surface. The presentable images are represented by
Image objects created by the platform. One image
(which can be an array image for multiview/stereoscopic-3D surfaces)
is displayed at a time, but multiple images can be queued for
presentation. An application renders to the image, and then queues the
image for presentation to the surface.
A native window cannot be associated with more than one non-retired swapchain at a time. Further, swapchains cannot be created for native windows that have a non-Vulkan graphics API surface associated with them.
The presentation engine is an abstraction for the platform’s compositor or display engine.
The presentation engine may be synchronous or asynchronous with respect to the application and/or logical device.
Some implementations may use the device’s graphics queue or dedicated presentation hardware to perform presentation.
The presentable images of a swapchain are owned by the presentation
engine. An application can acquire use of a presentable image from the
presentation engine. Use of a presentable image must occur only after
the image is returned by
acquireNextImageKHR, and before it
is released by queuePresentKHR.
This includes transitioning the image layout and rendering commands.
An application can acquire use of a presentable image with
acquireNextImageKHR. After
acquiring a presentable image and before modifying it, the application
must use a synchronization primitive to ensure that the presentation
engine has finished reading from the image. The application can then
transition the image’s layout, queue rendering commands to it, etc.
Finally, the application presents the image with
queuePresentKHR, which releases the
acquisition of the image. The application can also release the
acquisition of the image through
releaseSwapchainImagesKHR,
if the image is not in use by the device, and skip the present
operation.
The presentation engine controls the order in which presentable images are acquired for use by the application.
This allows the platform to handle situations which require out-of-order return of images after presentation. At the same time, it allows the application to generate command buffers referencing all of the images in the swapchain at initialization time, rather than in its main loop.
See Also
VK_DEFINE_NON_DISPATCHABLE_HANDLE,
VK_KHR_swapchain,
AcquireNextImageInfoKHR,
BindImageMemorySwapchainInfoKHR,
ImageSwapchainCreateInfoKHR,
PastPresentationTimingInfoEXT,
PresentInfoKHR,
ReleaseSwapchainImagesInfoKHR,
SwapchainCalibratedTimestampInfoEXT,
SwapchainCreateInfoKHR,
acquireFullScreenExclusiveModeEXT,
acquireNextImageKHR,
createSharedSwapchainsKHR,
createSwapchainKHR,
destroySwapchainKHR,
getLatencyTimingsNV,
getPastPresentationTimingGOOGLE,
getRefreshCycleDurationGOOGLE,
getSwapchainCounterEXT,
getSwapchainImagesKHR,
getSwapchainStatusKHR,
getSwapchainTimeDomainPropertiesEXT,
getSwapchainTimingPropertiesEXT,
latencySleepNV,
queuePresentKHR,
releaseFullScreenExclusiveModeEXT,
setHdrMetadataEXT,
setLatencyMarkerNV,
setLatencySleepModeNV,
setLocalDimmingAMD,
setSwapchainPresentTimingQueueSizeEXT,
waitForPresent2KHR,
waitForPresentKHR
Constructors
| SwapchainKHR Word64 |
Instances
newtype SwapchainCreateFlagBitsKHR Source #
VkSwapchainCreateFlagBitsKHR - Bitmask controlling swapchain creation
Description
SWAPCHAIN_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT_KHRspecifies that images created from the swapchain (i.e. with theswapchainmember ofImageSwapchainCreateInfoKHRset to this swapchain’s handle) must useIMAGE_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT.
SWAPCHAIN_CREATE_PROTECTED_BIT_KHRspecifies that images created from the swapchain are protected images.SWAPCHAIN_CREATE_MUTABLE_FORMAT_BIT_KHRspecifies that the images of the swapchain can be used to create aImageViewwith a different format than what the swapchain was created with. The list of allowed image view formats is specified by adding aImageFormatListCreateInfostructure to thepNextchain ofSwapchainCreateInfoKHR. In addition, this flag also specifies that the swapchain can be created with usage flags that are not supported for the format the swapchain is created with but are supported for at least one of the allowed image view formats.SWAPCHAIN_CREATE_DEFERRED_MEMORY_ALLOCATION_BIT_KHRspecifies that the implementation may defer allocation of memory associated with each swapchain image until its index is to be returned fromacquireNextImageKHRoracquireNextImage2KHRfor the first time.SWAPCHAIN_CREATE_PRESENT_ID_2_BIT_KHRspecifies that applications can include thePresentId2KHRstructure in thepNextchain of thePresentInfoKHRstructure to associate an identifier with each presentation request.SWAPCHAIN_CREATE_PRESENT_WAIT_2_BIT_KHRspecifies that applications can usewaitForPresent2KHRto wait for the presentation engine to have begun presentation of the presentation request associated withPresentWait2InfoKHR::presentIdonswapchain.SWAPCHAIN_CREATE_PRESENT_TIMING_BIT_EXTspecifies that features supported by the swapchain device inPhysicalDevicePresentTimingFeaturesEXTcan be used to collect timing information or schedule presentation requests at specific times.
See Also
Constructors
| SwapchainCreateFlagBitsKHR Flags |
Bundled Patterns