mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-07 18:35:34 +00:00
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:
+7
-7
File diff suppressed because one or more lines are too long
@@ -29,15 +29,15 @@ void main() {
|
|||||||
float maxy = maxy + pathOffset.y;
|
float maxy = maxy + pathOffset.y;
|
||||||
vec2 pos;
|
vec2 pos;
|
||||||
float c = corner;
|
float c = corner;
|
||||||
if (c >= 0.5) {
|
if (c >= 0.375) {
|
||||||
c -= 0.5;
|
|
||||||
// North.
|
// North.
|
||||||
|
c -= 0.5;
|
||||||
pos.y = maxy + 1.0;
|
pos.y = maxy + 1.0;
|
||||||
} else {
|
} else {
|
||||||
// South.
|
// South.
|
||||||
pos.y = min(min(from.y, ctrl.y), to.y) - 1.0;
|
pos.y = min(min(from.y, ctrl.y), to.y) - 1.0;
|
||||||
}
|
}
|
||||||
if (c >= 0.25) {
|
if (c >= 0.125) {
|
||||||
// East.
|
// East.
|
||||||
pos.x = max(max(from.x, ctrl.x), to.x)+1.0;
|
pos.x = max(max(from.x, ctrl.x), to.x)+1.0;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user