Fix flipped inequality in the shader causing AA artefacts

This commit is contained in:
Patrick Walton 2017-08-19 11:37:06 -07:00
parent 9f194b7618
commit 9b3f9d029c
3 changed files with 3 additions and 8 deletions

View File

@ -1255,17 +1255,12 @@ class ECAAStrategy implements AntialiasingStrategy {
this.detectEdges(view);
// Conservatively cover.
//if (view.timerQueryPollInterval == null)
// view.timerQueryExt.beginQueryEXT(view.timerQueryExt.TIME_ELAPSED_EXT, view.timerQuery);
this.cover(view);
// Antialias.
this.antialiasLines(view);
this.antialiasCurves(view);
//if (view.timerQueryPollInterval == null)
// view.timerQueryExt.endQueryEXT(view.timerQueryExt.TIME_ELAPSED_EXT);
// Resolve the antialiasing.
this.resolveAA(view);
}

View File

@ -9,5 +9,5 @@ varying vec2 vHorizontalExtents;
void main() {
vec2 sides = gl_FragCoord.xx + vec2(-0.5, 0.5);
vec2 clampedSides = clamp(vHorizontalExtents, sides.x, sides.y);
gl_FragColor = vec4(clampedSides.y - clampedSides.x);
gl_FragColor = vec4(vec3(clampedSides.y - clampedSides.x), 1.0);
}

View File

@ -38,8 +38,8 @@ void main() {
// be less than a pixel, and it saves a lot of time.)
//
// FIXME(pcwalton): Factor out shared terms to avoid computing them multiple times.
vec2 t = vec2(pixelExtents.x > p0.x ? solveCurveT(p0.x, cp.x, p1.x, pixelExtents.x) : 0.0,
p1.x < pixelExtents.y ? solveCurveT(p0.x, cp.x, p1.x, pixelExtents.y) : 1.0);
vec2 t = vec2(p0.x < pixelExtents.x ? solveCurveT(p0.x, cp.x, p1.x, pixelExtents.x) : 0.0,
p1.x > pixelExtents.y ? solveCurveT(p0.x, cp.x, p1.x, pixelExtents.y) : 1.0);
vec2 spanP0 = mix(mix(p0, cp, t.x), mix(cp, p1, t.x), t.x);
vec2 spanP1 = mix(mix(p0, cp, t.y), mix(cp, p1, t.y), t.y);