New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce the size of the sheets created for fonts. #14376

Merged
merged 1 commit into from Nov 19, 2017

Conversation

Projects
None yet
3 participants
@RoosterDragon
Member

RoosterDragon commented Nov 17, 2017

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.
Reduce the size of the sheets created for fonts.
- 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.
@abcdefg30

Didn't notice anything strange.
I can't comment on the code that much though, so :+0.5:

@pchote

This comment has been minimized.

Show comment
Hide comment
@pchote

pchote Nov 19, 2017

Member

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:

  • Start skirmish
  • Switch to options tab
  • Switch to change map panel
  • Cancel back to lobby

fonts_before
fonts_after

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.

Member

pchote commented Nov 19, 2017

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:

  • Start skirmish
  • Switch to options tab
  • Switch to change map panel
  • Cancel back to lobby

fonts_before
fonts_after

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.

@pchote

pchote approved these changes Nov 19, 2017

@pchote pchote merged commit a71a5cc into OpenRA:bleed Nov 19, 2017

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@RoosterDragon RoosterDragon deleted the RoosterDragon:smaller-font-sheet branch Nov 20, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment