Bug 1709535 - Fix clear tiles. r=gfx-reviewers,jnicol

In bug 1696905 I changed how clear tiles are rendered from multiply blend to opaque, however it breaks window controls on Windows 8 (the only thing that clear tiles are used for). This patch reverts clear tiles to the previous behavior.

I'm not sure how to test this part of the code because it depends on the widget integration code having something to show behind the window.

Differential Revision: https://phabricator.services.mozilla.com/D114327
This commit is contained in:
Nicolas Silva 2021-05-05 09:22:48 +00:00
Родитель 92b0ab56f1
Коммит 32c8731610
2 изменённых файлов: 26 добавлений и 1 удалений

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

@ -590,7 +590,8 @@ impl CompositeState {
(CompositeTileSurface::Color { color: *color }, true)
}
TileSurface::Clear => {
(CompositeTileSurface::Clear, true)
// Clear tiles are rendered with blend mode pre-multiply-dest-out.
(CompositeTileSurface::Clear, false)
}
TileSurface::Texture { descriptor, .. } => {
let surface = descriptor.resolve(resource_cache, tile_cache.current_tile_size);

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

@ -3500,6 +3500,7 @@ impl Renderer {
let cap = composite_state.tiles.len();
let mut occlusion = occlusion::FrontToBackBuilder::with_capacity(cap, cap);
let mut clear_tiles = Vec::new();
for (idx, tile) in composite_state.tiles.iter().enumerate() {
// Clear tiles overwrite whatever is under them, so they are treated as opaque.
@ -3526,6 +3527,15 @@ impl Renderer {
continue;
}
if tile.kind == TileKind::Clear {
// Clear tiles are specific to how we render the window buttons on
// Windows 8. We can get away with drawing them at the end on top
// of everything else, which we do to avoid having to juggle with
// the blend state.
clear_tiles.push(occlusion::Item { rectangle: rect, key: idx });
continue;
}
occlusion.add(&rect, is_opaque, idx);
}
@ -3583,6 +3593,20 @@ impl Renderer {
);
self.gpu_profiler.finish_sampler(transparent_sampler);
}
if !clear_tiles.is_empty() {
let transparent_sampler = self.gpu_profiler.start_sampler(GPU_SAMPLER_TAG_TRANSPARENT);
self.set_blend(true, FramebufferKind::Main);
self.device.set_blend_mode_premultiplied_dest_out();
self.draw_tile_list(
clear_tiles.iter(),
&composite_state,
&composite_state.external_surfaces,
projection,
&mut results.stats,
);
self.gpu_profiler.finish_sampler(transparent_sampler);
}
}
fn draw_color_target(