17.5. Updating Buffers

To update buffer data inline in a command buffer, call:


void vkCmdUpdateBuffer(
    VkCommandBuffer                             commandBuffer,
    VkBuffer                                    dstBuffer,
    VkDeviceSize                                dstOffset,
    VkDeviceSize                                dataSize,
    const void*                                 pData);

dataSize must be less than or equal to 65536 bytes. For larger updates, applications can use buffer to buffer copies.

The source data is copied from the user pointer to the command buffer when the command is called.

vkCmdUpdateBuffer is only allowed outside of a render pass. This command is treated as “transfer” operation, for the purposes of synchronization barriers. The VK_BUFFER_USAGE_TRANSFER_DST_BIT must be specified in usage of VkBufferCreateInfo in order for the buffer to be compatible with vkCmdUpdateBuffer.


The pData parameter was of type uint32_t* instead of void* prior to revision 1.0.19 of the Specification and VK_HEADER_VERSION 19 of vulkan.h. This was a historical anomaly, as the source data may be of other types.