Use one side for the X position in the multicolor MCAA vertex shader to avoid cracks

This commit is contained in:
Patrick Walton 2017-12-19 10:54:30 -08:00
parent cfe72f486e
commit ddd1c89294
2 changed files with 4 additions and 2 deletions

View File

@ -150,7 +150,6 @@ vec2 computeMCAASnappedPosition(vec2 position,
position = transformVertexPositionST(position, localTransformST);
position = transformVertexPositionST(position, globalTransformST);
position = convertClipToScreenSpace(position, framebufferSize);
//position.x = abs(mod(position.x, 1.0)) < 0.5 ? floor(position.x) : ceil(position.x);
float xNudge = fract(position.x);
if (xNudge < 0.5)

View File

@ -85,8 +85,11 @@ void main() {
float depth = convertPathIndexToViewportDepthValue(pathID);
// Use the same side--in this case, the top--or else floating point error during partitioning
// can occasionally cause inconsistent rounding, resulting in cracks.
vec2 position;
position.x = mix(tlPosition.x, brPosition.x, quadPosition.x);
position.x = quadPosition.x < 0.5 ? tlPosition.x : trPosition.x;
if (quadPosition.y < 0.5)
position.y = floor(min(tlPosition.y, trPosition.y));
else