Skip to content
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

Look into setting up multi-threading by giving each thread a context #4

Open
Ed94 opened this issue Dec 29, 2024 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@Ed94
Copy link
Owner

Ed94 commented Dec 29, 2024

There is a heavy performance bottleneck in iterating the text/shape/glyphs on the cpu (single-thread) vs the actual rendering (if doing thousands of drawing commands)

  • draw_text can provide in the context a job list per thread for the user to then hookup to their own threading solution to handle.

  • Context would need to be segregated into staged data structures for each thread to utilize

    • This could converge to the singlar draw_list on a per layer basis. The this would keep the issuing of gpu commands single-threaded unless, its assumed the user is going to feed the gpu the commands & data through separate threads as well (not ideal ux).
    • How the contexts are given jobs should be left up to the user
      Failed Attempts:
  • Attempted to chunk the text to more granular 'shapes' from draw_list before doing the actual call to draw_text_shape. This lead to a larger performance cost due to the additional iteration across the text string.

  • Attempted to cache the shape draw_list for future calls. Led to larger performance cost due to additional iteration in the merge_draw_list.

    • The shapes glyphs must still be traversed to identify if the glyph is cached. This arguably could be handled in shape_text_uncached, however that would require a significan't amount of refactoring to identify... (and would be more unergonomic when shapers libs are processing the text)
@Ed94 Ed94 added the enhancement New feature or request label Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant