Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Impeller] Glyph cache potentially abandons free space when it grows #183139

@flar

Description

@flar

When we run out of room in an existing glyph cache atlas, as determined by the rectangle packing algorithm, we need to grow the atlas to continue accumulating glyphs. We do this by allocating a taller atlas and then copying the existing glyphs into the top part of the newly allocated cache texture. We then update our rectangle packing mechanism to fill glyphs into the newly allocated space here:

The issue seems to be that we create a brand new empty packer that only allocates glyphs into the newly allocated space. While we don't lose any glyphs in the existing part of the atlas, it may not have been full and so it has empty space we might still be able to use. But, by replacing the rectangle packer with a brand new one that only sees the new space, we never look back at the old space to see if we can continue to use it.

The comments suggest that there is no way to add width to the packer which is why it only grows the cache vertically. It also doesn't seem to be able to grow the rectangle arena vertically, which is probably why we replace it and only allocate in the new space. But, since the algorithm is in our own source tree and we control it, we can fix either problem and potentially make better use of our glyph cache space, reducing the number of times we grow or replace our glyph cache.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions