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

[RFC] Improved Clipping #1656

Closed
kvark opened this issue Sep 1, 2017 · 3 comments
Closed

[RFC] Improved Clipping #1656

kvark opened this issue Sep 1, 2017 · 3 comments

Comments

@kvark
Copy link
Member Author

@kvark kvark commented Sep 1, 2017

Review part 1/N

Since these tiles are cacheable, and independent, they will always get drawn in pass 0, meaning each tile for a clip-stack clip will only ever get drawn once.

I'm not sure this is the most efficient way to render the inherited stack clips. Consider the hierarchy:

SC1 (with some heavy clips)
  - primitive 1
  - SC2 (with some clips)
    - primitive 2
    - primitive 3

We wouldn't want to repeat rendering SC1 clips for primitives 2 and 3. Instead, it would be great to re-use the SC1 rendered clips as a base for SC2 clips. Optimally, the pipeline would do:

  1. allocate space for SC1 clips and clear it
  2. render clips of SC1
  3. render primitive 1, using that clip mask
  4. render clips of SC2 on top of the same clip area
  5. render primitives 2 and 3 using the newly formed mask

Doing that would allow us to re-use the SC1 clip result without even copying it over (like we used to do initially, because that's how our render tasks are organized).

Of course, one can argue that this use case is not often seen. But we came here because of artificial benchmarks being slog in the first place, so...

@kvark
Copy link
Member Author

@kvark kvark commented Sep 1, 2017

Review part 2/N

Each clip-scroll tree clip is represented by a screen space tile grid (e.g. 128x128 tiles).

You don't want to let tiles rest in peace, do you? :D
AFAIK The task you are trying to solve here is avoiding drawing the mask regions that are not going to be used. Could we consider using the stencil buffer for more precise work culling?

E.g. we could have a screen-space stencil buffer, where the values are going to represent the stacking contexts that affect it (not totally sure how, perhaps by the depth of SC? needs more thought). Somewhere close to the start of the frame we could draw bounding boxes of the primitives (not the exact primitives - they are too heavy) to the stencil, and then we can stencil out when rendering clips into it. Of course, we'd still allocate all the space, so that may be a problem.

@glennw
Copy link
Member

@glennw glennw commented Dec 1, 2017

I think we can call this resolved now - any future clip mask work will be based on the work done in #2146.

@glennw glennw closed this Dec 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.