Skip to content

Conversation

@mephisto41
Copy link
Contributor

@mephisto41 mephisto41 commented Oct 2, 2017

There are some bugs when we have a transform-style:flat in the middle of transform-style:preserve-3d. So I fixed it by following changes.

  1. ps_split_composite shader did not take position of dest_task into
    account.
  2. make_polygon didn't work if isolated_items_bounds is empty.

r? kvark


This change is Reviewable

anchor: usize,
device_pixel_ratio: f32,
) -> Polygon<f32, WorldPixel> {
//TODO: only work with `isolated_items_bounds.size` worth of space
Copy link
Member

Choose a reason for hiding this comment

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

why is this comment removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I removed this accidentally. I'll add it back.

AlphaBatchTask src_task = fetch_alpha_batch_task(ci.src_task_index);
AlphaBatchTask dest_task = fetch_alpha_batch_task(ci.render_task_index);

vec2 dest_origin = dest_task.render_target_origin -
Copy link
Member

Choose a reason for hiding this comment

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

nice!

let rect = stacking_context.screen_bounds.to_f32() / device_pixel_ratio;
let bounds = LayerRect::new(LayerPoint::new(rect.origin.x, rect.origin.y),
LayerSize::new(rect.size.width, rect.size.height));
return Polygon::from_transformed_rect(bounds, LayerToWorldTransform::identity(), anchor);
Copy link
Member

Choose a reason for hiding this comment

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

hmm, I'm not seeing the point here. If a stacking context has no items to isolate, why would we even want it to participate in the plane splitting (and hence, generate a polygon here)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the reftest we have following display list.

sc1 (preserve3d)
  sc2 (preserve3d)
    rect1
  sc3 (flat)
    sc4 (preserve3d)
      sc5 (preserve3d)
        rect2
      sc6 (preserve3d)
        rect3

We'll create plane splitting for rect 2 and rect 3, then render it in sc3. Next, we'll create plane splitting for sc3 and render it on the screen. Thus, we have a sc with no item bound but need a plane splitting. Does it makes sense?

Copy link
Member

Choose a reason for hiding this comment

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

I believe the isolated_items_bounds for SC3 would then need to include the bounds of SC4. Given that SC4 is transformed, its bounds would need to be projected onto SC3 (transformed).

@mephisto41 mephisto41 force-pushed the fix-split-composite branch from 69f04bd to 556ee36 Compare October 5, 2017 08:39
@mephisto41
Copy link
Contributor Author

@kvark , Now if the SC doesn't have any primitive I'll use the union of all children's bounds as isolated_items_bounds. Can you review it again? Thanks.

@kvark
Copy link
Member

kvark commented Oct 5, 2017

@mephisto41 looks good to me now, thank you!
Do you mind launching a try push to see if any Gecko issues appear before we proceed?

@mephisto41
Copy link
Contributor Author

Sure, I'll submit a try.

@mephisto41
Copy link
Contributor Author

@bors-servo
Copy link
Contributor

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

@kvark
Copy link
Member

kvark commented Oct 5, 2017

@mephisto41 looks good, thank you!
Please rebase and r=me

@kvark
Copy link
Member

kvark commented Oct 5, 2017

@bors-servo delegate=mephisto41

@bors-servo
Copy link
Contributor

✌️ @mephisto41 can now approve this pull request

@bors-servo
Copy link
Contributor

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

@mephisto41
Copy link
Contributor Author

@kvark, I found the original solution did not resolved the issue completely. If the SC is not isolation and it contains primitives and preserve-3d SCs. The bounds for make_polygon should include primitives bounds and all SC children bounds. My original solution only works with the non-isolation SC without any primitives. So I add a new test case for this problem and add a condition in the handle_pop_stacking_context. I think this modification need your review.

else if stacking_context.isolation != ContextIsolation::Items {
    stacking_context.isolated_items_bounds = stacking_context
        .isolated_items_bounds
        .union(&stacking_context.children_sc_bounds);
}

1. ps_split_composite shader did not take position of dest_task into
account.
2. make_polygon didn't work if isolated_items_bounds is empty.
@kvark
Copy link
Member

kvark commented Oct 12, 2017

If the SC is not isolation and it contains primitives and preserve-3d SCs

Could you have a test case for that? AFAIS, both your reftests have all the contexts being isolated.

@mephisto41
Copy link
Contributor Author

I think the SC in line 19 of intermediate-2.yaml is non-isolated SC which has a primitive and a preserve-3d SC.

@kvark
Copy link
Member

kvark commented Oct 12, 2017

@mephisto41 ok, I think we are good to go then, thank you!
@bors-servo r+

@bors-servo
Copy link
Contributor

📌 Commit 1b97c1f has been approved by kvark

@bors-servo
Copy link
Contributor

⌛ Testing commit 1b97c1f with merge cd4415a...

bors-servo pushed a commit that referenced this pull request Oct 12, 2017
Fix some calculation errors for ps_split_composite and make_polygon.

There are some bugs when we have a transform-style:flat in the middle of transform-style:preserve-3d. So I fixed it by following changes.

1. ps_split_composite shader did not take position of dest_task into
account.
2. make_polygon didn't work if isolated_items_bounds is empty.

r? kvark

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

☀️ Test successful - status-appveyor, status-travis
Approved by: kvark
Pushing cd4415a to master...

@bors-servo bors-servo merged commit 1b97c1f into servo:master Oct 12, 2017
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.

3 participants