C Specification
For both vkCmdCopyBufferToImage and vkCmdCopyImageToBuffer, each
element of pRegions
is a structure defined as:
// Provided by VK_VERSION_1_0
typedef struct VkBufferImageCopy {
VkDeviceSize bufferOffset;
uint32_t bufferRowLength;
uint32_t bufferImageHeight;
VkImageSubresourceLayers imageSubresource;
VkOffset3D imageOffset;
VkExtent3D imageExtent;
} VkBufferImageCopy;
Members
-
bufferOffset
is the offset in bytes from the start of the buffer object where the image data is copied from or to. -
bufferRowLength
andbufferImageHeight
specify in texels a subregion of a larger two- or three-dimensional image in buffer memory, and control the addressing calculations. If either of these values is zero, that aspect of the buffer memory is considered to be tightly packed according to theimageExtent
. -
imageSubresource
is a VkImageSubresourceLayers used to specify the specific image subresources of the image used for the source or destination image data. -
imageOffset
selects the initialx
,y
,z
offsets in texels of the sub-region of the source or destination image data. -
imageExtent
is the size in texels of the image to copy inwidth
,height
anddepth
.
Description
When copying to or from a depth or stencil aspect, the data in buffer memory uses a layout that is a (mostly) tightly packed representation of the depth or stencil data. Specifically:
-
data copied to or from the stencil aspect of any depth/stencil format is tightly packed with one
VK_FORMAT_S8_UINT
value per texel. -
data copied to or from the depth aspect of a
VK_FORMAT_D16_UNORM
orVK_FORMAT_D16_UNORM_S8_UINT
format is tightly packed with oneVK_FORMAT_D16_UNORM
value per texel. -
data copied to or from the depth aspect of a
VK_FORMAT_D32_SFLOAT
orVK_FORMAT_D32_SFLOAT_S8_UINT
format is tightly packed with oneVK_FORMAT_D32_SFLOAT
value per texel. -
data copied to or from the depth aspect of a
VK_FORMAT_X8_D24_UNORM_PACK32
orVK_FORMAT_D24_UNORM_S8_UINT
format is packed with one 32-bit word per texel with the D24 value in the LSBs of the word, and undefined values in the eight MSBs.
Note
To copy both the depth and stencil aspects of a depth/stencil format, two
entries in |
Because depth or stencil aspect buffer to image copies may require format conversions on some implementations, they are not supported on queues that do not support graphics.
When copying to a depth aspect,
and the VK_EXT_depth_range_unrestricted
extension is not enabled,
the data in buffer memory must be in the range [0,1], or the
resulting values are undefined.
Copies are done layer by layer starting with image layer
baseArrayLayer
member of imageSubresource
.
layerCount
layers are copied from the source image or to the
destination image.
For purpose of valid usage statements here and in related copy commands, a blocked image is defined as:
-
an image with a single-plane, “
_422
” format, which is treated as a format with a 2 × 1 compressed texel block, or -
a compressed image.
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.