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

Change drop-shadows to be drawn via a single primitive. #2656

Merged
merged 1 commit into from Apr 13, 2018

Conversation

@glennw
Copy link
Member

glennw commented Apr 13, 2018

Previously, drop-shadows were a Picture, with two brush image
primitives, each referencing the picture (one for the content,
one for the shadow with an offset).

Although conceptually reasonable, this exposes some problems
with the way the current prim_store visibility pass works.
Specifically, we can end up processing the picture more than
once. In general this is an inefficiency but doesn't affect
correctness, but it breaks some assumptions once the content
of the drop-shadow element is an item in the render task cache.

In the future, this problem should disappear as we refactor
how the visibility pass operates, but for now the simplest solution
is to draw the drop-shadow with a single primitive. To make this
work, there are a couple of hacks in this patch, which
push an extra brush image primitive into the GPU cache data.

The drop shadows still have an issue with the shadow disappearing
if the content of the drop shadow is off-screen, however this is
no worse than the existing code. Doing it this way actually makes
it easier to fix this is the future too.


This change is Reviewable

Previously, drop-shadows were a Picture, with two brush image
primitives, each referencing the picture (one for the content,
one for the shadow with an offset).

Although conceptually reasonable, this exposes some problems
with the way the current prim_store visibility pass works.
Specifically, we can end up processing the picture more than
once. In general this is an inefficiency but doesn't affect
correctness, but it breaks some assumptions once the content
of the drop-shadow element is an item in the render task cache.

In the future, this problem should disappear as we refactor
how the visibility pass operates, but for now the simplest solution
is to draw the drop-shadow with a single primitive. To make this
work, there are a couple of hacks in this patch, which
push an extra brush image primitive into the GPU cache data.

The drop shadows still have an issue with the shadow disappearing
if the content of the drop shadow is off-screen, however this is
no worse than the existing code. Doing it this way actually makes
it easier to fix this is the future too.
@glennw glennw requested a review from kvark Apr 13, 2018
@glennw
Copy link
Member Author

glennw commented Apr 13, 2018

Try run looks good to me.

@kvark
Copy link
Member

kvark commented Apr 13, 2018

:lgtm:

In general this is an inefficiency but doesn't affect
correctness, but it breaks some assumptions once the content
of the drop-shadow element is an item in the render task cache.

I'd like to know more about this.


Reviewed 5 of 5 files at r1.
Review status: all files reviewed at latest revision, all discussions resolved.


webrender/src/picture.rs, line 171 at r1 (raw file):

                //           drop-shadows from disappearing if the main content
                //           rect is not visible. Something like:
                // let shadow_rect = local_content_rect

👍


Comments from Reviewable

@kvark
Copy link
Member

kvark commented Apr 13, 2018

@bors-servo
Copy link
Contributor

bors-servo commented Apr 13, 2018

📌 Commit cf9d147 has been approved by kvark

@bors-servo
Copy link
Contributor

bors-servo commented Apr 13, 2018

Testing commit cf9d147 with merge 4be4420...

bors-servo added a commit that referenced this pull request Apr 13, 2018
Change drop-shadows to be drawn via a single primitive.

Previously, drop-shadows were a Picture, with two brush image
primitives, each referencing the picture (one for the content,
one for the shadow with an offset).

Although conceptually reasonable, this exposes some problems
with the way the current prim_store visibility pass works.
Specifically, we can end up processing the picture more than
once. In general this is an inefficiency but doesn't affect
correctness, but it breaks some assumptions once the content
of the drop-shadow element is an item in the render task cache.

In the future, this problem should disappear as we refactor
how the visibility pass operates, but for now the simplest solution
is to draw the drop-shadow with a single primitive. To make this
work, there are a couple of hacks in this patch, which
push an extra brush image primitive into the GPU cache data.

The drop shadows still have an issue with the shadow disappearing
if the content of the drop shadow is off-screen, however this is
no worse than the existing code. Doing it this way actually makes
it easier to fix this is the future too.

<!-- 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/2656)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Apr 13, 2018

☀️ Test successful - status-appveyor, status-taskcluster
Approved by: kvark
Pushing 4be4420 to master...

@bors-servo bors-servo merged commit cf9d147 into servo:master Apr 13, 2018
3 of 4 checks passed
3 of 4 checks passed
code-review/reviewable 1 discussion left (glennw, kvark)
Details
Taskcluster (pull_request) TaskGroup: success
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.