Skip to content

[WIP] Presort text draw calls. #108369

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bruvzg
Copy link
Member

@bruvzg bruvzg commented Jul 7, 2025

Pre-sort text draw calls to improve batching, should significantly reduce draw call number for languages with a lot of glyphs and multiline text with outlines/shadow.

TODO:

  • TextEdit
  • Test and adjust RTL nested frame draw order.
  • Cleanup duplicate code.
  • Document new methods.

Before:

Screenshot 2025-07-07 at 09 21 28

After:

Screenshot 2025-07-07 at 10 43 35

Fixes #107109
Fixes #104537

@bruvzg
Copy link
Member Author

bruvzg commented Jul 9, 2025

Some extra tests:

1. Label with CJK test using system font fallback.

Screenshot 2025-07-09 at 11 54 17

4.5 beta 3 - FPS: 330, draw calls 967
this PR - FPS: 1980, draw calls 14

2. Label with Latin text.

Screenshot 2025-07-09 at 11 54 23

4.5 beta 3 - FPS: 1570, draw calls 50
this PR - FPS: 1740, draw calls 2
(as expected, much lower difference)

3. RTL with CJK text:

Screenshot 2025-07-09 at 11 54 27

4.5 beta 3 - FPS: 315, draw calls 980
this PR - FPS: 2080, draw calls 15

4. BBCode demo:

Screenshot 2025-07-09 at 11 55 05

4.5 beta 3 - FPS: 145, draw calls 45
this PR - FPS: 145, draw calls 23
(FPS seems to be linited by constant redraws of the RTL, not number draw calls)

5. 500 random Labels with outline.

Screenshot 2025-07-09 at 12 01 11

4.5 beta 3 - FPS: 380, draw calls 1000
this PR - FPS: 380, draw calls 1000
(can't be batched, labels are different canvas items and have specific draw order)

@bruvzg bruvzg force-pushed the text_draw_presort branch from 579ce25 to 61cf4fa Compare July 9, 2025 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant