Commit 7df46a01 authored by Eric Karl's avatar Eric Karl Committed by Commit Bot

De-jelly: Fix SurfaceDrawQuad with clipped non-merged root RenderPass

Note, this fix is general, but in this CL we restrict it to de-jelly
paths for merge safety. A follow-up CL will remove this restriction.

In cases where a SurfaceDrawQuad's root render pass was not merged into
its parent, we did not correctly handle cases where the root render
pass represented a subset of the SurfaceDrawQuad's area. This was
possible in OOPIF cases where the root render pass was clipped to
visible bounds.

This CL adjusts generated RenderPassDrawQuad's parameters to ensure it
is correctly sized and samples from the correct area of the source
RenderPass.

Bug: 1016677
Change-Id: Ic88d22c86e6d6399689dfb7d1ca4f0fda0ab24f3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1879750Reviewed-by: default avatarSaman Sami <samans@chromium.org>
Commit-Queue: Eric Karl <ericrk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#709715}
parent b29f02d9
......@@ -668,13 +668,39 @@ void SurfaceAggregator::EmitSurfaceContent(
gfx::ScaleToEnclosingRect(source_visible_rect, layer_to_content_scale_x,
layer_to_content_scale_y));
auto* quad = dest_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>();
RenderPassId remapped_pass_id = RemapPassId(last_pass.id, surface_id);
quad->SetNew(shared_quad_state, scaled_rect, scaled_visible_rect,
remapped_pass_id, 0, gfx::RectF(), gfx::Size(),
gfx::Vector2dF(), gfx::PointF(), gfx::RectF(scaled_rect),
/*force_anti_aliasing_off=*/false,
/* backdrop_filter_quality*/ 1.0f);
// TODO(ericrk): Apply this path everywhere (not just de-jelly).
// crbug.com/1016677
if (de_jelly_enabled_) {
// Due to viewport clipping, |last_pass|'s |output_rect| may be smaller
// than |source_rect|'s projection into content space. We always use
// |output_rect| to avoid sampling outside of RenderPass output.
gfx::Rect quad_rect = last_pass.output_rect;
// We can't produce content outside of |output_rect|, so clip the visible
// rect if necessary.
scaled_visible_rect.Intersect(quad_rect);
// |tex_coord_rect| indicates the area of the source texture to sample
// from. This is always the size of |quad_rect| which represents the full
// render pass |output_rect|.
gfx::RectF tex_coord_rect = gfx::RectF(gfx::SizeF(quad_rect.size()));
auto* quad = dest_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>();
RenderPassId remapped_pass_id = RemapPassId(last_pass.id, surface_id);
quad->SetNew(shared_quad_state, quad_rect, scaled_visible_rect,
remapped_pass_id, 0, gfx::RectF(), gfx::Size(),
gfx::Vector2dF(), gfx::PointF(), tex_coord_rect,
/*force_anti_aliasing_off=*/false,
/* backdrop_filter_quality*/ 1.0f);
} else {
auto* quad = dest_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>();
RenderPassId remapped_pass_id = RemapPassId(last_pass.id, surface_id);
quad->SetNew(shared_quad_state, scaled_rect, scaled_visible_rect,
remapped_pass_id, 0, gfx::RectF(), gfx::Size(),
gfx::Vector2dF(), gfx::PointF(), gfx::RectF(scaled_rect),
/*force_anti_aliasing_off=*/false,
/* backdrop_filter_quality*/ 1.0f);
}
}
referenced_surfaces_.erase(surface_id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment