cginternals / cginternals/webgl-operate

cache friendly packing optimizations for GlyphVertices

Open
#107 0 comments 0 reactions 0 assignees View on GitHub
haeley-webgl-text
Dominant language
TypeScript
Stars
170
Forks
25
PR merge metrics
No merged PRs in 30d

Description

* 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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading source/openll/source/Typesetter.cpp and the linked asset-generator issue to understand GlyphVertices packing and the proposed texture-locality metrics. Determine how glyph occurrences become draw calls, then define and benchmark a concrete packing strategy whose results group repeated code points, maximize instanced rendering, and reduce cache misses.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, typescript
Domain
computer-graphics, performance
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.