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.