webgl-operate
webgl-operate copied to clipboard
cache friendly packing optimizations for GlyphVertices
- https://github.com/cginternals/openll-cpp/blob/master/source/openll/source/Typesetter.cpp - Basically, all glyphs within the vertex cloud should be packed in buckets per code point. So in the end all occurrences of a glyph of the same code point should be rendered together, in a single draw instanced call ...
- furthermore, for the sequence of code points itself, e.g., the distance between sub textures of subsequent glyphs could be used as metric ... see cginternals/openll-asset-generator#8.
- The font asset could only be optimized in terms of pages, that is, to gather common code point pairs into the same page.
- Instead of optimizing the texture / font asset further, the actual vertex cloud should be optimized with two goals, (1) rely as much on instanced rendering as possible, (2) reduce cache misses between instanced draw calls.
@scheibel comment on this from asset gen issue:
The difference between the first and second specification is the scope: (1) as fine-grained approach: groups common characters together within one 2D texture; (2) as coarse-grained approach: groups common characters into one 2D texture.
Regarding the raster: I assume that a driver loads more that the affected texels into the cache during a texel fetch. If we can assume a pre-fetched area, we can optimize the packing of glyphs within a texture to align to those areas