To update buffer data inline in a command buffer, call:
// Provided by VK_VERSION_1_0 void vkCmdUpdateBuffer( VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const void* pData);
commandBufferis the command buffer into which the command will be recorded.
dstBufferis a handle to the buffer to be updated.
dstOffsetis the byte offset into the buffer to start updating, and must be a multiple of 4.
dataSizeis the number of bytes to update, and must be a multiple of 4.
pDatais a pointer to the source data for the buffer update, and must be at least
dataSizebytes in size.
dataSize must be less than or equal to 65536 bytes.
For larger updates, applications can use buffer to buffer
Buffer updates performed with
The additional cost of this functionality compared to buffer to buffer copies means it is only recommended for very small amounts of data, and is why it is limited to only 65536 bytes.
Applications can work around this by issuing multiple
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
VK_BUFFER_USAGE_TRANSFER_DST_BIT must be specified in
of VkBufferCreateInfo in order for the buffer to be compatible with
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 (c) 2014-2020 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.