vkCmdCopyBuffer
To copy data between buffer objects, call:
void vkCmdCopyBuffer(
VkCommandBuffer commandBuffer,
VkBuffer srcBuffer,
VkBuffer dstBuffer,
uint32_t regionCount,
const VkBufferCopy* pRegions);
pub fn cmd_copy_buffer(
command_buffer: vk::CommandBuffer,
src_buffer: vk::Buffer,
dst_buffer: vk::Buffer,
region_count: u32,
p_regions: *const vk::BufferCopy,
);
commandBufferis the command buffer into which the command will be recorded.srcBufferis the source buffer.dstBufferis the destination buffer.regionCountis the number of regions to copy.pRegionsis 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-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 the
VK_BUFFER_USAGE_TRANSFER_SRC_BIT usage flag set
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 the
VK_BUFFER_USAGE_TRANSFER_DST_BIT usage flag set
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 VK_QUEUE_COMPUTE_BIT, VK_QUEUE_GRAPHICS_BIT, or VK_QUEUE_TRANSFER_BIT operations
VUID-vkCmdCopyBuffer-renderpass
This command must only be called outside of a render pass instance
VUID-vkCmdCopyBuffer-suspended
This command must not be called between suspended render pass instances
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
commandBuffermust be externally synchronized - Host access to the
VkCommandPoolthatcommandBufferwas allocated from must be externally synchronized