| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 background_image = | 931 background_image = |
| 932 ApplyBackgroundFilters(frame, quad, background_texture.get()); | 932 ApplyBackgroundFilters(frame, quad, background_texture.get()); |
| 933 } | 933 } |
| 934 } | 934 } |
| 935 | 935 |
| 936 if (!background_texture) { | 936 if (!background_texture) { |
| 937 // Something went wrong with reading the backdrop. | 937 // Something went wrong with reading the backdrop. |
| 938 DCHECK(!background_image); | 938 DCHECK(!background_image); |
| 939 use_shaders_for_blending = false; | 939 use_shaders_for_blending = false; |
| 940 } else if (background_image) { | 940 } else if (background_image) { |
| 941 background_texture.reset(); | 941 // Reset original background texture if there is not any mask |
| 942 if (!quad->mask_resource_id) |
| 943 background_texture.reset(); |
| 942 } else if (CanApplyBlendModeUsingBlendFunc(blend_mode) && | 944 } else if (CanApplyBlendModeUsingBlendFunc(blend_mode) && |
| 943 ShouldApplyBackgroundFilters(frame, quad)) { | 945 ShouldApplyBackgroundFilters(frame, quad)) { |
| 944 // Something went wrong with applying background filters to the backdrop. | 946 // Something went wrong with applying background filters to the backdrop. |
| 945 use_shaders_for_blending = false; | 947 use_shaders_for_blending = false; |
| 946 background_texture.reset(); | 948 background_texture.reset(); |
| 947 } | 949 } |
| 948 } | 950 } |
| 949 | 951 // Need original background texture for mask? |
| 952 bool mask_for_background = |
| 953 background_texture && // Have original background texture |
| 954 background_image && // Have filtered background texture |
| 955 quad->mask_resource_id; // Have mask texture |
| 950 SetBlendEnabled( | 956 SetBlendEnabled( |
| 951 !use_shaders_for_blending && | 957 !use_shaders_for_blending && |
| 952 (quad->ShouldDrawWithBlending() || !IsDefaultBlendMode(blend_mode))); | 958 (quad->ShouldDrawWithBlending() || !IsDefaultBlendMode(blend_mode))); |
| 953 | 959 |
| 954 // TODO(senorblanco): Cache this value so that we don't have to do it for both | 960 // TODO(senorblanco): Cache this value so that we don't have to do it for both |
| 955 // the surface and its replica. Apply filters to the contents texture. | 961 // the surface and its replica. Apply filters to the contents texture. |
| 956 skia::RefPtr<SkImage> filter_image; | 962 skia::RefPtr<SkImage> filter_image; |
| 957 SkScalar color_matrix[20]; | 963 SkScalar color_matrix[20]; |
| 958 bool use_color_matrix = false; | 964 bool use_color_matrix = false; |
| 959 if (!quad->filters.IsEmpty()) { | 965 if (!quad->filters.IsEmpty()) { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 | 1024 |
| 1019 ShaderLocations locations; | 1025 ShaderLocations locations; |
| 1020 | 1026 |
| 1021 DCHECK_EQ(background_texture || background_image, use_shaders_for_blending); | 1027 DCHECK_EQ(background_texture || background_image, use_shaders_for_blending); |
| 1022 BlendMode shader_blend_mode = use_shaders_for_blending | 1028 BlendMode shader_blend_mode = use_shaders_for_blending |
| 1023 ? BlendModeFromSkXfermode(blend_mode) | 1029 ? BlendModeFromSkXfermode(blend_mode) |
| 1024 : BLEND_MODE_NONE; | 1030 : BLEND_MODE_NONE; |
| 1025 | 1031 |
| 1026 if (use_aa && mask_texture_id && !use_color_matrix) { | 1032 if (use_aa && mask_texture_id && !use_color_matrix) { |
| 1027 const RenderPassMaskProgramAA* program = GetRenderPassMaskProgramAA( | 1033 const RenderPassMaskProgramAA* program = GetRenderPassMaskProgramAA( |
| 1028 tex_coord_precision, mask_sampler, shader_blend_mode); | 1034 tex_coord_precision, mask_sampler, |
| 1035 shader_blend_mode, mask_for_background); |
| 1029 SetUseProgram(program->program()); | 1036 SetUseProgram(program->program()); |
| 1030 program->vertex_shader().FillLocations(&locations); | 1037 program->vertex_shader().FillLocations(&locations); |
| 1031 program->fragment_shader().FillLocations(&locations); | 1038 program->fragment_shader().FillLocations(&locations); |
| 1032 GLC(gl_, gl_->Uniform1i(locations.sampler, 0)); | 1039 GLC(gl_, gl_->Uniform1i(locations.sampler, 0)); |
| 1033 } else if (!use_aa && mask_texture_id && !use_color_matrix) { | 1040 } else if (!use_aa && mask_texture_id && !use_color_matrix) { |
| 1034 const RenderPassMaskProgram* program = GetRenderPassMaskProgram( | 1041 const RenderPassMaskProgram* program = GetRenderPassMaskProgram( |
| 1035 tex_coord_precision, mask_sampler, shader_blend_mode); | 1042 tex_coord_precision, mask_sampler, |
| 1043 shader_blend_mode, mask_for_background); |
| 1036 SetUseProgram(program->program()); | 1044 SetUseProgram(program->program()); |
| 1037 program->vertex_shader().FillLocations(&locations); | 1045 program->vertex_shader().FillLocations(&locations); |
| 1038 program->fragment_shader().FillLocations(&locations); | 1046 program->fragment_shader().FillLocations(&locations); |
| 1039 GLC(gl_, gl_->Uniform1i(locations.sampler, 0)); | 1047 GLC(gl_, gl_->Uniform1i(locations.sampler, 0)); |
| 1040 } else if (use_aa && !mask_texture_id && !use_color_matrix) { | 1048 } else if (use_aa && !mask_texture_id && !use_color_matrix) { |
| 1041 const RenderPassProgramAA* program = | 1049 const RenderPassProgramAA* program = |
| 1042 GetRenderPassProgramAA(tex_coord_precision, shader_blend_mode); | 1050 GetRenderPassProgramAA(tex_coord_precision, shader_blend_mode); |
| 1043 SetUseProgram(program->program()); | 1051 SetUseProgram(program->program()); |
| 1044 program->vertex_shader().FillLocations(&locations); | 1052 program->vertex_shader().FillLocations(&locations); |
| 1045 program->fragment_shader().FillLocations(&locations); | 1053 program->fragment_shader().FillLocations(&locations); |
| 1046 GLC(gl_, gl_->Uniform1i(locations.sampler, 0)); | 1054 GLC(gl_, gl_->Uniform1i(locations.sampler, 0)); |
| 1047 } else if (use_aa && mask_texture_id && use_color_matrix) { | 1055 } else if (use_aa && mask_texture_id && use_color_matrix) { |
| 1048 const RenderPassMaskColorMatrixProgramAA* program = | 1056 const RenderPassMaskColorMatrixProgramAA* program = |
| 1049 GetRenderPassMaskColorMatrixProgramAA( | 1057 GetRenderPassMaskColorMatrixProgramAA( |
| 1050 tex_coord_precision, mask_sampler, shader_blend_mode); | 1058 tex_coord_precision, mask_sampler, |
| 1059 shader_blend_mode, mask_for_background); |
| 1051 SetUseProgram(program->program()); | 1060 SetUseProgram(program->program()); |
| 1052 program->vertex_shader().FillLocations(&locations); | 1061 program->vertex_shader().FillLocations(&locations); |
| 1053 program->fragment_shader().FillLocations(&locations); | 1062 program->fragment_shader().FillLocations(&locations); |
| 1054 GLC(gl_, gl_->Uniform1i(locations.sampler, 0)); | 1063 GLC(gl_, gl_->Uniform1i(locations.sampler, 0)); |
| 1055 } else if (use_aa && !mask_texture_id && use_color_matrix) { | 1064 } else if (use_aa && !mask_texture_id && use_color_matrix) { |
| 1056 const RenderPassColorMatrixProgramAA* program = | 1065 const RenderPassColorMatrixProgramAA* program = |
| 1057 GetRenderPassColorMatrixProgramAA(tex_coord_precision, | 1066 GetRenderPassColorMatrixProgramAA(tex_coord_precision, |
| 1058 shader_blend_mode); | 1067 shader_blend_mode); |
| 1059 SetUseProgram(program->program()); | 1068 SetUseProgram(program->program()); |
| 1060 program->vertex_shader().FillLocations(&locations); | 1069 program->vertex_shader().FillLocations(&locations); |
| 1061 program->fragment_shader().FillLocations(&locations); | 1070 program->fragment_shader().FillLocations(&locations); |
| 1062 GLC(gl_, gl_->Uniform1i(locations.sampler, 0)); | 1071 GLC(gl_, gl_->Uniform1i(locations.sampler, 0)); |
| 1063 } else if (!use_aa && mask_texture_id && use_color_matrix) { | 1072 } else if (!use_aa && mask_texture_id && use_color_matrix) { |
| 1064 const RenderPassMaskColorMatrixProgram* program = | 1073 const RenderPassMaskColorMatrixProgram* program = |
| 1065 GetRenderPassMaskColorMatrixProgram( | 1074 GetRenderPassMaskColorMatrixProgram( |
| 1066 tex_coord_precision, mask_sampler, shader_blend_mode); | 1075 tex_coord_precision, mask_sampler, |
| 1076 shader_blend_mode, mask_for_background); |
| 1067 SetUseProgram(program->program()); | 1077 SetUseProgram(program->program()); |
| 1068 program->vertex_shader().FillLocations(&locations); | 1078 program->vertex_shader().FillLocations(&locations); |
| 1069 program->fragment_shader().FillLocations(&locations); | 1079 program->fragment_shader().FillLocations(&locations); |
| 1070 GLC(gl_, gl_->Uniform1i(locations.sampler, 0)); | 1080 GLC(gl_, gl_->Uniform1i(locations.sampler, 0)); |
| 1071 } else if (!use_aa && !mask_texture_id && use_color_matrix) { | 1081 } else if (!use_aa && !mask_texture_id && use_color_matrix) { |
| 1072 const RenderPassColorMatrixProgram* program = | 1082 const RenderPassColorMatrixProgram* program = |
| 1073 GetRenderPassColorMatrixProgram(tex_coord_precision, shader_blend_mode); | 1083 GetRenderPassColorMatrixProgram(tex_coord_precision, shader_blend_mode); |
| 1074 SetUseProgram(program->program()); | 1084 SetUseProgram(program->program()); |
| 1075 program->vertex_shader().FillLocations(&locations); | 1085 program->vertex_shader().FillLocations(&locations); |
| 1076 program->fragment_shader().FillLocations(&locations); | 1086 program->fragment_shader().FillLocations(&locations); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1170 background_rect.x(), | 1180 background_rect.x(), |
| 1171 background_rect.y(), | 1181 background_rect.y(), |
| 1172 background_rect.width(), | 1182 background_rect.width(), |
| 1173 background_rect.height())); | 1183 background_rect.height())); |
| 1174 | 1184 |
| 1175 if (background_image) { | 1185 if (background_image) { |
| 1176 GrTexture* texture = background_image->getTexture(); | 1186 GrTexture* texture = background_image->getTexture(); |
| 1177 GLC(gl_, gl_->ActiveTexture(GL_TEXTURE0 + last_texture_unit)); | 1187 GLC(gl_, gl_->ActiveTexture(GL_TEXTURE0 + last_texture_unit)); |
| 1178 gl_->BindTexture(GL_TEXTURE_2D, texture->getTextureHandle()); | 1188 gl_->BindTexture(GL_TEXTURE_2D, texture->getTextureHandle()); |
| 1179 GLC(gl_, gl_->ActiveTexture(GL_TEXTURE0)); | 1189 GLC(gl_, gl_->ActiveTexture(GL_TEXTURE0)); |
| 1180 } else { | 1190 if (mask_for_background) |
| 1191 GLC(gl_, gl_->Uniform1i(locations.original_backdrop, |
| 1192 ++last_texture_unit)); |
| 1193 } |
| 1194 if (background_texture) { |
| 1181 shader_background_sampler_lock = make_scoped_ptr( | 1195 shader_background_sampler_lock = make_scoped_ptr( |
| 1182 new ResourceProvider::ScopedSamplerGL(resource_provider_, | 1196 new ResourceProvider::ScopedSamplerGL(resource_provider_, |
| 1183 background_texture->id(), | 1197 background_texture->id(), |
| 1184 GL_TEXTURE0 + last_texture_unit, | 1198 GL_TEXTURE0 + last_texture_unit, |
| 1185 GL_LINEAR)); | 1199 GL_LINEAR)); |
| 1186 DCHECK_EQ(static_cast<GLenum>(GL_TEXTURE_2D), | 1200 DCHECK_EQ(static_cast<GLenum>(GL_TEXTURE_2D), |
| 1187 shader_background_sampler_lock->target()); | 1201 shader_background_sampler_lock->target()); |
| 1188 } | 1202 } |
| 1189 } | 1203 } |
| 1190 | 1204 |
| (...skipping 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2686 TRACE_EVENT0("cc", "GLRenderer::renderPassProgramAA::initialize"); | 2700 TRACE_EVENT0("cc", "GLRenderer::renderPassProgramAA::initialize"); |
| 2687 program->Initialize(output_surface_->context_provider(), precision, | 2701 program->Initialize(output_surface_->context_provider(), precision, |
| 2688 SAMPLER_TYPE_2D, blend_mode); | 2702 SAMPLER_TYPE_2D, blend_mode); |
| 2689 } | 2703 } |
| 2690 return program; | 2704 return program; |
| 2691 } | 2705 } |
| 2692 | 2706 |
| 2693 const GLRenderer::RenderPassMaskProgram* GLRenderer::GetRenderPassMaskProgram( | 2707 const GLRenderer::RenderPassMaskProgram* GLRenderer::GetRenderPassMaskProgram( |
| 2694 TexCoordPrecision precision, | 2708 TexCoordPrecision precision, |
| 2695 SamplerType sampler, | 2709 SamplerType sampler, |
| 2696 BlendMode blend_mode) { | 2710 BlendMode blend_mode, |
| 2711 bool mask_for_background) { |
| 2697 DCHECK_GE(precision, 0); | 2712 DCHECK_GE(precision, 0); |
| 2698 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 2713 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); |
| 2699 DCHECK_GE(sampler, 0); | 2714 DCHECK_GE(sampler, 0); |
| 2700 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); | 2715 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); |
| 2701 DCHECK_GE(blend_mode, 0); | 2716 DCHECK_GE(blend_mode, 0); |
| 2702 DCHECK_LE(blend_mode, LAST_BLEND_MODE); | 2717 DCHECK_LE(blend_mode, LAST_BLEND_MODE); |
| 2703 RenderPassMaskProgram* program = | 2718 RenderPassMaskProgram* program = |
| 2704 &render_pass_mask_program_[precision][sampler][blend_mode]; | 2719 &render_pass_mask_program_[precision][sampler][blend_mode] |
| 2720 [mask_for_background ? HAS_MASK : NO_MASK]; |
| 2705 if (!program->initialized()) { | 2721 if (!program->initialized()) { |
| 2706 TRACE_EVENT0("cc", "GLRenderer::renderPassMaskProgram::initialize"); | 2722 TRACE_EVENT0("cc", "GLRenderer::renderPassMaskProgram::initialize"); |
| 2707 program->Initialize( | 2723 program->Initialize( |
| 2708 output_surface_->context_provider(), precision, sampler, blend_mode); | 2724 output_surface_->context_provider(), precision, |
| 2725 sampler, blend_mode, mask_for_background); |
| 2709 } | 2726 } |
| 2710 return program; | 2727 return program; |
| 2711 } | 2728 } |
| 2712 | 2729 |
| 2713 const GLRenderer::RenderPassMaskProgramAA* | 2730 const GLRenderer::RenderPassMaskProgramAA* |
| 2714 GLRenderer::GetRenderPassMaskProgramAA(TexCoordPrecision precision, | 2731 GLRenderer::GetRenderPassMaskProgramAA(TexCoordPrecision precision, |
| 2715 SamplerType sampler, | 2732 SamplerType sampler, |
| 2716 BlendMode blend_mode) { | 2733 BlendMode blend_mode, |
| 2734 bool mask_for_background) { |
| 2717 DCHECK_GE(precision, 0); | 2735 DCHECK_GE(precision, 0); |
| 2718 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 2736 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); |
| 2719 DCHECK_GE(sampler, 0); | 2737 DCHECK_GE(sampler, 0); |
| 2720 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); | 2738 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); |
| 2721 DCHECK_GE(blend_mode, 0); | 2739 DCHECK_GE(blend_mode, 0); |
| 2722 DCHECK_LE(blend_mode, LAST_BLEND_MODE); | 2740 DCHECK_LE(blend_mode, LAST_BLEND_MODE); |
| 2723 RenderPassMaskProgramAA* program = | 2741 RenderPassMaskProgramAA* program = |
| 2724 &render_pass_mask_program_aa_[precision][sampler][blend_mode]; | 2742 &render_pass_mask_program_aa_[precision][sampler][blend_mode] |
| 2743 [mask_for_background ? HAS_MASK : NO_MASK]; |
| 2725 if (!program->initialized()) { | 2744 if (!program->initialized()) { |
| 2726 TRACE_EVENT0("cc", "GLRenderer::renderPassMaskProgramAA::initialize"); | 2745 TRACE_EVENT0("cc", "GLRenderer::renderPassMaskProgramAA::initialize"); |
| 2727 program->Initialize( | 2746 program->Initialize( |
| 2728 output_surface_->context_provider(), precision, sampler, blend_mode); | 2747 output_surface_->context_provider(), precision, |
| 2748 sampler, blend_mode, mask_for_background); |
| 2729 } | 2749 } |
| 2730 return program; | 2750 return program; |
| 2731 } | 2751 } |
| 2732 | 2752 |
| 2733 const GLRenderer::RenderPassColorMatrixProgram* | 2753 const GLRenderer::RenderPassColorMatrixProgram* |
| 2734 GLRenderer::GetRenderPassColorMatrixProgram(TexCoordPrecision precision, | 2754 GLRenderer::GetRenderPassColorMatrixProgram(TexCoordPrecision precision, |
| 2735 BlendMode blend_mode) { | 2755 BlendMode blend_mode) { |
| 2736 DCHECK_GE(precision, 0); | 2756 DCHECK_GE(precision, 0); |
| 2737 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 2757 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); |
| 2738 DCHECK_GE(blend_mode, 0); | 2758 DCHECK_GE(blend_mode, 0); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2759 if (!program->initialized()) { | 2779 if (!program->initialized()) { |
| 2760 TRACE_EVENT0("cc", | 2780 TRACE_EVENT0("cc", |
| 2761 "GLRenderer::renderPassColorMatrixProgramAA::initialize"); | 2781 "GLRenderer::renderPassColorMatrixProgramAA::initialize"); |
| 2762 program->Initialize(output_surface_->context_provider(), precision, | 2782 program->Initialize(output_surface_->context_provider(), precision, |
| 2763 SAMPLER_TYPE_2D, blend_mode); | 2783 SAMPLER_TYPE_2D, blend_mode); |
| 2764 } | 2784 } |
| 2765 return program; | 2785 return program; |
| 2766 } | 2786 } |
| 2767 | 2787 |
| 2768 const GLRenderer::RenderPassMaskColorMatrixProgram* | 2788 const GLRenderer::RenderPassMaskColorMatrixProgram* |
| 2769 GLRenderer::GetRenderPassMaskColorMatrixProgram(TexCoordPrecision precision, | 2789 GLRenderer::GetRenderPassMaskColorMatrixProgram( |
| 2770 SamplerType sampler, | 2790 TexCoordPrecision precision, |
| 2771 BlendMode blend_mode) { | 2791 SamplerType sampler, |
| 2792 BlendMode blend_mode, |
| 2793 bool mask_for_background) { |
| 2772 DCHECK_GE(precision, 0); | 2794 DCHECK_GE(precision, 0); |
| 2773 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 2795 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); |
| 2774 DCHECK_GE(sampler, 0); | 2796 DCHECK_GE(sampler, 0); |
| 2775 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); | 2797 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); |
| 2776 DCHECK_GE(blend_mode, 0); | 2798 DCHECK_GE(blend_mode, 0); |
| 2777 DCHECK_LE(blend_mode, LAST_BLEND_MODE); | 2799 DCHECK_LE(blend_mode, LAST_BLEND_MODE); |
| 2778 RenderPassMaskColorMatrixProgram* program = | 2800 RenderPassMaskColorMatrixProgram* program = |
| 2779 &render_pass_mask_color_matrix_program_[precision][sampler][blend_mode]; | 2801 &render_pass_mask_color_matrix_program_[precision][sampler][blend_mode] |
| 2802 [mask_for_background ? HAS_MASK : NO_MASK]; |
| 2780 if (!program->initialized()) { | 2803 if (!program->initialized()) { |
| 2781 TRACE_EVENT0("cc", | 2804 TRACE_EVENT0("cc", |
| 2782 "GLRenderer::renderPassMaskColorMatrixProgram::initialize"); | 2805 "GLRenderer::renderPassMaskColorMatrixProgram::initialize"); |
| 2783 program->Initialize( | 2806 program->Initialize( |
| 2784 output_surface_->context_provider(), precision, sampler, blend_mode); | 2807 output_surface_->context_provider(), precision, |
| 2808 sampler, blend_mode, mask_for_background); |
| 2785 } | 2809 } |
| 2786 return program; | 2810 return program; |
| 2787 } | 2811 } |
| 2788 | 2812 |
| 2789 const GLRenderer::RenderPassMaskColorMatrixProgramAA* | 2813 const GLRenderer::RenderPassMaskColorMatrixProgramAA* |
| 2790 GLRenderer::GetRenderPassMaskColorMatrixProgramAA(TexCoordPrecision precision, | 2814 GLRenderer::GetRenderPassMaskColorMatrixProgramAA( |
| 2791 SamplerType sampler, | 2815 TexCoordPrecision precision, |
| 2792 BlendMode blend_mode) { | 2816 SamplerType sampler, |
| 2817 BlendMode blend_mode, |
| 2818 bool mask_for_background) { |
| 2793 DCHECK_GE(precision, 0); | 2819 DCHECK_GE(precision, 0); |
| 2794 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 2820 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); |
| 2795 DCHECK_GE(sampler, 0); | 2821 DCHECK_GE(sampler, 0); |
| 2796 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); | 2822 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); |
| 2797 DCHECK_GE(blend_mode, 0); | 2823 DCHECK_GE(blend_mode, 0); |
| 2798 DCHECK_LE(blend_mode, LAST_BLEND_MODE); | 2824 DCHECK_LE(blend_mode, LAST_BLEND_MODE); |
| 2799 RenderPassMaskColorMatrixProgramAA* program = | 2825 RenderPassMaskColorMatrixProgramAA* program = |
| 2800 &render_pass_mask_color_matrix_program_aa_[precision][sampler] | 2826 &render_pass_mask_color_matrix_program_aa_[precision][sampler][blend_mode] |
| 2801 [blend_mode]; | 2827 [mask_for_background ? HAS_MASK : NO_MASK]; |
| 2802 if (!program->initialized()) { | 2828 if (!program->initialized()) { |
| 2803 TRACE_EVENT0("cc", | 2829 TRACE_EVENT0("cc", |
| 2804 "GLRenderer::renderPassMaskColorMatrixProgramAA::initialize"); | 2830 "GLRenderer::renderPassMaskColorMatrixProgramAA::initialize"); |
| 2805 program->Initialize( | 2831 program->Initialize( |
| 2806 output_surface_->context_provider(), precision, sampler, blend_mode); | 2832 output_surface_->context_provider(), precision, |
| 2833 sampler, blend_mode, mask_for_background); |
| 2807 } | 2834 } |
| 2808 return program; | 2835 return program; |
| 2809 } | 2836 } |
| 2810 | 2837 |
| 2811 const GLRenderer::TileProgram* GLRenderer::GetTileProgram( | 2838 const GLRenderer::TileProgram* GLRenderer::GetTileProgram( |
| 2812 TexCoordPrecision precision, | 2839 TexCoordPrecision precision, |
| 2813 SamplerType sampler) { | 2840 SamplerType sampler) { |
| 2814 DCHECK_GE(precision, 0); | 2841 DCHECK_GE(precision, 0); |
| 2815 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 2842 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); |
| 2816 DCHECK_GE(sampler, 0); | 2843 DCHECK_GE(sampler, 0); |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3023 for (int i = 0; i <= LAST_TEX_COORD_PRECISION; ++i) { | 3050 for (int i = 0; i <= LAST_TEX_COORD_PRECISION; ++i) { |
| 3024 for (int j = 0; j <= LAST_SAMPLER_TYPE; ++j) { | 3051 for (int j = 0; j <= LAST_SAMPLER_TYPE; ++j) { |
| 3025 tile_program_[i][j].Cleanup(gl_); | 3052 tile_program_[i][j].Cleanup(gl_); |
| 3026 tile_program_opaque_[i][j].Cleanup(gl_); | 3053 tile_program_opaque_[i][j].Cleanup(gl_); |
| 3027 tile_program_swizzle_[i][j].Cleanup(gl_); | 3054 tile_program_swizzle_[i][j].Cleanup(gl_); |
| 3028 tile_program_swizzle_opaque_[i][j].Cleanup(gl_); | 3055 tile_program_swizzle_opaque_[i][j].Cleanup(gl_); |
| 3029 tile_program_aa_[i][j].Cleanup(gl_); | 3056 tile_program_aa_[i][j].Cleanup(gl_); |
| 3030 tile_program_swizzle_aa_[i][j].Cleanup(gl_); | 3057 tile_program_swizzle_aa_[i][j].Cleanup(gl_); |
| 3031 | 3058 |
| 3032 for (int k = 0; k <= LAST_BLEND_MODE; k++) { | 3059 for (int k = 0; k <= LAST_BLEND_MODE; k++) { |
| 3033 render_pass_mask_program_[i][j][k].Cleanup(gl_); | 3060 for (int l = 0; l <= LAST_MASK_VALUE; ++l) { |
| 3034 render_pass_mask_program_aa_[i][j][k].Cleanup(gl_); | 3061 render_pass_mask_program_[i][j][k][l].Cleanup(gl_); |
| 3035 render_pass_mask_color_matrix_program_aa_[i][j][k].Cleanup(gl_); | 3062 render_pass_mask_program_aa_[i][j][k][l].Cleanup(gl_); |
| 3036 render_pass_mask_color_matrix_program_[i][j][k].Cleanup(gl_); | 3063 render_pass_mask_color_matrix_program_aa_[i][j][k][l].Cleanup(gl_); |
| 3064 render_pass_mask_color_matrix_program_[i][j][k][l].Cleanup(gl_); |
| 3065 } |
| 3037 } | 3066 } |
| 3038 } | 3067 } |
| 3039 for (int j = 0; j <= LAST_BLEND_MODE; j++) { | 3068 for (int j = 0; j <= LAST_BLEND_MODE; j++) { |
| 3040 render_pass_program_[i][j].Cleanup(gl_); | 3069 render_pass_program_[i][j].Cleanup(gl_); |
| 3041 render_pass_program_aa_[i][j].Cleanup(gl_); | 3070 render_pass_program_aa_[i][j].Cleanup(gl_); |
| 3042 render_pass_color_matrix_program_[i][j].Cleanup(gl_); | 3071 render_pass_color_matrix_program_[i][j].Cleanup(gl_); |
| 3043 render_pass_color_matrix_program_aa_[i][j].Cleanup(gl_); | 3072 render_pass_color_matrix_program_aa_[i][j].Cleanup(gl_); |
| 3044 } | 3073 } |
| 3045 | 3074 |
| 3046 texture_program_[i].Cleanup(gl_); | 3075 texture_program_[i].Cleanup(gl_); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3143 context_support_->ScheduleOverlayPlane( | 3172 context_support_->ScheduleOverlayPlane( |
| 3144 overlay.plane_z_order, | 3173 overlay.plane_z_order, |
| 3145 overlay.transform, | 3174 overlay.transform, |
| 3146 pending_overlay_resources_.back()->texture_id(), | 3175 pending_overlay_resources_.back()->texture_id(), |
| 3147 overlay.display_rect, | 3176 overlay.display_rect, |
| 3148 overlay.uv_rect); | 3177 overlay.uv_rect); |
| 3149 } | 3178 } |
| 3150 } | 3179 } |
| 3151 | 3180 |
| 3152 } // namespace cc | 3181 } // namespace cc |
| OLD | NEW |