3 ms·
I believe it's caching the text as GPU texture and then accelerating only the compositing. That's also why you can't directly draw formatted text into a WebGL c
by fxtentacle 3y ago
I believe it's caching the text as GPU texture and then accelerating only the compositing. That's also why you can't directly draw formatted text into a WebGL context. And for pages consisting mostly of static text, it's perfectly acceptable.
"GPU accelerated rendering means that the GPU is used for composition."
https://www.electronjs.org/docs/latest/tutorial/offscreen-rendering https://www.electronjs.org/docs/latest/tutorial/offscreen-re...
And that page says that's also how Chromium does it.
- esprehn 3y agoChromium (and Firefox) do GPU accelerated raster as well as composition. That page you linked is about a very specific case of wanting to get the pixels back to reuse in a different context. In that situation doing the work on the GPU and then copying back to the CPU may be slower than keeping it on the CPU the whole time.
- fxtentacle 3y agoThis source code: https://github.com/servo/webrender/blob/master/wr_glyph_rasterizer/src/rasterizer.rs https://github.com/servo/webrender/blob/master/wr_glyph_rast... suggests to me that the glyph rasterization (which is the CPU-limiting factor for text rendering) in WebRender (which is the new FF 93+ GPU-accelerated rendering engine) is implemented in Rust and to be run on CPU. On Linux it appears to use FreeType (which is CPU-only): https://github.com/servo/webrender/blob/master/wr_glyph_rasterizer/src/platform/unix/font.rs https://github.com/servo/webrender/blob/master/wr_glyph_rast... Also, that approach of pre-rendering text into textures is, sadly, very common. For example, see: https://stackoverflow.com/questions/44062566/how-do-hardware-accelerated-toolkits-like-qt-javafx-enable-quality-font-render https://stackoverflow.com/questions/44062566/how-do-hardware...