gpu: drop use of integer shader inputs

They're a pain to support. Encode the single integer value we have
as a float instead.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-02-27 21:04:55 +01:00
parent 3043c4243a
commit 591c89ab0a
5 changed files with 52 additions and 43 deletions
+11 -9
View File
@@ -9,7 +9,7 @@ layout(binding = 0) uniform Block {
vec2 pathOffset;
};
layout(location=0) in ivec2 corner;
layout(location=0) in float corner;
layout(location=1) in float maxy;
layout(location=2) in vec2 from;
layout(location=3) in vec2 ctrl;
@@ -28,20 +28,22 @@ void main() {
vec2 to = to + pathOffset;
float maxy = maxy + pathOffset.y;
vec2 pos;
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) {
float c = corner;
if (c >= 0.5) {
c -= 0.5;
// North.
pos.y = maxy + 1.0;
} else {
// South.
pos.y = min(min(from.y, ctrl.y), to.y) - 1.0;
}
if (c >= 0.25) {
// 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;
}
vFrom = from-pos;
vCtrl = ctrl-pos;
vTo = to-pos;