Formats
Supported buffer and image formats may vary across implementations. A minimum set of format features are guaranteed, but others must be explicitly queried before use to ensure they are supported by the implementation.
The features for the set of formats (VkFormat) supported by the implementation are queried individually using the vkGetPhysicalDeviceFormatProperties command.
Format Definition
Compatible Formats of Planes of Multi-Planar Formats
Individual planes of multi-planar formats are size-compatible with single-plane color formats if they occupy the same number of bits per texel block, and are compatible with those formats if they have the same block extent.
In the following table, individual planes of a multi-planar format are compatible with the format listed against the relevant plane index for that multi-planar format, and any format compatible with the listed single-plane format according to Format Compatibility Classes. These planes are also size-compatible with any format that is size-compatible with the listed single-plane format.
Multi-planar Format Image Aspect
When using VkImageAspectFlagBits to select a plane of a multi-planar format, the following are the valid options:
- Two planes
VK_IMAGE_ASPECT_PLANE_0_BIT
VK_IMAGE_ASPECT_PLANE_1_BIT
- Three planes
VK_IMAGE_ASPECT_PLANE_0_BIT
VK_IMAGE_ASPECT_PLANE_1_BIT
VK_IMAGE_ASPECT_PLANE_2_BIT
Packed Formats
For the purposes of address alignment when accessing buffer memory containing vertex attribute or texel data, the following formats are considered packed - components of the texels or attributes are stored in bitfields packed into one or more 8-, 16-, or 32-bit fundamental data type.
{generated}/formats/packed.adoc
Identification of Formats
A format
is represented by a single enum value.
The name of a format is usually built up by using the following pattern:
VK_FORMAT_{component-format|compression-scheme}_{numeric-format}
The component-format indicates either the size of the R, G, B, and A components (if they are present) in the case of a color format, or the size of the depth (D) and stencil (S) components (if they are present) in the case of a depth/stencil format (see below). An X indicates a component that is unused, but may be present for padding.
The suffix _PACKnn
indicates that the format is packed into an
underlying type with nn
bits.
The suffix _mPACKnn
is a short-hand that indicates that the format has
m
groups of components (which may or may not be stored in separate
planes) that are each packed into an underlying type with nn
bits.
The suffix _BLOCK
indicates that the format is a block-compressed
format, with the representation of multiple pixels encoded interdependently
within a region.
For multi-planar images, the components in separate planes are separated
by underscores, and the number of planes is indicated by the addition of a
_2PLANE
or _3PLANE
suffix.
Similarly, the separate aspects of depth-stencil formats are separated by
underscores, although these are not considered separate planes.
Formats are suffixed by _422
to indicate that planes other than the
first are reduced in size by a factor of two horizontally or that the R and
B values appear at half the horizontal frequency of the G values, _420
to indicate that planes other than the first are reduced in size by a factor
of two both horizontally and vertically, and _444
for consistency to
indicate that all three planes of a three-planar image are the same size.
No common format has a single plane containing both R and B components but does not store these components at reduced horizontal resolution.
Representation and Texel Block Size
Color formats must be represented in memory in exactly the form indicated by the format’s name. This means that promoting one format to another with more bits per component and/or additional components must not occur for color formats. Depth/stencil formats have more relaxed requirements as discussed below.
Each format has a texel block size, the number of bytes used to store one texel block (a single addressable element of an uncompressed image, or a single compressed block of a compressed image). The texel block size for each format is shown in the Compatible formats table.
The representation of non-packed formats is that the first component specified in the name of the format is in the lowest memory addresses and the last component specified is in the highest memory addresses. See Byte mappings for non-packed/compressed color formats. The in-memory ordering of bytes within a component is determined by the host endianness.
Packed formats store multiple components within one underlying type. The bit representation is that the first component specified in the name of the format is in the most-significant bits and the last component specified is in the least-significant bits of the underlying type. The in-memory ordering of bytes comprising the underlying type is determined by the host endianness.
Depth/Stencil Formats
Depth/stencil formats are considered opaque and need not be stored in the exact number of bits per texel or component ordering indicated by the format enum. However, implementations must not substitute a different depth or stencil precision than is described in the format (e.g. D16 must not be implemented as D24 or D32).
Format Compatibility Classes
Uncompressed color formats are compatible with each other if they occupy
the same number of bits per texel block
as long as neither or both are alpha formats (e.g.,
VK_FORMAT_A8_UNORM_KHR
)
.
Compressed color formats are compatible with each other if the only
difference between them is the numeric format of
the uncompressed pixels.
Each depth/stencil format is only compatible with itself.
In the following table, all the formats in the
same row are compatible.
Each format has a defined texel block extent specifying how many texels
each texel block represents in each dimension.
Size Compatibility
Color formats with the same texel block size are considered
size-compatible as long as neither or both are alpha formats (e.g.,
VK_FORMAT_A8_UNORM_KHR
).
If two size-compatible formats have different block extents (i.e. for
compressed formats), then an image with size A × B × C in
one format with a block extent of a × b × c can be
represented as an image with size X × Y × Z in the other
format with block extent x × y × z at the ratio between
the block extents for each format, where
⌈A/a⌉ = ⌈X/x⌉⌈B/b⌉ = ⌈Y/y⌉⌈C/c⌉ = ⌈Z/z⌉
For example, a 7x3 image in the VK_FORMAT_ASTC_8x5_UNORM_BLOCK
format
can be represented as a 1x1 VK_FORMAT_R64G64_UINT
image.
Images created with the
VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT
flag can have
size-compatible views created from them to enable access via different
size-compatible formats.
Image views created in this way will be sized to match the expectations of
the block extents noted above.
Copy operations are able to copy between size-compatible formats in different resources to enable manipulation of data in different formats. The extent used in these copy operations always matches the source image, and is resized to the expectations of the block extents noted above for the destination image.
Format Properties
Potential Format Features
Some valid usage conditions depend on the format features supported by a VkImage whose VkImageTiling is unknown. In such cases the exact VkFormatFeatureFlagBits supported by the VkImage cannot be determined, so the valid usage conditions are expressed in terms of the potential format features of the VkImage format.
The potential format features of a VkFormat are defined as follows:
- The union of VkFormatFeatureFlagBits
and VkFormatFeatureFlagBits2,
supported when the VkImageTiling is
VK_IMAGE_TILING_OPTIMAL
,VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT
, orVK_IMAGE_TILING_LINEAR
if VkFormat is notVK_FORMAT_UNDEFINED
- VkAndroidHardwareBufferFormatPropertiesANDROID::
formatFeatures
and VkAndroidHardwareBufferFormatProperties2ANDROID::formatFeatures
of a valid external format if VkFormat isVK_FORMAT_UNDEFINED
- VkScreenBufferFormatPropertiesQNX::
formatFeatures
of a valid external format if VkFormat isVK_FORMAT_UNDEFINED
Required Format Support
Implementations must support at least the following set of features on the listed formats. For images, these features must be supported for every VkImageType (including arrayed and cube variants) unless otherwise noted. These features are supported on existing formats without needing to advertise an extension or needing to explicitly enable them. Support for additional functionality beyond the requirements listed here is queried using the vkGetPhysicalDeviceFormatProperties command.
Unless otherwise excluded below, the required formats are supported for all VkImageCreateFlags values as long as those flag values are otherwise allowed.
The following tables show which feature bits must be supported for each
format.
Formats that are required to support
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT
must also support
VK_FORMAT_FEATURE_TRANSFER_SRC_BIT
and
VK_FORMAT_FEATURE_TRANSFER_DST_BIT
.
If cubic filtering is supported,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT
must be
supported for the following image view types:
VK_IMAGE_VIEW_TYPE_2D
VK_IMAGE_VIEW_TYPE_2D_ARRAY
for the following formats:
VK_FORMAT_R4G4_UNORM_PACK8
VK_FORMAT_R4G4B4A4_UNORM_PACK16
VK_FORMAT_B4G4R4A4_UNORM_PACK16
VK_FORMAT_R5G6B5_UNORM_PACK16
VK_FORMAT_B5G6R5_UNORM_PACK16
VK_FORMAT_R5G5B5A1_UNORM_PACK16
VK_FORMAT_B5G5R5A1_UNORM_PACK16
VK_FORMAT_A1R5G5B5_UNORM_PACK16
VK_FORMAT_R8_UNORM
VK_FORMAT_R8_SNORM
VK_FORMAT_R8_SRGB
VK_FORMAT_R8G8_UNORM
VK_FORMAT_R8G8_SNORM
VK_FORMAT_R8G8_SRGB
VK_FORMAT_R8G8B8_UNORM
VK_FORMAT_R8G8B8_SNORM
VK_FORMAT_R8G8B8_SRGB
VK_FORMAT_B8G8R8_UNORM
VK_FORMAT_B8G8R8_SNORM
VK_FORMAT_B8G8R8_SRGB
VK_FORMAT_R8G8B8A8_UNORM
VK_FORMAT_R8G8B8A8_SNORM
VK_FORMAT_R8G8B8A8_SRGB
VK_FORMAT_B8G8R8A8_UNORM
VK_FORMAT_B8G8R8A8_SNORM
VK_FORMAT_B8G8R8A8_SRGB
VK_FORMAT_A8B8G8R8_UNORM_PACK32
VK_FORMAT_A8B8G8R8_SNORM_PACK32
VK_FORMAT_A8B8G8R8_SRGB_PACK32
If ETC compressed formats are supported,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT
must be
supported for the following image view types:
VK_IMAGE_VIEW_TYPE_2D
VK_IMAGE_VIEW_TYPE_2D_ARRAY
for the following additional formats:
VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK
VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK
VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK
VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK
VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK
VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK
If cubic filtering is supported for any other formats, the following image view types must be supported for those formats:
VK_IMAGE_VIEW_TYPE_2D
VK_IMAGE_VIEW_TYPE_2D_ARRAY
To be used with VkImageView
with subresourceRange.aspectMask
equal to VK_IMAGE_ASPECT_COLOR_BIT
, sampler Y′CBCR conversion must be enabled for the following formats:
Implementations are not required to support the
VK_IMAGE_CREATE_SPARSE_BINDING_BIT
,
VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT
, or
VK_IMAGE_CREATE_SPARSE_ALIASED_BIT
VkImageCreateFlags for the
above formats that require sampler Y′CBCR
conversion.
To determine whether the implementation supports sparse image creation flags
with these formats use vkGetPhysicalDeviceImageFormatProperties or
vkGetPhysicalDeviceImageFormatProperties2.
VK_FORMAT_FEATURE_FRAGMENT_DENSITY_MAP_BIT_EXT
must be supported for
the following formats if the fragmentDensityMap
feature is enabled:
VK_FORMAT_R8G8_UNORM
VK_FORMAT_FEATURE_ACCELERATION_STRUCTURE_VERTEX_BUFFER_BIT_KHR
must
be supported in bufferFeatures
for the following formats if the
accelerationStructure
feature is
supported:
VK_FORMAT_R32G32_SFLOAT
VK_FORMAT_R32G32B32_SFLOAT
VK_FORMAT_R16G16_SFLOAT
VK_FORMAT_R16G16B16A16_SFLOAT
VK_FORMAT_R16G16_SNORM
VK_FORMAT_R16G16B16A16_SNORM
VK_FORMAT_FEATURE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR
must be
supported for the following formats if the
attachmentFragmentShadingRate
feature is supported:
VK_FORMAT_R8_UINT
If VK_EXT_host_image_copy is supported and
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT
is supported in
optimalTilingFeatures
or linearTilingFeatures
for a color
format, VK_FORMAT_FEATURE_2_HOST_IMAGE_TRANSFER_BIT_EXT
must also be
supported in optimalTilingFeatures
or linearTilingFeatures
respectively.
Formats Without Shader Storage Format
The device-level features for using a storage image or a storage texel
buffer with an image format of Unknown
,
shaderStorageImageReadWithoutFormat
and
shaderStorageImageWriteWithoutFormat
, only apply to the following
formats:
VK_FORMAT_R8G8B8A8_UNORM
VK_FORMAT_R8G8B8A8_SNORM
VK_FORMAT_R8G8B8A8_UINT
VK_FORMAT_R8G8B8A8_SINT
VK_FORMAT_R32_UINT
VK_FORMAT_R32_SINT
VK_FORMAT_R32_SFLOAT
VK_FORMAT_R32G32_UINT
VK_FORMAT_R32G32_SINT
VK_FORMAT_R32G32_SFLOAT
VK_FORMAT_R32G32B32A32_UINT
VK_FORMAT_R32G32B32A32_SINT
VK_FORMAT_R32G32B32A32_SFLOAT
VK_FORMAT_R16G16B16A16_UINT
VK_FORMAT_R16G16B16A16_SINT
VK_FORMAT_R16G16B16A16_SFLOAT
VK_FORMAT_R16G16_SFLOAT
VK_FORMAT_B10G11R11_UFLOAT_PACK32
VK_FORMAT_R16_SFLOAT
VK_FORMAT_R16G16B16A16_UNORM
VK_FORMAT_A2B10G10R10_UNORM_PACK32
VK_FORMAT_R16G16_UNORM
VK_FORMAT_R8G8_UNORM
VK_FORMAT_R16_UNORM
VK_FORMAT_R8_UNORM
VK_FORMAT_R16G16B16A16_SNORM
VK_FORMAT_R16G16_SNORM
VK_FORMAT_R8G8_SNORM
VK_FORMAT_R16_SNORM
VK_FORMAT_R8_SNORM
VK_FORMAT_R16G16_SINT
VK_FORMAT_R8G8_SINT
VK_FORMAT_R16_SINT
VK_FORMAT_R8_SINT
VK_FORMAT_A2B10G10R10_UINT_PACK32
VK_FORMAT_R16G16_UINT
VK_FORMAT_R8G8_UINT
VK_FORMAT_R16_UINT
VK_FORMAT_R8_UINT
VK_FORMAT_A8_UNORM_KHR
This list of formats is the union of required storage formats from
Required Format Support section and
formats listed in shaderStorageImageExtendedFormats
.
An implementation that supports VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT
for any format from the given list of formats and supports
shaderStorageImageReadWithoutFormat
must support
VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT
for that same
format if Vulkan 1.3 or the VK_KHR_format_feature_flags2 extension
is supported.
An implementation that supports VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT
for any format from the given list of formats and supports
shaderStorageImageWriteWithoutFormat
must support
VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT
for that same
format if Vulkan 1.3 or the VK_KHR_format_feature_flags2 extension
is supported.
An implementation that does not support either of
VK_FORMAT_FEATURE_2_STORAGE_READ_WITHOUT_FORMAT_BIT
or
VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT
for a format
must not report support for VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT
or
VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT
for that format if it is
not listed in the SPIR-V and Vulkan Image Format
Compatibility table.
Some older implementations do not follow this restriction.
They report support for formats as storage images even though they do not
support access without the Format
qualifier and there is no matching
Format
token.
Such images cannot be either read from or written to.
Drivers which pass Vulkan conformance test suite version 1.3.9.0, or any subsequent version will conform to the requirement above.
Depth Comparison Format Support
If Vulkan 1.3 or the VK_KHR_format_feature_flags2 extension is
supported, a depth/stencil format with a depth component supporting
VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT
must support
VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_DEPTH_COMPARISON_BIT
.
Format Feature Dependent Usage Flags
Certain resource usage flags depend on support for the corresponding format feature flag for the format in question. The following tables list the VkBufferUsageFlagBits and VkImageUsageFlagBits that have such dependencies, and the format feature flags they depend on. Additional restrictions, including, but not limited to, further required format feature flags specific to the particular use of the resource may apply, as described in the respective sections of this specification.