CARVIEW |
vkCmdCopyImage(3) Manual Page
Name
vkCmdCopyImage - Copy data between images
Loading… please wait.
C Specification
To copy data between image objects, call:
// Provided by VK_VERSION_1_0
void vkCmdCopyImage(
VkCommandBuffer commandBuffer,
VkImage srcImage,
VkImageLayout srcImageLayout,
VkImage dstImage,
VkImageLayout dstImageLayout,
uint32_t regionCount,
const VkImageCopy* pRegions);
Parameters
-
commandBuffer
is the command buffer into which the command will be recorded. -
srcImage
is the source image. -
srcImageLayout
is the current layout of the source image subresource. -
dstImage
is the destination image. -
dstImageLayout
is the current layout of the destination image subresource. -
regionCount
is the number of regions to copy. -
pRegions
is a pointer to an array of VkImageCopy structures specifying the regions to copy.
Description
Each source region specified by pRegions
is copied from the source
image to the destination region of the destination image.
If any of the specified regions in srcImage
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.
Multi-planar images can only be copied on a per-plane basis, and the subresources used in each region when copying to or from such images must specify only one plane, though different regions can specify different planes. When copying planes of multi-planar images, the format considered is the compatible format for that plane, rather than the format of the multi-planar image.
If the format of the destination image has a different block extent than the source image (e.g. one is a compressed format), the offset and extent for each of the regions specified is scaled according to the block extents of each format to match in size. Copy regions for each 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.
Image data can be copied between images with different image types.
If one image is VK_IMAGE_TYPE_3D
and the other image is
VK_IMAGE_TYPE_2D
with multiple layers, then each slice is copied to or
from a different layer; depth
slices in the 3D image correspond to
layerCount
layers in the 2D image, with an effective depth
of
1
used for the 2D image.
If the maintenance5
feature is enabled, all
other combinations are allowed and function as if 1D images are 2D images
with a height of 1.
Otherwise, other combinations of image types are disallowed.
-
VUID-vkCmdCopyImage-commandBuffer-01825
IfcommandBuffer
is an unprotected command buffer andprotectedNoFault
is not supported,srcImage
must not be a protected image -
VUID-vkCmdCopyImage-commandBuffer-01826
IfcommandBuffer
is an unprotected command buffer andprotectedNoFault
is not supported,dstImage
must not be a protected image -
VUID-vkCmdCopyImage-commandBuffer-01827
IfcommandBuffer
is a protected command buffer andprotectedNoFault
is not supported,dstImage
must not be an unprotected image -
VUID-vkCmdCopyImage-commandBuffer-10217
If the queue family used to create the VkCommandPool whichcommandBuffer
was allocated from does not supportVK_QUEUE_GRAPHICS_BIT
, for each element ofpRegions
, where theaspectMask
member ofsrcSubresource
isVK_IMAGE_ASPECT_COLOR_BIT
, theaspectMask
ofdstSubresource
must not beVK_IMAGE_ASPECT_DEPTH_BIT
orVK_IMAGE_ASPECT_STENCIL_BIT
-
VUID-vkCmdCopyImage-commandBuffer-10218
If the queue family used to create the VkCommandPool whichcommandBuffer
was allocated from does not supportVK_QUEUE_GRAPHICS_BIT
, for each element ofpRegions
, where theaspectMask
member ofdstSubresource
isVK_IMAGE_ASPECT_COLOR_BIT
then theaspectMask
ofsrcSubresource
must not beVK_IMAGE_ASPECT_DEPTH_BIT
orVK_IMAGE_ASPECT_STENCIL_BIT
-
VUID-vkCmdCopyImage-pRegions-00124
The union of all source regions, and the union of all destination regions, specified by the elements ofpRegions
, must not overlap in memory -
VUID-vkCmdCopyImage-srcImage-01995
The format features ofsrcImage
must containVK_FORMAT_FEATURE_TRANSFER_SRC_BIT
-
VUID-vkCmdCopyImage-srcImageLayout-00128
srcImageLayout
must specify the layout of the image subresources ofsrcImage
specified inpRegions
at the time this command is executed on aVkDevice
-
VUID-vkCmdCopyImage-srcImageLayout-01917
srcImageLayout
must beVK_IMAGE_LAYOUT_SHARED_PRESENT_KHR
,VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL
, orVK_IMAGE_LAYOUT_GENERAL
-
VUID-vkCmdCopyImage-srcImage-09460
IfsrcImage
anddstImage
are the same, and any elements ofpRegions
contains thesrcSubresource
anddstSubresource
with matchingmipLevel
and overlapping array layers, then thesrcImageLayout
anddstImageLayout
must beVK_IMAGE_LAYOUT_GENERAL
orVK_IMAGE_LAYOUT_SHARED_PRESENT_KHR
-
VUID-vkCmdCopyImage-dstImage-01996
The format features ofdstImage
must containVK_FORMAT_FEATURE_TRANSFER_DST_BIT
-
VUID-vkCmdCopyImage-dstImageLayout-00133
dstImageLayout
must specify the layout of the image subresources ofdstImage
specified inpRegions
at the time this command is executed on aVkDevice
-
VUID-vkCmdCopyImage-dstImageLayout-01395
dstImageLayout
must beVK_IMAGE_LAYOUT_SHARED_PRESENT_KHR
,VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL
, orVK_IMAGE_LAYOUT_GENERAL
-
VUID-vkCmdCopyImage-srcImage-01548
If the VkFormat of each ofsrcImage
anddstImage
is not a multi-planar format, the VkFormat of each ofsrcImage
anddstImage
must be size-compatible -
VUID-vkCmdCopyImage-None-01549
In a copy to or from a plane of a multi-planar image, the VkFormat of the image and plane must be compatible according to the description of compatible planes for the plane being copied -
VUID-vkCmdCopyImage-srcImage-09247
If the VkFormat of each ofsrcImage
anddstImage
is a compressed image format, the formats must have the same texel block extent -
VUID-vkCmdCopyImage-srcImage-00136
The sample count ofsrcImage
anddstImage
must match -
VUID-vkCmdCopyImage-srcOffset-01783
ThesrcOffset
andextent
members of each element ofpRegions
must respect the image transfer granularity requirements ofcommandBuffer
’s command pool’s queue family, as described in VkQueueFamilyProperties -
VUID-vkCmdCopyImage-dstOffset-01784
ThedstOffset
andextent
members of each element ofpRegions
must respect the image transfer granularity requirements ofcommandBuffer
’s command pool’s queue family, as described in VkQueueFamilyProperties -
VUID-vkCmdCopyImage-srcImage-01551
If neithersrcImage
nordstImage
has a multi-planar format and themaintenance8
feature is not enabled then for each element ofpRegions
,srcSubresource.aspectMask
anddstSubresource.aspectMask
must match -
VUID-vkCmdCopyImage-srcSubresource-10214
IfsrcSubresource.aspectMask
isVK_IMAGE_ASPECT_COLOR_BIT
, thendstSubresource.aspectMask
must not contain bothVK_IMAGE_ASPECT_DEPTH_BIT
andVK_IMAGE_ASPECT_STENCIL_BIT
-
VUID-vkCmdCopyImage-dstSubresource-10215
IfdstSubresource.aspectMask
isVK_IMAGE_ASPECT_COLOR_BIT
, thensrcSubresource.aspectMask
must not contain bothVK_IMAGE_ASPECT_DEPTH_BIT
andVK_IMAGE_ASPECT_STENCIL_BIT
-
VUID-vkCmdCopyImage-srcImage-08713
IfsrcImage
has a multi-planar format, then for each element ofpRegions
,srcSubresource.aspectMask
must be a single valid multi-planar aspect mask bit -
VUID-vkCmdCopyImage-dstImage-08714
IfdstImage
has a multi-planar format, then for each element ofpRegions
,dstSubresource.aspectMask
must be a single valid multi-planar aspect mask bit -
VUID-vkCmdCopyImage-srcImage-01556
IfsrcImage
has a multi-planar format and thedstImage
does not have a multi-planar image format, then for each element ofpRegions
,dstSubresource.aspectMask
must beVK_IMAGE_ASPECT_COLOR_BIT
-
VUID-vkCmdCopyImage-dstImage-01557
IfdstImage
has a multi-planar format and thesrcImage
does not have a multi-planar image format, then for each element ofpRegions
,srcSubresource.aspectMask
must beVK_IMAGE_ASPECT_COLOR_BIT
-
VUID-vkCmdCopyImage-srcSubresource-10211
IfsrcSubresource.aspectMask
isVK_IMAGE_ASPECT_COLOR_BIT
anddstSubresource.aspectMask
isVK_IMAGE_ASPECT_DEPTH_BIT
orVK_IMAGE_ASPECT_STENCIL_BIT
, then the VkFormat values ofsrcImage
anddstImage
must be compatible according to the list of compatible depth-stencil and color formats -
VUID-vkCmdCopyImage-srcSubresource-10212
IfsrcSubresource.aspectMask
isVK_IMAGE_ASPECT_DEPTH_BIT
orVK_IMAGE_ASPECT_STENCIL_BIT
anddstSubresource.aspectMask
isVK_IMAGE_ASPECT_COLOR_BIT
, then the VkFormat values ofsrcImage
anddstImage
must be compatible according to the list of compatible depth-stencil and color formats -
VUID-vkCmdCopyImage-apiVersion-07932
If the VK_KHR_maintenance1 extension is not enabled, or VkPhysicalDeviceProperties::apiVersion
is less than Vulkan 1.1, and eithersrcImage
ordstImage
is of typeVK_IMAGE_TYPE_3D
, then for each element ofpRegions
,srcSubresource.baseArrayLayer
anddstSubresource.baseArrayLayer
must both be0
, andsrcSubresource.layerCount
anddstSubresource.layerCount
must both be1
-
VUID-vkCmdCopyImage-srcImage-04443
IfsrcImage
is of typeVK_IMAGE_TYPE_3D
, then for each element ofpRegions
,srcSubresource.baseArrayLayer
must be0
andsrcSubresource.layerCount
must be1
-
VUID-vkCmdCopyImage-dstImage-04444
IfdstImage
is of typeVK_IMAGE_TYPE_3D
, then for each element ofpRegions
,dstSubresource.baseArrayLayer
must be0
anddstSubresource.layerCount
must be1
-
VUID-vkCmdCopyImage-aspectMask-00142
For each element ofpRegions
,srcSubresource.aspectMask
must specify aspects present insrcImage
-
VUID-vkCmdCopyImage-aspectMask-00143
For each element ofpRegions
,dstSubresource.aspectMask
must specify aspects present indstImage
-
VUID-vkCmdCopyImage-srcOffset-00144
For each element ofpRegions
,srcOffset.x
and (extent.width
+srcOffset.x
) must both be greater than or equal to0
and less than or equal to the width of the specifiedsrcSubresource
ofsrcImage
-
VUID-vkCmdCopyImage-srcOffset-00145
For each element ofpRegions
,srcOffset.y
and (extent.height
+srcOffset.y
) must both be greater than or equal to0
and less than or equal to the height of the specifiedsrcSubresource
ofsrcImage
-
VUID-vkCmdCopyImage-srcImage-00146
IfsrcImage
is of typeVK_IMAGE_TYPE_1D
, then for each element ofpRegions
,srcOffset.y
must be0
andextent.height
must be1
-
VUID-vkCmdCopyImage-srcOffset-00147
IfsrcImage
is of typeVK_IMAGE_TYPE_3D
, then for each element ofpRegions
,srcOffset.z
and (extent.depth
+srcOffset.z
) must both be greater than or equal to0
and less than or equal to the depth of the specifiedsrcSubresource
ofsrcImage
-
VUID-vkCmdCopyImage-srcImage-01785
IfsrcImage
is of typeVK_IMAGE_TYPE_1D
, then for each element ofpRegions
,srcOffset.z
must be0
andextent.depth
must be1
-
VUID-vkCmdCopyImage-dstImage-01786
IfdstImage
is of typeVK_IMAGE_TYPE_1D
, then for each element ofpRegions
,dstOffset.z
must be0
-
VUID-vkCmdCopyImage-srcImage-10907
If either the VkFormat of each ofsrcImage
anddstImage
is not a compressed image format, anddstImage
is of typeVK_IMAGE_TYPE_1D
, then for each element ofpRegions
,extent.depth
must be1
-
VUID-vkCmdCopyImage-srcImage-01787
IfsrcImage
is of typeVK_IMAGE_TYPE_2D
, then for each element ofpRegions
,srcOffset.z
must be0
-
VUID-vkCmdCopyImage-dstImage-01788
IfdstImage
is of typeVK_IMAGE_TYPE_2D
, then for each element ofpRegions
,dstOffset.z
must be0
-
VUID-vkCmdCopyImage-apiVersion-07933
If the VK_KHR_maintenance1 extension is not enabled, and VkPhysicalDeviceProperties::apiVersion
is less than Vulkan 1.1,srcImage
anddstImage
must have the same VkImageType -
VUID-vkCmdCopyImage-apiVersion-08969
If the VK_KHR_maintenance1 extension is not enabled, and VkPhysicalDeviceProperties::apiVersion
is less than Vulkan 1.1,srcImage
ordstImage
is of typeVK_IMAGE_TYPE_2D
, then for each element ofpRegions
,extent.depth
must be1
-
VUID-vkCmdCopyImage-srcImage-07743
IfsrcImage
anddstImage
have a different VkImageType, and themaintenance5
feature is not enabled, one must beVK_IMAGE_TYPE_3D
and the other must beVK_IMAGE_TYPE_2D
-
VUID-vkCmdCopyImage-srcImage-08793
IfsrcImage
anddstImage
have the same VkImageType, for each element ofpRegions
, if neither of thelayerCount
members ofsrcSubresource
ordstSubresource
areVK_REMAINING_ARRAY_LAYERS
, thelayerCount
members ofsrcSubresource
ordstSubresource
must match -
VUID-vkCmdCopyImage-srcImage-08794
IfsrcImage
anddstImage
have the same VkImageType, and one of thelayerCount
members ofsrcSubresource
ordstSubresource
isVK_REMAINING_ARRAY_LAYERS
, the other member must be eitherVK_REMAINING_ARRAY_LAYERS
or equal to thearrayLayers
member of the VkImageCreateInfo used to create the image minusbaseArrayLayer
-
VUID-vkCmdCopyImage-srcImage-01790
IfsrcImage
anddstImage
are both of typeVK_IMAGE_TYPE_2D
, then for each element ofpRegions
,extent.depth
must be1
-
VUID-vkCmdCopyImage-srcImage-01791
IfsrcImage
is of typeVK_IMAGE_TYPE_2D
, anddstImage
is of typeVK_IMAGE_TYPE_3D
, then for each element ofpRegions
,extent.depth
must equalsrcSubresource.layerCount
-
VUID-vkCmdCopyImage-dstImage-01792
IfdstImage
is of typeVK_IMAGE_TYPE_2D
, andsrcImage
is of typeVK_IMAGE_TYPE_3D
, then for each element ofpRegions
,extent.depth
must equaldstSubresource.layerCount
-
VUID-vkCmdCopyImage-dstOffset-00150
For each element ofpRegions
,dstOffset.x
and (extent.width
+dstOffset.x
), whereextent
is adjusted for size-compatibility, must both be greater than or equal to0
and less than or equal to the width of the specifieddstSubresource
ofdstImage
-
VUID-vkCmdCopyImage-dstOffset-00151
For each element ofpRegions
,dstOffset.y
and (extent.height
+dstOffset.y
), whereextent
is adjusted for size-compatibility, must both be greater than or equal to0
and less than or equal to the height of the specifieddstSubresource
ofdstImage
-
VUID-vkCmdCopyImage-dstImage-00152
IfdstImage
is of typeVK_IMAGE_TYPE_1D
, then for each element ofpRegions
,dstOffset.y
must be0
-
VUID-vkCmdCopyImage-srcImage-10908
If either the VkFormat of each ofsrcImage
anddstImage
is not a compressed image format, anddstImage
is of typeVK_IMAGE_TYPE_1D
, then for each element ofpRegions
,extent.height
must be1
, whereextent
is adjusted for size-compatibility -
VUID-vkCmdCopyImage-dstOffset-00153
IfdstImage
is of typeVK_IMAGE_TYPE_3D
, then for each element ofpRegions
,dstOffset.z
and (extent.depth
+dstOffset.z
), whereextent
is adjusted for size-compatibility, must both be greater than or equal to0
and less than or equal to the depth of the specifieddstSubresource
ofdstImage
-
VUID-vkCmdCopyImage-pRegions-07278
For each element ofpRegions
,srcOffset.x
must be a multiple of the texel block extent width of the VkFormat ofsrcImage
-
VUID-vkCmdCopyImage-pRegions-07279
For each element ofpRegions
,srcOffset.y
must be a multiple of the texel block extent height of the VkFormat ofsrcImage
-
VUID-vkCmdCopyImage-pRegions-07280
For each element ofpRegions
,srcOffset.z
must be a multiple of the texel block extent depth of the VkFormat ofsrcImage
-
VUID-vkCmdCopyImage-pRegions-07281
For each element ofpRegions
,dstOffset.x
must be a multiple of the texel block extent width of the VkFormat ofdstImage
-
VUID-vkCmdCopyImage-pRegions-07282
For each element ofpRegions
,dstOffset.y
must be a multiple of the texel block extent height of the VkFormat ofdstImage
-
VUID-vkCmdCopyImage-pRegions-07283
For each element ofpRegions
,dstOffset.z
must be a multiple of the texel block extent depth of the VkFormat ofdstImage
-
VUID-vkCmdCopyImage-srcImage-01728
For each element ofpRegions
, if the sum ofsrcOffset.x
andextent.width
does not equal the width of the subresource specified bysrcSubresource
,extent.width
must be a multiple of the texel block extent width of the VkFormat ofsrcImage
-
VUID-vkCmdCopyImage-srcImage-01729
For each element ofpRegions
, if the sum ofsrcOffset.y
andextent.height
does not equal the height of the subresource specified bysrcSubresource
,extent.height
must be a multiple of the texel block extent height of the VkFormat ofsrcImage
-
VUID-vkCmdCopyImage-srcImage-01730
For each element ofpRegions
, if the sum ofsrcOffset.z
andextent.depth
does not equal the depth of the subresource specified bysrcSubresource
,extent.depth
must be a multiple of the texel block extent depth of the VkFormat ofsrcImage
-
VUID-vkCmdCopyImage-aspect-06662
If theaspect
member of any element ofpRegions
includes any flag other thanVK_IMAGE_ASPECT_STENCIL_BIT
orsrcImage
was not created with separate stencil usage,VK_IMAGE_USAGE_TRANSFER_SRC_BIT
must have been included in the VkImageCreateInfo::usage
used to createsrcImage
-
VUID-vkCmdCopyImage-aspect-06663
If theaspect
member of any element ofpRegions
includes any flag other thanVK_IMAGE_ASPECT_STENCIL_BIT
ordstImage
was not created with separate stencil usage,VK_IMAGE_USAGE_TRANSFER_DST_BIT
must have been included in the VkImageCreateInfo::usage
used to createdstImage
-
VUID-vkCmdCopyImage-aspect-06664
If theaspect
member of any element ofpRegions
includesVK_IMAGE_ASPECT_STENCIL_BIT
, andsrcImage
was created with separate stencil usage,VK_IMAGE_USAGE_TRANSFER_SRC_BIT
must have been included in the VkImageStencilUsageCreateInfo::stencilUsage
used to createsrcImage
-
VUID-vkCmdCopyImage-aspect-06665
If theaspect
member of any element ofpRegions
includesVK_IMAGE_ASPECT_STENCIL_BIT
, anddstImage
was created with separate stencil usage,VK_IMAGE_USAGE_TRANSFER_DST_BIT
must have been included in the VkImageStencilUsageCreateInfo::stencilUsage
used to createdstImage
-
VUID-vkCmdCopyImage-srcImage-07966
IfsrcImage
is non-sparse then the image or the specified disjoint plane must be bound completely and contiguously to a singleVkDeviceMemory
object -
VUID-vkCmdCopyImage-srcSubresource-07967
ThesrcSubresource.mipLevel
member of each element ofpRegions
must be less than themipLevels
specified in VkImageCreateInfo whensrcImage
was created -
VUID-vkCmdCopyImage-srcSubresource-07968
IfsrcSubresource.layerCount
is notVK_REMAINING_ARRAY_LAYERS
,srcSubresource.baseArrayLayer
+srcSubresource.layerCount
of each element ofpRegions
must be less than or equal to thearrayLayers
specified in VkImageCreateInfo whensrcImage
was created -
VUID-vkCmdCopyImage-srcImage-07969
srcImage
must not have been created withflags
containingVK_IMAGE_CREATE_SUBSAMPLED_BIT_EXT
-
VUID-vkCmdCopyImage-dstImage-07966
IfdstImage
is non-sparse then the image or the specified disjoint plane must be bound completely and contiguously to a singleVkDeviceMemory
object -
VUID-vkCmdCopyImage-dstSubresource-07967
ThedstSubresource.mipLevel
member of each element ofpRegions
must be less than themipLevels
specified in VkImageCreateInfo whendstImage
was created -
VUID-vkCmdCopyImage-dstSubresource-07968
IfdstSubresource.layerCount
is notVK_REMAINING_ARRAY_LAYERS
,dstSubresource.baseArrayLayer
+dstSubresource.layerCount
of each element ofpRegions
must be less than or equal to thearrayLayers
specified in VkImageCreateInfo whendstImage
was created -
VUID-vkCmdCopyImage-dstImage-07969
dstImage
must not have been created withflags
containingVK_IMAGE_CREATE_SUBSAMPLED_BIT_EXT
-
VUID-vkCmdCopyImage-commandBuffer-parameter
commandBuffer
must be a valid VkCommandBuffer handle -
VUID-vkCmdCopyImage-srcImage-parameter
srcImage
must be a valid VkImage handle -
VUID-vkCmdCopyImage-srcImageLayout-parameter
srcImageLayout
must be a valid VkImageLayout value -
VUID-vkCmdCopyImage-dstImage-parameter
dstImage
must be a valid VkImage handle -
VUID-vkCmdCopyImage-dstImageLayout-parameter
dstImageLayout
must be a valid VkImageLayout value -
VUID-vkCmdCopyImage-pRegions-parameter
pRegions
must be a valid pointer to an array ofregionCount
valid VkImageCopy structures -
VUID-vkCmdCopyImage-commandBuffer-recording
commandBuffer
must be in the recording state -
VUID-vkCmdCopyImage-commandBuffer-cmdpool
TheVkCommandPool
thatcommandBuffer
was allocated from must supportVK_QUEUE_COMPUTE_BIT
,VK_QUEUE_GRAPHICS_BIT
, orVK_QUEUE_TRANSFER_BIT
operations -
VUID-vkCmdCopyImage-renderpass
This command must only be called outside of a render pass instance -
VUID-vkCmdCopyImage-videocoding
This command must only be called outside of a video coding scope -
VUID-vkCmdCopyImage-regionCount-arraylength
regionCount
must be greater than0
-
VUID-vkCmdCopyImage-commonparent
Each ofcommandBuffer
,dstImage
, andsrcImage
must have been created, allocated, or retrieved from the same VkDevice
-
Host access to
commandBuffer
must be externally synchronized -
Host access to the
VkCommandPool
thatcommandBuffer
was allocated from must be externally synchronized
Command Buffer Levels | Render Pass Scope | Video Coding Scope | Supported Queue Types | Command Type |
---|---|---|---|---|
Primary |
Outside |
Outside |
VK_QUEUE_COMPUTE_BIT |
Action |
vkCmdCopyImage is not affected by conditional rendering
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.