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

• commandBuffer is the command buffer into which the command will be recorded.
• dstBuffer is a handle to the buffer to be updated.
• dstOffset is the byte offset into the buffer to start updating, and must be a multiple of 4.
• 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.

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.

Note 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.