Function Prototype

vkCmdCopyImageToBuffer2

Copy image data into a buffer

To copy data from an image object to a buffer object, call:

void vkCmdCopyImageToBuffer2(
    VkCommandBuffer commandBuffer,
    const VkCopyImageToBufferInfo2* pCopyImageToBufferInfo);
void vkCmdCopyImageToBuffer2KHR(
    VkCommandBuffer commandBuffer,
    const VkCopyImageToBufferInfo2* pCopyImageToBufferInfo);
  • commandBuffer is the command buffer into which the command will be recorded.
  • pCopyImageToBufferInfo is a pointer to a VkCopyImageToBufferInfo2 structure describing the copy parameters.

This command is functionally identical to vkCmdCopyImageToBuffer, but includes extensible sub-structures that include sType and pNext parameters, allowing them to be more easily extended.

Valid Usage

VUID-vkCmdCopyImageToBuffer2-commandBuffer-01831

If commandBuffer is an unprotected command buffer and protectedNoFault is not supported, srcImage must not be a protected image

VUID-vkCmdCopyImageToBuffer2-commandBuffer-01832

If commandBuffer is an unprotected command buffer and protectedNoFault is not supported, dstBuffer must not be a protected buffer

VUID-vkCmdCopyImageToBuffer2-commandBuffer-01833

If commandBuffer is a protected command buffer and protectedNoFault is not supported, dstBuffer must not be an unprotected buffer

VUID-vkCmdCopyImageToBuffer2-commandBuffer-07746

If the queue family used to create the VkCommandPool which commandBuffer was allocated from does not support VK_QUEUE_GRAPHICS_BIT or VK_QUEUE_COMPUTE_BIT, the bufferOffset member of any element of pCopyImageToBufferInfo→pRegions must be a multiple of 4

VUID-vkCmdCopyImageToBuffer2-imageOffset-07747

The imageOffset and imageExtent members of each element of pCopyImageToBufferInfo→pRegions must respect the image transfer granularity requirements of commandBuffer’s command pool’s queue family, as described in VkQueueFamilyProperties

VUID-vkCmdCopyImageToBuffer2-commandBuffer-10216

If the queue family used to create the VkCommandPool which commandBuffer was allocated from does not support VK_QUEUE_GRAPHICS_BIT, and the maintenance10 feature is not enabled, for each element of pCopyImageToBufferInfo→pRegions, the aspectMask member of imageSubresource must not be VK_IMAGE_ASPECT_DEPTH_BIT or VK_IMAGE_ASPECT_STENCIL_BIT

VUID-vkCmdCopyImageToBuffer2-commandBuffer-11790

If the queue family used to create the VkCommandPool which commandBuffer was allocated from does not support VK_QUEUE_GRAPHICS_BIT but does support VK_QUEUE_COMPUTE_BIT, and in any element of pCopyImageToBufferInfo→pRegions the aspectMask member of imageSubresource is VK_IMAGE_ASPECT_DEPTH_BIT, then the format features of srcImagemust contain VK_FORMAT_FEATURE_2_DEPTH_COPY_ON_COMPUTE_QUEUE_BIT_KHR

VUID-vkCmdCopyImageToBuffer2-commandBuffer-11791

If the queue family used to create the VkCommandPool which commandBuffer was allocated from does not support VK_QUEUE_GRAPHICS_BIT and VK_QUEUE_COMPUTE_BIT, but does support VK_QUEUE_TRANSFER_BIT, and in any element of pCopyImageToBufferInfo→pRegions the aspectMask member of imageSubresource is VK_IMAGE_ASPECT_DEPTH_BIT, then the format features of srcImagemust contain VK_FORMAT_FEATURE_2_DEPTH_COPY_ON_TRANSFER_QUEUE_BIT_KHR

VUID-vkCmdCopyImageToBuffer2-commandBuffer-11792

If the queue family used to create the VkCommandPool which commandBuffer was allocated from does not support VK_QUEUE_GRAPHICS_BIT but does support VK_QUEUE_COMPUTE_BIT, and in any element of pCopyImageToBufferInfo→pRegions the aspectMask member of imageSubresource is VK_IMAGE_ASPECT_STENCIL_BIT, then the format features of srcImagemust contain VK_FORMAT_FEATURE_2_STENCIL_COPY_ON_COMPUTE_QUEUE_BIT_KHR

VUID-vkCmdCopyImageToBuffer2-commandBuffer-11793

If the queue family used to create the VkCommandPool which commandBuffer was allocated from does not support VK_QUEUE_GRAPHICS_BIT and VK_QUEUE_COMPUTE_BIT, but does support VK_QUEUE_TRANSFER_BIT, and in any element of pCopyImageToBufferInfo→pRegions the aspectMask member of imageSubresource is VK_IMAGE_ASPECT_STENCIL_BIT, then the format features of srcImagemust contain VK_FORMAT_FEATURE_2_STENCIL_COPY_ON_TRANSFER_QUEUE_BIT_KHR

Valid Usage (Implicit)

VUID-vkCmdCopyImageToBuffer2-pCopyImageToBufferInfo-parameter

pCopyImageToBufferInfo must be a valid pointer to a valid VkCopyImageToBufferInfo2 structure

VUID-vkCmdCopyImageToBuffer2-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-vkCmdCopyImageToBuffer2-renderpass

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

VUID-vkCmdCopyImageToBuffer2-suspended

This command must not be called between suspended render pass instances

VUID-vkCmdCopyImageToBuffer2-videocoding

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

Host Synchronization

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