Anti-aliasing techniques used in Skia GPU Implementation

1,916 views
Skip to first unread message

Tarun Gehlaut

unread,
Feb 19, 2018, 2:26:00 AM2/19/18
to skia-discuss
Hello everyone.

The skia website mentions about AAA as the anti-aliasing technique in the CPU pipeline(https://skia.org/dev/design/aaa).
I was interested to know what techniques have been used in Ganesh.

From the code I could see that the technique varies depending on the Rasterizer being used (GrTessellatingPathRenderer, GrCoverageCountingPathRenderer, etc). Is there any document that could be useful for me?

Thanks.

Brian Osman

unread,
Feb 21, 2018, 9:18:48 AM2/21/18
to skia-d...@googlegroups.com
Hi,
The GPU implementation uses a few different AA techniques, depending on your surface configuration & the type of primitive being drawn. Until recently, most of the techniques would fall into one of two buckets:
  1. MSAA: If your surface was constructed as an MSAA framebuffer, Skia computes binary coverage per sample, and relies on MSAA resolve for AA.
  2. Geometric / analytic: I think this is more common among our clients. Here, Skia tries to compute an exact coverage value per pixel using some geometric or analytic technique. For simple primitives like circles or round-rects, there are shaders that inflate the bounds by a pixel, then use the fragment position to compute the exact distance to the edge of the shape. For more complex paths, the different path renderers use a variety of approaches, but one common idea is to inflate the path geometry with a skirt of triangles, and interpolate coverage across that skirt.
More recently, a new path rendering algorithm has been added - CCPR, which is a particular GPU implementation of the idea from the AAA slides you linked above.

-Brian

--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss+unsubscribe@googlegroups.com.
To post to this group, send email to skia-d...@googlegroups.com.
Visit this group at https://groups.google.com/group/skia-discuss.
For more options, visit https://groups.google.com/d/optout.

Corey Lucier

unread,
Feb 21, 2018, 9:50:47 AM2/21/18
to skia-discuss
Brian,

What GL caps/features are required for the CCPR approach currently?


Brian Salomon

unread,
Feb 21, 2018, 9:58:47 AM2/21/18
to skia-d...@googlegroups.com
ES 3.0 is the minimum but it helps performance to have geometry shaders.

On Wed, Feb 21, 2018 at 9:50 AM Corey Lucier <corey....@gmail.com> wrote:
Brian,

What GL caps/features are required for the CCPR approach currently?


--
You received this message because you are subscribed to the Google Groups "skia-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.

Brian Salomon

unread,
Feb 21, 2018, 9:59:28 AM2/21/18
to skia-d...@googlegroups.com
Oh, and half-float alpha as a color-renderable format.

Corey Lucier

unread,
Feb 21, 2018, 10:01:27 AM2/21/18
to skia-discuss
So no hope of cross compilation to Web GL 1.0 then. ;)

Brian Salomon

unread,
Feb 21, 2018, 10:10:42 AM2/21/18
to skia-d...@googlegroups.com
Nope :(

WebGL 2.0 + EXT_color_buffer_half_float is almost enough. The WebGL extension strips out single channel half-float rendering from the ES extension, though. We could probably find a way to make it work with another texture format if that was useful.

On Wed, Feb 21, 2018 at 10:01 AM Corey Lucier <corey....@gmail.com> wrote:
So no hope of cross compilation to Web GL 1.0 then. ;)

--
Reply all
Reply to author
Forward
0 new messages