Module vulkano::format

source ·
Expand description

Declares all the formats of data and images supported by Vulkan.

Content of this module

This module contains three things:

  • The Format enumeration, which contains all the available formats.
  • The FormatDesc trait.
  • One struct for each format.

Formats

List of suffixes:

  • Unorm means that the values are unsigned integers that are converted into floating points. The maximum possible representable value becomes 1.0, and the minimum representable value becomes 0.0. For example the value 255 in a R8Unorm will be interpreted as 1.0.

  • Snorm is the same as Unorm, but the integers are signed and the range is from -1.0 to 1.0 instead.

  • Uscaled means that the values are unsigned integers that are converted into floating points. No change in the value is done. For example the value 255 in a R8Uscaled will be interpreted as 255.0.

  • Sscaled is the same as Uscaled expect that the integers are signed.

  • Uint means that the values are unsigned integers. No conversion is performed.

  • Sint means that the values are signed integers. No conversion is performed.

  • Ufloat means that the values are unsigned floating points. No conversion is performed. This format is very unusual.

  • Sfloat means that the values are regular floating points. No conversion is performed.

  • Srgb is the same as Unorm, except that the value is interpreted as being in the sRGB color space. This means that its value will be converted to fit in the RGB color space when it is read. The fourth channel (usually used for alpha), if present, is not concerned by the conversion.

Choosing a format

The following formats are guaranteed to be supported for everything that is related to texturing (ie. blitting source and sampling them linearly). You should choose one of these formats if you have an image that you are going to sample from:

// TODO: use vulkano enums

  • B4G4R4A4_UNORM_PACK16
  • R5G6B5_UNORM_PACK16
  • A1R5G5B5_UNORM_PACK16
  • R8_UNORM
  • R8_SNORM
  • R8G8_UNORM
  • R8G8_SNORM
  • R8G8B8A8_UNORM
  • R8G8B8A8_SNORM
  • R8G8B8A8_SRGB
  • B8G8R8A8_UNORM
  • B8G8R8A8_SRGB
  • A8B8G8R8_UNORM_PACK32
  • A8B8G8R8_SNORM_PACK32
  • A8B8G8R8_SRGB_PACK32
  • A2B10G10R10_UNORM_PACK32
  • R16_SFLOAT
  • R16G16_SFLOAT
  • R16G16B16A16_SFLOAT
  • B10G11R11_UFLOAT_PACK32
  • E5B9G9R9_UFLOAT_PACK32

The following formats are guaranteed to be supported for everything that is related to intermediate render targets (ie. blitting destination, color attachment and sampling linearly):

// TODO: use vulkano enums

  • R5G6B5_UNORM_PACK16
  • A1R5G5B5_UNORM_PACK16
  • R8_UNORM
  • R8G8_UNORM
  • R8G8B8A8_UNORM
  • R8G8B8A8_SRGB
  • B8G8R8A8_UNORM
  • B8G8R8A8_SRGB
  • A8B8G8R8_UNORM_PACK32
  • A8B8G8R8_SRGB_PACK32
  • A2B10G10R10_UNORM_PACK32
  • R16_SFLOAT
  • R16G16_SFLOAT
  • R16G16B16A16_SFLOAT

For depth images, only D16Unorm is guaranteed to be supported. For depth-stencil images, it is guaranteed that either D24Unorm_S8Uint or D32Sfloat_S8Uint are supported.

// TODO: storage formats

Structs

Enums

Describes a uniform value that will be used to fill an image.
An enumeration of all the possible formats.

Traits

Some data whose type must be known by the library.
Trait for types that can possibly describe a float attachment.
Trait for types that can possibly describe a float or compressed attachment.