Chromium Code Reviews| Index: cc/output/gl_renderer.cc |
| diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc |
| index dffc72a478c893068ee474d9f7a8bc8f35c14b4c..8a3ee427b5bde46f3accbcd87612cc439ff65f3f 100644 |
| --- a/cc/output/gl_renderer.cc |
| +++ b/cc/output/gl_renderer.cc |
| @@ -716,6 +716,9 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame& frame, |
| GL_TEXTURE_2D, |
| GL_LINEAR)); |
| + TexCoordPrecision texCoordPrecision = TexCoordPrecisionRequired( |
| + context_, quad->shared_quad_state->visible_content_rect.bottom_right()); |
| + |
| int shader_quad_location = -1; |
| int shader_edge_location = -1; |
| int shader_mask_sampler_location = -1; |
| @@ -727,7 +730,8 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame& frame, |
| int shader_tex_scale_location = -1; |
| if (use_aa && mask_texture_id) { |
| - const RenderPassMaskProgramAA* program = GetRenderPassMaskProgramAA(); |
| + const RenderPassMaskProgramAA* program = |
| + GetRenderPassMaskProgramAA(texCoordPrecision); |
| SetUseProgram(program->program()); |
| GLC(Context(), |
| Context()->uniform1i(program->fragment_shader().samplerLocation(), 0)); |
| @@ -744,7 +748,8 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame& frame, |
| shader_alpha_location = program->fragment_shader().alphaLocation(); |
| shader_tex_scale_location = program->vertex_shader().texScaleLocation(); |
| } else if (!use_aa && mask_texture_id) { |
| - const RenderPassMaskProgram* program = GetRenderPassMaskProgram(); |
| + const RenderPassMaskProgram* program = |
| + GetRenderPassMaskProgram(texCoordPrecision); |
| SetUseProgram(program->program()); |
| GLC(Context(), |
| Context()->uniform1i(program->fragment_shader().samplerLocation(), 0)); |
| @@ -760,7 +765,8 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame& frame, |
| shader_tex_transform_location = |
| program->vertex_shader().texTransformLocation(); |
| } else if (use_aa && !mask_texture_id) { |
| - const RenderPassProgramAA* program = GetRenderPassProgramAA(); |
| + const RenderPassProgramAA* program = |
| + GetRenderPassProgramAA(texCoordPrecision); |
| SetUseProgram(program->program()); |
| GLC(Context(), |
| Context()->uniform1i(program->fragment_shader().samplerLocation(), 0)); |
| @@ -771,7 +777,8 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame& frame, |
| shader_alpha_location = program->fragment_shader().alphaLocation(); |
| shader_tex_scale_location = program->vertex_shader().texScaleLocation(); |
| } else { |
| - const RenderPassProgram* program = GetRenderPassProgram(); |
| + const RenderPassProgram* program = |
| + GetRenderPassProgram(texCoordPrecision); |
| SetUseProgram(program->program()); |
| GLC(Context(), |
| Context()->uniform1i(program->fragment_shader().samplerLocation(), 0)); |
| @@ -1079,6 +1086,11 @@ void GLRenderer::DrawTileQuad(const DrawingFrame& frame, |
| float vertex_tex_scale_x = tile_rect.width() / clamp_geom_rect.width(); |
| float vertex_tex_scale_y = tile_rect.height() / clamp_geom_rect.height(); |
| + // We assume we do not need highp texture coordinates for tiles. |
| + // Make sure that assumption is correct here. |
| + DCHECK_LE(quad->texture_size.width(), TexCoordHighpThreshold(context_)); |
| + DCHECK_LE(quad->texture_size.height(), TexCoordHighpThreshold(context_)); |
| + |
| // Map to normalized texture coordinates. |
| gfx::Size texture_size = quad->texture_size; |
| float fragment_tex_translate_x = clamp_tex_rect.x() / texture_size.width(); |
| @@ -1187,7 +1199,10 @@ void GLRenderer::DrawYUVVideoQuad(const DrawingFrame& frame, |
| const YUVVideoDrawQuad* quad) { |
| SetBlendEnabled(quad->ShouldDrawWithBlending()); |
| - const VideoYUVProgram* program = GetVideoYUVProgram(); |
| + TexCoordPrecision texCoordPrecision = TexCoordPrecisionRequired( |
| + context_, quad->shared_quad_state->visible_content_rect.bottom_right()); |
| + |
| + const VideoYUVProgram* program = GetVideoYUVProgram(texCoordPrecision); |
| DCHECK(program && (program->initialized() || IsContextLost())); |
| const VideoLayerImpl::FramePlane& y_plane = quad->y_plane; |
| @@ -1258,7 +1273,10 @@ void GLRenderer::DrawStreamVideoQuad(const DrawingFrame& frame, |
| DCHECK(capabilities_.using_egl_image); |
| - const VideoStreamTextureProgram* program = GetVideoStreamTextureProgram(); |
| + TexCoordPrecision texCoordPrecision = TexCoordPrecisionRequired( |
| + context_, quad->shared_quad_state->visible_content_rect.bottom_right()); |
| + |
| + const VideoStreamTextureProgram* program = GetVideoStreamTextureProgram(texCoordPrecision); |
| SetUseProgram(program->program()); |
| ToGLMatrix(&gl_matrix[0], quad->matrix); |
| @@ -1384,12 +1402,15 @@ void GLRenderer::FlushTextureQuadCache() { |
| void GLRenderer::EnqueueTextureQuad(const DrawingFrame& frame, |
| const TextureDrawQuad* quad) { |
| + TexCoordPrecision texCoordPrecision = TexCoordPrecisionRequired( |
| + context_, quad->shared_quad_state->visible_content_rect.bottom_right()); |
| + |
| // Choose the correct texture program binding |
| TexTransformTextureProgramBinding binding; |
| if (quad->flipped) |
| - binding.Set(GetTextureProgramFlip(), Context()); |
| + binding.Set(GetTextureProgramFlip(texCoordPrecision), Context()); |
| else |
| - binding.Set(GetTextureProgram(), Context()); |
| + binding.Set(GetTextureProgram(texCoordPrecision), Context()); |
| int resource_id = quad->resource_id; |
| @@ -1435,11 +1456,14 @@ void GLRenderer::EnqueueTextureQuad(const DrawingFrame& frame, |
| void GLRenderer::DrawTextureQuad(const DrawingFrame& frame, |
| const TextureDrawQuad* quad) { |
| + TexCoordPrecision texCoordPrecision = TexCoordPrecisionRequired( |
| + context_, quad->shared_quad_state->visible_content_rect.bottom_right()); |
| + |
| TexTransformTextureProgramBinding binding; |
| if (quad->flipped) |
| - binding.Set(GetTextureProgramFlip(), Context()); |
| + binding.Set(GetTextureProgramFlip(texCoordPrecision), Context()); |
| else |
| - binding.Set(GetTextureProgram(), Context()); |
| + binding.Set(GetTextureProgram(texCoordPrecision), Context()); |
| SetUseProgram(binding.program_id); |
| GLC(Context(), Context()->uniform1i(binding.sampler_location, 0)); |
| gfx::PointF uv0 = quad->uv_top_left; |
| @@ -1485,8 +1509,11 @@ void GLRenderer::DrawIOSurfaceQuad(const DrawingFrame& frame, |
| const IOSurfaceDrawQuad* quad) { |
| SetBlendEnabled(quad->ShouldDrawWithBlending()); |
| + TexCoordPrecision texCoordPrecision = TexCoordPrecisionRequired( |
| + context_, quad->shared_quad_state->visible_content_rect.bottom_right()); |
| + |
| TexTransformTextureProgramBinding binding; |
| - binding.Set(GetTextureIOSurfaceProgram(), Context()); |
| + binding.Set(GetTextureIOSurfaceProgram(texCoordPrecision), Context()); |
| SetUseProgram(binding.program_id); |
| GLC(Context(), Context()->uniform1i(binding.sampler_location, 0)); |
| @@ -1619,7 +1646,9 @@ void GLRenderer::CopyTextureToFramebuffer(const DrawingFrame& frame, |
| int texture_id, |
| gfx::Rect rect, |
| const gfx::Transform& draw_matrix) { |
| - const RenderPassProgram* program = GetRenderPassProgram(); |
| + TexCoordPrecision texCoordPrecision = |
| + TexCoordPrecisionRequired(context_, rect.bottom_right()); |
| + const RenderPassProgram* program = GetRenderPassProgram(texCoordPrecision); |
| GLC(Context(), Context()->bindTexture(GL_TEXTURE_2D, texture_id)); |
| @@ -1956,11 +1985,16 @@ bool GLRenderer::InitializeSharedObjects() { |
| // We will always need these programs to render, so create the programs |
| // eagerly so that the shader compilation can start while we do other work. |
| // Other programs are created lazily on first access. |
| - shared_geometry_ = |
| - make_scoped_ptr(new GeometryBinding(context_, QuadVertexRect())); |
| - render_pass_program_ = make_scoped_ptr(new RenderPassProgram(context_)); |
| - tile_program_ = make_scoped_ptr(new TileProgram(context_)); |
| - tile_program_opaque_ = make_scoped_ptr(new TileProgramOpaque(context_)); |
| + shared_geometry_ = make_scoped_ptr( |
| + new GeometryBinding(context_, QuadVertexRect())); |
| + render_pass_program_ = make_scoped_ptr( |
| + new RenderPassProgram(context_, TexCoordPrecisionMedium)); |
| + render_pass_program_highp_ = make_scoped_ptr( |
| + new RenderPassProgram(context_, TexCoordPrecisionHigh)); |
| + tile_program_ = make_scoped_ptr( |
| + new TileProgram(context_, TexCoordPrecisionMedium)); |
| + tile_program_opaque_ = make_scoped_ptr( |
| + new TileProgramOpaque(context_, TexCoordPrecisionMedium)); |
| GLC(context_, context_->flush()); |
| @@ -1969,10 +2003,9 @@ bool GLRenderer::InitializeSharedObjects() { |
| const GLRenderer::TileCheckerboardProgram* |
| GLRenderer::GetTileCheckerboardProgram() { |
| - if (!tile_checkerboard_program_) { |
| - tile_checkerboard_program_ = |
| - make_scoped_ptr(new TileCheckerboardProgram(context_)); |
| - } |
| + if (!tile_checkerboard_program_) |
| + tile_checkerboard_program_ = make_scoped_ptr( |
| + new TileCheckerboardProgram(context_, TexCoordPrecisionMedium)); |
| if (!tile_checkerboard_program_->initialized()) { |
| TRACE_EVENT0("cc", "GLRenderer::checkerboardProgram::initalize"); |
| tile_checkerboard_program_->Initialize(context_, is_using_bind_uniform_); |
| @@ -1982,7 +2015,7 @@ GLRenderer::GetTileCheckerboardProgram() { |
| const GLRenderer::DebugBorderProgram* GLRenderer::GetDebugBorderProgram() { |
| if (!debug_border_program_) |
| - debug_border_program_ = make_scoped_ptr(new DebugBorderProgram(context_)); |
| + debug_border_program_ = make_scoped_ptr(new DebugBorderProgram(context_, TexCoordPrecisionNA)); |
|
Sami
2013/03/22 11:14:34
Nit: line length
|
| if (!debug_border_program_->initialized()) { |
| TRACE_EVENT0("cc", "GLRenderer::debugBorderProgram::initialize"); |
| debug_border_program_->Initialize(context_, is_using_bind_uniform_); |
| @@ -1992,7 +2025,8 @@ const GLRenderer::DebugBorderProgram* GLRenderer::GetDebugBorderProgram() { |
| const GLRenderer::SolidColorProgram* GLRenderer::GetSolidColorProgram() { |
| if (!solid_color_program_) |
| - solid_color_program_ = make_scoped_ptr(new SolidColorProgram(context_)); |
| + solid_color_program_ = make_scoped_ptr( |
| + new SolidColorProgram(context_, TexCoordPrecisionNA)); |
| if (!solid_color_program_->initialized()) { |
| TRACE_EVENT0("cc", "GLRenderer::solidColorProgram::initialize"); |
| solid_color_program_->Initialize(context_, is_using_bind_uniform_); |
| @@ -2003,7 +2037,7 @@ const GLRenderer::SolidColorProgram* GLRenderer::GetSolidColorProgram() { |
| const GLRenderer::SolidColorProgramAA* GLRenderer::GetSolidColorProgramAA() { |
| if (!solid_color_program_aa_) { |
| solid_color_program_aa_ = |
| - make_scoped_ptr(new SolidColorProgramAA(context_)); |
| + make_scoped_ptr(new SolidColorProgramAA(context_, TexCoordPrecisionNA)); |
| } |
| if (!solid_color_program_aa_->initialized()) { |
| TRACE_EVENT0("cc", "GLRenderer::solidColorProgramAA::initialize"); |
| @@ -2012,48 +2046,61 @@ const GLRenderer::SolidColorProgramAA* GLRenderer::GetSolidColorProgramAA() { |
| return solid_color_program_aa_.get(); |
| } |
| -const GLRenderer::RenderPassProgram* GLRenderer::GetRenderPassProgram() { |
| - DCHECK(render_pass_program_); |
| - if (!render_pass_program_->initialized()) { |
| +const GLRenderer::RenderPassProgram* GLRenderer::GetRenderPassProgram( |
| + TexCoordPrecision precision) { |
| + scoped_ptr<RenderPassProgram> &program = |
| + (precision == TexCoordPrecisionHigh) ? render_pass_program_highp_ |
| + : render_pass_program_; |
| + DCHECK(program); |
| + if (!program->initialized()) { |
| TRACE_EVENT0("cc", "GLRenderer::renderPassProgram::initialize"); |
| - render_pass_program_->Initialize(context_, is_using_bind_uniform_); |
| + program->Initialize(context_, is_using_bind_uniform_); |
| } |
| - return render_pass_program_.get(); |
| -} |
| - |
| -const GLRenderer::RenderPassProgramAA* GLRenderer::GetRenderPassProgramAA() { |
| - if (!render_pass_program_aa_) |
| - render_pass_program_aa_ = |
| - make_scoped_ptr(new RenderPassProgramAA(context_)); |
| - if (!render_pass_program_aa_->initialized()) { |
| + return program.get(); |
| +} |
| + |
| +const GLRenderer::RenderPassProgramAA* GLRenderer::GetRenderPassProgramAA( |
| + TexCoordPrecision precision) { |
| + scoped_ptr<RenderPassProgramAA> &program = |
| + (precision == TexCoordPrecisionHigh) ? render_pass_program_aa_highp_ |
| + : render_pass_program_aa_; |
| + if (!program) |
| + program = |
| + make_scoped_ptr(new RenderPassProgramAA(context_, precision)); |
| + if (!program->initialized()) { |
| TRACE_EVENT0("cc", "GLRenderer::renderPassProgramAA::initialize"); |
| - render_pass_program_aa_->Initialize(context_, is_using_bind_uniform_); |
| + program->Initialize(context_, is_using_bind_uniform_); |
| } |
| - return render_pass_program_aa_.get(); |
| + return program.get(); |
| } |
| const GLRenderer::RenderPassMaskProgram* |
| -GLRenderer::GetRenderPassMaskProgram() { |
| - if (!render_pass_mask_program_) |
| - render_pass_mask_program_ = |
| - make_scoped_ptr(new RenderPassMaskProgram(context_)); |
| - if (!render_pass_mask_program_->initialized()) { |
| +GLRenderer::GetRenderPassMaskProgram(TexCoordPrecision precision) { |
| + scoped_ptr<RenderPassMaskProgram> &program = |
| + (precision == TexCoordPrecisionHigh) ? render_pass_mask_program_highp_ |
| + : render_pass_mask_program_; |
| + if (!program) |
| + program = make_scoped_ptr(new RenderPassMaskProgram(context_, precision)); |
| + if (!program->initialized()) { |
| TRACE_EVENT0("cc", "GLRenderer::renderPassMaskProgram::initialize"); |
| - render_pass_mask_program_->Initialize(context_, is_using_bind_uniform_); |
| + program->Initialize(context_, is_using_bind_uniform_); |
| } |
| - return render_pass_mask_program_.get(); |
| + return program.get(); |
| } |
| const GLRenderer::RenderPassMaskProgramAA* |
| -GLRenderer::GetRenderPassMaskProgramAA() { |
| - if (!render_pass_mask_program_aa_) |
| - render_pass_mask_program_aa_ = |
| - make_scoped_ptr(new RenderPassMaskProgramAA(context_)); |
| - if (!render_pass_mask_program_aa_->initialized()) { |
| +GLRenderer::GetRenderPassMaskProgramAA(TexCoordPrecision precision) { |
| + scoped_ptr<RenderPassMaskProgramAA> &program = |
| + (precision == TexCoordPrecisionHigh) ? render_pass_mask_program_aa_highp_ |
| + : render_pass_mask_program_aa_; |
| + if (!program) |
| + program = |
| + make_scoped_ptr(new RenderPassMaskProgramAA(context_, precision)); |
| + if (!program->initialized()) { |
| TRACE_EVENT0("cc", "GLRenderer::renderPassMaskProgramAA::initialize"); |
| - render_pass_mask_program_aa_->Initialize(context_, is_using_bind_uniform_); |
| + program->Initialize(context_, is_using_bind_uniform_); |
| } |
| - return render_pass_mask_program_aa_.get(); |
| + return program.get(); |
| } |
| const GLRenderer::TileProgram* GLRenderer::GetTileProgram() { |
| @@ -2076,7 +2123,8 @@ const GLRenderer::TileProgramOpaque* GLRenderer::GetTileProgramOpaque() { |
| const GLRenderer::TileProgramAA* GLRenderer::GetTileProgramAA() { |
| if (!tile_program_aa_) |
| - tile_program_aa_ = make_scoped_ptr(new TileProgramAA(context_)); |
| + tile_program_aa_ = make_scoped_ptr( |
| + new TileProgramAA(context_, TexCoordPrecisionMedium)); |
| if (!tile_program_aa_->initialized()) { |
| TRACE_EVENT0("cc", "GLRenderer::tileProgramAA::initialize"); |
| tile_program_aa_->Initialize(context_, is_using_bind_uniform_); |
| @@ -2086,7 +2134,8 @@ const GLRenderer::TileProgramAA* GLRenderer::GetTileProgramAA() { |
| const GLRenderer::TileProgramSwizzle* GLRenderer::GetTileProgramSwizzle() { |
| if (!tile_program_swizzle_) |
| - tile_program_swizzle_ = make_scoped_ptr(new TileProgramSwizzle(context_)); |
| + tile_program_swizzle_ = make_scoped_ptr( |
| + new TileProgramSwizzle(context_, TexCoordPrecisionMedium)); |
| if (!tile_program_swizzle_->initialized()) { |
| TRACE_EVENT0("cc", "GLRenderer::tileProgramSwizzle::initialize"); |
| tile_program_swizzle_->Initialize(context_, is_using_bind_uniform_); |
| @@ -2097,8 +2146,8 @@ const GLRenderer::TileProgramSwizzle* GLRenderer::GetTileProgramSwizzle() { |
| const GLRenderer::TileProgramSwizzleOpaque* |
| GLRenderer::GetTileProgramSwizzleOpaque() { |
| if (!tile_program_swizzle_opaque_) |
| - tile_program_swizzle_opaque_ = |
| - make_scoped_ptr(new TileProgramSwizzleOpaque(context_)); |
| + tile_program_swizzle_opaque_ = make_scoped_ptr( |
| + new TileProgramSwizzleOpaque(context_, TexCoordPrecisionMedium)); |
| if (!tile_program_swizzle_opaque_->initialized()) { |
| TRACE_EVENT0("cc", "GLRenderer::tileProgramSwizzleOpaque::initialize"); |
| tile_program_swizzle_opaque_->Initialize(context_, is_using_bind_uniform_); |
| @@ -2108,8 +2157,8 @@ GLRenderer::GetTileProgramSwizzleOpaque() { |
| const GLRenderer::TileProgramSwizzleAA* GLRenderer::GetTileProgramSwizzleAA() { |
| if (!tile_program_swizzle_aa_) |
| - tile_program_swizzle_aa_ = |
| - make_scoped_ptr(new TileProgramSwizzleAA(context_)); |
| + tile_program_swizzle_aa_ = make_scoped_ptr( |
| + new TileProgramSwizzleAA(context_, TexCoordPrecisionMedium)); |
| if (!tile_program_swizzle_aa_->initialized()) { |
| TRACE_EVENT0("cc", "GLRenderer::tileProgramSwizzleAA::initialize"); |
| tile_program_swizzle_aa_->Initialize(context_, is_using_bind_uniform_); |
| @@ -2117,60 +2166,78 @@ const GLRenderer::TileProgramSwizzleAA* GLRenderer::GetTileProgramSwizzleAA() { |
| return tile_program_swizzle_aa_.get(); |
| } |
| -const GLRenderer::TextureProgram* GLRenderer::GetTextureProgram() { |
| - if (!texture_program_) |
| - texture_program_ = make_scoped_ptr(new TextureProgram(context_)); |
| - if (!texture_program_->initialized()) { |
| +const GLRenderer::TextureProgram* GLRenderer::GetTextureProgram( |
| + TexCoordPrecision precision) { |
| + scoped_ptr<TextureProgram> &program = |
| + (precision == TexCoordPrecisionHigh) ? texture_program_highp_ |
| + : texture_program_; |
| + if (!program) |
| + program = make_scoped_ptr(new TextureProgram(context_, precision)); |
| + if (!program->initialized()) { |
| TRACE_EVENT0("cc", "GLRenderer::textureProgram::initialize"); |
| - texture_program_->Initialize(context_, is_using_bind_uniform_); |
| + program->Initialize(context_, is_using_bind_uniform_); |
| } |
| - return texture_program_.get(); |
| + return program.get(); |
| } |
| -const GLRenderer::TextureProgramFlip* GLRenderer::GetTextureProgramFlip() { |
| - if (!texture_program_flip_) |
| - texture_program_flip_ = make_scoped_ptr(new TextureProgramFlip(context_)); |
| - if (!texture_program_flip_->initialized()) { |
| +const GLRenderer::TextureProgramFlip* GLRenderer::GetTextureProgramFlip( |
| + TexCoordPrecision precision) { |
| + scoped_ptr<TextureProgramFlip> &program = |
| + (precision == TexCoordPrecisionHigh) ? texture_program_flip_highp_ |
| + : texture_program_flip_; |
| + if (!program) |
| + program = make_scoped_ptr(new TextureProgramFlip(context_, precision)); |
| + if (!program->initialized()) { |
| TRACE_EVENT0("cc", "GLRenderer::textureProgramFlip::initialize"); |
| - texture_program_flip_->Initialize(context_, is_using_bind_uniform_); |
| + program->Initialize(context_, is_using_bind_uniform_); |
| } |
| - return texture_program_flip_.get(); |
| + return program.get(); |
| } |
| const GLRenderer::TextureIOSurfaceProgram* |
| -GLRenderer::GetTextureIOSurfaceProgram() { |
| - if (!texture_io_surface_program_) |
| - texture_io_surface_program_ = |
| - make_scoped_ptr(new TextureIOSurfaceProgram(context_)); |
| - if (!texture_io_surface_program_->initialized()) { |
| +GLRenderer::GetTextureIOSurfaceProgram(TexCoordPrecision precision) { |
| + scoped_ptr<TextureIOSurfaceProgram> &program = |
| + (precision == TexCoordPrecisionHigh) ? texture_io_surface_program_highp_ |
| + : texture_io_surface_program_; |
| + if (!program) |
| + program = |
| + make_scoped_ptr(new TextureIOSurfaceProgram(context_, precision)); |
| + if (!program->initialized()) { |
| TRACE_EVENT0("cc", "GLRenderer::textureIOSurfaceProgram::initialize"); |
| - texture_io_surface_program_->Initialize(context_, is_using_bind_uniform_); |
| + program->Initialize(context_, is_using_bind_uniform_); |
| } |
| - return texture_io_surface_program_.get(); |
| + return program.get(); |
| } |
| -const GLRenderer::VideoYUVProgram* GLRenderer::GetVideoYUVProgram() { |
| - if (!video_yuv_program_) |
| - video_yuv_program_ = make_scoped_ptr(new VideoYUVProgram(context_)); |
| - if (!video_yuv_program_->initialized()) { |
| +const GLRenderer::VideoYUVProgram* GLRenderer::GetVideoYUVProgram( |
| + TexCoordPrecision precision) { |
| + scoped_ptr<VideoYUVProgram> &program = |
| + (precision == TexCoordPrecisionHigh) ? video_yuv_program_highp_ |
| + : video_yuv_program_; |
| + if (!program) |
| + program = make_scoped_ptr(new VideoYUVProgram(context_, precision)); |
| + if (!program->initialized()) { |
| TRACE_EVENT0("cc", "GLRenderer::videoYUVProgram::initialize"); |
| - video_yuv_program_->Initialize(context_, is_using_bind_uniform_); |
| + program->Initialize(context_, is_using_bind_uniform_); |
| } |
| - return video_yuv_program_.get(); |
| + return program.get(); |
| } |
| const GLRenderer::VideoStreamTextureProgram* |
| -GLRenderer::GetVideoStreamTextureProgram() { |
| +GLRenderer::GetVideoStreamTextureProgram(TexCoordPrecision precision) { |
| if (!Capabilities().using_egl_image) |
| return NULL; |
| - if (!video_stream_texture_program_) |
| - video_stream_texture_program_ = |
| - make_scoped_ptr(new VideoStreamTextureProgram(context_)); |
| - if (!video_stream_texture_program_->initialized()) { |
| + scoped_ptr<VideoStreamTextureProgram> &program = |
| + (precision == TexCoordPrecisionHigh) ? video_stream_texture_program_highp_ |
| + : video_stream_texture_program_; |
| + if (!program) |
| + program = |
| + make_scoped_ptr(new VideoStreamTextureProgram(context_, precision)); |
| + if (!program->initialized()) { |
| TRACE_EVENT0("cc", "GLRenderer::streamTextureProgram::initialize"); |
| - video_stream_texture_program_->Initialize(context_, is_using_bind_uniform_); |
| + program->Initialize(context_, is_using_bind_uniform_); |
| } |
| - return video_stream_texture_program_.get(); |
| + return program.get(); |
| } |
| void GLRenderer::CleanupSharedObjects() { |
| @@ -2202,6 +2269,15 @@ void GLRenderer::CleanupSharedObjects() { |
| if (render_pass_program_aa_) |
| render_pass_program_aa_->Cleanup(context_); |
| + if (render_pass_mask_program_highp_) |
| + render_pass_mask_program_highp_->Cleanup(context_); |
| + if (render_pass_program_highp_) |
| + render_pass_program_highp_->Cleanup(context_); |
| + if (render_pass_mask_program_aa_highp_) |
| + render_pass_mask_program_aa_highp_->Cleanup(context_); |
| + if (render_pass_program_aa_highp_) |
| + render_pass_program_aa_highp_->Cleanup(context_); |
| + |
| if (texture_program_) |
| texture_program_->Cleanup(context_); |
| if (texture_program_flip_) |
| @@ -2209,11 +2285,23 @@ void GLRenderer::CleanupSharedObjects() { |
| if (texture_io_surface_program_) |
| texture_io_surface_program_->Cleanup(context_); |
| + if (texture_program_highp_) |
| + texture_program_highp_->Cleanup(context_); |
| + if (texture_program_flip_highp_) |
| + texture_program_flip_highp_->Cleanup(context_); |
| + if (texture_io_surface_program_highp_) |
| + texture_io_surface_program_highp_->Cleanup(context_); |
| + |
| if (video_yuv_program_) |
| video_yuv_program_->Cleanup(context_); |
| if (video_stream_texture_program_) |
| video_stream_texture_program_->Cleanup(context_); |
| + if (video_yuv_program_highp_) |
| + video_yuv_program_highp_->Cleanup(context_); |
| + if (video_stream_texture_program_highp_) |
| + video_stream_texture_program_highp_->Cleanup(context_); |
| + |
| if (debug_border_program_) |
| debug_border_program_->Cleanup(context_); |
| if (solid_color_program_) |