Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Reduce the size of the sheets created for fonts. #14376
Memory reduction efforts to tackle #12494.
- A 512x512 sheet is about half full after precaching and some usage, but uses 16x less memory than the default 2048x2048 sheet. This saving occurs twice as we maintain a managed buffer for this sheet. - Only precache smaller fonts, as the larger fonts are less used and take up more space than is worthwhile. - Only precache in white, as red is largely unused.
I can confirm @RoosterDragon's description above.
Here are before and after dumps of the font cache after the following steps in the RA mod:
When starting the game and hovering over player names and tooltips (which use additional colours) it fills up some more but does not overflow. Note also that i'm running with HiDPI fonts, so for most people the texture usage will be a factor of 4 less.
In TD I can fairly easily overflow the cache onto a second sheet, but I think its reasonable to assume that people with HiDPI displays also have sufficient GPU power that breaking batches on text rendering is not going to ruin everything. The memory benefit clearly outweighs the render overheads.