Function Prototype

vkCmdCopyBuffer

Copy data between buffer regions
primary / secondary
outside
transfer / graphics / compute
action

To copy data between buffer objects, call:

void vkCmdCopyBuffer(
    VkCommandBuffer commandBuffer,
    VkBuffer srcBuffer,
    VkBuffer dstBuffer,
    uint32_t regionCount,
    const VkBufferCopy* pRegions);
  • commandBuffer is the command buffer into which the command will be recorded.
  • srcBuffer is the source buffer.
  • dstBuffer is the destination buffer.
  • regionCount is the number of regions to copy.
  • pRegions is a pointer to an array of VkBufferCopy structures specifying the regions to copy.

Each source region specified by pRegions is copied from the source buffer to the destination region of the destination buffer. If any of the specified regions in srcBuffer overlaps in memory with any of the specified regions in dstBuffer, values read from those overlapping regions are undefined:.

Valid Usage

VUID-vkCmdCopyBuffer-srcOffset-00113

The srcOffset member of each element of pRegions must be less than the size of srcBuffer

VUID-vkCmdCopyBuffer-dstOffset-00114

The dstOffset member of each element of pRegions must be less than the size of dstBuffer

VUID-vkCmdCopyBuffer-size-00115

The size member of each element of pRegions must be less than or equal to the size of srcBuffer minus srcOffset

VUID-vkCmdCopyBuffer-size-00116

The size member of each element of pRegions must be less than or equal to the size of dstBuffer minus dstOffset

VUID-vkCmdCopyBuffer-pRegions-00117

The union of the source regions, and the union of the destination regions, specified by the elements of pRegions, must not overlap in memory

VUID-vkCmdCopyBuffer-srcBuffer-00118

srcBuffer must have been created with VK_BUFFER_USAGE_TRANSFER_SRC_BIT usage flag

VUID-vkCmdCopyBuffer-srcBuffer-00119

If srcBuffer is non-sparse then it must be bound completely and contiguously to a single VkDeviceMemory object

VUID-vkCmdCopyBuffer-dstBuffer-00120

dstBuffer must have been created with VK_BUFFER_USAGE_TRANSFER_DST_BIT usage flag

VUID-vkCmdCopyBuffer-dstBuffer-00121

If dstBuffer is non-sparse then it must be bound completely and contiguously to a single VkDeviceMemory object

Valid Usage (Implicit)

VUID-vkCmdCopyBuffer-srcBuffer-parameter

srcBuffer must be a valid VkBuffer handle

VUID-vkCmdCopyBuffer-dstBuffer-parameter

dstBuffer must be a valid VkBuffer handle

VUID-vkCmdCopyBuffer-pRegions-parameter

pRegions must be a valid pointer to an array of regionCount valid VkBufferCopy structures

VUID-vkCmdCopyBuffer-commandBuffer-cmdpool

The VkCommandPool that commandBuffer was allocated from must support transfer, graphics, or compute operations

VUID-vkCmdCopyBuffer-renderpass

This command must only be called outside of a render pass instance

VUID-vkCmdCopyBuffer-videocoding

This command must only be called outside of a video coding scope

VUID-vkCmdCopyBuffer-regionCount-arraylength

regionCount must be greater than 0

VUID-vkCmdCopyBuffer-commonparent

Each of commandBuffer, dstBuffer, and srcBuffer must have been created, allocated, or retrieved from the same VkDevice

Host Synchronization

  • Host access to commandBuffer must be externally synchronized
  • Host access to the VkCommandPool that commandBuffer was allocated from must be externally synchronized ::