天天看点

DXGI FOMAT中的SNORM和 UNORM格式

  1. SNORM:表示归一化处理的有符号整数,这个格式的数据在资源(resource)中解释为有符号整数,在shader中则被解释为(-1.0...1.0)之间的浮点数,如DXGI_FORMAT_R8G8B8A8_SNORM。
Signed normalized integer; which is interpreted in a resource as a signed integer, and is interpreted in a shader as a signed normalized floating-point value in the range [-1, 1]. For an 2's complement number, the maximum value is 1.0f (a 5-bit value 01111 maps to 1.0f), and the minimum value is -1.0f (a 5-bit value 10000 maps to -1.0f). In addition, the second-minimum number maps to -1.0f (a 5-bit value 10001 maps to -1.0f). The resulting integer representations are evenly spaced floating-point values in the range (-1.0f...0.0f), and also a complementary set of representations for numbers in the range (0.0f...1.0f).
  1. UNORM:表示归一化处理的无符号整数,此种格式数据在资源中被解释为无符号整数,在shader中解释为(0.0...1.0)之间的浮点数,如DXGI_FORMAT_R8G8B8A8_UNORM。以2位无符号整数为例,00,01,10,11(即0,1,2,3),分别对应的浮点数为0.0,1/3,2/3,1.0。
    Unsigned normalized integer; which is interpreted in a resource as an unsigned integer, and is interpreted in a shader as an unsigned normalized floating-point value in the range [0, 1]. All 0's maps to 0.0f, and all 1's maps to 1.0f. A sequence of evenly spaced floating-point values from 0.0f to 1.0f are represented. For instance, a 2-bit UNORM represents 0.0f, 1/3, 2/3, and 1.0f.

继续阅读