C Specification

To update device memory inline in a command buffer, call:

// Provided by VK_KHR_device_address_commands
void vkCmdUpdateMemoryKHR(
    VkCommandBuffer                             commandBuffer,
    const VkDeviceAddressRangeKHR*              pDstRange,
    VkAddressCommandFlagsKHR                    dstFlags,
    VkDeviceSize                                dataSize,
    const void*                                 pData);

Parameters

  • commandBuffer is the command buffer into which the command will be recorded.

  • pDstRange is a pointer to the VkDeviceAddressRangeKHR selecting the memory range to be updated.

  • dstFlags is a VkAddressCommandFlagsKHR value defining the copy flags for the destination address range.

  • dataSize is the number of bytes to update, and must be a multiple of 4.

  • pData is a pointer to the source data for the buffer update, and must be at least dataSize bytes in size.

Description

The source data is copied from pData to the command buffer when the command is called, and then copied to dstRange when the command is executed on a device.

Note

Due to the data being copied into command buffers, memory range copies are recommended for larger data transfers, to avoid excessive memory consumption.

Valid Usage
Valid Usage (Implicit)
  • VUID-vkCmdUpdateMemoryKHR-commandBuffer-parameter
    commandBuffer must be a valid VkCommandBuffer handle

  • VUID-vkCmdUpdateMemoryKHR-pDstRange-parameter
    pDstRange must be a valid pointer to a valid VkDeviceAddressRangeKHR structure

  • VUID-vkCmdUpdateMemoryKHR-dstFlags-parameter
    dstFlags must be a valid combination of VkAddressCommandFlagBitsKHR values

  • VUID-vkCmdUpdateMemoryKHR-pData-parameter
    pData must be a valid pointer to an array of dataSize bytes

  • VUID-vkCmdUpdateMemoryKHR-commandBuffer-recording
    commandBuffer must be in the recording state

  • VUID-vkCmdUpdateMemoryKHR-commandBuffer-cmdpool
    The VkCommandPool that commandBuffer was allocated from must support VK_QUEUE_TRANSFER_BIT operations

  • VUID-vkCmdUpdateMemoryKHR-renderpass
    This command must only be called outside of a render pass instance

  • VUID-vkCmdUpdateMemoryKHR-suspended
    This command must not be called between suspended render pass instances

  • VUID-vkCmdUpdateMemoryKHR-videocoding
    This command must only be called outside of a video coding scope

  • VUID-vkCmdUpdateMemoryKHR-dataSize-arraylength
    dataSize must be greater than 0

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

Outside

Outside

VK_QUEUE_TRANSFER_BIT

Action

Conditional Rendering

vkCmdUpdateMemoryKHR is not affected by conditional rendering

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

SPDX-License-Identifier: CC-BY-4.0