Reproducer is here: https://github.com/egonelbre/expgio/blob/master/too-many-rects/main.go
My best guess it's hitting some buffer limit for GPU-s. I haven't done any extensive debugging.
It's a z-buffer overflow. gioui.org/commit/5286495 adds a panic a TODO for later.
Any reason not to switch depth buffer to 24 bits for now?
64k seems reasonable, 16M less so.
Found an easy workaround that didn't require 24 bit depth: gioui.org/commit/504664e.
How do we feel about adding an Op to influence z-index? In some cases, the user (or widget or whatever) might know that there is no overlap and be able to skip out on z-index management (e.g. this would solve for the reproducer). It does feel leaky, though.
Alternatively, might there be some way to avoid incrementing the buffer if we can somehow track that the current path doesn't clip with anything else drawn at the current z-index?
Lastly, is there any reason we couldn't simply use
ALWAYSfor the depth test func and let last-writer-win?
An op is definitely too leaky.
I believe this issue is fundamentally fixed when tiled rendering ala Pathfinder is implemented.
I'm open to workarounds in the meantime, but note that the rendering this many rectangles is currently impractically slow.
I am running into this issue as well while drawing a very fine grid (lots of rectangles basically). I dont notice any slowdown up until it crashes.
For grids, maybe supporting tiling an image would help... it probably could be used in other scenarios as well?
Out of curiosity, how does the compute renderer fare? Its general performance doesn't yet match the old renderer, but it doesn't have limits in the number of paths (except for GPU memory).
Use GIORENDERER=forcecompute to enable it.
I get the following error when trying to use the new renderer: gpu: no support for float render targets nor compute
My laptop is recent (with Intel Iris Plus Graphics 1536 Mo) so maybe I am missing something else?
Are you running on Linux? The compute renderer only supports Linux and Android right now.
OK, I have tried it on an old Linux laptop and it still crashes, this time with:
i965: Failed to submit batchbuffer: Input/output error
Note. the new renderer was noticeably slower (while going to fullscreen or zooming out to display more grids).