VKBUFFERIMAGECOPY(3)

NAME
VkBufferImageCopy - Structure specifying a buffer image copy operation

C SPECIFICATION

For both vkCmdCopyBufferToImage and vkCmdCopyImageToBuffer, each element of pRegions is a structure defined as:

    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 and bufferImageHeight specify the data in buffer memory as a subregion of a larger two- or three-dimensional image, and control the addressing calculations of data in buffer memory. If either of these values is zero, that aspect of the buffer memory is considered to be tightly packed according to the imageExtent.

    • imageSubresource is an VkImageSubresourceLayers used to specify the specific image subresources of the image used for the source or destination image data.

    • imageOffset selects the initial x, 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 in width, height and depth. 1D images use only x and width. 2D images use x, y, width and height. 3D images use x, y, z, width, height and depth.

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 or VK_FORMAT_D16_UNORM_S8_UINT format is tightly packed with one VK_FORMAT_D16_UNORM value per texel.

    • data copied to or from the depth aspect of a VK_FORMAT_D32_SFLOAT or VK_FORMAT_D32_SFLOAT_S8_UINT format is tightly packed with one VK_FORMAT_D32_SFLOAT value per texel.

    • data copied to or from the depth aspect of a VK_FORMAT_X8_D24_UNORM_PACK32 or VK_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 pRegions can be used, where one specifies the depth aspect in imageSubresource, and the other specifies the stencil aspect.

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.

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.

VALID USAGE

    • imageSubresource must be a valid VkImageSubresourceLayers structure

    • bufferOffset must be a multiple of the calling command’s VkImage parameter’s texel size

    • bufferOffset must be a multiple of 4

    • bufferRowLength must be 0, or greater than or equal to the width member of imageExtent

    • bufferImageHeight must be 0, or greater than or equal to the height member of imageExtent

    • imageOffset.x and (imageExtent.width + imageOffset.x) must both be greater than or equal to 0 and less than or equal to the image subresource width

    • imageOffset.y and (imageExtent.height + imageOffset.y) must both be greater than or equal to 0 and less than or equal to the image subresource height

    • imageOffset.z and (imageExtent.depth + imageOffset.z) must both be greater than or equal to 0 and less than or equal to the image subresource depth

    • If the calling command’s VkImage parameter is a compressed format image:

        • bufferRowLength must be a multiple of the compressed texel block width

        • bufferImageHeight must be a multiple of the compressed texel block height

        • all members of imageOffset must be a multiple of the corresponding dimensions of the compressed texel block

        • bufferOffset must be a multiple of the compressed texel block size in bytes

        • imageExtent.width must be a multiple of the compressed texel block width or (imageExtent.width + imageOffset.x) must equal the image subresource width

        • imageExtent.height must be a multiple of the compressed texel block height or (imageExtent.height + imageOffset.y) must equal the image subresource height

        • imageExtent.depth must be a multiple of the compressed texel block depth or (imageExtent.depth + imageOffset.z) must equal the image subresource depth

    • bufferOffset, bufferRowLength, bufferImageHeight and all members of imageOffset and imageExtent must respect the image transfer granularity requirements of the queue family that it will be submitted against, as described in Physical Device Enumeration

    • The aspectMask member of imageSubresource must specify aspects present in the calling command’s VkImage parameter

    • The aspectMask member of imageSubresource must only have a single bit set

    • If the calling command’s VkImage parameter is of VkImageType VK_IMAGE_TYPE_3D, the baseArrayLayer and layerCount members of imageSubresource must be 0 and 1, respectively

SEE ALSO

VkDeviceSize, VkExtent3D, VkImageSubresourceLayers, VkOffset3D, vkCmdCopyBufferToImage, vkCmdCopyImageToBuffer

DOCUMENT NOTES

For more information, see the Vulkan Specification at URL

https://www.khronos.org/registry/vulkan/specs/1.0/xhtml/vkspec.html#VkBufferImageCopy

This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification,not directly.

COPYRIGHT

Copyright (c) 2014-2016 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.

AUTHOR

Khronos Group
    Author.