vkCmdSetEvent(3)

# vkCmdSetEvent(3) Manual Page

## Name

vkCmdSetEvent - Set an event object to signaled state

## C Specification

To set the state of an event to signaled from a device, call:

    void vkCmdSetEvent(
        VkCommandBuffer                             commandBuffer,
        VkEvent                                     event,
        VkPipelineStageFlags                        stageMask);

## Parameters

- `commandBuffer` is the command buffer into which the command is recorded.

- `event` is the event that will be signaled.

- `stageMask` specifies the source stage mask used to determine when the `event` is signaled.

## Description

When vkCmdSetEvent is submitted to a queue, it defines an execution dependency on commands that were submitted before it, and defines an event signal operation which sets the event to the signaled state.

The first synchronization scope includes all commands that occur earlier in submission order. The synchronization scope is limited to operations on the pipeline stages determined by the source stage mask specified by `stageMask`.

The second synchronization scope includes only the event signal operation.

If `event` is already in the signaled state when vkCmdSetEvent is executed on the device, then vkCmdSetEvent has no effect, no event signal operation occurs, and no execution dependency is generated.

Valid Usage

- `stageMask` must not include `VK_PIPELINE_STAGE_HOST_BIT`

- If the geometry shaders feature is not enabled, `stageMask` must not contain `VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT`

- If the tessellation shaders feature is not enabled, `stageMask` must not contain `VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT` or `VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT`

- `commandBuffer`’s current device mask must include exactly one physical device.

- If the mesh shaders feature is not enabled, `stageMask` must not contain `VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV`

- If the task shaders feature is not enabled, `stageMask` must not contain `VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV`

Valid Usage (Implicit)

- `commandBuffer` must be a valid `VkCommandBuffer` handle

- `event` must be a valid `VkEvent` handle

- `stageMask` must be a valid combination of VkPipelineStageFlagBits values

- `stageMask` must not be `0`

- `commandBuffer` must be in the recording state

- The `VkCommandPool` that `commandBuffer` was allocated from must support graphics, or compute operations

- This command must only be called outside of a render pass instance

- Both of `commandBuffer`, and `event` must have been created, allocated, or retrieved from the same `VkDevice`

Host Synchronization

- Host access to `commandBuffer` must be externally synchronized

- Host access to the `VkCommandPool` that `commandBuffer` was allocated from must be externally synchronized

Command Properties

Command Buffer Levels | Render Pass Scope | Supported Queue Types | Pipeline Type
--- | --- | --- | ---
Primary Secondary | Outside | Graphics Compute |

## See Also

VkCommandBuffer, VkEvent, VkPipelineStageFlags

## 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

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