C Specification
The VkImageViewCreateInfo
structure is defined as:
typedef struct VkImageViewCreateInfo {
VkStructureType sType;
const void* pNext;
VkImageViewCreateFlags flags;
VkImage image;
VkImageViewType viewType;
VkFormat format;
VkComponentMapping components;
VkImageSubresourceRange subresourceRange;
} VkImageViewCreateInfo;
Members
-
sType
is the type of this structure. -
pNext
isNULL
or a pointer to an extension-specific structure. -
flags
is a bitmask of VkImageViewCreateFlagBits describing 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 describing the format and type used to interpret texel blocks in the image. -
components
is a VkComponentMapping specifies a remapping of color components (or of depth or stencil components after they have been converted into color components). -
subresourceRange
is a VkImageSubresourceRange 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.
If the image was has a depth-stencil format and was created with an instance
of VkImageStencilUsageCreateInfoEXT in the pNext
chain of
VkImageCreateInfo, the usage is calculated based on the
subresource.aspectMask
provided:
-
If
aspectMask
includes onlyVK_IMAGE_ASPECT_STENCIL_BIT
, the implicitusage
is equal to VkImageStencilUsageCreateInfoEXT::stencilUsage
. -
If
aspectMask
includes onlyVK_IMAGE_ASPECT_DEPTH_BIT
, the implicitusage
is equal to VkImageCreateInfo::usage
. -
If both aspects are included in
aspectMask
, the implicitusage
is equal to the intersection of VkImageCreateInfo::usage
and VkImageStencilUsageCreateInfoEXT::stencilUsage
. The implicitusage
can be overriden by including an instance of VkImageViewUsageCreateInfo structure in thepNext
chain.
If image
was created with the VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT
flag,
and if the format
of the image is not
multi-planar,
format
can be different from the image’s format, but if
image
was created without the
VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT
flag and
they are not equal they must be compatible.
Image format compatibility is defined in the
Format Compatibility Classes section.
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.
Note
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. |
If image
was created with the
VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT
flag, format
must be compatible with the image’s format as described above, or must
be an uncompressed format in which case it must be size-compatible with
the image’s format, as defined for
copying data between images In
this case the resulting image view’s texel dimensions equal the dimensions
of the selected mip level divided by the compressed texel block size and
rounded up.
If the image view is to be used with a sampler which supports
sampler Y’CBCR conversion, an identically
defined object of type VkSamplerYcbcrConversion to that used to
create the sampler must be passed to vkCreateImageView in a
VkSamplerYcbcrConversionInfo added to the pNext
chain of
VkImageViewCreateInfo.
Conversely, if a VkSamplerYcbcrConversion object is passed to
vkCreateImageView, an identically defined
VkSamplerYcbcrConversion object must be used when sampling the image.
If the image has a
multi-planar format
and
subresourceRange.aspectMask
is VK_IMAGE_ASPECT_COLOR_BIT
,
format
must be identical to the image format
, and the sampler
to be used with the image view must enable
sampler Y’CBCR conversion.
If image
was created with the VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT
and the image has a
multi-planar format
,
and if subresourceRange.aspectMask
is
VK_IMAGE_ASPECT_PLANE_0_BIT
, VK_IMAGE_ASPECT_PLANE_1_BIT
, or
VK_IMAGE_ASPECT_PLANE_2_BIT
, format
must be
compatible with the corresponding plane of the
image, and the sampler to be used with the image view must not enable
sampler Y’CBCR conversion.
The width
and height
of the single-plane image view must be
derived from the multi-planar image’s dimensions in the manner listed for
plane compatibility for the plane.
Any view of an image plane will have the same mapping between texel coordinates and memory locations as used by the channels of the color aspect, subject to the formulae relating texel coordinates to lower-resolution planes as described in Chroma Reconstruction. That is, if an R or B plane has a reduced resolution relative to the G plane of the multi-planar image, the image view operates using the (uplane, vplane) unnormalized coordinates of the reduced-resolution plane, and these coordinates access the same memory locations as the (ucolor, vcolor) unnormalized coordinates of the color aspect for which chroma reconstruction operations operate on the same (uplane, vplane) or (iplane, jplane) coordinates.
Dim, Arrayed, MS | Image parameters | View parameters |
---|---|---|
|
|
|
1D, 0, 0 |
|
|
1D, 1, 0 |
|
|
2D, 0, 0 |
|
|
2D, 1, 0 |
|
|
2D, 0, 1 |
|
|
2D, 1, 1 |
|
|
CUBE, 0, 0 |
|
|
CUBE, 1, 0 |
|
|
3D, 0, 0 |
|
|
3D, 0, 0 |
|
|
3D, 0, 0 |
|
|
See Also
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.
Copyright
Copyright (c) 2014-2019 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.