From eddc0c948e9d4a826a25a0056f4a9a4ee3694108 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Sun, 9 Jun 2019 22:18:40 +0200 Subject: [PATCH] ui/app/internal/gpu: fix stenciling on the iOS simulator It seems that the iOS simulator can return NaN from texture2D, so even though width == 0, the resulting cover is not. Signed-off-by: Elias Naur --- ui/app/internal/gpu/path.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/app/internal/gpu/path.go b/ui/app/internal/gpu/path.go index 94f7ed44..07ba8d3d 100644 --- a/ui/app/internal/gpu/path.go +++ b/ui/app/internal/gpu/path.go @@ -503,7 +503,10 @@ void main() { // around dy = 0. Scale slope with extent width. float areav = abs(dy*width)/16.0; // Look up coverage from y and slope and scale to extent. - gl_FragColor.r = texture2D(areaLUT, vec2(areau, areav)).r*width; + float cover = texture2D(areaLUT, vec2(areau, areav)).r*width; + if (width == 0.0) + cover = 0.0; // Needed on the iOS simulator. + gl_FragColor.r = cover; } `