Live data from Hacker News

The web at maximum FPS: How WebRender gets rid of jank

hacks.mozilla.org

1–10 of 212 posts

Re: The web at maximum FPS: How WebRender gets rid of jank

#2
Good stuff.

Speaking of rendering text glyphs on the GPU, there's a really clever trick(commonly called loop-blinn, from the two authors): https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch25....

You can pretty much just use the existing bezier control points from TTF as-is which is really nice.

Re: The web at maximum FPS: How WebRender gets rid of jank

#6
post #4

I just love how they simplify something that's seemingly esoteric to me. I work with the web and I still have a lot to learn.

A lot of credit for that goes towards Lin Clark, who's done some amazing expository articles like this before.

Re: The web at maximum FPS: How WebRender gets rid of jank

#8
post #2

Good stuff. Speaking of rendering text glyphs on the GPU, there's a really clever trick(commonly called loop-blinn, from the two authors): https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch25.... You can pretty much just use the existing bezier control points from TTF as-is which is really nice.

If only it were as simple as just using Loop-Blinn. :) The technique described there will produce unacceptably bad antialiasing for body text. Loop-Blinn is fine if you want fast rendering with medium quality antialiasing, though. (Incidentally, it's better to just use supersampling or MLAA-style antialiasing with Loop-Blinn and not try to do the fancy shader-based AA described in that article.)

Additionally, the original Loop-Blinn technique uses a constrained Delaunay triangulation to produce the mesh, which is too expensive (O(n^3) IIRC) to compute in real time. You need a faster technique, which is really tricky because it has to preserve curves (splitting when convex hulls intersect) and deal with self-intersection. Most of the work in Pathfinder 2 has gone into optimizing this step. In practice people usually use the stencil buffer to compute the fill rule, which hurts performance as it effectively computes the winding number from scratch for each pixel.

The good news is that it's quite possible to render glyphs quickly and with excellent antialiasing on the GPU using other techniques. There's lots of miscellaneous engineering work to do, but I'm pretty confident in Pathfinder's approach these days.

Re: The web at maximum FPS: How WebRender gets rid of jank

#9
post #5

I imagine the render task tree also has to determine which intermediate textures to keep in the texture cache, and which ones will likely need to be redone in the next frame. That kind of optimization has to be tricky.

Yeah, it's one of the two hard problems in computer science after all :)

In practice LRU caches work pretty well.

Post reply on HN