Eight million pixels and counting: improving texture atlas allocation in Firefox (2021)
nical.github.io
nical.github.io
If so, then could you do a fast but messy allocation, then clean it up when you run out of space, or are about to? Or you could pull in more traditional GC tricks: have one texture that gradually accumulates long-lived images (the tenured region), and divide up another region into two semispaces that you do fast bump-like allocations into and then compact from one to the other when it fills up. You could even incrementally repack, assume copying within and between atlases works in the first place.
We also made heavy use of allocation bitmaps and a few other tricks to ensure that the texture allocator does zero dynamic memory allocation at runtime, as that could cause performance bubbles.
Since it's device local it takes almost no time.
> Maybe one day they'll finally get to follow game engines in deleting all of their atlas hacks.
Are there any public game engines using bindless resources? Unreal seems to be the only one, but they pretty much don't care about low-end Android.
Here’s a C++ port of his C version: https://github.com/Const-me/nanovg/blob/master/src/FontStash...