gpu/shaders: use correct type for integer vector

OpenGL supports casting from int to float during vertex array
reading. Direct3D doesn't. Since we're transpiling from GLSL, we can't
directly use the Direct3D builtin "asint". So that leaves using
"ivec2" instead of vec2.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-02-26 20:50:45 +01:00
parent 7ff2f60412
commit 29d36e11ee
4 changed files with 19 additions and 10 deletions
+3 -3
View File
@@ -10,7 +10,7 @@ layout(binding = 0) uniform Block {
vec2 pathOffset;
};
layout(location=0) in vec2 corner;
layout(location=0) in ivec2 corner;
layout(location=1) in float maxy;
layout(location=2) in vec2 from;
layout(location=3) in vec2 ctrl;
@@ -29,14 +29,14 @@ void main() {
vec2 to = to + pathOffset;
float maxy = maxy + pathOffset.y;
vec2 pos;
if (corner.x > 0.0) {
if (corner.x > 0) {
// East.
pos.x = max(max(from.x, ctrl.x), to.x)+1.0;
} else {
// West.
pos.x = min(min(from.x, ctrl.x), to.x)-1.0;
}
if (corner.y > 0.0) {
if (corner.y > 0) {
// North.
pos.y = maxy + 1.0;
} else {