gpu/shaders: be more robust against floating point inaccuracies

We're forced by compatibility to encode an integer state into a
floating point. Make the implicit conversion from floating point to
integer more robust against GPUs with low precision floats.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-02-29 14:23:26 +01:00
parent 148a2828e7
commit 8405bf0e47
2 changed files with 10 additions and 10 deletions
+3 -3
View File
@@ -29,15 +29,15 @@ void main() {
float maxy = maxy + pathOffset.y;
vec2 pos;
float c = corner;
if (c >= 0.5) {
c -= 0.5;
if (c >= 0.375) {
// North.
c -= 0.5;
pos.y = maxy + 1.0;
} else {
// South.
pos.y = min(min(from.y, ctrl.y), to.y) - 1.0;
}
if (c >= 0.25) {
if (c >= 0.125) {
// East.
pos.x = max(max(from.x, ctrl.x), to.x)+1.0;
} else {