1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-11-29 10:24:10 +01:00

[d3d9] Use a common header for cs conversion helpers

This commit is contained in:
Joshua Ashton 2020-03-08 22:29:41 +00:00
parent 304dad2d2e
commit afd4e6e457
2 changed files with 16 additions and 14 deletions

View File

@ -0,0 +1,13 @@
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);
}

View File

@ -1,4 +1,7 @@
#version 450
#extension GL_GOOGLE_include_directive : enable
#include "d3d9_convert_common.h"
layout(
local_size_x = 8,
@ -15,20 +18,6 @@ uniform u_info_t {
uvec2 extent;
} u_info;
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);
}
void main() {
ivec3 thread_id = ivec3(gl_GlobalInvocationID);