mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-04 17:05:38 +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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user