Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Unified Diff: cc/output/direct_renderer.cc

Issue 2612023002: cc: Implement overdraw feedback debugging feature. (Closed)
Patch Set: fix typo in comment Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/output/direct_renderer.cc
diff --git a/cc/output/direct_renderer.cc b/cc/output/direct_renderer.cc
index d0798231bcb21092967c4ca6161b0881e6b54360..8c3764a0e2b30be7d6fa2293458fe68f83d96db3 100644
--- a/cc/output/direct_renderer.cc
+++ b/cc/output/direct_renderer.cc
@@ -87,6 +87,10 @@ void DirectRenderer::Initialize() {
context_provider->ContextCapabilities().commit_overlay_planes)
allow_empty_swap_ = true;
+ LOG_IF(WARNING, settings_->show_overdraw_feedback &&
danakj 2017/01/12 00:42:57 use DLOG_IF instead. why doesn't this happen for
reveman 2017/01/13 01:27:42 Done.
danakj 2017/01/16 16:22:01 What about just a simple static bool? It's okay to
reveman 2017/01/16 18:02:26 Done. Although "call once" execution of code using
danakj 2017/01/16 18:17:52 What race are you worried about, DirectRenderer be
reveman 2017/01/16 22:46:18 I'd rather not introduce the assumption that this
+ !output_surface_->capabilities().supports_stencil)
+ << "Overdraw feedback enabled without output surface stencil support.";
danakj 2017/01/12 00:42:57 This error is pretty vague, I think it might be ni
reveman 2017/01/13 01:27:42 Makes sense. Done.
+
initialized_ = true;
}
@@ -225,6 +229,14 @@ void DirectRenderer::DrawFrame(RenderPassList* render_passes_in_draw_order,
RenderPass* root_render_pass = render_passes_in_draw_order->back().get();
DCHECK(root_render_pass);
+ bool overdraw_tracing_enabled;
+ TRACE_EVENT_CATEGORY_GROUP_ENABLED(
+ TRACE_DISABLED_BY_DEFAULT("cc.debug.overdraw"),
+ &overdraw_tracing_enabled);
+ overdraw_feedback_ =
+ (settings_->show_overdraw_feedback || overdraw_tracing_enabled) &&
+ output_surface_->capabilities().supports_stencil;
+
DrawingFrame frame;
frame.render_passes_in_draw_order = render_passes_in_draw_order;
frame.root_render_pass = root_render_pass;
@@ -238,17 +250,20 @@ void DirectRenderer::DrawFrame(RenderPassList* render_passes_in_draw_order,
// can leave the window at the wrong size if we never draw and the proper
// viewport size is never set.
bool frame_has_alpha = frame.root_render_pass->has_transparent_background;
+ bool use_stencil = overdraw_feedback_;
if (device_viewport_size != reshape_surface_size_ ||
device_scale_factor != reshape_device_scale_factor_ ||
device_color_space != reshape_device_color_space_ ||
- frame_has_alpha != reshape_has_alpha_) {
+ frame_has_alpha != reshape_has_alpha_ ||
+ use_stencil != reshape_use_stencil_) {
reshape_surface_size_ = device_viewport_size;
reshape_device_scale_factor_ = device_scale_factor;
reshape_device_color_space_ = device_color_space;
reshape_has_alpha_ = frame.root_render_pass->has_transparent_background;
- output_surface_->Reshape(reshape_surface_size_,
- reshape_device_scale_factor_,
- reshape_device_color_space_, reshape_has_alpha_);
+ reshape_use_stencil_ = overdraw_feedback_;
+ output_surface_->Reshape(
+ reshape_surface_size_, reshape_device_scale_factor_,
+ reshape_device_color_space_, reshape_has_alpha_, reshape_use_stencil_);
}
BeginDrawingFrame(&frame);
« no previous file with comments | « cc/output/direct_renderer.h ('k') | cc/output/gl_renderer.h » ('j') | cc/output/gl_renderer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698