Commit 2e0a019f authored by Daniele Castagna's avatar Daniele Castagna Committed by Commit Bot

viz: Fix overdraw feedback

Overdraw feedback has been broken for two reasons:
1. When we added explicit fences, we inserted the fence before the
  overdraw colors were drawn
2. When we changed how we do partial swap, we forgot to expand the rect
  where the overdraw feedback is drawn to.

This CL fixes those two issues moving the drawing of the overdraw
feedback at the end of DrawRenderPass.

Test: Run Chrome on nocture with the flag to enable overdraw feedback
Change-Id: I57069f8596d0bdb2bc819c8de5c70cf3901d7199
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1904681
Commit-Queue: Daniele Castagna <dcastagna@chromium.org>
Reviewed-by: default avatarkylechar <kylechar@chromium.org>
Reviewed-by: default avatarAndres Calderon Jaramillo <andrescj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#714540}
parent 74a82b96
......@@ -683,6 +683,9 @@ void DirectRenderer::DrawRenderPass(const RenderPass* render_pass) {
render_pass_requires_scissor);
FinishDrawingQuadList();
if (is_root_render_pass && overdraw_feedback_)
FlushOverdrawFeedback(render_pass_scissor_in_draw_space);
if (render_pass->generate_mipmap)
GenerateMipmap();
}
......
......@@ -206,6 +206,7 @@ class VIZ_SERVICE_EXPORT DirectRenderer {
virtual void DoDrawQuad(const DrawQuad* quad,
const gfx::QuadF* clip_region) = 0;
virtual void BeginDrawingFrame() = 0;
virtual void FlushOverdrawFeedback(const gfx::Rect& output_rect) {}
virtual void FinishDrawingFrame() = 0;
// If a pass contains a single tile draw quad and can be drawn without
// a render pass (e.g. applying a filter directly to the tile quad)
......
......@@ -2725,8 +2725,6 @@ void GLRenderer::FinishDrawingFrame() {
}
swap_buffer_rect_.Union(current_frame()->root_damage_rect);
if (overdraw_feedback_)
FlushOverdrawFeedback(swap_buffer_rect_);
if (use_swap_with_bounds_)
swap_content_bounds_ = current_frame()->root_content_bounds;
......@@ -2799,9 +2797,6 @@ void GLRenderer::CopyDrawnRenderPass(
std::unique_ptr<CopyOutputRequest> request) {
TRACE_EVENT0("viz", "GLRenderer::CopyDrawnRenderPass");
if (overdraw_feedback_)
FlushOverdrawFeedback(current_frame()->current_render_pass->output_rect);
GLuint framebuffer_texture = 0;
gfx::Size framebuffer_texture_size;
if (current_framebuffer_texture_) {
......
......@@ -102,6 +102,7 @@ class VIZ_SERVICE_EXPORT GLRenderer : public DirectRenderer {
void DoDrawQuad(const class DrawQuad*,
const gfx::QuadF* draw_region) override;
void BeginDrawingFrame() override;
void FlushOverdrawFeedback(const gfx::Rect& output_rect) override;
void FinishDrawingFrame() override;
bool FlippedFramebuffer() const override;
bool FlippedRootFramebuffer() const;
......@@ -330,7 +331,7 @@ class VIZ_SERVICE_EXPORT GLRenderer : public DirectRenderer {
// Setup/flush all pending overdraw feedback to framebuffer.
void SetupOverdrawFeedback();
void FlushOverdrawFeedback(const gfx::Rect& output_rect);
// Process overdraw feedback from query.
void ProcessOverdrawFeedback(std::vector<int>* overdraw,
size_t num_expected_results,
......
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