Back when I wrote this I didn't think about how it would work with 3d transforms and near plane clipping. Correctly extruding by exactly 1 device pixel won't just work when one or several corners are behind the view. That said, we can still keep a conservative extrusion for the AA like we do today with the general idea of how the primitive is split between the AA parts and the opaque part in my earlier comments. Also, while we are at it, the current AA code does not deal well with non-uniform scales. One solution is to store in a interpolated varying vec4 the signed distance in screen space between the vertex and the line defined by each of the edges. In the fragment shader you can just take the max of the 4 floats, add 0.5, clamp to 0..1 and that gives you the AA.
Bug 1762603 Comment 2 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
Back when I wrote this I didn't think about how it would work with 3d transforms and near plane clipping. Correctly extruding by exactly 1 device pixel won't just work when one or several corners are behind the view. That said, we can still keep a conservative extrusion for the AA like we do today with the general idea of how the primitive is split between the AA parts and the opaque part in my earlier comments. Also, while we are at it, the current AA code does not deal well with non-uniform scales. One solution is to store in a interpolated varying vec4 the signed distance in screen space between the vertex and the line defined by each of the edges. In the fragment shader you can just take the max of the 4 floats, add 0.5, clamp to 0..1 and that gives you the AA. Lee implemented this approach in DrawTargetWebGL: https://phabricator.services.mozilla.com/D143832