| Index: cc/output/gl_renderer.cc
|
| diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
|
| index 3c6bbfe9fb5da6c61bfd19fd2c4a4fb316bee05c..3a3b53d3516a689b75455d17c948d4d23738146e 100644
|
| --- a/cc/output/gl_renderer.cc
|
| +++ b/cc/output/gl_renderer.cc
|
| @@ -1124,8 +1124,8 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame,
|
| : BlendModeNormal;
|
|
|
| if (use_aa && mask_texture_id && !use_color_matrix) {
|
| - const RenderPassMaskProgramAA* program =
|
| - GetRenderPassMaskProgramAA(tex_coord_precision, shader_blend_mode);
|
| + const RenderPassMaskProgramAA* program = GetRenderPassMaskProgramAA(
|
| + tex_coord_precision, mask_sampler, shader_blend_mode);
|
| SetUseProgram(program->program());
|
| GLC(gl_, gl_->Uniform1i(program->fragment_shader().sampler_location(), 0));
|
|
|
| @@ -1146,8 +1146,8 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame,
|
| shader_backdrop_rect_location =
|
| program->fragment_shader().backdrop_rect_location();
|
| } else if (!use_aa && mask_texture_id && !use_color_matrix) {
|
| - const RenderPassMaskProgram* program =
|
| - GetRenderPassMaskProgram(tex_coord_precision, shader_blend_mode);
|
| + const RenderPassMaskProgram* program = GetRenderPassMaskProgram(
|
| + tex_coord_precision, mask_sampler, shader_blend_mode);
|
| SetUseProgram(program->program());
|
| GLC(gl_, gl_->Uniform1i(program->fragment_shader().sampler_location(), 0));
|
|
|
| @@ -1182,8 +1182,8 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame,
|
| program->fragment_shader().backdrop_rect_location();
|
| } else if (use_aa && mask_texture_id && use_color_matrix) {
|
| const RenderPassMaskColorMatrixProgramAA* program =
|
| - GetRenderPassMaskColorMatrixProgramAA(tex_coord_precision,
|
| - shader_blend_mode);
|
| + GetRenderPassMaskColorMatrixProgramAA(
|
| + tex_coord_precision, mask_sampler, shader_blend_mode);
|
| SetUseProgram(program->program());
|
| GLC(gl_, gl_->Uniform1i(program->fragment_shader().sampler_location(), 0));
|
|
|
| @@ -1230,8 +1230,8 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame,
|
| program->fragment_shader().backdrop_rect_location();
|
| } else if (!use_aa && mask_texture_id && use_color_matrix) {
|
| const RenderPassMaskColorMatrixProgram* program =
|
| - GetRenderPassMaskColorMatrixProgram(tex_coord_precision,
|
| - shader_blend_mode);
|
| + GetRenderPassMaskColorMatrixProgram(
|
| + tex_coord_precision, mask_sampler, shader_blend_mode);
|
| SetUseProgram(program->program());
|
| GLC(gl_, gl_->Uniform1i(program->fragment_shader().sampler_location(), 0));
|
|
|
| @@ -1302,14 +1302,16 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame,
|
| -tex_scale_y));
|
|
|
| GLint last_texture_unit = 0;
|
| - scoped_ptr<ResourceProvider::ScopedSamplerGL> shader_mask_sampler_lock;
|
| if (shader_mask_sampler_location != -1) {
|
| DCHECK_NE(shader_mask_tex_coord_scale_location, 1);
|
| DCHECK_NE(shader_mask_tex_coord_offset_location, 1);
|
| - DCHECK_EQ(SamplerType2D, mask_sampler);
|
| GLC(gl_, gl_->Uniform1i(shader_mask_sampler_location, 1));
|
|
|
| gfx::RectF mask_uv_rect = quad->MaskUVRect();
|
| + if (mask_sampler != SamplerType2D) {
|
| + mask_uv_rect.Scale(quad->mask_texture_size.width(),
|
| + quad->mask_texture_size.height());
|
| + }
|
|
|
| // Mask textures are oriented vertically flipped relative to the framebuffer
|
| // and the RenderPass contents texture, so we flip the tex coords from the
|
| @@ -2843,38 +2845,40 @@ const GLRenderer::RenderPassProgramAA* GLRenderer::GetRenderPassProgramAA(
|
|
|
| const GLRenderer::RenderPassMaskProgram* GLRenderer::GetRenderPassMaskProgram(
|
| TexCoordPrecision precision,
|
| + SamplerType sampler,
|
| BlendMode blend_mode) {
|
| DCHECK_GE(precision, 0);
|
| DCHECK_LT(precision, NumTexCoordPrecisions);
|
| + DCHECK_GE(sampler, 0);
|
| + DCHECK_LT(sampler, NumSamplerTypes);
|
| DCHECK_GE(blend_mode, 0);
|
| DCHECK_LT(blend_mode, NumBlendModes);
|
| RenderPassMaskProgram* program =
|
| - &render_pass_mask_program_[precision][blend_mode];
|
| + &render_pass_mask_program_[precision][sampler][blend_mode];
|
| if (!program->initialized()) {
|
| TRACE_EVENT0("cc", "GLRenderer::renderPassMaskProgram::initialize");
|
| - program->Initialize(output_surface_->context_provider(),
|
| - precision,
|
| - SamplerType2D,
|
| - blend_mode);
|
| + program->Initialize(
|
| + output_surface_->context_provider(), precision, sampler, blend_mode);
|
| }
|
| return program;
|
| }
|
|
|
| const GLRenderer::RenderPassMaskProgramAA*
|
| GLRenderer::GetRenderPassMaskProgramAA(TexCoordPrecision precision,
|
| + SamplerType sampler,
|
| BlendMode blend_mode) {
|
| DCHECK_GE(precision, 0);
|
| DCHECK_LT(precision, NumTexCoordPrecisions);
|
| + DCHECK_GE(sampler, 0);
|
| + DCHECK_LT(sampler, NumSamplerTypes);
|
| DCHECK_GE(blend_mode, 0);
|
| DCHECK_LT(blend_mode, NumBlendModes);
|
| RenderPassMaskProgramAA* program =
|
| - &render_pass_mask_program_aa_[precision][blend_mode];
|
| + &render_pass_mask_program_aa_[precision][sampler][blend_mode];
|
| if (!program->initialized()) {
|
| TRACE_EVENT0("cc", "GLRenderer::renderPassMaskProgramAA::initialize");
|
| - program->Initialize(output_surface_->context_provider(),
|
| - precision,
|
| - SamplerType2D,
|
| - blend_mode);
|
| + program->Initialize(
|
| + output_surface_->context_provider(), precision, sampler, blend_mode);
|
| }
|
| return program;
|
| }
|
| @@ -2920,40 +2924,43 @@ GLRenderer::GetRenderPassColorMatrixProgramAA(TexCoordPrecision precision,
|
|
|
| const GLRenderer::RenderPassMaskColorMatrixProgram*
|
| GLRenderer::GetRenderPassMaskColorMatrixProgram(TexCoordPrecision precision,
|
| + SamplerType sampler,
|
| BlendMode blend_mode) {
|
| DCHECK_GE(precision, 0);
|
| DCHECK_LT(precision, NumTexCoordPrecisions);
|
| + DCHECK_GE(sampler, 0);
|
| + DCHECK_LT(sampler, NumSamplerTypes);
|
| DCHECK_GE(blend_mode, 0);
|
| DCHECK_LT(blend_mode, NumBlendModes);
|
| RenderPassMaskColorMatrixProgram* program =
|
| - &render_pass_mask_color_matrix_program_[precision][blend_mode];
|
| + &render_pass_mask_color_matrix_program_[precision][sampler][blend_mode];
|
| if (!program->initialized()) {
|
| TRACE_EVENT0("cc",
|
| "GLRenderer::renderPassMaskColorMatrixProgram::initialize");
|
| - program->Initialize(output_surface_->context_provider(),
|
| - precision,
|
| - SamplerType2D,
|
| - blend_mode);
|
| + program->Initialize(
|
| + output_surface_->context_provider(), precision, sampler, blend_mode);
|
| }
|
| return program;
|
| }
|
|
|
| const GLRenderer::RenderPassMaskColorMatrixProgramAA*
|
| GLRenderer::GetRenderPassMaskColorMatrixProgramAA(TexCoordPrecision precision,
|
| + SamplerType sampler,
|
| BlendMode blend_mode) {
|
| DCHECK_GE(precision, 0);
|
| DCHECK_LT(precision, NumTexCoordPrecisions);
|
| + DCHECK_GE(sampler, 0);
|
| + DCHECK_LT(sampler, NumSamplerTypes);
|
| DCHECK_GE(blend_mode, 0);
|
| DCHECK_LT(blend_mode, NumBlendModes);
|
| RenderPassMaskColorMatrixProgramAA* program =
|
| - &render_pass_mask_color_matrix_program_aa_[precision][blend_mode];
|
| + &render_pass_mask_color_matrix_program_aa_[precision][sampler]
|
| + [blend_mode];
|
| if (!program->initialized()) {
|
| TRACE_EVENT0("cc",
|
| "GLRenderer::renderPassMaskColorMatrixProgramAA::initialize");
|
| - program->Initialize(output_surface_->context_provider(),
|
| - precision,
|
| - SamplerType2D,
|
| - blend_mode);
|
| + program->Initialize(
|
| + output_surface_->context_provider(), precision, sampler, blend_mode);
|
| }
|
| return program;
|
| }
|
| @@ -3178,16 +3185,19 @@ void GLRenderer::CleanupSharedObjects() {
|
| tile_program_swizzle_opaque_[i][j].Cleanup(gl_);
|
| tile_program_aa_[i][j].Cleanup(gl_);
|
| tile_program_swizzle_aa_[i][j].Cleanup(gl_);
|
| +
|
| + for (int k = 0; k < NumBlendModes; k++) {
|
| + render_pass_mask_program_[i][j][k].Cleanup(gl_);
|
| + render_pass_mask_program_aa_[i][j][k].Cleanup(gl_);
|
| + render_pass_mask_color_matrix_program_aa_[i][j][k].Cleanup(gl_);
|
| + render_pass_mask_color_matrix_program_[i][j][k].Cleanup(gl_);
|
| + }
|
| }
|
| for (int j = 0; j < NumBlendModes; j++) {
|
| - render_pass_mask_program_[i][j].Cleanup(gl_);
|
| render_pass_program_[i][j].Cleanup(gl_);
|
| - render_pass_mask_program_aa_[i][j].Cleanup(gl_);
|
| render_pass_program_aa_[i][j].Cleanup(gl_);
|
| render_pass_color_matrix_program_[i][j].Cleanup(gl_);
|
| - render_pass_mask_color_matrix_program_aa_[i][j].Cleanup(gl_);
|
| render_pass_color_matrix_program_aa_[i][j].Cleanup(gl_);
|
| - render_pass_mask_color_matrix_program_[i][j].Cleanup(gl_);
|
| }
|
|
|
| texture_program_[i].Cleanup(gl_);
|
|
|