Class VkImageSubresourceRange

java.lang.Object
org.lwjgl.system.Pointer.Default
org.lwjgl.system.Struct<VkImageSubresourceRange>
org.lwjgl.vulkan.VkImageSubresourceRange
All Implemented Interfaces:
AutoCloseable, org.lwjgl.system.NativeResource, org.lwjgl.system.Pointer

public class VkImageSubresourceRange extends org.lwjgl.system.Struct<VkImageSubresourceRange> implements org.lwjgl.system.NativeResource
Structure specifying an image subresource range.
Description

The number of mipmap levels and array layers must be a subset of the image subresources in the image. If an application wants to use all mip levels or layers in an image after the baseMipLevel or baseArrayLayer, it can set levelCount and layerCount to the special values REMAINING_MIP_LEVELS and REMAINING_ARRAY_LAYERS without knowing the exact number of mip levels or layers.

For cube and cube array image views, the layers of the image view starting at baseArrayLayer correspond to faces in the order +X, -X, +Y, -Y, +Z, -Z. For cube arrays, each set of six sequential layers is a single cube, so the number of cube maps in a cube map array view is layerCount / 6, and image array layer (baseArrayLayer + i) is face index (i mod 6) of cube i / 6. If the number of layers in the view, whether set explicitly in layerCount or implied by REMAINING_ARRAY_LAYERS, is not a multiple of 6, the last cube map in the array must not be accessed.

aspectMask must be only IMAGE_ASPECT_COLOR_BIT, IMAGE_ASPECT_DEPTH_BIT or IMAGE_ASPECT_STENCIL_BIT if format is a color, depth-only or stencil-only format, respectively, except if format is a multi-planar format. If using a depth/stencil format with both depth and stencil components, aspectMask must include at least one of IMAGE_ASPECT_DEPTH_BIT and IMAGE_ASPECT_STENCIL_BIT, and can include both.

When the VkImageSubresourceRange structure is used to select a subset of the slices of a 3D image’s mip level in order to create a 2D or 2D array image view of a 3D image created with IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT, baseArrayLayer and layerCount specify the first slice index and the number of slices to include in the created image view. Such an image view can be used as a framebuffer attachment that refers only to the specified range of slices of the selected mip level. However, any layout transitions performed on such an attachment view during a render pass instance still apply to the entire subresource referenced which includes all the slices of the selected mip level.

When using an image view of a depth/stencil image to populate a descriptor set (e.g. for sampling in the shader, or for use as an input attachment), the aspectMask must only include one bit, which selects whether the image view is used for depth reads (i.e. using a floating-point sampler or input attachment in the shader) or stencil reads (i.e. using an unsigned integer sampler or input attachment in the shader). When an image view of a depth/stencil image is used as a depth/stencil framebuffer attachment, the aspectMask is ignored and both depth and stencil image subresources are used.

When creating a VkImageView, if sampler Y′CBCR conversion is enabled in the sampler, the aspectMask of a subresourceRange used by the VkImageView must be IMAGE_ASPECT_COLOR_BIT.

When creating a VkImageView, if sampler Y′CBCR conversion is not enabled in the sampler and the image format is multi-planar, the image must have been created with IMAGE_CREATE_MUTABLE_FORMAT_BIT, and the aspectMask of the VkImageView’s subresourceRange must be IMAGE_ASPECT_PLANE_0_BIT, IMAGE_ASPECT_PLANE_1_BIT or IMAGE_ASPECT_PLANE_2_BIT.

Valid Usage
Valid Usage (Implicit)
  • aspectMask must be a valid combination of VkImageAspectFlagBits values
  • aspectMask must not be 0
See Also

VkHostImageLayoutTransitionInfo, VkImageMemoryBarrier, VkImageMemoryBarrier2, VkImageViewCreateInfo, CmdClearColorImage, CmdClearDepthStencilImage

Layout


 struct VkImageSubresourceRange {
     VkImageAspectFlags aspectMask();
     uint32_t baseMipLevel();
     uint32_t levelCount();
     uint32_t baseArrayLayer();
     uint32_t layerCount();
 }
  • Field Details

    • SIZEOF

      public static final int SIZEOF
      The struct size in bytes.
    • ALIGNOF

      public static final int ALIGNOF
      The struct alignment in bytes.
    • ASPECTMASK

      public static final int ASPECTMASK
      The struct member offsets.
    • BASEMIPLEVEL

      public static final int BASEMIPLEVEL
      The struct member offsets.
    • LEVELCOUNT

      public static final int LEVELCOUNT
      The struct member offsets.
    • BASEARRAYLAYER

      public static final int BASEARRAYLAYER
      The struct member offsets.
    • LAYERCOUNT

      public static final int LAYERCOUNT
      The struct member offsets.
  • Constructor Details

    • VkImageSubresourceRange

      public VkImageSubresourceRange(ByteBuffer container)
      Creates a VkImageSubresourceRange instance at the current position of the specified ByteBuffer container. Changes to the buffer's content will be visible to the struct instance and vice versa.

      The created instance holds a strong reference to the container object.

  • Method Details