Bug 1567472 - Fix bug in preserve-3d batching code in WebRender. r=nical

The code to batch preserve-3d elements was incorrectly using the
bounds and visibility mask from the parent element. This could
result in batching bugs in some cases, which were showing up as
draw order issues.

Differential Revision: https://phabricator.services.mozilla.com/D38834

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Glenn Watson 2019-07-22 13:30:55 +00:00
parent 93bd4b973a
commit be4cf10770
4 changed files with 53 additions and 2 deletions

View File

@ -1137,6 +1137,10 @@ impl BatchBuilder {
gpu_cache,
);
// Need a new z-id for each child preserve-3d context added
// by this inner loop.
let z_id = z_generator.next();
let prim_header_index = prim_headers.push(&prim_header, z_id, [
uv_rect_address.as_int(),
if raster_config.establishes_raster_root { 1 } else { 0 },
@ -1152,11 +1156,11 @@ impl BatchBuilder {
self.add_split_composite_instance_to_batches(
key,
&prim_info.clip_chain.pic_clip_rect,
&child_prim_info.clip_chain.pic_clip_rect,
z_id,
prim_header_index,
child.gpu_address,
prim_info.visibility_mask,
child_prim_info.visibility_mask,
);
}
}

View File

@ -0,0 +1,15 @@
---
root:
items:
-
type: rect
bounds: [8, 8, 200, 200]
color: blue
-
type: rect
bounds: [8, 208, 200, 200]
color: blue
-
type: rect
bounds: [8, 408, 200, 200]
color: blue

View File

@ -0,0 +1,31 @@
# Ensure that preserve-3d items are correctly batched with transparent siblings.
---
root:
items:
-
type: stacking-context
transform-style: "preserve-3d"
items:
-
type: rect
bounds: [8, 8, 200, 200]
color: blue
-
type: stacking-context
transform-style: "preserve-3d"
items:
-
type: rect
bounds: [8, 208, 200, 200]
color: blue
- type: rect
color: [255, 0, 0, 0.5]
bounds: [8, 408, 200, 200]
-
type: stacking-context
transform-style: "preserve-3d"
items:
-
type: rect
bounds: [8, 408, 200, 200]
color: blue

View File

@ -19,3 +19,4 @@ platform(linux,mac) fuzzy(1,20) == same-plane.yaml same-plane.png
== mixed-order.yaml mixed-order-ref.yaml
fuzzy(1,40000) == filter.yaml filter-ref.yaml
fuzzy(1,10000) == gradient.yaml gradient-ref.yaml
== order-3.yaml order-3-ref.yaml