Originally we made the font texture f16 due to "clamping" of the
distance field, and kept it as floats (but f32 since conversion isn't
automatic with Vulkan) here. However, clamping isn't really an issue.
You can increase the spread of the font to literally get a wider spread
of the SDF for glows, etc. Switching to u8 uses 4x less texture memory,
which is significant.
It can be used to push the current cursor onto the stack, perform some
tmep allocations, and then pop the stack to "free" them all at once.
This can be nice if you're doing some temporary allocations that aren't
going to be needed when the function returns, since it reduces the
amount of allocator growth a bit.
This allocator is meant to be threadlocal eventually, so there are no
thread-safety concerns.
- Padding is automatically computed from spread.
- Spread increases detail at small sizes.
- Remove failure cases where padding < spread/2
- UVs are un16x2, making room for color
- Don't center glyphs inside their atlas bounding box
- Cache normalized UVs and update them (for glyphs and vertices) when
the atlas changes size.
- Updating the UVs is UGLY and duplicates a lot of code. It may be
better to normalize the UVs on the fly, or just re-render the entire
string if the atlas is updated.