Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(622)

Side by Side Diff: cc/output/gl_renderer.cc

Issue 51653008: Remove WGC3D::isContextLost references from cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 ResourceProvider* resource_provider, 159 ResourceProvider* resource_provider,
160 TextureMailboxDeleter* texture_mailbox_deleter, 160 TextureMailboxDeleter* texture_mailbox_deleter,
161 int highp_threshold_min) 161 int highp_threshold_min)
162 : DirectRenderer(client, settings, output_surface, resource_provider), 162 : DirectRenderer(client, settings, output_surface, resource_provider),
163 offscreen_framebuffer_id_(0), 163 offscreen_framebuffer_id_(0),
164 shared_geometry_quad_(gfx::RectF(-0.5f, -0.5f, 1.0f, 1.0f)), 164 shared_geometry_quad_(gfx::RectF(-0.5f, -0.5f, 1.0f, 1.0f)),
165 context_(output_surface->context_provider()->Context3d()), 165 context_(output_surface->context_provider()->Context3d()),
166 context_support_(output_surface->context_provider()->ContextSupport()), 166 context_support_(output_surface->context_provider()->ContextSupport()),
167 texture_mailbox_deleter_(texture_mailbox_deleter), 167 texture_mailbox_deleter_(texture_mailbox_deleter),
168 is_backbuffer_discarded_(false), 168 is_backbuffer_discarded_(false),
169 is_using_bind_uniform_(false),
170 visible_(true), 169 visible_(true),
171 is_scissor_enabled_(false), 170 is_scissor_enabled_(false),
172 stencil_shadow_(false), 171 stencil_shadow_(false),
173 blend_shadow_(false), 172 blend_shadow_(false),
174 highp_threshold_min_(highp_threshold_min), 173 highp_threshold_min_(highp_threshold_min),
175 highp_threshold_cache_(0), 174 highp_threshold_cache_(0),
176 on_demand_tile_raster_resource_id_(0) { 175 on_demand_tile_raster_resource_id_(0) {
177 DCHECK(context_); 176 DCHECK(context_);
178 DCHECK(context_support_); 177 DCHECK(context_support_);
179 } 178 }
(...skipping 25 matching lines...) Expand all
205 capabilities_.avoid_pow2_textures = context_caps.fast_npot_mo8_textures; 204 capabilities_.avoid_pow2_textures = context_caps.fast_npot_mo8_textures;
206 205
207 capabilities_.using_offscreen_context3d = true; 206 capabilities_.using_offscreen_context3d = true;
208 207
209 capabilities_.using_map_image = 208 capabilities_.using_map_image =
210 settings_->use_map_image && context_caps.map_image; 209 settings_->use_map_image && context_caps.map_image;
211 210
212 capabilities_.using_discard_framebuffer = 211 capabilities_.using_discard_framebuffer =
213 context_caps.discard_framebuffer; 212 context_caps.discard_framebuffer;
214 213
215 is_using_bind_uniform_ = context_caps.bind_uniform_location;
216
217 if (!InitializeSharedObjects()) 214 if (!InitializeSharedObjects())
218 return false; 215 return false;
219 216
220 // Make sure the viewport and context gets initialized, even if it is to zero. 217 // Make sure the viewport and context gets initialized, even if it is to zero.
221 ViewportChanged(); 218 ViewportChanged();
222 return true; 219 return true;
223 } 220 }
224 221
225 void GLRenderer::InitializeGrContext() { 222 void GLRenderer::InitializeGrContext() {
226 skia::RefPtr<GrGLInterface> interface = skia::AdoptRef( 223 skia::RefPtr<GrGLInterface> interface = skia::AdoptRef(
(...skipping 1471 matching lines...) Expand 10 before | Expand all | Expand 10 after
1698 bitmap_pixels, 1695 bitmap_pixels,
1699 gfx::Rect(quad->texture_size), 1696 gfx::Rect(quad->texture_size),
1700 gfx::Rect(quad->texture_size), 1697 gfx::Rect(quad->texture_size),
1701 gfx::Vector2d()); 1698 gfx::Vector2d());
1702 1699
1703 DrawContentQuad(frame, quad, on_demand_tile_raster_resource_id_); 1700 DrawContentQuad(frame, quad, on_demand_tile_raster_resource_id_);
1704 } 1701 }
1705 1702
1706 struct TextureProgramBinding { 1703 struct TextureProgramBinding {
1707 template <class Program> 1704 template <class Program>
1708 void Set(Program* program, WebKit::WebGraphicsContext3D* context) { 1705 void Set(Program* program) {
1709 DCHECK(program && (program->initialized() || context->isContextLost())); 1706 DCHECK(program);
1710 program_id = program->program(); 1707 program_id = program->program();
1711 sampler_location = program->fragment_shader().sampler_location(); 1708 sampler_location = program->fragment_shader().sampler_location();
1712 matrix_location = program->vertex_shader().matrix_location(); 1709 matrix_location = program->vertex_shader().matrix_location();
1713 background_color_location = 1710 background_color_location =
1714 program->fragment_shader().background_color_location(); 1711 program->fragment_shader().background_color_location();
1715 } 1712 }
1716 int program_id; 1713 int program_id;
1717 int sampler_location; 1714 int sampler_location;
1718 int matrix_location; 1715 int matrix_location;
1719 int background_color_location; 1716 int background_color_location;
1720 }; 1717 };
1721 1718
1722 struct TexTransformTextureProgramBinding : TextureProgramBinding { 1719 struct TexTransformTextureProgramBinding : TextureProgramBinding {
1723 template <class Program> 1720 template <class Program>
1724 void Set(Program* program, WebKit::WebGraphicsContext3D* context) { 1721 void Set(Program* program) {
1725 TextureProgramBinding::Set(program, context); 1722 TextureProgramBinding::Set(program);
1726 tex_transform_location = program->vertex_shader().tex_transform_location(); 1723 tex_transform_location = program->vertex_shader().tex_transform_location();
1727 vertex_opacity_location = 1724 vertex_opacity_location =
1728 program->vertex_shader().vertex_opacity_location(); 1725 program->vertex_shader().vertex_opacity_location();
1729 } 1726 }
1730 int tex_transform_location; 1727 int tex_transform_location;
1731 int vertex_opacity_location; 1728 int vertex_opacity_location;
1732 }; 1729 };
1733 1730
1734 void GLRenderer::FlushTextureQuadCache() { 1731 void GLRenderer::FlushTextureQuadCache() {
1735 // Check to see if we have anything to draw. 1732 // Check to see if we have anything to draw.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1802 void GLRenderer::EnqueueTextureQuad(const DrawingFrame* frame, 1799 void GLRenderer::EnqueueTextureQuad(const DrawingFrame* frame,
1803 const TextureDrawQuad* quad) { 1800 const TextureDrawQuad* quad) {
1804 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( 1801 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired(
1805 context_, &highp_threshold_cache_, highp_threshold_min_, 1802 context_, &highp_threshold_cache_, highp_threshold_min_,
1806 quad->shared_quad_state->visible_content_rect.bottom_right()); 1803 quad->shared_quad_state->visible_content_rect.bottom_right());
1807 1804
1808 // Choose the correct texture program binding 1805 // Choose the correct texture program binding
1809 TexTransformTextureProgramBinding binding; 1806 TexTransformTextureProgramBinding binding;
1810 if (quad->premultiplied_alpha) { 1807 if (quad->premultiplied_alpha) {
1811 if (quad->background_color == SK_ColorTRANSPARENT) { 1808 if (quad->background_color == SK_ColorTRANSPARENT) {
1812 binding.Set(GetTextureProgram(tex_coord_precision), Context()); 1809 binding.Set(GetTextureProgram(tex_coord_precision));
1813 } else { 1810 } else {
1814 binding.Set(GetTextureBackgroundProgram(tex_coord_precision), Context()); 1811 binding.Set(GetTextureBackgroundProgram(tex_coord_precision));
1815 } 1812 }
1816 } else { 1813 } else {
1817 if (quad->background_color == SK_ColorTRANSPARENT) { 1814 if (quad->background_color == SK_ColorTRANSPARENT) {
1818 binding.Set(GetNonPremultipliedTextureProgram(tex_coord_precision), 1815 binding.Set(GetNonPremultipliedTextureProgram(tex_coord_precision));
1819 Context());
1820 } else { 1816 } else {
1821 binding.Set( 1817 binding.Set(
1822 GetNonPremultipliedTextureBackgroundProgram(tex_coord_precision), 1818 GetNonPremultipliedTextureBackgroundProgram(tex_coord_precision));
1823 Context());
1824 } 1819 }
1825 } 1820 }
1826 1821
1827 int resource_id = quad->resource_id; 1822 int resource_id = quad->resource_id;
1828 1823
1829 if (draw_cache_.program_id != binding.program_id || 1824 if (draw_cache_.program_id != binding.program_id ||
1830 draw_cache_.resource_id != resource_id || 1825 draw_cache_.resource_id != resource_id ||
1831 draw_cache_.needs_blending != quad->ShouldDrawWithBlending() || 1826 draw_cache_.needs_blending != quad->ShouldDrawWithBlending() ||
1832 draw_cache_.background_color != quad->background_color || 1827 draw_cache_.background_color != quad->background_color ||
1833 draw_cache_.matrix_data.size() >= 8) { 1828 draw_cache_.matrix_data.size() >= 8) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1866 1861
1867 void GLRenderer::DrawIOSurfaceQuad(const DrawingFrame* frame, 1862 void GLRenderer::DrawIOSurfaceQuad(const DrawingFrame* frame,
1868 const IOSurfaceDrawQuad* quad) { 1863 const IOSurfaceDrawQuad* quad) {
1869 SetBlendEnabled(quad->ShouldDrawWithBlending()); 1864 SetBlendEnabled(quad->ShouldDrawWithBlending());
1870 1865
1871 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( 1866 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired(
1872 context_, &highp_threshold_cache_, highp_threshold_min_, 1867 context_, &highp_threshold_cache_, highp_threshold_min_,
1873 quad->shared_quad_state->visible_content_rect.bottom_right()); 1868 quad->shared_quad_state->visible_content_rect.bottom_right());
1874 1869
1875 TexTransformTextureProgramBinding binding; 1870 TexTransformTextureProgramBinding binding;
1876 binding.Set(GetTextureIOSurfaceProgram(tex_coord_precision), Context()); 1871 binding.Set(GetTextureIOSurfaceProgram(tex_coord_precision));
1877 1872
1878 SetUseProgram(binding.program_id); 1873 SetUseProgram(binding.program_id);
1879 GLC(Context(), Context()->uniform1i(binding.sampler_location, 0)); 1874 GLC(Context(), Context()->uniform1i(binding.sampler_location, 0));
1880 if (quad->orientation == IOSurfaceDrawQuad::FLIPPED) { 1875 if (quad->orientation == IOSurfaceDrawQuad::FLIPPED) {
1881 GLC(Context(), 1876 GLC(Context(),
1882 Context()->uniform4f(binding.tex_transform_location, 1877 Context()->uniform4f(binding.tex_transform_location,
1883 0, 1878 0,
1884 quad->io_surface_size.height(), 1879 quad->io_surface_size.height(),
1885 quad->io_surface_size.width(), 1880 quad->io_surface_size.width(),
1886 quad->io_surface_size.height() * -1.0f)); 1881 quad->io_surface_size.height() * -1.0f));
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
2509 2504
2510 bool GLRenderer::MakeContextCurrent() { return context_->makeContextCurrent(); } 2505 bool GLRenderer::MakeContextCurrent() { return context_->makeContextCurrent(); }
2511 2506
2512 bool GLRenderer::InitializeSharedObjects() { 2507 bool GLRenderer::InitializeSharedObjects() {
2513 TRACE_EVENT0("cc", "GLRenderer::InitializeSharedObjects"); 2508 TRACE_EVENT0("cc", "GLRenderer::InitializeSharedObjects");
2514 MakeContextCurrent(); 2509 MakeContextCurrent();
2515 2510
2516 // Create an FBO for doing offscreen rendering. 2511 // Create an FBO for doing offscreen rendering.
2517 GLC(context_, offscreen_framebuffer_id_ = context_->createFramebuffer()); 2512 GLC(context_, offscreen_framebuffer_id_ = context_->createFramebuffer());
2518 2513
2519 // We will always need these programs to render, so create the programs
2520 // eagerly so that the shader compilation can start while we do other work.
2521 // Other programs are created lazily on first access.
2522 shared_geometry_ = make_scoped_ptr( 2514 shared_geometry_ = make_scoped_ptr(
2523 new GeometryBinding(context_, QuadVertexRect())); 2515 new GeometryBinding(context_, QuadVertexRect()));
2524 render_pass_program_ = make_scoped_ptr( 2516 // We will always need these programs to render, so initialize the programs
2525 new RenderPassProgram(context_, TexCoordPrecisionMedium)); 2517 // eagerly so that the shader compilation can start while we do other work.
2526 render_pass_program_highp_ = make_scoped_ptr( 2518 // Other programs are initialized lazily on first access.
2527 new RenderPassProgram(context_, TexCoordPrecisionHigh)); 2519 render_pass_program_.Initialize(output_surface_->context_provider(),
2528 tile_program_ = make_scoped_ptr( 2520 TexCoordPrecisionMedium);
2529 new TileProgram(context_, TexCoordPrecisionMedium)); 2521 render_pass_program_highp_.Initialize(output_surface_->context_provider(),
2530 tile_program_opaque_ = make_scoped_ptr( 2522 TexCoordPrecisionHigh);
2531 new TileProgramOpaque(context_, TexCoordPrecisionMedium)); 2523 tile_program_.Initialize(output_surface_->context_provider(),
2532 tile_program_highp_ = make_scoped_ptr( 2524 TexCoordPrecisionMedium);
2533 new TileProgram(context_, TexCoordPrecisionHigh)); 2525 tile_program_opaque_.Initialize(output_surface_->context_provider(),
2534 tile_program_opaque_highp_ = make_scoped_ptr( 2526 TexCoordPrecisionMedium);
2535 new TileProgramOpaque(context_, TexCoordPrecisionHigh)); 2527 tile_program_highp_.Initialize(output_surface_->context_provider(),
2528 TexCoordPrecisionHigh);
2529 tile_program_opaque_highp_.Initialize(output_surface_->context_provider(),
2530 TexCoordPrecisionHigh);
2536 2531
2537 GLC(context_, context_->flush()); 2532 GLC(context_, context_->flush());
2538 2533
2539 return true; 2534 return true;
2540 } 2535 }
2541 2536
2542 const GLRenderer::TileCheckerboardProgram* 2537 const GLRenderer::TileCheckerboardProgram*
2543 GLRenderer::GetTileCheckerboardProgram() { 2538 GLRenderer::GetTileCheckerboardProgram() {
2544 if (!tile_checkerboard_program_) 2539 if (!tile_checkerboard_program_.initialized()) {
2545 tile_checkerboard_program_ = make_scoped_ptr(
2546 new TileCheckerboardProgram(context_, TexCoordPrecisionNA));
2547 if (!tile_checkerboard_program_->initialized()) {
2548 TRACE_EVENT0("cc", "GLRenderer::checkerboardProgram::initalize"); 2540 TRACE_EVENT0("cc", "GLRenderer::checkerboardProgram::initalize");
2549 tile_checkerboard_program_->Initialize(context_, is_using_bind_uniform_); 2541 tile_checkerboard_program_.Initialize(
2550 } 2542 output_surface_->context_provider(), TexCoordPrecisionNA);
2551 return tile_checkerboard_program_.get(); 2543 }
2544 return &tile_checkerboard_program_;
2552 } 2545 }
2553 2546
2554 const GLRenderer::DebugBorderProgram* GLRenderer::GetDebugBorderProgram() { 2547 const GLRenderer::DebugBorderProgram* GLRenderer::GetDebugBorderProgram() {
2555 if (!debug_border_program_) 2548 if (!debug_border_program_.initialized()) {
2556 debug_border_program_ = make_scoped_ptr(
2557 new DebugBorderProgram(context_, TexCoordPrecisionNA));
2558 if (!debug_border_program_->initialized()) {
2559 TRACE_EVENT0("cc", "GLRenderer::debugBorderProgram::initialize"); 2549 TRACE_EVENT0("cc", "GLRenderer::debugBorderProgram::initialize");
2560 debug_border_program_->Initialize(context_, is_using_bind_uniform_); 2550 debug_border_program_.Initialize(
2561 } 2551 output_surface_->context_provider(), TexCoordPrecisionNA);
2562 return debug_border_program_.get(); 2552 }
2553 return &debug_border_program_;
2563 } 2554 }
2564 2555
2565 const GLRenderer::SolidColorProgram* GLRenderer::GetSolidColorProgram() { 2556 const GLRenderer::SolidColorProgram* GLRenderer::GetSolidColorProgram() {
2566 if (!solid_color_program_) 2557 if (!solid_color_program_.initialized()) {
2567 solid_color_program_ = make_scoped_ptr(
2568 new SolidColorProgram(context_, TexCoordPrecisionNA));
2569 if (!solid_color_program_->initialized()) {
2570 TRACE_EVENT0("cc", "GLRenderer::solidColorProgram::initialize"); 2558 TRACE_EVENT0("cc", "GLRenderer::solidColorProgram::initialize");
2571 solid_color_program_->Initialize(context_, is_using_bind_uniform_); 2559 solid_color_program_.Initialize(
2572 } 2560 output_surface_->context_provider(), TexCoordPrecisionNA);
2573 return solid_color_program_.get(); 2561 }
2562 return &solid_color_program_;
2574 } 2563 }
2575 2564
2576 const GLRenderer::SolidColorProgramAA* GLRenderer::GetSolidColorProgramAA() { 2565 const GLRenderer::SolidColorProgramAA* GLRenderer::GetSolidColorProgramAA() {
2577 if (!solid_color_program_aa_) { 2566 if (!solid_color_program_aa_.initialized()) {
2578 solid_color_program_aa_ =
2579 make_scoped_ptr(new SolidColorProgramAA(context_, TexCoordPrecisionNA));
2580 }
2581 if (!solid_color_program_aa_->initialized()) {
2582 TRACE_EVENT0("cc", "GLRenderer::solidColorProgramAA::initialize"); 2567 TRACE_EVENT0("cc", "GLRenderer::solidColorProgramAA::initialize");
2583 solid_color_program_aa_->Initialize(context_, is_using_bind_uniform_); 2568 solid_color_program_aa_.Initialize(
2584 } 2569 output_surface_->context_provider(), TexCoordPrecisionNA);
2585 return solid_color_program_aa_.get(); 2570 }
2571 return &solid_color_program_aa_;
2586 } 2572 }
2587 2573
2588 const GLRenderer::RenderPassProgram* GLRenderer::GetRenderPassProgram( 2574 const GLRenderer::RenderPassProgram* GLRenderer::GetRenderPassProgram(
2589 TexCoordPrecision precision) { 2575 TexCoordPrecision precision) {
2590 scoped_ptr<RenderPassProgram>& program = 2576 RenderPassProgram* program =
2591 (precision == TexCoordPrecisionHigh) ? render_pass_program_highp_ 2577 (precision == TexCoordPrecisionHigh) ? &render_pass_program_highp_
2592 : render_pass_program_; 2578 : &render_pass_program_;
2593 DCHECK(program);
2594 if (!program->initialized()) { 2579 if (!program->initialized()) {
2595 TRACE_EVENT0("cc", "GLRenderer::renderPassProgram::initialize"); 2580 TRACE_EVENT0("cc", "GLRenderer::renderPassProgram::initialize");
2596 program->Initialize(context_, is_using_bind_uniform_); 2581 program->Initialize(output_surface_->context_provider(), precision);
2597 } 2582 }
2598 return program.get(); 2583 return program;
2599 } 2584 }
2600 2585
2601 const GLRenderer::RenderPassProgramAA* GLRenderer::GetRenderPassProgramAA( 2586 const GLRenderer::RenderPassProgramAA* GLRenderer::GetRenderPassProgramAA(
2602 TexCoordPrecision precision) { 2587 TexCoordPrecision precision) {
2603 scoped_ptr<RenderPassProgramAA>& program = 2588 RenderPassProgramAA* program =
2604 (precision == TexCoordPrecisionHigh) ? render_pass_program_aa_highp_ 2589 (precision == TexCoordPrecisionHigh) ? &render_pass_program_aa_highp_
2605 : render_pass_program_aa_; 2590 : &render_pass_program_aa_;
2606 if (!program)
2607 program =
2608 make_scoped_ptr(new RenderPassProgramAA(context_, precision));
2609 if (!program->initialized()) { 2591 if (!program->initialized()) {
2610 TRACE_EVENT0("cc", "GLRenderer::renderPassProgramAA::initialize"); 2592 TRACE_EVENT0("cc", "GLRenderer::renderPassProgramAA::initialize");
2611 program->Initialize(context_, is_using_bind_uniform_); 2593 program->Initialize(output_surface_->context_provider(), precision);
2612 } 2594 }
2613 return program.get(); 2595 return program;
2614 } 2596 }
2615 2597
2616 const GLRenderer::RenderPassMaskProgram* 2598 const GLRenderer::RenderPassMaskProgram*
2617 GLRenderer::GetRenderPassMaskProgram(TexCoordPrecision precision) { 2599 GLRenderer::GetRenderPassMaskProgram(TexCoordPrecision precision) {
2618 scoped_ptr<RenderPassMaskProgram>& program = 2600 RenderPassMaskProgram* program =
2619 (precision == TexCoordPrecisionHigh) ? render_pass_mask_program_highp_ 2601 (precision == TexCoordPrecisionHigh) ? &render_pass_mask_program_highp_
2620 : render_pass_mask_program_; 2602 : &render_pass_mask_program_;
2621 if (!program)
2622 program = make_scoped_ptr(new RenderPassMaskProgram(context_, precision));
2623 if (!program->initialized()) { 2603 if (!program->initialized()) {
2624 TRACE_EVENT0("cc", "GLRenderer::renderPassMaskProgram::initialize"); 2604 TRACE_EVENT0("cc", "GLRenderer::renderPassMaskProgram::initialize");
2625 program->Initialize(context_, is_using_bind_uniform_); 2605 program->Initialize(output_surface_->context_provider(), precision);
2626 } 2606 }
2627 return program.get(); 2607 return program;
2628 } 2608 }
2629 2609
2630 const GLRenderer::RenderPassMaskProgramAA* 2610 const GLRenderer::RenderPassMaskProgramAA*
2631 GLRenderer::GetRenderPassMaskProgramAA(TexCoordPrecision precision) { 2611 GLRenderer::GetRenderPassMaskProgramAA(TexCoordPrecision precision) {
2632 scoped_ptr<RenderPassMaskProgramAA>& program = 2612 RenderPassMaskProgramAA* program =
2633 (precision == TexCoordPrecisionHigh) ? render_pass_mask_program_aa_highp_ 2613 (precision == TexCoordPrecisionHigh) ? &render_pass_mask_program_aa_highp_
2634 : render_pass_mask_program_aa_; 2614 : &render_pass_mask_program_aa_;
2635 if (!program)
2636 program =
2637 make_scoped_ptr(new RenderPassMaskProgramAA(context_, precision));
2638 if (!program->initialized()) { 2615 if (!program->initialized()) {
2639 TRACE_EVENT0("cc", "GLRenderer::renderPassMaskProgramAA::initialize"); 2616 TRACE_EVENT0("cc", "GLRenderer::renderPassMaskProgramAA::initialize");
2640 program->Initialize(context_, is_using_bind_uniform_); 2617 program->Initialize(output_surface_->context_provider(), precision);
2641 } 2618 }
2642 return program.get(); 2619 return program;
2643 } 2620 }
2644 2621
2645 const GLRenderer::RenderPassColorMatrixProgram* 2622 const GLRenderer::RenderPassColorMatrixProgram*
2646 GLRenderer::GetRenderPassColorMatrixProgram(TexCoordPrecision precision) { 2623 GLRenderer::GetRenderPassColorMatrixProgram(TexCoordPrecision precision) {
2647 scoped_ptr<RenderPassColorMatrixProgram>& program = 2624 RenderPassColorMatrixProgram* program =
2648 (precision == TexCoordPrecisionHigh) ? 2625 (precision == TexCoordPrecisionHigh) ?
2649 render_pass_color_matrix_program_highp_ : 2626 &render_pass_color_matrix_program_highp_ :
2650 render_pass_color_matrix_program_; 2627 &render_pass_color_matrix_program_;
2651 if (!program)
2652 program = make_scoped_ptr(
2653 new RenderPassColorMatrixProgram(context_, precision));
2654 if (!program->initialized()) { 2628 if (!program->initialized()) {
2655 TRACE_EVENT0("cc", "GLRenderer::renderPassColorMatrixProgram::initialize"); 2629 TRACE_EVENT0("cc", "GLRenderer::renderPassColorMatrixProgram::initialize");
2656 program->Initialize(context_, is_using_bind_uniform_); 2630 program->Initialize(output_surface_->context_provider(), precision);
2657 } 2631 }
2658 return program.get(); 2632 return program;
2659 } 2633 }
2660 2634
2661 const GLRenderer::RenderPassColorMatrixProgramAA* 2635 const GLRenderer::RenderPassColorMatrixProgramAA*
2662 GLRenderer::GetRenderPassColorMatrixProgramAA(TexCoordPrecision precision) { 2636 GLRenderer::GetRenderPassColorMatrixProgramAA(TexCoordPrecision precision) {
2663 scoped_ptr<RenderPassColorMatrixProgramAA>& program = 2637 RenderPassColorMatrixProgramAA* program =
2664 (precision == TexCoordPrecisionHigh) ? 2638 (precision == TexCoordPrecisionHigh) ?
2665 render_pass_color_matrix_program_aa_highp_ : 2639 &render_pass_color_matrix_program_aa_highp_ :
2666 render_pass_color_matrix_program_aa_; 2640 &render_pass_color_matrix_program_aa_;
2667 if (!program)
2668 program = make_scoped_ptr(
2669 new RenderPassColorMatrixProgramAA(context_, precision));
2670 if (!program->initialized()) { 2641 if (!program->initialized()) {
2671 TRACE_EVENT0("cc", 2642 TRACE_EVENT0("cc",
2672 "GLRenderer::renderPassColorMatrixProgramAA::initialize"); 2643 "GLRenderer::renderPassColorMatrixProgramAA::initialize");
2673 program->Initialize(context_, is_using_bind_uniform_); 2644 program->Initialize(output_surface_->context_provider(), precision);
2674 } 2645 }
2675 return program.get(); 2646 return program;
2676 } 2647 }
2677 2648
2678 const GLRenderer::RenderPassMaskColorMatrixProgram* 2649 const GLRenderer::RenderPassMaskColorMatrixProgram*
2679 GLRenderer::GetRenderPassMaskColorMatrixProgram(TexCoordPrecision precision) { 2650 GLRenderer::GetRenderPassMaskColorMatrixProgram(TexCoordPrecision precision) {
2680 scoped_ptr<RenderPassMaskColorMatrixProgram>& program = 2651 RenderPassMaskColorMatrixProgram* program =
2681 (precision == TexCoordPrecisionHigh) ? 2652 (precision == TexCoordPrecisionHigh) ?
2682 render_pass_mask_color_matrix_program_highp_ : 2653 &render_pass_mask_color_matrix_program_highp_ :
2683 render_pass_mask_color_matrix_program_; 2654 &render_pass_mask_color_matrix_program_;
2684 if (!program)
2685 program = make_scoped_ptr(
2686 new RenderPassMaskColorMatrixProgram(context_, precision));
2687 if (!program->initialized()) { 2655 if (!program->initialized()) {
2688 TRACE_EVENT0("cc", 2656 TRACE_EVENT0("cc",
2689 "GLRenderer::renderPassMaskColorMatrixProgram::initialize"); 2657 "GLRenderer::renderPassMaskColorMatrixProgram::initialize");
2690 program->Initialize(context_, is_using_bind_uniform_); 2658 program->Initialize(output_surface_->context_provider(), precision);
2691 } 2659 }
2692 return program.get(); 2660 return program;
2693 } 2661 }
2694 2662
2695 const GLRenderer::RenderPassMaskColorMatrixProgramAA* 2663 const GLRenderer::RenderPassMaskColorMatrixProgramAA*
2696 GLRenderer::GetRenderPassMaskColorMatrixProgramAA(TexCoordPrecision precision) { 2664 GLRenderer::GetRenderPassMaskColorMatrixProgramAA(TexCoordPrecision precision) {
2697 scoped_ptr<RenderPassMaskColorMatrixProgramAA>& program = 2665 RenderPassMaskColorMatrixProgramAA* program =
2698 (precision == TexCoordPrecisionHigh) ? 2666 (precision == TexCoordPrecisionHigh) ?
2699 render_pass_mask_color_matrix_program_aa_highp_ : 2667 &render_pass_mask_color_matrix_program_aa_highp_ :
2700 render_pass_mask_color_matrix_program_aa_; 2668 &render_pass_mask_color_matrix_program_aa_;
2701 if (!program)
2702 program = make_scoped_ptr(
2703 new RenderPassMaskColorMatrixProgramAA(context_, precision));
2704 if (!program->initialized()) { 2669 if (!program->initialized()) {
2705 TRACE_EVENT0("cc", 2670 TRACE_EVENT0("cc",
2706 "GLRenderer::renderPassMaskColorMatrixProgramAA::initialize"); 2671 "GLRenderer::renderPassMaskColorMatrixProgramAA::initialize");
2707 program->Initialize(context_, is_using_bind_uniform_); 2672 program->Initialize(output_surface_->context_provider(), precision);
2708 } 2673 }
2709 return program.get(); 2674 return program;
2710 } 2675 }
2711 2676
2712 const GLRenderer::TileProgram* GLRenderer::GetTileProgram( 2677 const GLRenderer::TileProgram* GLRenderer::GetTileProgram(
2713 TexCoordPrecision precision) { 2678 TexCoordPrecision precision) {
2714 scoped_ptr<TileProgram>& program = 2679 TileProgram* program =
2715 (precision == TexCoordPrecisionHigh) ? tile_program_highp_ 2680 (precision == TexCoordPrecisionHigh) ? &tile_program_highp_
2716 : tile_program_; 2681 : &tile_program_;
2682 if (!program->initialized()) {
2683 TRACE_EVENT0("cc", "GLRenderer::tileProgram::initialize");
2684 program->Initialize(output_surface_->context_provider(), precision);
2685 }
2686 return program;
2687 }
2688
2689 const GLRenderer::TileProgramOpaque* GLRenderer::GetTileProgramOpaque(
2690 TexCoordPrecision precision) {
2691 TileProgramOpaque* program =
2692 (precision == TexCoordPrecisionHigh) ? &tile_program_opaque_highp_
2693 : &tile_program_opaque_;
2717 DCHECK(program); 2694 DCHECK(program);
2718 if (!program->initialized()) { 2695 if (!program->initialized()) {
2719 TRACE_EVENT0("cc", "GLRenderer::tileProgram::initialize");
2720 program->Initialize(context_, is_using_bind_uniform_);
2721 }
2722 return program.get();
2723 }
2724
2725 const GLRenderer::TileProgramOpaque* GLRenderer::GetTileProgramOpaque(
2726 TexCoordPrecision precision) {
2727 scoped_ptr<TileProgramOpaque>& program =
2728 (precision == TexCoordPrecisionHigh) ? tile_program_opaque_highp_
2729 : tile_program_opaque_;
2730 DCHECK(program);
2731 if (!program->initialized()) {
2732 TRACE_EVENT0("cc", "GLRenderer::tileProgramOpaque::initialize"); 2696 TRACE_EVENT0("cc", "GLRenderer::tileProgramOpaque::initialize");
2733 program->Initialize(context_, is_using_bind_uniform_); 2697 program->Initialize(output_surface_->context_provider(), precision);
2734 } 2698 }
2735 return program.get(); 2699 return program;
2736 } 2700 }
2737 2701
2738 const GLRenderer::TileProgramAA* GLRenderer::GetTileProgramAA( 2702 const GLRenderer::TileProgramAA* GLRenderer::GetTileProgramAA(
2739 TexCoordPrecision precision) { 2703 TexCoordPrecision precision) {
2740 scoped_ptr<TileProgramAA>& program = 2704 TileProgramAA* program =
2741 (precision == TexCoordPrecisionHigh) ? tile_program_aa_highp_ 2705 (precision == TexCoordPrecisionHigh) ? &tile_program_aa_highp_
2742 : tile_program_aa_; 2706 : &tile_program_aa_;
2743 if (!program)
2744 program = make_scoped_ptr(new TileProgramAA(context_, precision));
2745 if (!program->initialized()) { 2707 if (!program->initialized()) {
2746 TRACE_EVENT0("cc", "GLRenderer::tileProgramAA::initialize"); 2708 TRACE_EVENT0("cc", "GLRenderer::tileProgramAA::initialize");
2747 program->Initialize(context_, is_using_bind_uniform_); 2709 program->Initialize(output_surface_->context_provider(), precision);
2748 } 2710 }
2749 return program.get(); 2711 return program;
2750 } 2712 }
2751 2713
2752 const GLRenderer::TileProgramSwizzle* GLRenderer::GetTileProgramSwizzle( 2714 const GLRenderer::TileProgramSwizzle* GLRenderer::GetTileProgramSwizzle(
2753 TexCoordPrecision precision) { 2715 TexCoordPrecision precision) {
2754 scoped_ptr<TileProgramSwizzle>& program = 2716 TileProgramSwizzle* program =
2755 (precision == TexCoordPrecisionHigh) ? tile_program_swizzle_highp_ 2717 (precision == TexCoordPrecisionHigh) ? &tile_program_swizzle_highp_
2756 : tile_program_swizzle_; 2718 : &tile_program_swizzle_;
2757 if (!program)
2758 program = make_scoped_ptr(new TileProgramSwizzle(context_, precision));
2759 if (!program->initialized()) { 2719 if (!program->initialized()) {
2760 TRACE_EVENT0("cc", "GLRenderer::tileProgramSwizzle::initialize"); 2720 TRACE_EVENT0("cc", "GLRenderer::tileProgramSwizzle::initialize");
2761 program->Initialize(context_, is_using_bind_uniform_); 2721 program->Initialize(output_surface_->context_provider(), precision);
2762 } 2722 }
2763 return program.get(); 2723 return program;
2764 } 2724 }
2765 2725
2766 const GLRenderer::TileProgramSwizzleOpaque* 2726 const GLRenderer::TileProgramSwizzleOpaque*
2767 GLRenderer::GetTileProgramSwizzleOpaque(TexCoordPrecision precision) { 2727 GLRenderer::GetTileProgramSwizzleOpaque(TexCoordPrecision precision) {
2768 scoped_ptr<TileProgramSwizzleOpaque>& program = 2728 TileProgramSwizzleOpaque* program =
2769 (precision == TexCoordPrecisionHigh) ? tile_program_swizzle_opaque_highp_ 2729 (precision == TexCoordPrecisionHigh) ? &tile_program_swizzle_opaque_highp_
2770 : tile_program_swizzle_opaque_; 2730 : &tile_program_swizzle_opaque_;
2771 if (!program)
2772 program = make_scoped_ptr(
2773 new TileProgramSwizzleOpaque(context_, precision));
2774 if (!program->initialized()) { 2731 if (!program->initialized()) {
2775 TRACE_EVENT0("cc", "GLRenderer::tileProgramSwizzleOpaque::initialize"); 2732 TRACE_EVENT0("cc", "GLRenderer::tileProgramSwizzleOpaque::initialize");
2776 program->Initialize(context_, is_using_bind_uniform_); 2733 program->Initialize(output_surface_->context_provider(), precision);
2777 } 2734 }
2778 return program.get(); 2735 return program;
2779 } 2736 }
2780 2737
2781 const GLRenderer::TileProgramSwizzleAA* GLRenderer::GetTileProgramSwizzleAA( 2738 const GLRenderer::TileProgramSwizzleAA* GLRenderer::GetTileProgramSwizzleAA(
2782 TexCoordPrecision precision) { 2739 TexCoordPrecision precision) {
2783 scoped_ptr<TileProgramSwizzleAA>& program = 2740 TileProgramSwizzleAA* program =
2784 (precision == TexCoordPrecisionHigh) ? tile_program_swizzle_aa_highp_ 2741 (precision == TexCoordPrecisionHigh) ? &tile_program_swizzle_aa_highp_
2785 : tile_program_swizzle_aa_; 2742 : &tile_program_swizzle_aa_;
2786 if (!program)
2787 program = make_scoped_ptr(new TileProgramSwizzleAA(context_, precision));
2788 if (!program->initialized()) { 2743 if (!program->initialized()) {
2789 TRACE_EVENT0("cc", "GLRenderer::tileProgramSwizzleAA::initialize"); 2744 TRACE_EVENT0("cc", "GLRenderer::tileProgramSwizzleAA::initialize");
2790 program->Initialize(context_, is_using_bind_uniform_); 2745 program->Initialize(output_surface_->context_provider(), precision);
2791 } 2746 }
2792 return program.get(); 2747 return program;
2793 } 2748 }
2794 2749
2795 const GLRenderer::TextureProgram* GLRenderer::GetTextureProgram( 2750 const GLRenderer::TextureProgram* GLRenderer::GetTextureProgram(
2796 TexCoordPrecision precision) { 2751 TexCoordPrecision precision) {
2797 scoped_ptr<TextureProgram>& program = 2752 TextureProgram* program =
2798 (precision == TexCoordPrecisionHigh) ? texture_program_highp_ 2753 (precision == TexCoordPrecisionHigh) ? &texture_program_highp_
2799 : texture_program_; 2754 : &texture_program_;
2800 if (!program)
2801 program = make_scoped_ptr(new TextureProgram(context_, precision));
2802 if (!program->initialized()) { 2755 if (!program->initialized()) {
2803 TRACE_EVENT0("cc", "GLRenderer::textureProgram::initialize"); 2756 TRACE_EVENT0("cc", "GLRenderer::textureProgram::initialize");
2804 program->Initialize(context_, is_using_bind_uniform_); 2757 program->Initialize(output_surface_->context_provider(), precision);
2805 } 2758 }
2806 return program.get(); 2759 return program;
2807 } 2760 }
2808 2761
2809 const GLRenderer::NonPremultipliedTextureProgram* 2762 const GLRenderer::NonPremultipliedTextureProgram*
2810 GLRenderer::GetNonPremultipliedTextureProgram(TexCoordPrecision precision) { 2763 GLRenderer::GetNonPremultipliedTextureProgram(TexCoordPrecision precision) {
2811 scoped_ptr<NonPremultipliedTextureProgram>& program = 2764 NonPremultipliedTextureProgram* program =
2812 (precision == TexCoordPrecisionHigh) ? 2765 (precision == TexCoordPrecisionHigh) ?
2813 nonpremultiplied_texture_program_highp_ : 2766 &nonpremultiplied_texture_program_highp_ :
2814 nonpremultiplied_texture_program_; 2767 &nonpremultiplied_texture_program_;
2815 if (!program) {
2816 program = make_scoped_ptr(
2817 new NonPremultipliedTextureProgram(context_, precision));
2818 }
2819 if (!program->initialized()) { 2768 if (!program->initialized()) {
2820 TRACE_EVENT0("cc", 2769 TRACE_EVENT0("cc",
2821 "GLRenderer::NonPremultipliedTextureProgram::Initialize"); 2770 "GLRenderer::NonPremultipliedTextureProgram::Initialize");
2822 program->Initialize(context_, is_using_bind_uniform_); 2771 program->Initialize(output_surface_->context_provider(), precision);
2823 } 2772 }
2824 return program.get(); 2773 return program;
2825 } 2774 }
2826 2775
2827 const GLRenderer::TextureBackgroundProgram* 2776 const GLRenderer::TextureBackgroundProgram*
2828 GLRenderer::GetTextureBackgroundProgram(TexCoordPrecision precision) { 2777 GLRenderer::GetTextureBackgroundProgram(TexCoordPrecision precision) {
2829 scoped_ptr<TextureBackgroundProgram>& program = 2778 TextureBackgroundProgram* program =
2830 (precision == TexCoordPrecisionHigh) ? texture_background_program_highp_ 2779 (precision == TexCoordPrecisionHigh) ? &texture_background_program_highp_
2831 : texture_background_program_; 2780 : &texture_background_program_;
2832 if (!program) {
2833 program = make_scoped_ptr(
2834 new TextureBackgroundProgram(context_, precision));
2835 }
2836 if (!program->initialized()) { 2781 if (!program->initialized()) {
2837 TRACE_EVENT0("cc", "GLRenderer::textureProgram::initialize"); 2782 TRACE_EVENT0("cc", "GLRenderer::textureProgram::initialize");
2838 program->Initialize(context_, is_using_bind_uniform_); 2783 program->Initialize(output_surface_->context_provider(), precision);
2839 } 2784 }
2840 return program.get(); 2785 return program;
2841 } 2786 }
2842 2787
2843 const GLRenderer::NonPremultipliedTextureBackgroundProgram* 2788 const GLRenderer::NonPremultipliedTextureBackgroundProgram*
2844 GLRenderer::GetNonPremultipliedTextureBackgroundProgram( 2789 GLRenderer::GetNonPremultipliedTextureBackgroundProgram(
2845 TexCoordPrecision precision) { 2790 TexCoordPrecision precision) {
2846 scoped_ptr<NonPremultipliedTextureBackgroundProgram>& program = 2791 NonPremultipliedTextureBackgroundProgram* program =
2847 (precision == TexCoordPrecisionHigh) ? 2792 (precision == TexCoordPrecisionHigh) ?
2848 nonpremultiplied_texture_background_program_highp_ : 2793 &nonpremultiplied_texture_background_program_highp_ :
2849 nonpremultiplied_texture_background_program_; 2794 &nonpremultiplied_texture_background_program_;
2850 if (!program) {
2851 program = make_scoped_ptr(
2852 new NonPremultipliedTextureBackgroundProgram(context_, precision));
2853 }
2854 if (!program->initialized()) { 2795 if (!program->initialized()) {
2855 TRACE_EVENT0("cc", 2796 TRACE_EVENT0("cc",
2856 "GLRenderer::NonPremultipliedTextureProgram::Initialize"); 2797 "GLRenderer::NonPremultipliedTextureProgram::Initialize");
2857 program->Initialize(context_, is_using_bind_uniform_); 2798 program->Initialize(output_surface_->context_provider(), precision);
2858 } 2799 }
2859 return program.get(); 2800 return program;
2860 } 2801 }
2861 2802
2862 const GLRenderer::TextureIOSurfaceProgram* 2803 const GLRenderer::TextureIOSurfaceProgram*
2863 GLRenderer::GetTextureIOSurfaceProgram(TexCoordPrecision precision) { 2804 GLRenderer::GetTextureIOSurfaceProgram(TexCoordPrecision precision) {
2864 scoped_ptr<TextureIOSurfaceProgram>& program = 2805 TextureIOSurfaceProgram* program =
2865 (precision == TexCoordPrecisionHigh) ? texture_io_surface_program_highp_ 2806 (precision == TexCoordPrecisionHigh) ? &texture_io_surface_program_highp_
2866 : texture_io_surface_program_; 2807 : &texture_io_surface_program_;
2867 if (!program)
2868 program =
2869 make_scoped_ptr(new TextureIOSurfaceProgram(context_, precision));
2870 if (!program->initialized()) { 2808 if (!program->initialized()) {
2871 TRACE_EVENT0("cc", "GLRenderer::textureIOSurfaceProgram::initialize"); 2809 TRACE_EVENT0("cc", "GLRenderer::textureIOSurfaceProgram::initialize");
2872 program->Initialize(context_, is_using_bind_uniform_); 2810 program->Initialize(output_surface_->context_provider(), precision);
2873 } 2811 }
2874 return program.get(); 2812 return program;
2875 } 2813 }
2876 2814
2877 const GLRenderer::VideoYUVProgram* GLRenderer::GetVideoYUVProgram( 2815 const GLRenderer::VideoYUVProgram* GLRenderer::GetVideoYUVProgram(
2878 TexCoordPrecision precision) { 2816 TexCoordPrecision precision) {
2879 scoped_ptr<VideoYUVProgram>& program = 2817 VideoYUVProgram* program =
2880 (precision == TexCoordPrecisionHigh) ? video_yuv_program_highp_ 2818 (precision == TexCoordPrecisionHigh) ? &video_yuv_program_highp_
2881 : video_yuv_program_; 2819 : &video_yuv_program_;
2882 if (!program)
2883 program = make_scoped_ptr(new VideoYUVProgram(context_, precision));
2884 if (!program->initialized()) { 2820 if (!program->initialized()) {
2885 TRACE_EVENT0("cc", "GLRenderer::videoYUVProgram::initialize"); 2821 TRACE_EVENT0("cc", "GLRenderer::videoYUVProgram::initialize");
2886 program->Initialize(context_, is_using_bind_uniform_); 2822 program->Initialize(output_surface_->context_provider(), precision);
2887 } 2823 }
2888 return program.get(); 2824 return program;
2889 } 2825 }
2890 2826
2891 const GLRenderer::VideoYUVAProgram* GLRenderer::GetVideoYUVAProgram( 2827 const GLRenderer::VideoYUVAProgram* GLRenderer::GetVideoYUVAProgram(
2892 TexCoordPrecision precision) { 2828 TexCoordPrecision precision) {
2893 scoped_ptr<VideoYUVAProgram>& program = 2829 VideoYUVAProgram* program =
2894 (precision == TexCoordPrecisionHigh) ? video_yuva_program_highp_ 2830 (precision == TexCoordPrecisionHigh) ? &video_yuva_program_highp_
2895 : video_yuva_program_; 2831 : &video_yuva_program_;
2896 if (!program)
2897 program = make_scoped_ptr(new VideoYUVAProgram(context_, precision));
2898 if (!program->initialized()) { 2832 if (!program->initialized()) {
2899 TRACE_EVENT0("cc", "GLRenderer::videoYUVAProgram::initialize"); 2833 TRACE_EVENT0("cc", "GLRenderer::videoYUVAProgram::initialize");
2900 program->Initialize(context_, is_using_bind_uniform_); 2834 program->Initialize(output_surface_->context_provider(), precision);
2901 } 2835 }
2902 return program.get(); 2836 return program;
2903 } 2837 }
2904 2838
2905 const GLRenderer::VideoStreamTextureProgram* 2839 const GLRenderer::VideoStreamTextureProgram*
2906 GLRenderer::GetVideoStreamTextureProgram(TexCoordPrecision precision) { 2840 GLRenderer::GetVideoStreamTextureProgram(TexCoordPrecision precision) {
2907 if (!Capabilities().using_egl_image) 2841 if (!Capabilities().using_egl_image)
2908 return NULL; 2842 return NULL;
2909 scoped_ptr<VideoStreamTextureProgram>& program = 2843 VideoStreamTextureProgram* program = (precision == TexCoordPrecisionHigh)
2910 (precision == TexCoordPrecisionHigh) ? video_stream_texture_program_highp_ 2844 ? &video_stream_texture_program_highp_
2911 : video_stream_texture_program_; 2845 : &video_stream_texture_program_;
2912 if (!program)
2913 program =
2914 make_scoped_ptr(new VideoStreamTextureProgram(context_, precision));
2915 if (!program->initialized()) { 2846 if (!program->initialized()) {
2916 TRACE_EVENT0("cc", "GLRenderer::streamTextureProgram::initialize"); 2847 TRACE_EVENT0("cc", "GLRenderer::streamTextureProgram::initialize");
2917 program->Initialize(context_, is_using_bind_uniform_); 2848 program->Initialize(output_surface_->context_provider(), precision);
2918 } 2849 }
2919 return program.get(); 2850 return program;
2920 } 2851 }
2921 2852
2922 void GLRenderer::CleanupSharedObjects() { 2853 void GLRenderer::CleanupSharedObjects() {
2923 MakeContextCurrent(); 2854 MakeContextCurrent();
2924 2855
2925 shared_geometry_.reset(); 2856 shared_geometry_.reset();
2926 2857
2927 if (tile_program_) 2858 tile_program_.Cleanup(context_);
2928 tile_program_->Cleanup(context_); 2859 tile_program_opaque_.Cleanup(context_);
2929 if (tile_program_opaque_) 2860 tile_program_swizzle_.Cleanup(context_);
2930 tile_program_opaque_->Cleanup(context_); 2861 tile_program_swizzle_opaque_.Cleanup(context_);
2931 if (tile_program_swizzle_) 2862 tile_program_aa_.Cleanup(context_);
2932 tile_program_swizzle_->Cleanup(context_); 2863 tile_program_swizzle_aa_.Cleanup(context_);
2933 if (tile_program_swizzle_opaque_) 2864 tile_checkerboard_program_.Cleanup(context_);
2934 tile_program_swizzle_opaque_->Cleanup(context_);
2935 if (tile_program_aa_)
2936 tile_program_aa_->Cleanup(context_);
2937 if (tile_program_swizzle_aa_)
2938 tile_program_swizzle_aa_->Cleanup(context_);
2939 if (tile_checkerboard_program_)
2940 tile_checkerboard_program_->Cleanup(context_);
2941 2865
2942 if (tile_program_highp_) 2866 tile_program_highp_.Cleanup(context_);
2943 tile_program_highp_->Cleanup(context_); 2867 tile_program_opaque_highp_.Cleanup(context_);
2944 if (tile_program_opaque_highp_) 2868 tile_program_swizzle_highp_.Cleanup(context_);
2945 tile_program_opaque_highp_->Cleanup(context_); 2869 tile_program_swizzle_opaque_highp_.Cleanup(context_);
2946 if (tile_program_swizzle_highp_) 2870 tile_program_aa_highp_.Cleanup(context_);
2947 tile_program_swizzle_highp_->Cleanup(context_); 2871 tile_program_swizzle_aa_highp_.Cleanup(context_);
2948 if (tile_program_swizzle_opaque_highp_)
2949 tile_program_swizzle_opaque_highp_->Cleanup(context_);
2950 if (tile_program_aa_highp_)
2951 tile_program_aa_highp_->Cleanup(context_);
2952 if (tile_program_swizzle_aa_highp_)
2953 tile_program_swizzle_aa_highp_->Cleanup(context_);
2954 2872
2955 if (render_pass_mask_program_) 2873 render_pass_mask_program_.Cleanup(context_);
2956 render_pass_mask_program_->Cleanup(context_); 2874 render_pass_program_.Cleanup(context_);
2957 if (render_pass_program_) 2875 render_pass_mask_program_aa_.Cleanup(context_);
2958 render_pass_program_->Cleanup(context_); 2876 render_pass_program_aa_.Cleanup(context_);
2959 if (render_pass_mask_program_aa_) 2877 render_pass_color_matrix_program_.Cleanup(context_);
2960 render_pass_mask_program_aa_->Cleanup(context_); 2878 render_pass_mask_color_matrix_program_aa_.Cleanup(context_);
2961 if (render_pass_program_aa_) 2879 render_pass_color_matrix_program_aa_.Cleanup(context_);
2962 render_pass_program_aa_->Cleanup(context_); 2880 render_pass_mask_color_matrix_program_.Cleanup(context_);
2963 if (render_pass_color_matrix_program_)
2964 render_pass_color_matrix_program_->Cleanup(context_);
2965 if (render_pass_mask_color_matrix_program_aa_)
2966 render_pass_mask_color_matrix_program_aa_->Cleanup(context_);
2967 if (render_pass_color_matrix_program_aa_)
2968 render_pass_color_matrix_program_aa_->Cleanup(context_);
2969 if (render_pass_mask_color_matrix_program_)
2970 render_pass_mask_color_matrix_program_->Cleanup(context_);
2971 2881
2972 if (render_pass_mask_program_highp_) 2882 render_pass_mask_program_highp_.Cleanup(context_);
2973 render_pass_mask_program_highp_->Cleanup(context_); 2883 render_pass_program_highp_.Cleanup(context_);
2974 if (render_pass_program_highp_) 2884 render_pass_mask_program_aa_highp_.Cleanup(context_);
2975 render_pass_program_highp_->Cleanup(context_); 2885 render_pass_program_aa_highp_.Cleanup(context_);
2976 if (render_pass_mask_program_aa_highp_) 2886 render_pass_color_matrix_program_highp_.Cleanup(context_);
2977 render_pass_mask_program_aa_highp_->Cleanup(context_); 2887 render_pass_mask_color_matrix_program_aa_highp_.Cleanup(context_);
2978 if (render_pass_program_aa_highp_) 2888 render_pass_color_matrix_program_aa_highp_.Cleanup(context_);
2979 render_pass_program_aa_highp_->Cleanup(context_); 2889 render_pass_mask_color_matrix_program_highp_.Cleanup(context_);
2980 if (render_pass_color_matrix_program_highp_)
2981 render_pass_color_matrix_program_highp_->Cleanup(context_);
2982 if (render_pass_mask_color_matrix_program_aa_highp_)
2983 render_pass_mask_color_matrix_program_aa_highp_->Cleanup(context_);
2984 if (render_pass_color_matrix_program_aa_highp_)
2985 render_pass_color_matrix_program_aa_highp_->Cleanup(context_);
2986 if (render_pass_mask_color_matrix_program_highp_)
2987 render_pass_mask_color_matrix_program_highp_->Cleanup(context_);
2988 2890
2989 if (texture_program_) 2891 texture_program_.Cleanup(context_);
2990 texture_program_->Cleanup(context_); 2892 nonpremultiplied_texture_program_.Cleanup(context_);
2991 if (nonpremultiplied_texture_program_) 2893 texture_background_program_.Cleanup(context_);
2992 nonpremultiplied_texture_program_->Cleanup(context_); 2894 nonpremultiplied_texture_background_program_.Cleanup(context_);
2993 if (texture_background_program_) 2895 texture_io_surface_program_.Cleanup(context_);
2994 texture_background_program_->Cleanup(context_);
2995 if (nonpremultiplied_texture_background_program_)
2996 nonpremultiplied_texture_background_program_->Cleanup(context_);
2997 if (texture_io_surface_program_)
2998 texture_io_surface_program_->Cleanup(context_);
2999 2896
3000 if (texture_program_highp_) 2897 texture_program_highp_.Cleanup(context_);
3001 texture_program_highp_->Cleanup(context_); 2898 nonpremultiplied_texture_program_highp_.Cleanup(context_);
3002 if (nonpremultiplied_texture_program_highp_) 2899 texture_background_program_highp_.Cleanup(context_);
3003 nonpremultiplied_texture_program_highp_->Cleanup(context_); 2900 nonpremultiplied_texture_background_program_highp_.Cleanup(context_);
3004 if (texture_background_program_highp_) 2901 texture_io_surface_program_highp_.Cleanup(context_);
3005 texture_background_program_highp_->Cleanup(context_);
3006 if (nonpremultiplied_texture_background_program_highp_)
3007 nonpremultiplied_texture_background_program_highp_->Cleanup(context_);
3008 if (texture_io_surface_program_highp_)
3009 texture_io_surface_program_highp_->Cleanup(context_);
3010 2902
3011 if (video_yuv_program_) 2903 video_yuv_program_.Cleanup(context_);
3012 video_yuv_program_->Cleanup(context_); 2904 video_yuva_program_.Cleanup(context_);
3013 if (video_yuva_program_) 2905 video_stream_texture_program_.Cleanup(context_);
3014 video_yuva_program_->Cleanup(context_);
3015 if (video_stream_texture_program_)
3016 video_stream_texture_program_->Cleanup(context_);
3017 2906
3018 if (video_yuv_program_highp_) 2907 video_yuv_program_highp_.Cleanup(context_);
3019 video_yuv_program_highp_->Cleanup(context_); 2908 video_yuva_program_highp_.Cleanup(context_);
3020 if (video_yuva_program_highp_) 2909 video_stream_texture_program_highp_.Cleanup(context_);
3021 video_yuva_program_highp_->Cleanup(context_);
3022 if (video_stream_texture_program_highp_)
3023 video_stream_texture_program_highp_->Cleanup(context_);
3024 2910
3025 if (debug_border_program_) 2911 debug_border_program_.Cleanup(context_);
3026 debug_border_program_->Cleanup(context_); 2912 solid_color_program_.Cleanup(context_);
3027 if (solid_color_program_) 2913 solid_color_program_aa_.Cleanup(context_);
3028 solid_color_program_->Cleanup(context_);
3029 if (solid_color_program_aa_)
3030 solid_color_program_aa_->Cleanup(context_);
3031 2914
3032 if (offscreen_framebuffer_id_) 2915 if (offscreen_framebuffer_id_)
3033 GLC(context_, context_->deleteFramebuffer(offscreen_framebuffer_id_)); 2916 GLC(context_, context_->deleteFramebuffer(offscreen_framebuffer_id_));
3034 2917
3035 if (on_demand_tile_raster_resource_id_) 2918 if (on_demand_tile_raster_resource_id_)
3036 resource_provider_->DeleteResource(on_demand_tile_raster_resource_id_); 2919 resource_provider_->DeleteResource(on_demand_tile_raster_resource_id_);
3037 2920
3038 ReleaseRenderPassTextures(); 2921 ReleaseRenderPassTextures();
3039 } 2922 }
3040 2923
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
3078 GLC(context_, context_->disable(GL_SCISSOR_TEST)); 2961 GLC(context_, context_->disable(GL_SCISSOR_TEST));
3079 } 2962 }
3080 2963
3081 bool GLRenderer::CanUseSkiaGPUBackend() const { 2964 bool GLRenderer::CanUseSkiaGPUBackend() const {
3082 // The Skia GPU backend requires a stencil buffer. See ReinitializeGrCanvas 2965 // The Skia GPU backend requires a stencil buffer. See ReinitializeGrCanvas
3083 // implementation. 2966 // implementation.
3084 return gr_context_ && context_->getContextAttributes().stencil; 2967 return gr_context_ && context_->getContextAttributes().stencil;
3085 } 2968 }
3086 2969
3087 bool GLRenderer::IsContextLost() { 2970 bool GLRenderer::IsContextLost() {
3088 return (context_->getGraphicsResetStatusARB() != GL_NO_ERROR); 2971 return output_surface_->context_provider()->IsContextLost();
3089 } 2972 }
3090 2973
3091 } // namespace cc 2974 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698