- Rename/reorder some projection matrix functions.
- Make perspective functions flip Y and use 0-1 NDC range.
- Flip winding and font vertices based on handedness.
This stuff is really confusing
Pass stores a small 16-bucket cache of vertices/indices it recently
generated. Draws that have relatively predictable geometry can provide
a hash along with their draw. The Pass will reuse vertices based on the
hash, when possible, and return a NULL vertex pointer to let the draw-er
know they don't need to generate any vertices.
This provides a dramatic speedup when drawing the same shape many times
in a row. The overhead is negligible, with benefits kicking in with
just a small handful of repeated draws (3-5 for cubes, less for more
complex shapes).
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.
This is an experimental take on the "default filter" system. Each
render Pass has its own "global sampler", initialized to trilinear. The
global sampler will be used by default to sample textures/materials in
shaders. You can set it to a filter mode or a full Sampler object. You
can always send your own Sampler objects to Shaders if you want
per-texture sampler settings. The global sampler is designed to be set a
small number of times per pass instead of on every draw. Basically,
just do Pass:setSampler('nearest') and draw your minecraft world.
- Temporary buffers are not tracked
- Sample-only textures are not tracked, but their initial upload is synchronized.
- Default texture something something