C Specification

To copy data between buffer objects, call:

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 region in pRegions is copied from the source buffer to the same region of the destination buffer. srcBuffer and dstBuffer can be the same buffer or alias the same memory, but the result is undefined if the copy regions overlap in memory.

Valid Usage
  • The size member of a given element of pRegions must be greater than 0

  • The srcOffset member of a given element of pRegions must be less than the size of srcBuffer

  • The dstOffset member of a given element of pRegions must be less than the size of dstBuffer

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

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

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

  • srcBuffer must have been created with VK_BUFFER_USAGE_TRANSFER_SRC_BIT usage flag

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

  • dstBuffer must have been created with VK_BUFFER_USAGE_TRANSFER_DST_BIT usage flag

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

Valid Usage (Implicit)
  • commandBuffer must be a valid VkCommandBuffer handle

  • srcBuffer must be a valid VkBuffer handle

  • dstBuffer must be a valid VkBuffer handle

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

  • commandBuffer must be in the recording state

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

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

  • regionCount must be greater than 0

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

Primary
Secondary

Outside

Transfer
graphics
compute

Transfer

See Also

Document Notes

For more information, see the Vulkan Specification at URL

This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.

Copyright (c) 2014-2017 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.