Skip to content

Conversation

@eqrion
Copy link
Contributor

@eqrion eqrion commented Jan 29, 2017

A StackingContext holds a Vec and a MixBlendMode, but currently only one operation is applied. This change modifies the render task building code to respect multiple composite operations. It's also careful to apply filters first and then the mix-blend-mode according to the spec.


This change is Reviewable

@eqrion
Copy link
Contributor Author

eqrion commented Jan 29, 2017

I've tested this on some basic filter and mix-blend-mode combinations and it seems to work. I used wrench plus the changes in #801.

@glennw
Copy link
Member

glennw commented Jan 30, 2017

Reviewed 2 of 3 files at r1.
Review status: 2 of 3 files reviewed at latest revision, 1 unresolved discussion.


webrender/src/tiling.rs, line 1880 at r1 (raw file):

                      pipeline_id: PipelineId,
                      scroll_layer_id: ScrollLayerId,
                      composite_ops: &CompositeOps) {

Let's remove the & and move the CompositeOps here - that will avoid the clone() below.


Comments from Reviewable

@glennw
Copy link
Member

glennw commented Jan 30, 2017

This looks great! Just one minor issue above.

@eqrion
Copy link
Contributor Author

eqrion commented Jan 30, 2017

Review status: 1 of 3 files reviewed at latest revision, 1 unresolved discussion.


webrender/src/tiling.rs, line 1880 at r1 (raw file):

Previously, glennw (Glenn Watson) wrote…

Let's remove the & and move the CompositeOps here - that will avoid the clone() below.

The &[CompositionOp] was passed into push_layer twice if the stacking context was root with a background color. But I don't think that extra layer needs CompositeOps, so I've removed the & and give that layer CompositeOps::empty().


Comments from Reviewable

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.

It's nice to see the removal of CompositionOp, which makes things a bit more straightforward. I got a single concern here, and it's not critical.

let prev_task = mem::replace(&mut current_task, new_task);
alpha_task_stack.push(prev_task);
}
let composite_count = layer.composite_ops.count();
Copy link
Member

Choose a reason for hiding this comment

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

why do you need to separate task creation from task initialization (which is happening in PopStackingContext)? Could we have all the logic in one place (in the pop code) instead?

for filter in &layer.composite_ops.filters {
let mut prev_task = alpha_task_stack.pop().unwrap();
let item = AlphaRenderItem::Blend(sc_index, current_task.id, *filter, next_z);
next_z += 1;
Copy link
Member

Choose a reason for hiding this comment

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

I don't think changing the Z makes sense here, given that we are rendering into the task cache and that's not supposed to use the depth test anyway.

Copy link
Member

Choose a reason for hiding this comment

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

The Z is used here when drawing the blend item into the main scene.

@glennw
Copy link
Member

glennw commented Jan 30, 2017

@rlhunt Yup, you're right about the extra layer - your change seems correct to me. r=me once the question from @kvark is resolved.

@glennw
Copy link
Member

glennw commented Jan 31, 2017

Review status: 1 of 3 files reviewed at latest revision, 3 unresolved discussions.


webrender/src/tiling.rs, line 2595 at r2 (raw file):

Previously, kvark (Dzmitry Malyshau) wrote…

why do you need to separate task creation from task initialization (which is happening in PopStackingContext)? Could we have all the logic in one place (in the pop code) instead?

The tasks are created here and pushed onto a stack, so that the items in the primitive runs get pushed on to the right task. Or am I completely misunderstanding your comment? :)


Comments from Reviewable

@bors-servo
Copy link
Contributor

☔ The latest upstream changes (presumably #792) made this pull request unmergeable. Please resolve the merge conflicts.

@eqrion
Copy link
Contributor Author

eqrion commented Jan 31, 2017

So yes, basically what Glenn said. Tasks need to be created before the following primitive run so the primitives are added to them. And I'm not familiar with how the Z order code is used, but Glenn's comment makes sense.

I tried to preserve the original task creation logic. I only extended it so multiple filters on a single stacking context would act like multiple identical stacking contexts with a single filter.

@eqrion
Copy link
Contributor Author

eqrion commented Jan 31, 2017

Hmm, so I rebased my branch on the latest master. Not sure why that isn't showing up here.

@glennw
Copy link
Member

glennw commented Jan 31, 2017

I'm not sure why appveyor is confused either. Could you try rebasing again, or if it's already up to date, try do just run git commit --amend which will modify the timestamp and commit SHA, and then force push?

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.

ok, sounds good, thanks for the answers!

@eqrion
Copy link
Contributor Author

eqrion commented Jan 31, 2017

Okay, that did the trick!

@glennw
Copy link
Member

glennw commented Jan 31, 2017

@bors-servo r+

@bors-servo
Copy link
Contributor

📌 Commit 4dadd6c has been approved by glennw

@bors-servo
Copy link
Contributor

⌛ Testing commit 4dadd6c with merge b8fd811...

bors-servo pushed a commit that referenced this pull request Feb 1, 2017
Support multiple composite operations in a StackingContext

A StackingContext holds a Vec<FilterOp> and a MixBlendMode, but currently only one operation is applied. This change modifies the render task building code to respect multiple composite operations. It's also careful to apply filters first and then the mix-blend-mode according to the spec.

<!-- 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/802)
<!-- Reviewable:end -->
@glennw glennw closed this Feb 1, 2017
@glennw glennw reopened this Feb 1, 2017
@glennw
Copy link
Member

glennw commented Feb 1, 2017

@bors-servo r+

@bors-servo
Copy link
Contributor

💡 This pull request was already approved, no need to approve it again.

  • This pull request is currently being tested. If there's no response from the continuous integration service, you may use retry to trigger a build again.

@bors-servo
Copy link
Contributor

📌 Commit 4dadd6c has been approved by glennw

@glennw
Copy link
Member

glennw commented Feb 2, 2017

Merging manually - homu is not listening, but travis has passed on both platforms.

@glennw glennw merged commit 1f767cf into servo:master Feb 2, 2017
@eqrion eqrion deleted the composite branch April 6, 2017 21:39
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