VkImageViewCreateInfo(3)

Name

VkImageViewCreateInfo - Structure specifying parameters of a newly created image view

C Specification

The VkImageViewCreateInfo structure is defined as:

// Provided by VK_VERSION_1_0
typedef struct VkImageViewCreateInfo {
    VkStructureType            sType;
    const void*                pNext;
    VkImageViewCreateFlags     flags;
    VkImage                    image;
    VkImageViewType            viewType;
    VkFormat                   format;
    VkComponentMapping         components;
    VkImageSubresourceRange    subresourceRange;
} VkImageViewCreateInfo;

Members

  • sType is a VkStructureType value identifying this structure.

  • pNext is NULL or a pointer to a structure extending this structure.

  • flags is a bitmask of VkImageViewCreateFlagBits specifying additional parameters of the image view.

  • image is a VkImage on which the view will be created.

  • viewType is a VkImageViewType value specifying the type of the image view.

  • format is a VkFormat specifying the format and type used to interpret texel blocks of the image.

  • components is a VkComponentMapping structure specifying a remapping of color components (or of depth or stencil components after they have been converted into color components).

  • subresourceRange is a VkImageSubresourceRange structure selecting the set of mipmap levels and array layers to be accessible to the view.

Description

Some of the image creation parameters are inherited by the view. In particular, image view creation inherits the implicit parameter usage specifying the allowed usages of the image view that, by default, takes the value of the corresponding usage parameter specified in VkImageCreateInfo at image creation time. The implicit usage can be overridden by adding a VkImageViewUsageCreateInfo or VkImageViewUsage2CreateInfoKHR structure to the pNext chain, but the view usage must be a subset of the image usage. If image has a depth-stencil format and was created with a VkImageStencilUsageCreateInfo structure included in the pNext chain of VkImageCreateInfo, the usage is calculated based on the subresourceRange.aspectMask provided:

If image is a 3D image, its Z range can be restricted to a subset by adding a VkImageViewSlicedCreateInfoEXT to the pNext chain.

If image was not created with VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT, format must equal the format used to create image.

If image was created with VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT, format can be set to a format that is compatible with the format used to create image with the following exceptions:

Views of compatible formats will have the same mapping between texel coordinates and memory locations irrespective of the format, with only the interpretation of the bit pattern changing.

Values intended to be used with one view format may not be exactly preserved when written or read through a different format. For example, an integer value that happens to have the bit pattern of a floating-point denorm or NaN may be flushed or canonicalized when written or read through a view with a floating-point format. Similarly, a value written through a signed normalized format that has a bit pattern exactly equal to -2b may be changed to -2b + 1 as described in Conversion from Normalized Fixed-Point to Floating-Point.

The texel dimensions of the view are derived as follows:

If subresourceRange.aspectMask is one of the multi-planar aspect mask bits, a single-plane image view will be created. The image of a single-plane view must have been created with a multi-planar format and the VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT create flag.

The set of plane view formats for the plane is the compatible plane format and the formats compatible with it.

The plane view dimensions are derived from the dimensions of the image in the manner listed for plane compatibility for the plane.

The plane view’s aspect mask is considered to be equivalent to VK_IMAGE_ASPECT_COLOR_BIT when used as a framebuffer attachment.

If the format of the image is a multi-planar format and subresourceRange.aspectMask is equal to VK_IMAGE_ASPECT_COLOR_BIT, a multi-plane image view will be created.

The VkComponentMapping components member describes a remapping from components of the image to components of the vector returned by shader image instructions. This remapping must be the identity swizzle for any VkImageView used with a combined image sampler that enables sampler Y′CBCR conversion, input attachment descriptors, framebuffer attachments, and storage image descriptors.

Image views with formats that require YCBCR conversion and usage containing VK_IMAGE_USAGE_SAMPLED_BIT or external formats must be created with a VkSamplerYcbcrConversionInfo structure in the pNext chain to be used with sampling. Any image view created with a VkSamplerYcbcrConversionInfo structure in the pNext chain must only be sampled using a sampler with an identically defined VkSamplerYcbcrConversion. When used in a video coding operation, the specified sampler Y′CBCR conversion has no effect.

Table 1. Image Type and Image View Type Compatibility Requirements
Image View Type Compatible Image Types

VK_IMAGE_VIEW_TYPE_1D

VK_IMAGE_TYPE_1D

VK_IMAGE_VIEW_TYPE_1D_ARRAY

VK_IMAGE_TYPE_1D

VK_IMAGE_VIEW_TYPE_2D

VK_IMAGE_TYPE_2D , VK_IMAGE_TYPE_3D

VK_IMAGE_VIEW_TYPE_2D_ARRAY

VK_IMAGE_TYPE_2D , VK_IMAGE_TYPE_3D

VK_IMAGE_VIEW_TYPE_CUBE

VK_IMAGE_TYPE_2D

VK_IMAGE_VIEW_TYPE_CUBE_ARRAY

VK_IMAGE_TYPE_2D

VK_IMAGE_VIEW_TYPE_3D

VK_IMAGE_TYPE_3D

Valid Usage
Valid Usage (Implicit)

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.