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

Side by Side Diff: cc/output/gl_renderer.cc

Issue 2516063002: Always restore GL scissor box in GLRenderer::RestoreGLState() (Closed)
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « cc/output/gl_renderer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/output/gl_renderer.h" 5 #include "cc/output/gl_renderer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 ResourceProvider* resource_provider, 373 ResourceProvider* resource_provider,
374 TextureMailboxDeleter* texture_mailbox_deleter, 374 TextureMailboxDeleter* texture_mailbox_deleter,
375 int highp_threshold_min) 375 int highp_threshold_min)
376 : DirectRenderer(settings, output_surface, resource_provider), 376 : DirectRenderer(settings, output_surface, resource_provider),
377 offscreen_framebuffer_id_(0), 377 offscreen_framebuffer_id_(0),
378 shared_geometry_quad_(QuadVertexRect()), 378 shared_geometry_quad_(QuadVertexRect()),
379 gl_(output_surface->context_provider()->ContextGL()), 379 gl_(output_surface->context_provider()->ContextGL()),
380 context_support_(output_surface->context_provider()->ContextSupport()), 380 context_support_(output_surface->context_provider()->ContextSupport()),
381 texture_mailbox_deleter_(texture_mailbox_deleter), 381 texture_mailbox_deleter_(texture_mailbox_deleter),
382 is_scissor_enabled_(false), 382 is_scissor_enabled_(false),
383 scissor_rect_needs_reset_(true),
384 stencil_shadow_(false), 383 stencil_shadow_(false),
385 blend_shadow_(false), 384 blend_shadow_(false),
386 highp_threshold_min_(highp_threshold_min), 385 highp_threshold_min_(highp_threshold_min),
387 highp_threshold_cache_(0), 386 highp_threshold_cache_(0),
388 use_sync_query_(false), 387 use_sync_query_(false),
389 gl_composited_texture_quad_border_( 388 gl_composited_texture_quad_border_(
390 settings->gl_composited_texture_quad_border), 389 settings->gl_composited_texture_quad_border),
391 bound_geometry_(NO_BINDING), 390 bound_geometry_(NO_BINDING),
392 color_lut_cache_(gl_) { 391 color_lut_cache_(gl_) {
393 DCHECK(gl_); 392 DCHECK(gl_);
(...skipping 2823 matching lines...) Expand 10 before | Expand all | Expand 10 after
3217 GL_FRAMEBUFFER_COMPLETE || 3216 GL_FRAMEBUFFER_COMPLETE ||
3218 IsContextLost()); 3217 IsContextLost());
3219 return true; 3218 return true;
3220 } 3219 }
3221 3220
3222 void GLRenderer::SetScissorTestRect(const gfx::Rect& scissor_rect) { 3221 void GLRenderer::SetScissorTestRect(const gfx::Rect& scissor_rect) {
3223 EnsureScissorTestEnabled(); 3222 EnsureScissorTestEnabled();
3224 3223
3225 // Don't unnecessarily ask the context to change the scissor, because it 3224 // Don't unnecessarily ask the context to change the scissor, because it
3226 // may cause undesired GPU pipeline flushes. 3225 // may cause undesired GPU pipeline flushes.
3227 if (scissor_rect == scissor_rect_ && !scissor_rect_needs_reset_) 3226 if (scissor_rect == scissor_rect_) {
3227 #if DCHECK_IS_ON()
3228 GLint actual_scissor[4];
3229 gl_->GetIntegerv(GL_SCISSOR_BOX, actual_scissor);
3230 DCHECK(scissor_rect.x() == actual_scissor[0] &&
3231 scissor_rect.y() == actual_scissor[1] &&
3232 scissor_rect.width() == actual_scissor[2] &&
3233 scissor_rect.height() == actual_scissor[3]);
3234 #endif
3228 return; 3235 return;
3236 }
3229 3237
3230 scissor_rect_ = scissor_rect; 3238 scissor_rect_ = scissor_rect;
3231 FlushTextureQuadCache(SHARED_BINDING); 3239 FlushTextureQuadCache(SHARED_BINDING);
3232 gl_->Scissor(scissor_rect.x(), scissor_rect.y(), scissor_rect.width(), 3240 gl_->Scissor(scissor_rect.x(), scissor_rect.y(), scissor_rect.width(),
3233 scissor_rect.height()); 3241 scissor_rect.height());
3234
3235 scissor_rect_needs_reset_ = false;
3236 } 3242 }
3237 3243
3238 void GLRenderer::SetViewport() { 3244 void GLRenderer::SetViewport() {
3239 gl_->Viewport(current_window_space_viewport_.x(), 3245 gl_->Viewport(current_window_space_viewport_.x(),
3240 current_window_space_viewport_.y(), 3246 current_window_space_viewport_.y(),
3241 current_window_space_viewport_.width(), 3247 current_window_space_viewport_.width(),
3242 current_window_space_viewport_.height()); 3248 current_window_space_viewport_.height());
3243 } 3249 }
3244 3250
3245 void GLRenderer::InitializeSharedObjects() { 3251 void GLRenderer::InitializeSharedObjects() {
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
3717 solid_color_program_aa_.Cleanup(gl_); 3723 solid_color_program_aa_.Cleanup(gl_);
3718 3724
3719 if (offscreen_framebuffer_id_) 3725 if (offscreen_framebuffer_id_)
3720 gl_->DeleteFramebuffers(1, &offscreen_framebuffer_id_); 3726 gl_->DeleteFramebuffers(1, &offscreen_framebuffer_id_);
3721 3727
3722 ReleaseRenderPassTextures(); 3728 ReleaseRenderPassTextures();
3723 } 3729 }
3724 3730
3725 void GLRenderer::ReinitializeGLState() { 3731 void GLRenderer::ReinitializeGLState() {
3726 is_scissor_enabled_ = false; 3732 is_scissor_enabled_ = false;
3727 scissor_rect_needs_reset_ = true; 3733 scissor_rect_ = gfx::Rect(0, 0, 0, 0);
enne (OOO) 2016/11/21 00:47:44 I think this is not correct. If something sets th
trchen 2016/11/21 22:36:15 Shouldn't it early out because the scissor rect is
enne (OOO) 2016/11/21 23:08:05 Ok sure, I guess ReinitializeGLState always calls
3728 stencil_shadow_ = false; 3734 stencil_shadow_ = false;
3729 blend_shadow_ = true; 3735 blend_shadow_ = true;
3730 program_shadow_ = 0; 3736 program_shadow_ = 0;
3731 3737
3732 RestoreGLState(); 3738 RestoreGLState();
3733 } 3739 }
3734 3740
3735 void GLRenderer::RestoreGLState() { 3741 void GLRenderer::RestoreGLState() {
3736 // This restores the current GLRenderer state to the GL context. 3742 // This restores the current GLRenderer state to the GL context.
3737 bound_geometry_ = NO_BINDING; 3743 bound_geometry_ = NO_BINDING;
(...skipping 11 matching lines...) Expand all
3749 if (stencil_shadow_) 3755 if (stencil_shadow_)
3750 gl_->Enable(GL_STENCIL_TEST); 3756 gl_->Enable(GL_STENCIL_TEST);
3751 else 3757 else
3752 gl_->Disable(GL_STENCIL_TEST); 3758 gl_->Disable(GL_STENCIL_TEST);
3753 3759
3754 if (blend_shadow_) 3760 if (blend_shadow_)
3755 gl_->Enable(GL_BLEND); 3761 gl_->Enable(GL_BLEND);
3756 else 3762 else
3757 gl_->Disable(GL_BLEND); 3763 gl_->Disable(GL_BLEND);
3758 3764
3759 if (is_scissor_enabled_) { 3765 if (is_scissor_enabled_)
3760 gl_->Enable(GL_SCISSOR_TEST); 3766 gl_->Enable(GL_SCISSOR_TEST);
3761 gl_->Scissor(scissor_rect_.x(), scissor_rect_.y(), scissor_rect_.width(), 3767 else
3762 scissor_rect_.height());
3763 } else {
3764 gl_->Disable(GL_SCISSOR_TEST); 3768 gl_->Disable(GL_SCISSOR_TEST);
3765 } 3769
3770 gl_->Scissor(scissor_rect_.x(), scissor_rect_.y(), scissor_rect_.width(),
enne (OOO) 2016/11/21 00:47:44 I think a patch that just does this line of code t
trchen 2016/11/21 22:36:15 Sure it will still fix the bug. I don't see why th
3771 scissor_rect_.height());
3766 } 3772 }
3767 3773
3768 bool GLRenderer::IsContextLost() { 3774 bool GLRenderer::IsContextLost() {
3769 return gl_->GetGraphicsResetStatusKHR() != GL_NO_ERROR; 3775 return gl_->GetGraphicsResetStatusKHR() != GL_NO_ERROR;
3770 } 3776 }
3771 3777
3772 void GLRenderer::ScheduleCALayers(DrawingFrame* frame) { 3778 void GLRenderer::ScheduleCALayers(DrawingFrame* frame) {
3773 if (overlay_resource_pool_) { 3779 if (overlay_resource_pool_) {
3774 overlay_resource_pool_->CheckBusyResources(); 3780 overlay_resource_pool_->CheckBusyResources();
3775 } 3781 }
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
4045 // The alpha has already been applied when copying the RPDQ to an IOSurface. 4051 // The alpha has already been applied when copying the RPDQ to an IOSurface.
4046 GLfloat alpha = 1; 4052 GLfloat alpha = 1;
4047 gl_->ScheduleCALayerSharedStateCHROMIUM(alpha, is_clipped, clip_rect, 4053 gl_->ScheduleCALayerSharedStateCHROMIUM(alpha, is_clipped, clip_rect,
4048 sorting_context_id, gl_transform); 4054 sorting_context_id, gl_transform);
4049 gl_->ScheduleCALayerCHROMIUM( 4055 gl_->ScheduleCALayerCHROMIUM(
4050 texture_id, contents_rect, ca_layer_overlay->background_color, 4056 texture_id, contents_rect, ca_layer_overlay->background_color,
4051 ca_layer_overlay->edge_aa_mask, bounds_rect, filter); 4057 ca_layer_overlay->edge_aa_mask, bounds_rect, filter);
4052 } 4058 }
4053 4059
4054 } // namespace cc 4060 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/gl_renderer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698