OLD | NEW |
---|---|
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 3846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3857 // 3. Fix shader uniforms that were broken by (2). | 3857 // 3. Fix shader uniforms that were broken by (2). |
3858 // | 3858 // |
3859 // Then: | 3859 // Then: |
3860 // 4. Allocate an IOSurface as the drawing destination. | 3860 // 4. Allocate an IOSurface as the drawing destination. |
3861 // 5. Draw the RPDQ. | 3861 // 5. Draw the RPDQ. |
3862 void GLRenderer::CopyRenderPassDrawQuadToOverlayResource( | 3862 void GLRenderer::CopyRenderPassDrawQuadToOverlayResource( |
3863 const CALayerOverlay* ca_layer_overlay, | 3863 const CALayerOverlay* ca_layer_overlay, |
3864 Resource** resource, | 3864 Resource** resource, |
3865 DrawingFrame* external_frame, | 3865 DrawingFrame* external_frame, |
3866 gfx::RectF* new_bounds) { | 3866 gfx::RectF* new_bounds) { |
3867 // Don't carry over any GL state from previous RenderPass draw operations. | |
3868 ReinitializeGLState(); | |
ericrk
2016/08/24 19:04:50
This makes sense - so the state was just left over
erikchen
2016/08/24 20:04:36
Yup. Unfortunately, GLRenderer is very stateful.
| |
3869 | |
3867 ScopedResource* contents_texture = | 3870 ScopedResource* contents_texture = |
3868 render_pass_textures_[ca_layer_overlay->rpdq->render_pass_id].get(); | 3871 render_pass_textures_[ca_layer_overlay->rpdq->render_pass_id].get(); |
3869 DCHECK(contents_texture); | 3872 DCHECK(contents_texture); |
3870 | 3873 |
3871 // Configure parameters as if drawing to a framebuffer the size of the | 3874 // Configure parameters as if drawing to a framebuffer the size of the |
3872 // screen. | 3875 // screen. |
3873 DrawRenderPassDrawQuadParams params; | 3876 DrawRenderPassDrawQuadParams params; |
3874 params.quad = ca_layer_overlay->rpdq; | 3877 params.quad = ca_layer_overlay->rpdq; |
3875 params.flip_texture = true; | 3878 params.flip_texture = true; |
3876 params.contents_texture = contents_texture; | 3879 params.contents_texture = contents_texture; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3960 | 3963 |
3961 gl_->GenFramebuffers(1, &temp_fbo); | 3964 gl_->GenFramebuffers(1, &temp_fbo); |
3962 gl_->BindFramebuffer(GL_FRAMEBUFFER, temp_fbo); | 3965 gl_->BindFramebuffer(GL_FRAMEBUFFER, temp_fbo); |
3963 gl_->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, | 3966 gl_->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, |
3964 destination.target(), destination.texture_id(), 0); | 3967 destination.target(), destination.texture_id(), 0); |
3965 DCHECK(gl_->CheckFramebufferStatus(GL_FRAMEBUFFER) == | 3968 DCHECK(gl_->CheckFramebufferStatus(GL_FRAMEBUFFER) == |
3966 GL_FRAMEBUFFER_COMPLETE); | 3969 GL_FRAMEBUFFER_COMPLETE); |
3967 | 3970 |
3968 // Clear to 0 to ensure the background is transparent. | 3971 // Clear to 0 to ensure the background is transparent. |
3969 gl_->ClearColor(0, 0, 0, 0); | 3972 gl_->ClearColor(0, 0, 0, 0); |
3970 if (is_scissor_enabled_) | |
3971 gl_->Disable(GL_SCISSOR_TEST); | |
3972 gl_->Clear(GL_COLOR_BUFFER_BIT); | 3973 gl_->Clear(GL_COLOR_BUFFER_BIT); |
3973 if (is_scissor_enabled_) | |
3974 gl_->Enable(GL_SCISSOR_TEST); | |
3975 | 3974 |
3976 UpdateRPDQTexturesForSampling(¶ms); | 3975 UpdateRPDQTexturesForSampling(¶ms); |
3977 UpdateRPDQBlendMode(¶ms); | 3976 UpdateRPDQBlendMode(¶ms); |
3978 ChooseRPDQProgram(¶ms); | 3977 ChooseRPDQProgram(¶ms); |
3979 UpdateRPDQUniforms(¶ms); | 3978 UpdateRPDQUniforms(¶ms); |
3980 | 3979 |
3981 // Prior to drawing, set up the destination framebuffer and viewport. | 3980 // Prior to drawing, set up the destination framebuffer and viewport. |
3982 gl_->BindFramebuffer(GL_FRAMEBUFFER, temp_fbo); | 3981 gl_->BindFramebuffer(GL_FRAMEBUFFER, temp_fbo); |
3983 gl_->Viewport(0, 0, updated_dst_rect.width(), updated_dst_rect.height()); | 3982 gl_->Viewport(0, 0, updated_dst_rect.width(), updated_dst_rect.height()); |
3984 | 3983 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4034 | 4033 |
4035 gl_->ScheduleCALayerSharedStateCHROMIUM( | 4034 gl_->ScheduleCALayerSharedStateCHROMIUM( |
4036 ca_layer_overlay->shared_state->opacity, is_clipped, clip_rect, | 4035 ca_layer_overlay->shared_state->opacity, is_clipped, clip_rect, |
4037 sorting_context_id, gl_transform); | 4036 sorting_context_id, gl_transform); |
4038 gl_->ScheduleCALayerCHROMIUM( | 4037 gl_->ScheduleCALayerCHROMIUM( |
4039 texture_id, contents_rect, ca_layer_overlay->background_color, | 4038 texture_id, contents_rect, ca_layer_overlay->background_color, |
4040 ca_layer_overlay->edge_aa_mask, bounds_rect, filter); | 4039 ca_layer_overlay->edge_aa_mask, bounds_rect, filter); |
4041 } | 4040 } |
4042 | 4041 |
4043 } // namespace cc | 4042 } // namespace cc |
OLD | NEW |