News for hackers. Stuff that matters.
Re:AvaloniaUI: Create Multi-Platform Apps with .NET by fxtentacle on Sunday February 04, 2024 @03:17AM (#39248558)
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-re...

And that page says that's also how Chromium does it.

Re:AvaloniaUI: Create Multi-Platform Apps with .NET by esprehn on Sunday February 04, 2024 @06:57AM (#39249552)
Chromium (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.
Re:AvaloniaUI: Create Multi-Platform Apps with .NET by fxtentacle on Sunday February 04, 2024 @11:33AM (#39251649)
This source code:

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_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...