vkCmdSetDeviceMask(3)

# vkCmdSetDeviceMask(3) Manual Page

## Name

vkCmdSetDeviceMask - Modify device mask of a command buffer

Loading… please wait.

## C Specification

To update the current device mask of a command buffer, call:

    // Provided by VK_VERSION_1_1
    void vkCmdSetDeviceMask(
        VkCommandBuffer                             commandBuffer,
        uint32_t                                    deviceMask);

    // Provided by VK_KHR_device_group
    // Equivalent to vkCmdSetDeviceMask
    void vkCmdSetDeviceMaskKHR(
        VkCommandBuffer                             commandBuffer,
        uint32_t                                    deviceMask);

## Parameters

- `commandBuffer` is command buffer whose current device mask is modified.

- `deviceMask` is the new value of the current device mask.

## Description

`deviceMask` is used to filter out subsequent commands from executing on all physical devices whose bit indices are not set in the mask, except commands beginning a render pass instance, commands transitioning to the next subpass in the render pass instance, and commands ending a render pass instance, which always execute on the set of physical devices whose bit indices are included in the `deviceMask` member of the VkDeviceGroupRenderPassBeginInfo structure passed to the command beginning the corresponding render pass instance.

Valid Usage

- VUID-vkCmdSetDeviceMask-deviceMask-00108
  `deviceMask` must be a valid device mask value

- VUID-vkCmdSetDeviceMask-deviceMask-00109
  `deviceMask` must not be zero

- VUID-vkCmdSetDeviceMask-deviceMask-00110
  `deviceMask` must not include any set bits that were not in the VkDeviceGroupCommandBufferBeginInfo::`deviceMask` value when the command buffer began recording

- VUID-vkCmdSetDeviceMask-deviceMask-00111
  If `vkCmdSetDeviceMask` is called inside a render pass instance, `deviceMask` must not include any set bits that were not in the VkDeviceGroupRenderPassBeginInfo::`deviceMask` value when the render pass instance began recording

Valid Usage (Implicit)

- VUID-vkCmdSetDeviceMask-commandBuffer-parameter
  `commandBuffer` must be a valid VkCommandBuffer handle

- VUID-vkCmdSetDeviceMask-commandBuffer-recording
  `commandBuffer` must be in the recording state

- VUID-vkCmdSetDeviceMask-commandBuffer-cmdpool
  The `VkCommandPool` that `commandBuffer` was allocated from must support VK_QUEUE_COMPUTE_BIT, VK_QUEUE_GRAPHICS_BIT, or VK_QUEUE_TRANSFER_BIT operations

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 | Video Coding Scope | Supported Queue Types | Command Type
--- | --- | --- | --- | ---
Primary Secondary | Both | Both | VK_QUEUE_COMPUTE_BIT VK_QUEUE_GRAPHICS_BIT VK_QUEUE_TRANSFER_BIT | State

Conditional Rendering

vkCmdSetDeviceMask is not affected by conditional rendering

## See Also

VK_KHR_device_group, VK_VERSION_1_1, VkCommandBuffer

## 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 2014-2026 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0