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 is NULL or a pointer to an extension-specific structure.

  • flags is reserved for future use.

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

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

  • format is a VkFormat describing the format and type used to interpret data elements 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

If image was created with the VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT flag, format can be different from the image’s format, but if 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.

Table 1. Image and image view parameter compatibility requirements
Dim, Arrayed, MS Image parameters View parameters

imageType = ci.imageType
width = ci.extent.width
height = ci.extent.height
depth = ci.extent.depth
arrayLayers = ci.arrayLayers
samples = ci.samples
flags = ci.flags
where ci is the VkImageCreateInfo used to create image.

baseArrayLayer and layerCount are members of the subresourceRange member.

1D, 0, 0

imageType = VK_IMAGE_TYPE_1D
width ≥ 1
height = 1
depth = 1
arrayLayers ≥ 1
samples = 1

viewType = VK_IMAGE_VIEW_TYPE_1D
baseArrayLayer ≥ 0
layerCount = 1

1D, 1, 0

imageType = VK_IMAGE_TYPE_1D
width ≥ 1
height = 1
depth = 1
arrayLayers ≥ 1
samples = 1

viewType = VK_IMAGE_VIEW_TYPE_1D_ARRAY
baseArrayLayer ≥ 0
layerCount ≥ 1

2D, 0, 0

imageType = VK_IMAGE_TYPE_2D
width ≥ 1
height ≥ 1
depth = 1
arrayLayers ≥ 1
samples = 1

viewType = VK_IMAGE_VIEW_TYPE_2D
baseArrayLayer ≥ 0
layerCount = 1

2D, 1, 0

imageType = VK_IMAGE_TYPE_2D
width ≥ 1
height ≥ 1
depth = 1
arrayLayers ≥ 1
samples = 1

viewType = VK_IMAGE_VIEW_TYPE_2D_ARRAY
baseArrayLayer ≥ 0
layerCount ≥ 1

2D, 0, 1

imageType = VK_IMAGE_TYPE_2D
width ≥ 1
height ≥ 1
depth = 1
arrayLayers ≥ 1
samples > 1

viewType = VK_IMAGE_VIEW_TYPE_2D
baseArrayLayer ≥ 0
layerCount = 1

2D, 1, 1

imageType = VK_IMAGE_TYPE_2D
width ≥ 1
height ≥ 1
depth = 1
arrayLayers ≥ 1
samples > 1

viewType = VK_IMAGE_VIEW_TYPE_2D_ARRAY
baseArrayLayer ≥ 0
layerCount ≥ 1

CUBE, 0, 0

imageType = VK_IMAGE_TYPE_2D
width ≥ 1
height = width
depth = 1
arrayLayers ≥ 6
samples = 1
flags includes VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT

viewType = VK_IMAGE_VIEW_TYPE_CUBE
baseArrayLayer ≥ 0
layerCount = 6

CUBE, 1, 0

imageType = VK_IMAGE_TYPE_2D
width ≥ 1
height = width
depth = 1
N ≥ 1
arrayLayers ≥ 6 × N
samples = 1
flags includes VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT

viewType = VK_IMAGE_VIEW_TYPE_CUBE_ARRAY
baseArrayLayer ≥ 0
layerCount = 6 × N, N ≥ 1

3D, 0, 0

imageType = VK_IMAGE_TYPE_3D
width ≥ 1
height ≥ 1
depth ≥ 1
arrayLayers = 1
samples = 1

viewType = VK_IMAGE_VIEW_TYPE_3D
baseArrayLayer = 0
layerCount = 1

Valid Usage
  • If image was not created with VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT then viewType must not be VK_IMAGE_VIEW_TYPE_CUBE or VK_IMAGE_VIEW_TYPE_CUBE_ARRAY

  • If the image cubemap arrays feature is not enabled, viewType must not be VK_IMAGE_VIEW_TYPE_CUBE_ARRAY

  • If image was created with VK_IMAGE_TILING_LINEAR, format must be format that has at least one supported feature bit present in the value of VkFormatProperties::linearTilingFeatures returned by vkGetPhysicalDeviceFormatProperties with the same value of format

  • image must have been created with a usage value containing at least one of VK_IMAGE_USAGE_SAMPLED_BIT, VK_IMAGE_USAGE_STORAGE_BIT, VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, or VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT

  • If image was created with VK_IMAGE_TILING_LINEAR and usage contains VK_IMAGE_USAGE_SAMPLED_BIT, format must be supported for sampled images, as specified by the VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT flag in VkFormatProperties::linearTilingFeatures returned by vkGetPhysicalDeviceFormatProperties with the same value of format

  • If image was created with VK_IMAGE_TILING_LINEAR and usage contains VK_IMAGE_USAGE_STORAGE_BIT, format must be supported for storage images, as specified by the VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT flag in VkFormatProperties::linearTilingFeatures returned by vkGetPhysicalDeviceFormatProperties with the same value of format

  • If image was created with VK_IMAGE_TILING_LINEAR and usage contains VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, format must be supported for color attachments, as specified by the VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT flag in VkFormatProperties::linearTilingFeatures returned by vkGetPhysicalDeviceFormatProperties with the same value of format

  • If image was created with VK_IMAGE_TILING_LINEAR and usage contains VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, format must be supported for depth/stencil attachments, as specified by the VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT flag in VkFormatProperties::linearTilingFeatures returned by vkGetPhysicalDeviceFormatProperties with the same value of format

  • If image was created with VK_IMAGE_TILING_OPTIMAL, format must be format that has at least one supported feature bit present in the value of VkFormatProperties::optimalTilingFeatures returned by vkGetPhysicalDeviceFormatProperties with the same value of format

  • If image was created with VK_IMAGE_TILING_OPTIMAL and usage contains VK_IMAGE_USAGE_SAMPLED_BIT, format must be supported for sampled images, as specified by the VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT flag in VkFormatProperties::optimalTilingFeatures returned by vkGetPhysicalDeviceFormatProperties with the same value of format

  • If image was created with VK_IMAGE_TILING_OPTIMAL and usage contains VK_IMAGE_USAGE_STORAGE_BIT, format must be supported for storage images, as specified by the VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT flag in VkFormatProperties::optimalTilingFeatures returned by vkGetPhysicalDeviceFormatProperties with the same value of format

  • If image was created with VK_IMAGE_TILING_OPTIMAL and usage contains VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, format must be supported for color attachments, as specified by the VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT flag in VkFormatProperties::optimalTilingFeatures returned by vkGetPhysicalDeviceFormatProperties with the same value of format

  • If image was created with VK_IMAGE_TILING_OPTIMAL and usage contains VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, format must be supported for depth/stencil attachments, as specified by the VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT flag in VkFormatProperties::optimalTilingFeatures returned by vkGetPhysicalDeviceFormatProperties with the same value of format

  • subresourceRange.baseMipLevel must be less than the mipLevels specified in VkImageCreateInfo when image was created

  • If subresourceRange.levelCount is not VK_REMAINING_MIP_LEVELS, subresourceRange.baseMipLevel + subresourceRange.levelCount must be less than or equal to the mipLevels specified in VkImageCreateInfo when image was created

  • subresourceRange.baseArrayLayer must be less than the arrayLayers specified in VkImageCreateInfo when image was created

  • If subresourceRange.layerCount is not VK_REMAINING_ARRAY_LAYERS, subresourceRange.baseArrayLayer + subresourceRange.layerCount must be less than or equal to the arrayLayers specified in VkImageCreateInfo when image was created

  • If image was created with the VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT flag, format must be compatible with the format used to create image, as defined in Format Compatibility Classes

  • If image was not created with the VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT flag, format must be identical to the format used to create image

  • If image is non-sparse then it must be bound completely and contiguously to a single VkDeviceMemory object

  • subresourceRange and viewType must be compatible with the image, as described in the compatibility table

Valid Usage (Implicit)
  • sType must be VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO

  • pNext must be NULL

  • flags must be 0

  • image must be a valid VkImage handle

  • viewType must be a valid VkImageViewType value

  • format must be a valid VkFormat value

  • components must be a valid VkComponentMapping structure

  • subresourceRange must be a valid VkImageSubresourceRange structure

See Also

Document Notes

For more information, see the Vulkan Specification at URL

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

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