mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
e6c31a02fdf6aa9dfa201fd5ff7cefaf2c0fbfb9
The compute renderer is more expensive to run than the old renderer on low-end GPUs, and even more so on CPUs. To ensure good performance regardless of the end-user device, this change implements automatic re-use of content rendered in the frame before the current. The basic idea is that every drawing operation (PaintOp), along with its transform and clipping, can be hashed and efficiently looked up. A naïve caching approach is then to rasterize every operation to separate sections of several large texture atlases, turning a cache hit into a very cheap texture copy. However, for scenes with lots of overlapping operations, the resulting texture memory from separating the operations would be much larger than the memory for just the window framebuffer. So instead of caching individual operations, this change caches layers, which are sequences of drawing operations. It starts by putting all operations into a single layer. Then, if the subsequent frame re-uses a sub-sequence of that larger layer, it is split. For example, consider a UI similar to the kitchen sample: Hello, Gio <Editor> <Line Editor> <Button> <Button> <Button> <ProgressBar> <Checkbox> <Toggle> In the first frame, all of the drawing operations comprising the UI will be stored and cached in a single layer. In the second frame the progress bar will have moved and the renderer splits the UI into three layers: layer A for everything up to (but not including) the progress bar, layer B with just the progress bar, and layer C for the rest. Note that nothing has been re-used yet. In the third frame, the progress bar moves again, and this time layer A and C can be copied from the cache only the progress bar needs redrawing through the compute programs. Signed-off-by: Elias Naur <mail@eliasnaur.com>
Gio - https://gioui.org
Immediate mode GUI programs in Go for Android, iOS, macOS, Linux, FreeBSD, OpenBSD, Windows, and WebAssembly (experimental).
Installation, examples, documentation
Go to gioui.org.
Issues
File bugs and TODOs through the issue tracker or send an email to ~eliasnaur/gio@todo.sr.ht. For general discussion, use the mailing list: ~eliasnaur/gio@lists.sr.ht.
Contributing
Post discussion to the mailing list and patches to gio-patches. No Sourcehut account is required and you can post without being subscribed.
See the contribution guide for more details.
An official GitHub mirror is available.
Description
Languages
Go
89.6%
C
7%
Java
1.7%
Objective-C
1.6%