graphics: Remove one unnecessary check from fragment shader (#461)

This commit is contained in:
Hajime Hoshi 2017-12-16 01:42:36 +09:00
parent d6878d6887
commit d45a975e3d

View File

@ -72,13 +72,10 @@ varying highp vec2 varying_tex_coord_max;
highp vec2 roundTexel(highp vec2 p) {
// highp (relative) precision is 2^(-16) in the spec.
// As the maximum source size is 4096, the minimum value for a denominator is
// 65536 (= 4096 * 16).
highp vec2 factor = 1.0 / (source_size * 16.0);
if (factor.x * 0.5 > 0.0 && factor.y * 0.5 > 0.0) {
p.x -= mod(p.x + factor.x * 0.5, factor.x) - factor.x * 0.5;
p.y -= mod(p.y + factor.y * 0.5, factor.y) - factor.y * 0.5;
}
// The minimum value for a denominator is half of 65536.
highp float factor = 1.0 / 32768.0;
p.x -= mod(p.x + factor * 0.5, factor) - factor * 0.5;
p.y -= mod(p.y + factor * 0.5, factor) - factor * 0.5;
return p;
}