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

Unified Diff: cc/output/gl_renderer.cc

Issue 24239006: cc: Don't discard framebuffer when using partial swaps (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 7 years, 3 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
« no previous file with comments | « cc/output/gl_renderer.h ('k') | cc/output/gl_renderer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/gl_renderer.cc
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
index f365e36cd9108281b19cb2830c13c14e0a0f228c..f4b1e575d3920391c6e667c5bc230b1f0496730a 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -290,25 +290,29 @@ void GLRenderer::ViewportChanged() {
ReinitializeGrCanvas();
}
-void GLRenderer::ClearFramebuffer(DrawingFrame* frame) {
+void GLRenderer::DiscardPixels(bool has_external_stencil_test,
+ bool draw_rect_covers_full_surface) {
+ if (has_external_stencil_test || !draw_rect_covers_full_surface ||
+ !capabilities_.using_discard_framebuffer)
+ return;
+ bool using_default_framebuffer =
+ !current_framebuffer_lock_ &&
+ output_surface_->capabilities().uses_default_gl_framebuffer;
+ GLenum attachments[] = {static_cast<GLenum>(
+ using_default_framebuffer ? GL_COLOR_EXT : GL_COLOR_ATTACHMENT0_EXT)};
+ context_->discardFramebufferEXT(
+ GL_FRAMEBUFFER, arraysize(attachments), attachments);
+}
+
+void GLRenderer::ClearFramebuffer(DrawingFrame* frame,
+ bool has_external_stencil_test) {
// It's unsafe to clear when we have a stencil test because glClear ignores
// stencil.
- if (output_surface_->HasExternalStencilTest() &&
- frame->current_render_pass == frame->root_render_pass) {
+ if (has_external_stencil_test) {
DCHECK(!frame->current_render_pass->has_transparent_background);
return;
}
- if (capabilities_.using_discard_framebuffer) {
- bool using_default_framebuffer =
- !current_framebuffer_lock_ &&
- output_surface_->capabilities().uses_default_gl_framebuffer;
- GLenum attachments[] = {static_cast<GLenum>(
- using_default_framebuffer ? GL_COLOR_EXT : GL_COLOR_ATTACHMENT0_EXT)};
- context_->discardFramebufferEXT(
- GL_FRAMEBUFFER, arraysize(attachments), attachments);
- }
-
// On DEBUG builds, opaque render passes are cleared to blue to easily see
// regions that were not drawn on the screen.
if (frame->current_render_pass->has_transparent_background)
« no previous file with comments | « cc/output/gl_renderer.h ('k') | cc/output/gl_renderer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698