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

Refactor how text shadows and elements are handled. #1498

Merged
merged 1 commit into from Jul 19, 2017

Commits on Jul 19, 2017

  1. Refactor how text shadows and elements are handled.

    While working on adding line decorations, I kept running into
    issues and extra complexity. Instead, I've refactored how
    text shadow contexts are handled. The implementation is a bit
    complex in parts, but conceptually this fits in much better with
    how the frame builder, prim store and GPU cache work.
    
    Now, text-shadow primitives add text runs and decorations as
    sub-primitives, using an index buffer of primitives. This means:
    
    * The code to manage the text-element stack and maintain correct
      paint order is much simpler.
    * The GPU cache layouts are much simpler. Text runs and decorations
      within a text-shadow element have the same layout as normal
      primitives (no weird offsets and packed layouts).
    * Text primitives that have both visual and shadows (which is the
      common case) share the same GPU primitive - so they only get
      built and uploaded once. This is quite a large performance win
      on pages with a lot of shadows.
    * The code to truncate glyph positions is moved from the CPU
      to the vertex shader, which is a significant performance win.
    * The paint order of shadows is reversed from the previous
      implementation, back to what it was originally.
    gw3583 committed Jul 19, 2017
You can’t perform that action at this time.