vulkan/数据格式说明- normalized

  • VK_FORMAT_A8B8G8R8_UNORM_PACK32

  • VK_FORMAT_A8B8G8R8_SNORM_PACK32

  • VK_FORMAT_A8B8G8R8_USCALED_PACK32

  • VK_FORMAT_A8B8G8R8_SSCALED_PACK32

  • VK_FORMAT_A8B8G8R8_UINT_PACK32

 

引用规范中的 Identification of Formats 和 Conversion from Normalized Fixed-Point to Floating-Point

  • UNORM 是 float 范围内的 [0, 1] 。
  • SNORM 相同,但在 [-1, 1]
的范围内
  • USCALED 是转换为 float
的无符号整数值
  • SSCALED 是转换为 float
的整数值
  • UINT是一个无符号整数
  • SINT 是有符号整数

对于 VK_FORMAT_R8_* :
  • 用于 UNORM 原始 0 将给出 0.0f ,原始 255 将给出 1.0f
  • 用于 SNORM 原始 -127 (resp. 129 ) 将给出 -1.0f ,原始 127 将给出 1.0f
  • USCALED 原始 0 将给出 0.0f ,原始 255 将给出 255.0f
  • SSCALED raw -128 (resp. 128 ) 会给出 -128.0f , raw 127 会给出 127.0f
  -128 (-2n-1) 在 SNORM 中没有意义,只是简单地钳制到 -1.0f 。
 

33.1.3. 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.

  • Packed into 8-bit data types:

    • VK_FORMAT_R4G4_UNORM_PACK8

  • Packed into 16-bit data types:

    • 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_R10X6_UNORM_PACK16

    • VK_FORMAT_R10X6G10X6_UNORM_2PACK16

    • VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16

    • VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16

    • VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16

    • VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16

    • VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16

    • VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16

    • VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16

    • VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16

    • VK_FORMAT_R12X4_UNORM_PACK16

    • VK_FORMAT_R12X4G12X4_UNORM_2PACK16

    • VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16

    • VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16

    • VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16

    • VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16

    • VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16

    • VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16

    • VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16

    • VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16

  • Packed into 32-bit data types:

    • VK_FORMAT_A8B8G8R8_UNORM_PACK32

    • VK_FORMAT_A8B8G8R8_SNORM_PACK32

    • VK_FORMAT_A8B8G8R8_USCALED_PACK32

    • VK_FORMAT_A8B8G8R8_SSCALED_PACK32

    • VK_FORMAT_A8B8G8R8_UINT_PACK32

    • VK_FORMAT_A8B8G8R8_SINT_PACK32

    • VK_FORMAT_A8B8G8R8_SRGB_PACK32

    • VK_FORMAT_A2R10G10B10_UNORM_PACK32

    • VK_FORMAT_A2R10G10B10_SNORM_PACK32

    • VK_FORMAT_A2R10G10B10_USCALED_PACK32

    • VK_FORMAT_A2R10G10B10_SSCALED_PACK32

    • VK_FORMAT_A2R10G10B10_UINT_PACK32

    • VK_FORMAT_A2R10G10B10_SINT_PACK32

    • VK_FORMAT_A2B10G10R10_UNORM_PACK32

    • VK_FORMAT_A2B10G10R10_SNORM_PACK32

    • VK_FORMAT_A2B10G10R10_USCALED_PACK32

    • VK_FORMAT_A2B10G10R10_SSCALED_PACK32

    • VK_FORMAT_A2B10G10R10_UINT_PACK32

    • VK_FORMAT_A2B10G10R10_SINT_PACK32

    • VK_FORMAT_B10G11R11_UFLOAT_PACK32

    • VK_FORMAT_E5B9G9R9_UFLOAT_PACK32

    • VK_FORMAT_X8_D24_UNORM_PACK32

33.1.4. 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.

 
Table 34. Interpretation of Numeric Format
Numeric formatType-Declaration instructionsNumeric typeDescription

UNORM

OpTypeFloat

floating-point

The components are unsigned normalized values in the range [0,1]

SNORM

OpTypeFloat

floating-point

The components are signed normalized values in the range [-1,1]

USCALED

OpTypeFloat

floating-point

The components are unsigned integer values that get converted to floating-point in the range [0,2n-1]

SSCALED

OpTypeFloat

floating-point

The components are signed integer values that get converted to floating-point in the range [-2n-1,2n-1-1]

UINT

OpTypeInt

unsigned integer

The components are unsigned integer values in the range [0,2n-1]

SINT

OpTypeInt

signed integer

The components are signed integer values in the range [-2n-1,2n-1-1]

UFLOAT

OpTypeFloat

floating-point

The components are unsigned floating-point numbers (used by packed, shared exponent, and some compressed formats)

SFLOAT

OpTypeFloat

floating-point

The components are signed floating-point numbers

SRGB

OpTypeFloat

floating-point

The R, G, and B components are unsigned normalized values that represent values using sRGB nonlinear encoding, while the A component (if one exists) is a regular unsigned normalized value

n is the number of bits in the component.

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.

Table 35. Interpretation of Compression Scheme
Compression schemeDescription

BC

Block Compression. See Block-Compressed Image Formats.

ETC2

Ericsson Texture Compression. See ETC Compressed Image Formats.

EAC

ETC2 Alpha Compression. See ETC Compressed Image Formats.

ASTC

Adaptive Scalable Texture Compression (LDR Profile). See ASTC Compressed Image Formats.


 

 

 

posted @ 2024-01-18 19:49  经纬视界  阅读(86)  评论(0编辑  收藏  举报