Skip to content

[gpu_cache] Only rasterize & upload after queue has successfully fit in cache

Alex Butler requested to merge (removed):master into master

Currently we take all the glyphs not currently cached and loop through them fitting them in, rasterizing & uploading.

While generally fine, in the case we can't fit a glyph in we either error out or clear the cache and retry with better packing. In either case all the rasterization & upload work is wasted. This can occur when the cache needs resizing to allow more glyphs, and when the cache needs to clear previously used glyphs that are no longer needed.

This change instead defers the rasterization & upload until after the entire queue has fit inside the cache. This allows for faster failing, and improves the worst case benchmarks. (control: 08aa5189, change: 94605349)

name                                    control ns/iter  change ns/iter  diff ns/iter   diff %  speedup 
cache_bad_cases::moving_text_thrashing  24,971,463       21,545,751        -3,425,712  -13.72%   x 1.16 
cache_bad_cases::resizing               19,758,198       15,340,310        -4,417,888  -22.36%   x 1.29 

Merge request reports