Bug 1771561 - Fix incorrectly invalidating tiles with zero-sized backdrop filters r=gfx-reviewers,lsalzman

Differential Revision: https://phabricator.services.mozilla.com/D147710
This commit is contained in:
Glenn Watson 2022-05-31 22:55:32 +00:00
Родитель fffb5f1ec1
Коммит 64e35e6e1a
3 изменённых файлов: 53 добавлений и 27 удалений

Просмотреть файл

@ -0,0 +1,18 @@
<html reftest-zoom="3" class="reftest-wait">
<head>
<style>
#a {
scale: 0.785 6 1;
clip-path: polygon(0px 0px, 0px 1px, -1px 10px);
}
#b {
text-indent: -1em;
backdrop-filter: grayscale(1%);
}
</style>
</head>
<body onload="document.documentElement.classList.remove('reftest-wait')">
<table id="a" rules="groups">
<th id="b">a</th>
<th>1(ewye</th>
</body>

Просмотреть файл

@ -217,3 +217,4 @@ load 1768096-1.html
pref(layout.css.backdrop-filter.enabled,true) load 1771294.html
pref(layout.css.backdrop-filter.enabled,true) load 1771293.html
pref(layout.css.backdrop-filter.enabled,true) load 1771556.html
pref(layout.css.backdrop-filter.enabled,true) load 1771561.html

Просмотреть файл

@ -3344,38 +3344,45 @@ impl TileCacheInstance {
}
PrimitiveInstanceKind::BackdropCapture { .. } => {}
PrimitiveInstanceKind::BackdropRender { pic_index, .. } => {
// Mark that we need the sub-graph this render depends on so that
// we don't skip it during the prepare pass
scratch.required_sub_graphs.insert(pic_index);
// If the area that the backdrop covers in the space of the surface it draws on
// is empty, skip any sub-graph processing. This is not just a performance win,
// it also ensures that we don't do a deferred dirty test that invalidates a tile
// even if the tile isn't actually dirty, which can cause panics later in the
// WR pipeline.
if !pic_coverage_rect.is_empty() {
// Mark that we need the sub-graph this render depends on so that
// we don't skip it during the prepare pass
scratch.required_sub_graphs.insert(pic_index);
// If this is a sub-graph, register the bounds on any affected tiles
// so we know how much to expand the content tile by.
// If this is a sub-graph, register the bounds on any affected tiles
// so we know how much to expand the content tile by.
// Implicitly, we know that any slice with a sub-graph disables compositor
// surface promotion, so sub_slice_index will always be 0.
debug_assert_eq!(sub_slice_index, 0);
let sub_slice = &mut self.sub_slices[sub_slice_index];
// Implicitly, we know that any slice with a sub-graph disables compositor
// surface promotion, so sub_slice_index will always be 0.
debug_assert_eq!(sub_slice_index, 0);
let sub_slice = &mut self.sub_slices[sub_slice_index];
let mut surface_info = Vec::new();
for (pic_index, surface_index) in surface_stack.iter().rev() {
let pic = &pictures[pic_index.0];
surface_info.push((pic.composite_mode.as_ref().unwrap().clone(), *surface_index));
}
for y in p0.y .. p1.y {
for x in p0.x .. p1.x {
let key = TileOffset::new(x, y);
let tile = sub_slice.tiles.get_mut(&key).expect("bug: no tile");
tile.sub_graphs.push((pic_coverage_rect, surface_info.clone()));
let mut surface_info = Vec::new();
for (pic_index, surface_index) in surface_stack.iter().rev() {
let pic = &pictures[pic_index.0];
surface_info.push((pic.composite_mode.as_ref().unwrap().clone(), *surface_index));
}
}
// For backdrop-filter, we need to check if any of the dirty rects
// in tiles that are affected by the filter primitive are dirty.
self.deferred_dirty_tests.push(DeferredDirtyTest {
tile_rect: TileRect::new(p0, p1),
prim_rect: pic_coverage_rect,
});
for y in p0.y .. p1.y {
for x in p0.x .. p1.x {
let key = TileOffset::new(x, y);
let tile = sub_slice.tiles.get_mut(&key).expect("bug: no tile");
tile.sub_graphs.push((pic_coverage_rect, surface_info.clone()));
}
}
// For backdrop-filter, we need to check if any of the dirty rects
// in tiles that are affected by the filter primitive are dirty.
self.deferred_dirty_tests.push(DeferredDirtyTest {
tile_rect: TileRect::new(p0, p1),
prim_rect: pic_coverage_rect,
});
}
}
PrimitiveInstanceKind::LineDecoration { .. } |
PrimitiveInstanceKind::NormalBorder { .. } |