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

Various simplifications, optimizations and features related to clipping. #1679

Merged
merged 5 commits into from Sep 12, 2017

Conversation

@glennw
Copy link
Member

glennw commented Sep 8, 2017

  • Introduce ClipStore, an arena for storing clip sources.
    This reduces a lot of memory copying and allocations, since the clip stack built each frame now just contains handles into the clip store, rather than copying the entire mask cache.
  • Move remaining mask cache code into ClipSources, and simplify it.
    We no longer need to copy the border sources etc into the mask cache structures - they can be referenced directly from the clip sources.
  • Use a separate GPU cache handle for each clip, so ClipAddressRange code is no longer needed.
    This is possible since we use the GpuCache now, which doesn't need to allocate space during initialization.
  • Simplify the code in the clip batcher that adds clip instances to the render targets.
  • Add support for multiple image masks (a by-product of removing the init step of the mask cache code).
  • Move MaskBounds into the ClipSources (from the MaskCacheInfo struct).
  • Add recycle() to free list, and support cloning weak handles.

This change is Reviewable

@glennw
Copy link
Member Author

glennw commented Sep 8, 2017

This change is probably easier to review by considering each commit as a separate improvement...

@glennw glennw force-pushed the glennw:clip-store-6 branch from d44f18e to 925d6ee Sep 8, 2017
gw3583 added 4 commits Sep 8, 2017
This reduces a lot of memory copying and allocations, since
the clip stack built each frame now just contains handles
into the clip store, rather than copying the entire mask cache.
We no longer need to copy the border sources etc into the mask
cache structures - they can be referenced directly from the clip sources.

We also use a separate GPU cache handle for each clip now, so the
ClipAddressRange code is no longer needed. This is possible since
we use the GpuCache now, which doesn't need to allocate space
during initialization.

This also simplifies the code in the clip batcher that adds
clip instances to the render targets.

Add support for multiple image masks (a by-product of removing
the init step of the mask cache code).
@glennw glennw force-pushed the glennw:clip-store-6 branch from 925d6ee to fe7444e Sep 11, 2017
@kvark
kvark approved these changes Sep 11, 2017
Copy link
Member

kvark left a comment

Looks sensible (and rather elegant)!
Just one note to address/answer, after which r=me

clips: Vec<ClipSource>,
pub mask_cache_info: MaskCacheInfo,
pub clips: Vec<ClipSource>,
pub handles: Vec<GpuCacheHandle>,

This comment has been minimized.

@kvark

kvark Sep 11, 2017

Member

why don't we want to either simply include GpuCacheHandle into ClipSource or have it stored nearby, e.g. Vec<(ClipSrouce, GpuCacheHandle)>?

This comment has been minimized.

@glennw

glennw Sep 11, 2017

Author Member

I did consider including it in ClipSource but it seemed a bit cleaner conceptually to separate them. No real reason it couldn't be in a tuple though!

This comment has been minimized.

@kvark

kvark Sep 11, 2017

Member

Great, let's tuple it up then ;)

@glennw
Copy link
Member Author

glennw commented Sep 11, 2017

@kvark OK, pushed a commit that moves handles into a tuple in clips.

@kvark
Copy link
Member

kvark commented Sep 11, 2017

Thank you!
@bors-servo r+

@bors-servo
Copy link
Contributor

bors-servo commented Sep 11, 2017

📌 Commit e1ef408 has been approved by kvark

@bors-servo
Copy link
Contributor

bors-servo commented Sep 11, 2017

Testing commit e1ef408 with merge d8223e4...

bors-servo added a commit that referenced this pull request Sep 11, 2017
Various simplifications, optimizations and features related to clipping.

* Introduce ClipStore, an arena for storing clip sources.
    This reduces a lot of memory copying and allocations, since the clip stack built each frame now just contains handles into the clip store, rather than copying the entire mask cache.
* Move remaining mask cache code into ClipSources, and simplify it.
    We no longer need to copy the border sources etc into the mask cache structures - they can be referenced directly from the clip sources.
* Use a separate GPU cache handle for each clip, so ClipAddressRange code is no longer needed.
    This is possible since we use the GpuCache now, which doesn't need to allocate space during initialization.
* Simplify the code in the clip batcher that adds clip instances to the render targets.
* Add support for multiple image masks (a by-product of removing the init step of the mask cache code).
* Move MaskBounds into the ClipSources (from the MaskCacheInfo struct).
* Add recycle() to free list, and support cloning weak handles.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/1679)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Sep 11, 2017

💔 Test failed - status-travis

@glennw
Copy link
Member Author

glennw commented Sep 12, 2017

@bors-servo retry

@bors-servo
Copy link
Contributor

bors-servo commented Sep 12, 2017

Testing commit e1ef408 with merge 7628617...

bors-servo added a commit that referenced this pull request Sep 12, 2017
Various simplifications, optimizations and features related to clipping.

* Introduce ClipStore, an arena for storing clip sources.
    This reduces a lot of memory copying and allocations, since the clip stack built each frame now just contains handles into the clip store, rather than copying the entire mask cache.
* Move remaining mask cache code into ClipSources, and simplify it.
    We no longer need to copy the border sources etc into the mask cache structures - they can be referenced directly from the clip sources.
* Use a separate GPU cache handle for each clip, so ClipAddressRange code is no longer needed.
    This is possible since we use the GpuCache now, which doesn't need to allocate space during initialization.
* Simplify the code in the clip batcher that adds clip instances to the render targets.
* Add support for multiple image masks (a by-product of removing the init step of the mask cache code).
* Move MaskBounds into the ClipSources (from the MaskCacheInfo struct).
* Add recycle() to free list, and support cloning weak handles.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/1679)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Sep 12, 2017

☀️ Test successful - status-travis
Approved by: kvark
Pushing 7628617 to master...

@bors-servo bors-servo merged commit e1ef408 into servo:master Sep 12, 2017
2 of 3 checks passed
2 of 3 checks passed
continuous-integration/travis-ci/pr The Travis CI build could not complete due to an error
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.