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

Convert rectangle from prim to brush shader and support segments. #2146

Merged
merged 1 commit into from Dec 4, 2017

Commits on Dec 4, 2017

  1. Convert rectangle from prim to brush shader and support segments.

    Add support for brushes to be drawn as a list of segments that
    are part of a larger primitive. Initially, these segments are
    nine-patches only, although they may be expanded in the future
    to work with generic segment rects.
    
    This allows large brush primitives to be split into a number
    of segments that can be split among the opaque and alpha passes,
    which means that large rectangles are often rendered with the
    inner rectangle as part of the opaque pass. Additionally, edge
    segments are rendered in the opaque pass when the primitive does
    not have a rotation or perspective transform applied.
    
    When a rectangle is split, the clip tasks are generated only
    where required for individual segments. This can significantly
    reduce the amount of allocated area for clip masks, and also
    the amount of GPU time spent drawing clip masks.
    
    Previously, rectangle splitting could only work on LocalClip
    items specified as part of the item, which meant that rectangles
    in Gecko would never be split. Now, we calculate splitting
    during prepare_prim_for_render, consulting the current clip chain
    for the primitive. This means that we get the benefits of rectangle
    splitting in Gecko, which doesn't use LocalClip API.
    
    Having rectangle splitting handled as segments also means that we
    don't add extra top-level primitives that take extra time to do
    visibility culling on, saving some CPU time.
    
    Future work:
     - Support more cases of primitive splitting.
     - Port images and gradients to be brushes so they automatically get splitting.
    gw3583 committed Dec 4, 2017
You can’t perform that action at this time.