vkCmdUpdateMemoryKHR(3)

# vkCmdUpdateMemoryKHR(3) Manual Page

## Name

vkCmdUpdateMemoryKHR - Update the content of device memory from host memory

Loading… please wait.

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

- VUID-vkCmdUpdateMemoryKHR-pDstRange-13097
  If the range specified by `pDstRange` is not bound completely to memory when accessed, `dstFlags` must not include VK_ADDRESS_COMMAND_FULLY_BOUND_BIT_KHR

- VUID-vkCmdUpdateMemoryKHR-pDstRange-13098
  If the buffer from which the range specified by `pDstRange` was created with VK_BUFFER_CREATE_PROTECTED_BIT, and `protectedNoFault` is not supported, `dstFlags` must include VK_ADDRESS_COMMAND_PROTECTED_BIT_KHR

- VUID-vkCmdUpdateMemoryKHR-pDstRange-13099
  If the buffer from which the range specified by `pDstRange` was created without VK_BUFFER_CREATE_PROTECTED_BIT, and `protectedNoFault` is not supported, `dstFlags` must not include VK_ADDRESS_COMMAND_PROTECTED_BIT_KHR

- VUID-vkCmdUpdateMemoryKHR-dstFlags-13100
  `dstFlags` must not include both VK_ADDRESS_COMMAND_STORAGE_BUFFER_USAGE_BIT_KHR and VK_ADDRESS_COMMAND_UNKNOWN_STORAGE_BUFFER_USAGE_BIT_KHR

- VUID-vkCmdUpdateMemoryKHR-pDstRange-13122
  If any buffer, which is bound to a range of VkDeviceMemory that overlaps the range backing `pDstRange`, was created with VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, `dstFlags` must include VK_ADDRESS_COMMAND_STORAGE_BUFFER_USAGE_BIT_KHR or VK_ADDRESS_COMMAND_UNKNOWN_STORAGE_BUFFER_USAGE_BIT_KHR

- VUID-vkCmdUpdateMemoryKHR-pDstRange-13123
  If any buffer, which is bound to a range of VkDeviceMemory that overlaps the range backing `pDstRange`, was created without VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, `dstFlags` must not include VK_ADDRESS_COMMAND_STORAGE_BUFFER_USAGE_BIT_KHR

- VUID-vkCmdUpdateMemoryKHR-dstFlags-13101
  `dstFlags` must not include both VK_ADDRESS_COMMAND_TRANSFORM_FEEDBACK_BUFFER_USAGE_BIT_KHR and VK_ADDRESS_COMMAND_UNKNOWN_TRANSFORM_FEEDBACK_BUFFER_USAGE_BIT_KHR

- VUID-vkCmdUpdateMemoryKHR-pDstRange-13124
  If any buffer, which is bound to a range of VkDeviceMemory that overlaps the range backing `pDstRange`, was created with VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_BUFFER_BIT_EXT, `dstFlags` must include VK_ADDRESS_COMMAND_TRANSFORM_FEEDBACK_BUFFER_USAGE_BIT_KHR or VK_ADDRESS_COMMAND_UNKNOWN_TRANSFORM_FEEDBACK_BUFFER_USAGE_BIT_KHR

- VUID-vkCmdUpdateMemoryKHR-pDstRange-13125
  If any buffer, which is bound to a range of VkDeviceMemory that overlaps the range backing `pDstRange`, was created without VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_BUFFER_BIT_EXT, `dstFlags` must not include VK_ADDRESS_COMMAND_TRANSFORM_FEEDBACK_BUFFER_USAGE_BIT_KHR

- VUID-vkCmdUpdateMemoryKHR-dstRange-13005
  The buffer from which `dstRange` was queried must have been created with VK_BUFFER_USAGE_TRANSFER_DST_BIT usage flag

- VUID-vkCmdUpdateMemoryKHR-pDstRange-13006
  `pDstRange->address` must be a multiple of 4

- VUID-vkCmdUpdateMemoryKHR-pDstRange-13007
  `pDstRange->size` must be less than or equal to 65536

- VUID-vkCmdUpdateMemoryKHR-dataSize-13008
  `dataSize` must be less than or equal to `pDstRange->size`

- VUID-vkCmdUpdateMemoryKHR-dataSize-13009
  `dataSize` must be a multiple of 4

- VUID-vkCmdUpdateMemoryKHR-commandBuffer-13010
  If `commandBuffer` is an unprotected command buffer and `protectedNoFault` is not supported, `dstFlags` must not include VK_ADDRESS_COMMAND_PROTECTED_BIT_KHR

- VUID-vkCmdUpdateMemoryKHR-commandBuffer-13011
  If `commandBuffer` is a protected command buffer and `protectedNoFault` is not supported, `dstFlags` must include VK_ADDRESS_COMMAND_PROTECTED_BIT_KHR

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

VK_KHR_device_address_commands, VkAddressCommandFlagsKHR, VkCommandBuffer, VkDeviceAddressRangeKHR, VkDeviceSize

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