C Specification
To copy data from a buffer object to an image object, call:
// Provided by VK_VERSION_1_0
void vkCmdCopyBufferToImage(
    VkCommandBuffer                             commandBuffer,
    VkBuffer                                    srcBuffer,
    VkImage                                     dstImage,
    VkImageLayout                               dstImageLayout,
    uint32_t                                    regionCount,
    const VkBufferImageCopy*                    pRegions);Parameters
- 
commandBufferis the command buffer into which the command will be recorded.
- 
srcBufferis the source buffer.
- 
dstImageis the destination image.
- 
dstImageLayoutis the layout of the destination image subresources for the copy.
- 
regionCountis the number of regions to copy.
- 
pRegionsis a pointer to an array of VkBufferImageCopy 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 image according to the
addressing calculations for each
resource.
If any of the specified regions in srcBuffer overlaps in memory with
any of the specified regions in dstImage, values read from those
overlapping regions are undefined.
If any region accesses a depth aspect in dstImage
and the VK_EXT_depth_range_unrestricted extension is not enabled,
values copied from srcBuffer outside of the range [0,1] will be
written as undefined values to the destination image.
Copy regions for the image must be aligned to a multiple of the texel block extent in each dimension, except at the edges of the image, where region extents must match the edge of the image.
- 
VUID-vkCmdCopyBufferToImage-dstImage-07966 
 IfdstImageis non-sparse then the image or the specified disjoint plane must be bound completely and contiguously to a singleVkDeviceMemoryobject
- 
VUID-vkCmdCopyBufferToImage-imageSubresource-07967 
 TheimageSubresource.mipLevelmember of each element ofpRegionsmust be less than themipLevelsspecified in VkImageCreateInfo whendstImagewas created
- 
VUID-vkCmdCopyBufferToImage-imageSubresource-07968 
 IfimageSubresource.layerCountis notVK_REMAINING_ARRAY_LAYERS,imageSubresource.baseArrayLayer+imageSubresource.layerCountof each element ofpRegionsmust be less than or equal to thearrayLayersspecified in VkImageCreateInfo whendstImagewas created
- 
VUID-vkCmdCopyBufferToImage-dstImage-07969 
 dstImagemust not have been created withflagscontainingVK_IMAGE_CREATE_SUBSAMPLED_BIT_EXT
- 
VUID-vkCmdCopyBufferToImage-imageSubresource-07971 
 For each element ofpRegions,imageOffset.xand (imageExtent.width+imageOffset.x) must both be greater than or equal to0and less than or equal to the width of the specifiedimageSubresourceofdstImage
- 
VUID-vkCmdCopyBufferToImage-imageSubresource-07972 
 For each element ofpRegions,imageOffset.yand (imageExtent.height+imageOffset.y) must both be greater than or equal to0and less than or equal to the height of the specifiedimageSubresourceofdstImage
- 
VUID-vkCmdCopyBufferToImage-commandBuffer-01828 
 IfcommandBufferis an unprotected command buffer andprotectedNoFaultis not supported,srcBuffermust not be a protected buffer
- 
VUID-vkCmdCopyBufferToImage-commandBuffer-01829 
 IfcommandBufferis an unprotected command buffer andprotectedNoFaultis not supported,dstImagemust not be a protected image
- 
VUID-vkCmdCopyBufferToImage-commandBuffer-01830 
 IfcommandBufferis a protected command buffer andprotectedNoFaultis not supported,dstImagemust not be an unprotected image
- 
VUID-vkCmdCopyBufferToImage-commandBuffer-07737 
 If the queue family used to create the VkCommandPool whichcommandBufferwas allocated from does not supportVK_QUEUE_GRAPHICS_BITorVK_QUEUE_COMPUTE_BIT, thebufferOffsetmember of any element ofpRegionsmust be a multiple of4
- 
VUID-vkCmdCopyBufferToImage-imageOffset-07738 
 TheimageOffsetandimageExtentmembers of each element ofpRegionsmust respect the image transfer granularity requirements ofcommandBuffer’s command pool’s queue family, as described in VkQueueFamilyProperties
- 
VUID-vkCmdCopyBufferToImage-commandBuffer-07739 
 If the queue family used to create the VkCommandPool whichcommandBufferwas allocated from does not supportVK_QUEUE_GRAPHICS_BIT, for each element ofpRegions, theaspectMaskmember ofimageSubresourcemust not beVK_IMAGE_ASPECT_DEPTH_BITorVK_IMAGE_ASPECT_STENCIL_BIT
- 
VUID-vkCmdCopyBufferToImage-pRegions-00171 
 srcBuffermust be large enough to contain all buffer locations that are accessed according to Buffer and Image Addressing, for each element ofpRegions
- 
VUID-vkCmdCopyBufferToImage-pRegions-00173 
 The union of all source regions, and the union of all destination regions, specified by the elements ofpRegions, must not overlap in memory
- 
VUID-vkCmdCopyBufferToImage-srcBuffer-00174 
 srcBuffermust have been created withVK_BUFFER_USAGE_TRANSFER_SRC_BITusage flag
- 
VUID-vkCmdCopyBufferToImage-dstImage-01997 
 The format features ofdstImagemust containVK_FORMAT_FEATURE_TRANSFER_DST_BIT
- 
VUID-vkCmdCopyBufferToImage-srcBuffer-00176 
 IfsrcBufferis non-sparse then it must be bound completely and contiguously to a singleVkDeviceMemoryobject
- 
VUID-vkCmdCopyBufferToImage-dstImage-00177 
 dstImagemust have been created withVK_IMAGE_USAGE_TRANSFER_DST_BITusage flag
- 
VUID-vkCmdCopyBufferToImage-dstImageLayout-00180 
 dstImageLayoutmust specify the layout of the image subresources ofdstImagespecified inpRegionsat the time this command is executed on aVkDevice
- 
VUID-vkCmdCopyBufferToImage-dstImageLayout-01396 
 dstImageLayoutmust beVK_IMAGE_LAYOUT_SHARED_PRESENT_KHR,VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, orVK_IMAGE_LAYOUT_GENERAL
- 
VUID-vkCmdCopyBufferToImage-pRegions-07931 
 If VK_EXT_depth_range_unrestricted is not enabled, for each element ofpRegionswhoseimageSubresourcecontains a depth aspect, the data insrcBuffermust be in the range [0,1]
- 
VUID-vkCmdCopyBufferToImage-dstImage-07979 
 IfdstImageis of typeVK_IMAGE_TYPE_1D, then for each element ofpRegions,imageOffset.ymust be0andimageExtent.heightmust be1
- 
VUID-vkCmdCopyBufferToImage-imageOffset-09104 
 For each element ofpRegions,imageOffset.zand (imageExtent.depth+imageOffset.z) must both be greater than or equal to0and less than or equal to the depth of the specifiedimageSubresourceofdstImage
- 
VUID-vkCmdCopyBufferToImage-dstImage-07980 
 IfdstImageis of typeVK_IMAGE_TYPE_1DorVK_IMAGE_TYPE_2D, then for each element ofpRegions,imageOffset.zmust be0andimageExtent.depthmust be1
- 
VUID-vkCmdCopyBufferToImage-dstImage-07274 
 For each element ofpRegions, if VkCopyCommandTransformInfoQCOM::transformis equal toVK_SURFACE_TRANSFORM_IDENTITY_BIT_KHRorVK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR,imageOffset.xmust be a multiple of the texel block extent width of the VkFormat ofdstImage
- 
VUID-vkCmdCopyBufferToImage-imageOffset-10051 
 For each element ofpRegions, if VkCopyCommandTransformInfoQCOM::transformis equal toVK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHRorVK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR, andimageOffset.xdoes not equal the width of the subresource specified byimageSubresource,imageOffset.xmust be a multiple of the texel block extent width of the VkFormat ofdstImage
- 
VUID-vkCmdCopyBufferToImage-dstImage-07275 
 For each element ofpRegions, if VkCopyCommandTransformInfoQCOM::transformis equal toVK_SURFACE_TRANSFORM_IDENTITY_BIT_KHRorVK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR,imageOffset.ymust be a multiple of the texel block extent height of the VkFormat ofdstImage
- 
VUID-vkCmdCopyBufferToImage-imageOffset-10052 
 For each element ofpRegions, if VkCopyCommandTransformInfoQCOM::transformis equal toVK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHRorVK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR, andimageOffset.ydoes not equal the height of the subresource specified byimageSubresource,imageOffset.ymust be a multiple of the texel block extent height of the VkFormat ofdstImage
- 
VUID-vkCmdCopyBufferToImage-dstImage-07276 
 For each element ofpRegions,imageOffset.zmust be a multiple of the texel block extent depth of the VkFormat ofdstImage
- 
VUID-vkCmdCopyBufferToImage-dstImage-00207 
 For each element ofpRegions, if VkCopyCommandTransformInfoQCOM::transformis equal toVK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR, the sum ofimageOffset.xandextent.widthdoes not equal the width of the subresource specified byimageSubresource,extent.widthmust be a multiple of the texel block extent width of the VkFormat ofdstImage
- 
VUID-vkCmdCopyBufferToImage-imageOffset-10053 
 For each element ofpRegions, if VkCopyCommandTransformInfoQCOM::transformis equal toVK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR, the difference ofimageOffset.xandextent.heightmust be a multiple of the texel block extent width of the VkFormat ofdstImage
- 
VUID-vkCmdCopyBufferToImage-imageOffset-10054 
 For each element ofpRegions, if VkCopyCommandTransformInfoQCOM::transformis equal toVK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR, the difference ofimageOffset.xandextent.widthmust be a multiple of the texel block extent width of the VkFormat ofdstImage
- 
VUID-vkCmdCopyBufferToImage-imageOffset-10055 
 For each element ofpRegions, if VkCopyCommandTransformInfoQCOM::transformis equal toVK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR, the sum ofimageOffset.xandextent.heightdoes not equal the width of the subresource specified byimageSubresource,extent.heightmust be a multiple of the texel block extent width of the VkFormat ofdstImage
- 
VUID-vkCmdCopyBufferToImage-dstImage-00208 
 For each element ofpRegions, if VkCopyCommandTransformInfoQCOM::transformis equal toVK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR, and the sum ofimageOffset.yandextent.heightdoes not equal the height of the subresource specified byimageSubresource,extent.heightmust be a multiple of the texel block extent height of the VkFormat ofdstImage
- 
VUID-vkCmdCopyBufferToImage-imageOffset-10056 
 For each element ofpRegions, if VkCopyCommandTransformInfoQCOM::transformis equal toVK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR, the sum ofimageOffset.yandextent.widthdoes not equal the height of the subresource specified byimageSubresource,extent.widthmust be a multiple of the texel block extent height of the VkFormat ofdstImage
- 
VUID-vkCmdCopyBufferToImage-imageOffset-10057 
 For each element ofpRegions, if VkCopyCommandTransformInfoQCOM::transformis equal toVK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR, the difference ofimageOffset.yandextent.heightmust be a multiple of the texel block extent height of the VkFormat ofdstImage
- 
VUID-vkCmdCopyBufferToImage-imageOffset-10058 
 For each element ofpRegions, if VkCopyCommandTransformInfoQCOM::transformis equal toVK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR, the difference ofimageOffset.yandextent.widthmust be a multiple of the texel block extent height of the VkFormat ofdstImage
- 
VUID-vkCmdCopyBufferToImage-dstImage-00209 
 For each element ofpRegions, if the sum ofimageOffset.zandextent.depthdoes not equal the depth of the subresource specified bysrcSubresource,extent.depthmust be a multiple of the texel block extent depth of the VkFormat ofdstImage
- 
VUID-vkCmdCopyBufferToImage-imageSubresource-09105 
 For each element ofpRegions,imageSubresource.aspectMaskmust specify aspects present indstImage
- 
VUID-vkCmdCopyBufferToImage-dstImage-07981 
 IfdstImagehas a multi-planar format, then for each element ofpRegions,imageSubresource.aspectMaskmust be a single valid multi-planar aspect mask bit
- 
VUID-vkCmdCopyBufferToImage-dstImage-07983 
 IfdstImageis of typeVK_IMAGE_TYPE_3D, for each element ofpRegions,imageSubresource.baseArrayLayermust be0andimageSubresource.layerCountmust be1
- 
VUID-vkCmdCopyBufferToImage-bufferRowLength-09106 
 For each element ofpRegions,bufferRowLengthmust be a multiple of the texel block extent width of the VkFormat ofdstImage
- 
VUID-vkCmdCopyBufferToImage-bufferImageHeight-09107 
 For each element ofpRegions,bufferImageHeightmust be a multiple of the texel block extent height of the VkFormat ofdstImage
- 
VUID-vkCmdCopyBufferToImage-bufferRowLength-09108 
 For each element ofpRegions,bufferRowLengthdivided by the texel block extent width and then multiplied by the texel block size ofdstImagemust be less than or equal to 231-1
- 
VUID-vkCmdCopyBufferToImage-dstImage-07975 
 IfdstImagedoes not have either a depth/stencil format or a multi-planar format, then for each element ofpRegions,bufferOffsetmust be a multiple of the texel block size
- 
VUID-vkCmdCopyBufferToImage-dstImage-07976 
 IfdstImagehas a multi-planar format, then for each element ofpRegions,bufferOffsetmust be a multiple of the element size of the compatible format for the format and theaspectMaskof theimageSubresourceas defined in [formats-compatible-planes]
- 
VUID-vkCmdCopyBufferToImage-dstImage-07978 
 IfdstImagehas a depth/stencil format, thebufferOffsetmember of any element ofpRegionsmust be a multiple of4
- 
VUID-vkCmdCopyBufferToImage-commandBuffer-parameter 
 commandBuffermust be a valid VkCommandBuffer handle
- 
VUID-vkCmdCopyBufferToImage-srcBuffer-parameter 
 srcBuffermust be a valid VkBuffer handle
- 
VUID-vkCmdCopyBufferToImage-dstImage-parameter 
 dstImagemust be a valid VkImage handle
- 
VUID-vkCmdCopyBufferToImage-dstImageLayout-parameter 
 dstImageLayoutmust be a valid VkImageLayout value
- 
VUID-vkCmdCopyBufferToImage-pRegions-parameter 
 pRegionsmust be a valid pointer to an array ofregionCountvalid VkBufferImageCopy structures
- 
VUID-vkCmdCopyBufferToImage-commandBuffer-recording 
 commandBuffermust be in the recording state
- 
VUID-vkCmdCopyBufferToImage-commandBuffer-cmdpool 
 TheVkCommandPoolthatcommandBufferwas allocated from must support transfer, graphics, or compute operations
- 
VUID-vkCmdCopyBufferToImage-renderpass 
 This command must only be called outside of a render pass instance
- 
VUID-vkCmdCopyBufferToImage-videocoding 
 This command must only be called outside of a video coding scope
- 
VUID-vkCmdCopyBufferToImage-regionCount-arraylength 
 regionCountmust be greater than0
- 
VUID-vkCmdCopyBufferToImage-commonparent 
 Each ofcommandBuffer,dstImage, andsrcBuffermust have been created, allocated, or retrieved from the same VkDevice
- 
Host access to commandBuffermust be externally synchronized
- 
Host access to the VkCommandPoolthatcommandBufferwas allocated from must be externally synchronized
| Command Buffer Levels | Render Pass Scope | Video Coding Scope | Supported Queue Types | Command Type | 
|---|---|---|---|---|
| Primary | Outside | Outside | Transfer | Action | 
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.