cginternals / openll-asset-generator

Font Asset Generator based on OpenLL Specifications
http://www.openll.org
MIT License
7 stars 1 forks source link

cache friendly packing optimizations #8

Open cgcostume opened 7 years ago

cgcostume commented 7 years ago

Evaluate if, e.g., target text could be used for more cache friendly (fewer cache misses when rendering) asset generation. The quality of a packing could be measured using a synthetic cache with strict rendering assumptions (e.g. based on reference implementations).

scheibel commented 6 years ago

To further specify/clarify the requirements:

Question I still have:

anne-gropler commented 6 years ago

I don't understand the difference between bullet 1 and 2.

Basically, here are two different (but related) ideas considering the use of multiple textures. 1) Sort characters by occurence (in a reference text or in language) and pack the glyphs of higher occurence togther into one texture, the others into other textures. This features is perfect for when the characters are sorted for rendering. 2) A reference text (or a language) could be examined to find common glyph pairs. The packing then tries to pack glyphs, that often occure together, into one texture, e.g., if "a" occurs a lot after "s", and "t", then "a", "s", and "t" are packed into one texture; while "p" and "b" might be packed into different textures. This might be a bad idea for sorted rendering: (continuing the example) if "a" is rendered first, then "p" --> texture switch. Then "s" is rendered --> switch back to first texture.

The interface yet does not offer a feature to pass example text. A separate function in the core library should be implemented, i.e., a new stage in the pipeline.

anne-gropler commented 6 years ago

@scheibel Add could you please elaborate what you mean with "Add few pixels additional alignment so that glyph texture rectangles spread least amount of tiles (16x16 raster?)".

scheibel commented 6 years ago

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.