Chromium Code Reviews| Index: cc/output/gl_renderer.cc |
| diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc |
| index 61d233a4a7f17a26960ffc0e45cacfb4c9b1192e..63edccb5cf6ed45e92569d8a8875d0a58c5b6579 100644 |
| --- a/cc/output/gl_renderer.cc |
| +++ b/cc/output/gl_renderer.cc |
| @@ -1214,7 +1214,7 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame, |
| if (use_aa && mask_texture_id && !use_color_matrix) { |
| const RenderPassMaskProgramAA* program = |
| - GetRenderPassMaskProgramAA(tex_coord_precision); |
| + GetRenderPassMaskProgramAA(tex_coord_precision, mask_sampler); |
| SetUseProgram(program->program()); |
| GLC(gl_, gl_->Uniform1i(program->fragment_shader().sampler_location(), 0)); |
| @@ -1233,7 +1233,7 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame, |
| program->vertex_shader().tex_transform_location(); |
| } else if (!use_aa && mask_texture_id && !use_color_matrix) { |
| const RenderPassMaskProgram* program = |
| - GetRenderPassMaskProgram(tex_coord_precision); |
| + GetRenderPassMaskProgram(tex_coord_precision, mask_sampler); |
| SetUseProgram(program->program()); |
| GLC(gl_, gl_->Uniform1i(program->fragment_shader().sampler_location(), 0)); |
| @@ -1262,7 +1262,8 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame, |
| program->vertex_shader().tex_transform_location(); |
| } else if (use_aa && mask_texture_id && use_color_matrix) { |
| const RenderPassMaskColorMatrixProgramAA* program = |
| - GetRenderPassMaskColorMatrixProgramAA(tex_coord_precision); |
| + GetRenderPassMaskColorMatrixProgramAA(tex_coord_precision, |
| + mask_sampler); |
| SetUseProgram(program->program()); |
| GLC(gl_, gl_->Uniform1i(program->fragment_shader().sampler_location(), 0)); |
| @@ -1302,7 +1303,7 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame, |
| program->fragment_shader().color_offset_location(); |
| } else if (!use_aa && mask_texture_id && use_color_matrix) { |
| const RenderPassMaskColorMatrixProgram* program = |
| - GetRenderPassMaskColorMatrixProgram(tex_coord_precision); |
| + GetRenderPassMaskColorMatrixProgram(tex_coord_precision, mask_sampler); |
| SetUseProgram(program->program()); |
| GLC(gl_, gl_->Uniform1i(program->fragment_shader().sampler_location(), 0)); |
| @@ -1363,14 +1364,16 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame, |
| tex_scale_x, |
| -tex_scale_y)); |
| - 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 == SamplerType2DRect) { |
|
reveman
2014/10/22 12:40:38
sampler != SamplerType2DRect? or how is GL_TEXTURE
enne (OOO)
2014/10/22 19:20:44
Ack. Thanks for pointing out that I had not thoug
reveman
2014/10/22 20:36:47
It's used on Android. It's the only supported targ
|
| + 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 |
| @@ -2858,27 +2861,35 @@ const GLRenderer::RenderPassProgramAA* GLRenderer::GetRenderPassProgramAA( |
| } |
| const GLRenderer::RenderPassMaskProgram* GLRenderer::GetRenderPassMaskProgram( |
| - TexCoordPrecision precision) { |
| + TexCoordPrecision precision, |
| + SamplerType sampler) { |
| DCHECK_GE(precision, 0); |
| DCHECK_LT(precision, NumTexCoordPrecisions); |
| - RenderPassMaskProgram* program = &render_pass_mask_program_[precision]; |
| + DCHECK_GE(sampler, 0); |
| + DCHECK_LT(sampler, NumSamplerTypes); |
| + RenderPassMaskProgram* program = |
| + &render_pass_mask_program_[precision][sampler]; |
| if (!program->initialized()) { |
| TRACE_EVENT0("cc", "GLRenderer::renderPassMaskProgram::initialize"); |
| program->Initialize( |
| - output_surface_->context_provider(), precision, SamplerType2D); |
| + output_surface_->context_provider(), precision, sampler); |
| } |
| return program; |
| } |
| const GLRenderer::RenderPassMaskProgramAA* |
| -GLRenderer::GetRenderPassMaskProgramAA(TexCoordPrecision precision) { |
| +GLRenderer::GetRenderPassMaskProgramAA(TexCoordPrecision precision, |
| + SamplerType sampler) { |
| DCHECK_GE(precision, 0); |
| DCHECK_LT(precision, NumTexCoordPrecisions); |
| - RenderPassMaskProgramAA* program = &render_pass_mask_program_aa_[precision]; |
| + DCHECK_GE(sampler, 0); |
| + DCHECK_LT(sampler, NumSamplerTypes); |
| + RenderPassMaskProgramAA* program = |
| + &render_pass_mask_program_aa_[precision][sampler]; |
| if (!program->initialized()) { |
| TRACE_EVENT0("cc", "GLRenderer::renderPassMaskProgramAA::initialize"); |
| program->Initialize( |
| - output_surface_->context_provider(), precision, SamplerType2D); |
| + output_surface_->context_provider(), precision, sampler); |
| } |
| return program; |
| } |
| @@ -2913,31 +2924,37 @@ GLRenderer::GetRenderPassColorMatrixProgramAA(TexCoordPrecision precision) { |
| } |
| const GLRenderer::RenderPassMaskColorMatrixProgram* |
| -GLRenderer::GetRenderPassMaskColorMatrixProgram(TexCoordPrecision precision) { |
| +GLRenderer::GetRenderPassMaskColorMatrixProgram(TexCoordPrecision precision, |
| + SamplerType sampler) { |
| DCHECK_GE(precision, 0); |
| DCHECK_LT(precision, NumTexCoordPrecisions); |
| + DCHECK_GE(sampler, 0); |
| + DCHECK_LT(sampler, NumSamplerTypes); |
| RenderPassMaskColorMatrixProgram* program = |
| - &render_pass_mask_color_matrix_program_[precision]; |
| + &render_pass_mask_color_matrix_program_[precision][sampler]; |
| if (!program->initialized()) { |
| TRACE_EVENT0("cc", |
| "GLRenderer::renderPassMaskColorMatrixProgram::initialize"); |
| program->Initialize( |
| - output_surface_->context_provider(), precision, SamplerType2D); |
| + output_surface_->context_provider(), precision, sampler); |
| } |
| return program; |
| } |
| const GLRenderer::RenderPassMaskColorMatrixProgramAA* |
| -GLRenderer::GetRenderPassMaskColorMatrixProgramAA(TexCoordPrecision precision) { |
| +GLRenderer::GetRenderPassMaskColorMatrixProgramAA(TexCoordPrecision precision, |
| + SamplerType sampler) { |
| DCHECK_GE(precision, 0); |
| DCHECK_LT(precision, NumTexCoordPrecisions); |
| + DCHECK_GE(sampler, 0); |
| + DCHECK_LT(sampler, NumSamplerTypes); |
| RenderPassMaskColorMatrixProgramAA* program = |
| - &render_pass_mask_color_matrix_program_aa_[precision]; |
| + &render_pass_mask_color_matrix_program_aa_[precision][sampler]; |
| if (!program->initialized()) { |
| TRACE_EVENT0("cc", |
| "GLRenderer::renderPassMaskColorMatrixProgramAA::initialize"); |
| program->Initialize( |
| - output_surface_->context_provider(), precision, SamplerType2D); |
| + output_surface_->context_provider(), precision, sampler); |
| } |
| return program; |
| } |
| @@ -3162,16 +3179,17 @@ 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_); |
| + |
| + render_pass_mask_program_[i][j].Cleanup(gl_); |
| + render_pass_mask_program_aa_[i][j].Cleanup(gl_); |
| + render_pass_mask_color_matrix_program_aa_[i][j].Cleanup(gl_); |
| + render_pass_mask_color_matrix_program_[i][j].Cleanup(gl_); |
| } |
| - render_pass_mask_program_[i].Cleanup(gl_); |
| render_pass_program_[i].Cleanup(gl_); |
| - render_pass_mask_program_aa_[i].Cleanup(gl_); |
| render_pass_program_aa_[i].Cleanup(gl_); |
| render_pass_color_matrix_program_[i].Cleanup(gl_); |
| - render_pass_mask_color_matrix_program_aa_[i].Cleanup(gl_); |
| render_pass_color_matrix_program_aa_[i].Cleanup(gl_); |
| - render_pass_mask_color_matrix_program_[i].Cleanup(gl_); |
| texture_program_[i].Cleanup(gl_); |
| nonpremultiplied_texture_program_[i].Cleanup(gl_); |