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:
parent
304dad2d2e
commit
afd4e6e457
13
src/d3d9/shaders/d3d9_convert_common.h
Normal file
13
src/d3d9/shaders/d3d9_convert_common.h
Normal 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);
|
||||
}
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user