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

Unified Diff: cc/output/gl_renderer.cc

Issue 1028333002: Chromium -> Mojo roll. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 9 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.cc.rej » ('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 b49ac8eefec9d79361aab1583bbc9e807bc61d0a..e614d8b56131bd8402fde62e17b13980da162268 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -401,10 +401,8 @@ void GLRenderer::DidChangeVisibility() {
void GLRenderer::ReleaseRenderPassTextures() { render_pass_textures_.clear(); }
-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)
+void GLRenderer::DiscardPixels() {
+ if (!capabilities_.using_discard_framebuffer)
return;
bool using_default_framebuffer =
!current_framebuffer_lock_ &&
@@ -415,15 +413,27 @@ void GLRenderer::DiscardPixels(bool has_external_stencil_test,
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 (has_external_stencil_test) {
- DCHECK(!frame->current_render_pass->has_transparent_background);
- return;
+void GLRenderer::PrepareSurfaceForPass(
+ DrawingFrame* frame,
+ SurfaceInitializationMode initialization_mode,
+ const gfx::Rect& render_pass_scissor) {
+ switch (initialization_mode) {
+ case SURFACE_INITIALIZATION_MODE_PRESERVE:
+ EnsureScissorTestDisabled();
+ return;
+ case SURFACE_INITIALIZATION_MODE_FULL_SURFACE_CLEAR:
+ EnsureScissorTestDisabled();
+ DiscardPixels();
+ ClearFramebuffer(frame);
+ break;
+ case SURFACE_INITIALIZATION_MODE_SCISSORED_CLEAR:
+ SetScissorTestRect(render_pass_scissor);
+ ClearFramebuffer(frame);
+ break;
}
+}
+void GLRenderer::ClearFramebuffer(DrawingFrame* frame) {
// 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)
@@ -2920,9 +2930,6 @@ bool GLRenderer::BindFramebufferToTexture(DrawingFrame* frame,
DCHECK(gl_->CheckFramebufferStatus(GL_FRAMEBUFFER) ==
GL_FRAMEBUFFER_COMPLETE ||
IsContextLost());
-
- InitializeViewport(
- frame, target_rect, gfx::Rect(target_rect.size()), target_rect.size());
return true;
}
« no previous file with comments | « cc/output/gl_renderer.h ('k') | cc/output/gl_renderer.cc.rej » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698