C Specification
To wait for one or more events to enter the signaled state on a device, call:
// Provided by VK_KHR_synchronization2
void vkCmdWaitEvents2KHR(
VkCommandBuffer commandBuffer,
uint32_t eventCount,
const VkEvent* pEvents,
const VkDependencyInfo* pDependencyInfos);
Parameters
-
commandBuffer
is the command buffer into which the command is recorded. -
eventCount
is the length of thepEvents
array. -
pEvents
is a pointer to an array ofeventCount
events to wait on. -
pDependencyInfos
is a pointer to an array ofeventCount
VkDependencyInfo structures, defining the second synchronization scope.
Description
When vkCmdWaitEvents2KHR
is submitted to a queue, it inserts memory
dependencies according to the elements of pDependencyInfos
and each
corresponding element of pEvents
.
vkCmdWaitEvents2KHR
must not be used to wait on event signal operations
occurring on other queues, or signal operations executed by
vkCmdSetEvent.
The first synchronization scope and
access scope of each memory
dependency defined by any element i of pDependencyInfos
are
applied to operations that occurred earlier in
submission order than the last event
signal operation on element i of pEvents
.
Signal operations for an event at index i are only included if:
-
The event was signaled by a vkCmdSetEvent2KHR command that occurred earlier in submission order with a
dependencyInfo
parameter exactly equal to the element ofpDependencyInfos
at index i ; or -
The event was created without
VK_EVENT_CREATE_DEVICE_ONLY_BIT
, and the first synchronization scope defined by the element ofpDependencyInfos
at index i only includes host operations (VK_PIPELINE_STAGE_2_HOST_BIT
).
The second synchronization scope
and access scope of each
memory dependency defined by any element i of pDependencyInfos
are applied to operations that occurred later in
submission order than
vkCmdWaitEvents2KHR
.
Note
vkCmdWaitEvents2KHR is used with vkCmdSetEvent2KHR to define a memory dependency between two sets of action commands, roughly in the same way as pipeline barriers, but split into two commands such that work between the two may execute unhindered. |
Note
Applications should be careful to avoid race conditions when using events.
There is no direct ordering guarantee between |
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.