C Specification

To copy data between buffer objects, call:

// Provided by VK_VERSION_1_0
void vkCmdCopyBuffer(
    VkCommandBuffer                             commandBuffer,
    VkBuffer                                    srcBuffer,
    VkBuffer                                    dstBuffer,
    uint32_t                                    regionCount,
    const VkBufferCopy*                         pRegions);

Parameters

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

Description

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-commandBuffer-01822
    If commandBuffer is an unprotected command buffer and protectedNoFault is not supported, srcBuffer must not be a protected buffer

  • VUID-vkCmdCopyBuffer-commandBuffer-01823
    If commandBuffer is an unprotected command buffer and protectedNoFault is not supported, dstBuffer must not be a protected buffer

  • VUID-vkCmdCopyBuffer-commandBuffer-01824
    If commandBuffer is a protected command buffer and protectedNoFault is not supported, dstBuffer must not be an unprotected buffer

  • 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-commandBuffer-parameter
    commandBuffer must be a valid VkCommandBuffer handle

  • 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-recording
    commandBuffer must be in the recording state

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

Command Properties
Command Buffer Levels Render Pass Scope Supported Queue Types Command Type

Primary
Secondary

Outside

Transfer
Graphics
Compute

Action

See Also

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 2014-2023 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0