C Specification

To wait for a set of semaphores created with a VkSemaphoreTypeKHR of VK_SEMAPHORE_TYPE_TIMELINE_KHR to reach particular counter values on the host, call:

VkResult vkWaitSemaphoresKHR(
    VkDevice                                    device,
    const VkSemaphoreWaitInfoKHR*               pWaitInfo,
    uint64_t                                    timeout);

Parameters

  • device is the logical device that owns the semaphore.

  • pWaitInfo is a pointer to an instance of the VkSemaphoreWaitInfoKHR structure containing information about the wait condition.

  • timeout is 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.

Description

If the condition is satisfied when vkWaitSemaphoresKHR is called, then vkWaitSemaphoresKHR returns immediately. If the condition is not satisfied at the time vkWaitSemaphoresKHR is called, then vkWaitSemaphoresKHR will block and wait up to timeout nanoseconds for the condition to become satisfied.

If timeout is zero, then vkWaitSemaphoresKHR does not wait, but simply returns information about the current state of the semaphore. VK_TIMEOUT will be returned in this case if the condition is not satisfied, even though no actual wait was performed.

If the specified timeout period expires before the condition is satisfied, vkWaitSemaphoresKHR returns VK_TIMEOUT. If the condition is satisfied before timeout nanoseconds has expired, vkWaitSemaphoresKHR returns VK_SUCCESS.

If device loss occurs (see Lost Device) before the timeout has expired, vkWaitSemaphoresKHR must return in finite time with either VK_SUCCESS or VK_ERROR_DEVICE_LOST.

Valid Usage (Implicit)
  • device must be a valid VkDevice handle

  • pWaitInfo must be a valid pointer to a valid VkSemaphoreWaitInfoKHR structure

Return Codes
On success, this command returns
  • VK_SUCCESS

  • VK_TIMEOUT

On failure, this command returns
  • VK_ERROR_OUT_OF_HOST_MEMORY

  • VK_ERROR_OUT_OF_DEVICE_MEMORY

  • VK_ERROR_DEVICE_LOST

See Also

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.

Copyright (c) 2014-2019 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.