Commit Graph

159 Commits

Author SHA1 Message Date
Patrick Walton 7bd3a48110 Don't clip curves to the left and right sides of the pixel column twice 2017-11-21 15:51:27 -08:00
Patrick Walton 86df78f939 Flesh out the integration test more 2017-11-17 17:06:59 -08:00
Patrick Walton 8c1b3e9cb5 Optimize and better document the exact antialiasing calculation 2017-11-14 18:02:26 -08:00
Patrick Walton bc99fdf02b Enable early Z in the XCAA multicolor direct interior pass 2017-11-11 14:45:28 -08:00
Patrick Walton 575d4c2366 Fix regression involving NaN when doing curve clipping 2017-11-11 09:38:06 -08:00
Patrick Walton 37cdc9bc5c Optimize the signed area calculation 2017-11-10 23:09:54 -08:00
Patrick Walton 1f5dbe33e8 Apply optimizations to the multi-edge mask shader too 2017-11-10 22:09:29 -08:00
Patrick Walton fc2ac12fc0 Optimize the XCAA fragment shaders a bit 2017-11-10 19:25:47 -08:00
Patrick Walton 75474b19e6 Add the normal angle to the shaders used in the 3D demo 2017-11-10 15:03:43 -08:00
Patrick Walton 3bcd05a5ed Update the XCAA multi direct shaders to support normals.
Fixes XCAA in the SVG demo.
2017-11-09 16:42:53 -08:00
Patrick Walton 8e7eb6ca60 Support stem darkening in SSAA mode.
The normals are incorrect right now in some cases, but it looks OK-ish.
2017-11-09 16:20:15 -08:00
Patrick Walton e5b76726d9 Use the LUT to gamma correct text, and fix stem darkening math 2017-11-07 17:24:19 -08:00
Patrick Walton 8a1e3bc8b2 Add some basic Phong shading to the monument 2017-11-03 18:49:25 -07:00
Patrick Walton 4cbc2a8800 Add partial support for clip paths in the SVG demo.
At the moment, this only works when antialiasing is off.
2017-11-03 14:14:29 -07:00
Patrick Walton 579528ebdc Remove one direct rendering pass from the multicolor XCAA path 2017-10-31 12:41:38 -07:00
Patrick Walton 2604151521 Replace the multicolor (SVG) XCAA with a multipass compositing algorithm 2017-10-30 15:28:35 -07:00
Patrick Walton e4b531f3a0 Do some work on shader documentation 2017-10-26 20:30:47 -07:00
Patrick Walton 0506365cc7 Fix blending in the text demo.
As a nice added cleanup, this commit standardizes on the red channel for
all monochrome textures.
2017-10-26 20:15:51 -07:00
Patrick Walton 9d93cebca6 Stop using multiple render targets.
We don't need them anymore, so let's lower our hardware requirements!
2017-10-20 22:04:53 -07:00
Patrick Walton 048c261f6c Add a working experimental implementation of XCAA for SVG.
This has known performance problems and artefacts due to working at
sample level only, but it's a decent first cut.
2017-10-20 19:41:18 -07:00
Patrick Walton 70201bb29c Draw distant glyphs as prerendered images in the 3D demo.
This has known performance problems, but it's a good first cut.
2017-10-18 16:19:19 -07:00
Patrick Walton 314185684c Implement stem darkening and split ECAA into ECAA and MCAA.
We now implement stem darkening (also known as font dilation) like
macOS and FreeType under certain configurations. This pushes out font
outlines along their normals slightly in order to make small text easier
to read. This is especially important when performing gamma correction,
as otherwise text can end up too light.

Because the stem darkening is implemented in the vertex shader, it can
easily break the mesh. Therefore, I needed to implement a new rendering
mode that does not use the mesh. It's a variant of ECAA, and for
clarity's sake I've renamed the related antialiasing methods:

* MCAA stands for "mesh coverage antialiasing" and is the new name for
what was called "ECAA" prior to this patch.

* ECAA now stands for "edge coverage antialiasing". It does not use the
mesh but rather computes winding numbers from scratch for every pixel.
Surprisingly, despite being worse asymptotically, this usually ends up
being faster than MCAA at small font sizes, presumably because there are
fewer vertices to transform.

* XCAA, "exact coverage antialiasing" is a generic term that refers to
both ECAA and MCAA. References to ECAA have been changed to XCAA as
needed.
2017-10-15 13:28:49 -07:00
Patrick Walton 2a236319d4 Use regular VBOs instead of textures to store vertex positions for ECAA.
This improves performance at small font sizes a bit by reducing vertex
shading load.
2017-10-06 16:42:51 -07:00
Patrick Walton 6a7c013e61 Make the hints a uniform instead of a buffer texture.
Saves a good bit of memory traffic during vertex shading.
2017-10-05 19:14:52 -07:00
Patrick Walton 28837f72a6 Fetch and transform fewer vertices in the ECAA cover shader 2017-10-05 13:30:32 -07:00
Patrick Walton 22d0eb7b24 Fix file headers in shaders/ 2017-10-03 15:32:03 -07:00
Patrick Walton 99f6f2a104 Snap stems up to the nearest pixel when hinting 2017-09-29 18:02:33 -07:00
Patrick Walton 83cfb1d9d5 Make glyphs transparent.
Avoids cutting off the bottom of the "g" in the text demo.
2017-09-19 13:57:56 -07:00
Patrick Walton f68da75c75 Implement SSAA for the 3D demo.
This commit additionally refactors transforms to be resolution-independent as much as possible throughout all the demos.
2017-09-12 19:43:43 -07:00
Patrick Walton eb9c0ceb4d Implement "slight" hinting by rounding x-heights up to the nearest pixel 2017-09-09 13:12:51 -07:00
Patrick Walton 3ee066bdf0 Implement subpixel ECAA 2017-09-07 14:58:41 -07:00
Patrick Walton cedce49a1d Perform color defringing in the shader using the FreeType algorithm 2017-09-06 16:50:36 -07:00
Patrick Walton 82d2f076d7 Add basic subpixel AA support for SSAA.
No LCD filter is implemented yet, so the color fringing is currently fairly extreme.
2017-09-06 16:32:11 -07:00
Patrick Walton 4b7ac0182c Implement basic working 3D support 2017-09-05 19:47:19 -07:00
Patrick Walton a9dd33d479 Stub a shader for objects in the 3D demo 2017-09-03 19:24:28 -07:00
Patrick Walton 07d425dfb2 Split the ECAA shader into separate shaders for monochrome and multicolor 2017-08-24 12:08:58 -07:00
Patrick Walton ad565ffde7 Use early Z to avoid resolving blank areas for ECAA. ~50% speedup. 2017-08-24 11:43:38 -07:00
Patrick Walton 81a6f8f051 Enable early Z for edge detection and render only in the used area of the atlas 2017-08-23 19:18:24 -07:00
Patrick Walton 52afa359b4 Render a line of text using the atlas 2017-08-22 18:25:32 -07:00
Patrick Walton 7db61bfe8e Add a transform parameter to blit and switch framebuffer sizes to be `glmatrix.vec2` types 2017-08-19 16:52:14 -07:00
Patrick Walton 9b3f9d029c Fix flipped inequality in the shader causing AA artefacts 2017-08-19 11:37:06 -07:00
Patrick Walton 37c947c751 Get basic ECAA fully working 2017-08-18 20:23:45 -07:00
Patrick Walton 343c67aa33 Remove commented out debug code 2017-08-18 17:13:44 -07:00
Patrick Walton 653530be0b Add a curve shader for ECAA and refactor the line shader to minimize code duplication 2017-08-18 17:12:58 -07:00
Patrick Walton 3a9b29735a Get exact antialiasing mostly working for lines (no curves yet) 2017-08-18 15:17:23 -07:00
Patrick Walton a9eeec39fe Implement the line antialiasing shader, untested as of yet 2017-08-18 11:44:17 -07:00
Patrick Walton ccf5000e1c Get the cover step mostly working 2017-08-17 22:47:28 -07:00
Patrick Walton 9a7063a29b Render conservative coverage. Not working yet. 2017-08-17 20:09:18 -07:00
Patrick Walton ec78a632dc Split path IDs and Loop-Blinn data into separate VBOs 2017-08-17 12:47:50 -07:00
Patrick Walton 0a4d57580a Add the ECAA cover shader, untested as of yet 2017-08-16 19:51:13 -07:00
Patrick Walton 4b62ec8fa7 Get edge detection working in the demo 2017-08-16 16:37:39 -07:00
Patrick Walton b10807d217 Initial setup for ECAA in the demo 2017-08-15 22:09:09 -07:00
Patrick Walton 3f7fc8baf6 Add an edge detection shader for ECAA, untested as of yet 2017-08-15 17:28:07 -07:00
Patrick Walton 0f5b23622a Implement SSAA in the demo 2017-08-15 15:57:52 -07:00
Patrick Walton eb7cfe7c5f Fetch the colors of paths 2017-08-14 21:24:58 -07:00
Patrick Walton 309034b7dd Implement basic Loop-Blinn curves 2017-08-14 19:08:18 -07:00
Patrick Walton f8bd405759 Get basic polygons rendering in the demo 2017-08-14 16:08:45 -07:00
Patrick Walton 5f89f7ba50 Fix compile errors in shaders 2017-08-13 13:39:51 -07:00
Patrick Walton ebeaf119ba Add some OpenGL ES 2.0 shaders for direct rendering, untested 2017-08-11 18:12:17 -07:00