Skip to content

Conversation

@glennw
Copy link
Member

@glennw 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...

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).
Copy link
Member

@kvark kvark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📌 Commit e1ef408 has been approved by kvark

@bors-servo
Copy link
Contributor

⌛ Testing commit e1ef408 with merge d8223e4...

bors-servo pushed 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

💔 Test failed - status-travis

@glennw
Copy link
Member Author

glennw commented Sep 12, 2017

@bors-servo retry

@bors-servo
Copy link
Contributor

⌛ Testing commit e1ef408 with merge 7628617...

bors-servo pushed 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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants