Class VkSubresourceLayout

  • All Implemented Interfaces:
    java.lang.AutoCloseable, NativeResource, Pointer

    public class VkSubresourceLayout
    extends Struct
    implements NativeResource
    Structure specifying subresource layout.
    Description

    If the image is linear, then rowPitch, arrayPitch and depthPitch describe the layout of the image subresource in linear memory. For uncompressed formats, rowPitch is the number of bytes between texels with the same x coordinate in adjacent rows (y coordinates differ by one). arrayPitch is the number of bytes between texels with the same x and y coordinate in adjacent array layers of the image (array layer values differ by one). depthPitch is the number of bytes between texels with the same x and y coordinate in adjacent slices of a 3D image (z coordinates differ by one). Expressed as an addressing formula, the starting byte of a texel in the image subresource has address:

    
     // (x,y,z,layer) are in texel coordinates
     address(x,y,z,layer) = layer*arrayPitch + z*depthPitch + y*rowPitch + x*elementSize + offset

    For compressed formats, the rowPitch is the number of bytes between compressed texel blocks in adjacent rows. arrayPitch is the number of bytes between compressed texel blocks in adjacent array layers. depthPitch is the number of bytes between compressed texel blocks in adjacent slices of a 3D image.

    
     // (x,y,z,layer) are in compressed texel block coordinates
     address(x,y,z,layer) = layer*arrayPitch + z*depthPitch + y*rowPitch + x*compressedTexelBlockByteSize + offset;

    arrayPitch is undefined for images that were not created as arrays. depthPitch is defined only for 3D images.

    If the image has a single-plane color format , then the aspectMask member of VkImageSubresource must be IMAGE_ASPECT_COLOR_BIT.

    If the image has a depth/stencil format , then aspectMask must be either IMAGE_ASPECT_DEPTH_BIT or IMAGE_ASPECT_STENCIL_BIT. On implementations that store depth and stencil aspects separately, querying each of these image subresource layouts will return a different offset and size representing the region of memory used for that aspect. On implementations that store depth and stencil aspects interleaved, the same offset and size are returned and represent the interleaved memory allocation.

    If the image has a multi-planar format , then the aspectMask member of VkImageSubresource must be IMAGE_ASPECT_PLANE_0_BIT, IMAGE_ASPECT_PLANE_1_BIT, or (for 3-plane formats only) IMAGE_ASPECT_PLANE_2_BIT. Querying each of these image subresource layouts will return a different offset and size representing the region of memory used for that plane. If the image is disjoint, then the offset is relative to the base address of the plane. If the image is non-disjoint, then the offset is relative to the base address of the image.

    See Also

    GetImageSubresourceLayout

    Member documentation

    • offset – the byte offset from the start of the image or the plane where the image subresource begins.
    • size – the size in bytes of the image subresource. size includes any extra memory that is required based on rowPitch.
    • rowPitch – describes the number of bytes between each row of texels in an image.
    • arrayPitch – describes the number of bytes between each array layer of an image.
    • depthPitch – describes the number of bytes between each slice of 3D image.

    Layout

    
     struct VkSubresourceLayout {
         VkDeviceSize offset;
         VkDeviceSize size;
         VkDeviceSize rowPitch;
         VkDeviceSize arrayPitch;
         VkDeviceSize depthPitch;
     }