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 <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-06-09 22:18:40 +02:00
parent 0138544242
commit eddc0c948e
+4 -1
View File
@@ -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;
}
`