1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-13 07:54:32 +01:00
dxvk/src/d3d9/shaders/d3d9_convert_common.h

13 lines
325 B
C
Raw Normal View History

float unormalize(uint value, int bits) {
const int range = (1 << bits) - 1;
return float(value) / float(range);
}
float snormalize(int value, int bits) {
const int range = (1 << (bits - 1)) - 1;
// Min because, -32 and -31 map to -1.0f, and we
// divide by 31.
return max(float(value) / float(range), -1.0f);
}