| 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 20 matching lines...) Expand all Loading... |
| 31 #include "cc/quads/stream_video_draw_quad.h" | 31 #include "cc/quads/stream_video_draw_quad.h" |
| 32 #include "cc/quads/texture_draw_quad.h" | 32 #include "cc/quads/texture_draw_quad.h" |
| 33 #include "cc/resources/layer_quad.h" | 33 #include "cc/resources/layer_quad.h" |
| 34 #include "cc/resources/scoped_resource.h" | 34 #include "cc/resources/scoped_resource.h" |
| 35 #include "cc/resources/texture_mailbox_deleter.h" | 35 #include "cc/resources/texture_mailbox_deleter.h" |
| 36 #include "cc/trees/damage_tracker.h" | 36 #include "cc/trees/damage_tracker.h" |
| 37 #include "cc/trees/proxy.h" | 37 #include "cc/trees/proxy.h" |
| 38 #include "cc/trees/single_thread_proxy.h" | 38 #include "cc/trees/single_thread_proxy.h" |
| 39 #include "gpu/GLES2/gl2extchromium.h" | 39 #include "gpu/GLES2/gl2extchromium.h" |
| 40 #include "gpu/command_buffer/client/context_support.h" | 40 #include "gpu/command_buffer/client/context_support.h" |
| 41 #include "gpu/command_buffer/client/gles2_interface.h" |
| 41 #include "gpu/command_buffer/common/gpu_memory_allocation.h" | 42 #include "gpu/command_buffer/common/gpu_memory_allocation.h" |
| 42 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 43 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
| 43 #include "third_party/khronos/GLES2/gl2.h" | 44 #include "third_party/khronos/GLES2/gl2.h" |
| 44 #include "third_party/khronos/GLES2/gl2ext.h" | 45 #include "third_party/khronos/GLES2/gl2ext.h" |
| 45 #include "third_party/skia/include/core/SkBitmap.h" | 46 #include "third_party/skia/include/core/SkBitmap.h" |
| 46 #include "third_party/skia/include/core/SkColor.h" | 47 #include "third_party/skia/include/core/SkColor.h" |
| 47 #include "third_party/skia/include/core/SkColorFilter.h" | 48 #include "third_party/skia/include/core/SkColorFilter.h" |
| 48 #include "third_party/skia/include/core/SkSurface.h" | 49 #include "third_party/skia/include/core/SkSurface.h" |
| 49 #include "third_party/skia/include/gpu/GrContext.h" | 50 #include "third_party/skia/include/gpu/GrContext.h" |
| 50 #include "third_party/skia/include/gpu/GrTexture.h" | 51 #include "third_party/skia/include/gpu/GrTexture.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 GLRenderer::GLRenderer(RendererClient* client, | 164 GLRenderer::GLRenderer(RendererClient* client, |
| 164 const LayerTreeSettings* settings, | 165 const LayerTreeSettings* settings, |
| 165 OutputSurface* output_surface, | 166 OutputSurface* output_surface, |
| 166 ResourceProvider* resource_provider, | 167 ResourceProvider* resource_provider, |
| 167 TextureMailboxDeleter* texture_mailbox_deleter, | 168 TextureMailboxDeleter* texture_mailbox_deleter, |
| 168 int highp_threshold_min) | 169 int highp_threshold_min) |
| 169 : DirectRenderer(client, settings, output_surface, resource_provider), | 170 : DirectRenderer(client, settings, output_surface, resource_provider), |
| 170 offscreen_framebuffer_id_(0), | 171 offscreen_framebuffer_id_(0), |
| 171 shared_geometry_quad_(gfx::RectF(-0.5f, -0.5f, 1.0f, 1.0f)), | 172 shared_geometry_quad_(gfx::RectF(-0.5f, -0.5f, 1.0f, 1.0f)), |
| 172 context_(output_surface->context_provider()->Context3d()), | 173 context_(output_surface->context_provider()->Context3d()), |
| 174 gl_(output_surface->context_provider()->ContextGL()), |
| 173 context_support_(output_surface->context_provider()->ContextSupport()), | 175 context_support_(output_surface->context_provider()->ContextSupport()), |
| 174 texture_mailbox_deleter_(texture_mailbox_deleter), | 176 texture_mailbox_deleter_(texture_mailbox_deleter), |
| 175 is_backbuffer_discarded_(false), | 177 is_backbuffer_discarded_(false), |
| 176 visible_(true), | 178 visible_(true), |
| 177 is_scissor_enabled_(false), | 179 is_scissor_enabled_(false), |
| 178 scissor_rect_needs_reset_(true), | 180 scissor_rect_needs_reset_(true), |
| 179 stencil_shadow_(false), | 181 stencil_shadow_(false), |
| 180 blend_shadow_(false), | 182 blend_shadow_(false), |
| 181 highp_threshold_min_(highp_threshold_min), | 183 highp_threshold_min_(highp_threshold_min), |
| 182 highp_threshold_cache_(0), | 184 highp_threshold_cache_(0), |
| (...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 952 } else { | 954 } else { |
| 953 contents_resource_lock = make_scoped_ptr( | 955 contents_resource_lock = make_scoped_ptr( |
| 954 new ResourceProvider::ScopedSamplerGL(resource_provider_, | 956 new ResourceProvider::ScopedSamplerGL(resource_provider_, |
| 955 contents_texture->id(), | 957 contents_texture->id(), |
| 956 GL_LINEAR)); | 958 GL_LINEAR)); |
| 957 DCHECK_EQ(static_cast<GLenum>(GL_TEXTURE_2D), | 959 DCHECK_EQ(static_cast<GLenum>(GL_TEXTURE_2D), |
| 958 contents_resource_lock->target()); | 960 contents_resource_lock->target()); |
| 959 } | 961 } |
| 960 | 962 |
| 961 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( | 963 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( |
| 962 context_, &highp_threshold_cache_, highp_threshold_min_, | 964 gl_, &highp_threshold_cache_, highp_threshold_min_, |
| 963 quad->shared_quad_state->visible_content_rect.bottom_right()); | 965 quad->shared_quad_state->visible_content_rect.bottom_right()); |
| 964 | 966 |
| 965 int shader_quad_location = -1; | 967 int shader_quad_location = -1; |
| 966 int shader_edge_location = -1; | 968 int shader_edge_location = -1; |
| 967 int shader_viewport_location = -1; | 969 int shader_viewport_location = -1; |
| 968 int shader_mask_sampler_location = -1; | 970 int shader_mask_sampler_location = -1; |
| 969 int shader_mask_tex_coord_scale_location = -1; | 971 int shader_mask_tex_coord_scale_location = -1; |
| 970 int shader_mask_tex_coord_offset_location = -1; | 972 int shader_mask_tex_coord_offset_location = -1; |
| 971 int shader_matrix_location = -1; | 973 int shader_matrix_location = -1; |
| 972 int shader_alpha_location = -1; | 974 int shader_alpha_location = -1; |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1458 clamp_tex_rect.Inset(tex_clamp_x, tex_clamp_y, tex_clamp_x, tex_clamp_y); | 1460 clamp_tex_rect.Inset(tex_clamp_x, tex_clamp_y, tex_clamp_x, tex_clamp_y); |
| 1459 | 1461 |
| 1460 // Map clamping rectangle to unit square. | 1462 // Map clamping rectangle to unit square. |
| 1461 float vertex_tex_translate_x = -clamp_geom_rect.x() / clamp_geom_rect.width(); | 1463 float vertex_tex_translate_x = -clamp_geom_rect.x() / clamp_geom_rect.width(); |
| 1462 float vertex_tex_translate_y = | 1464 float vertex_tex_translate_y = |
| 1463 -clamp_geom_rect.y() / clamp_geom_rect.height(); | 1465 -clamp_geom_rect.y() / clamp_geom_rect.height(); |
| 1464 float vertex_tex_scale_x = tile_rect.width() / clamp_geom_rect.width(); | 1466 float vertex_tex_scale_x = tile_rect.width() / clamp_geom_rect.width(); |
| 1465 float vertex_tex_scale_y = tile_rect.height() / clamp_geom_rect.height(); | 1467 float vertex_tex_scale_y = tile_rect.height() / clamp_geom_rect.height(); |
| 1466 | 1468 |
| 1467 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( | 1469 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( |
| 1468 context_, &highp_threshold_cache_, highp_threshold_min_, | 1470 gl_, &highp_threshold_cache_, highp_threshold_min_, |
| 1469 quad->texture_size); | 1471 quad->texture_size); |
| 1470 | 1472 |
| 1471 gfx::Transform device_transform = | 1473 gfx::Transform device_transform = |
| 1472 frame->window_matrix * frame->projection_matrix * quad->quadTransform(); | 1474 frame->window_matrix * frame->projection_matrix * quad->quadTransform(); |
| 1473 device_transform.FlattenTo2d(); | 1475 device_transform.FlattenTo2d(); |
| 1474 if (!device_transform.IsInvertible()) | 1476 if (!device_transform.IsInvertible()) |
| 1475 return; | 1477 return; |
| 1476 | 1478 |
| 1477 gfx::QuadF local_quad = gfx::QuadF(gfx::RectF(tile_rect)); | 1479 gfx::QuadF local_quad = gfx::QuadF(gfx::RectF(tile_rect)); |
| 1478 float edge[24]; | 1480 float edge[24]; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1601 tile_rect.size()); | 1603 tile_rect.size()); |
| 1602 DrawQuadGeometry( | 1604 DrawQuadGeometry( |
| 1603 frame, quad->quadTransform(), centered_rect, uniforms.matrix_location); | 1605 frame, quad->quadTransform(), centered_rect, uniforms.matrix_location); |
| 1604 } | 1606 } |
| 1605 | 1607 |
| 1606 void GLRenderer::DrawYUVVideoQuad(const DrawingFrame* frame, | 1608 void GLRenderer::DrawYUVVideoQuad(const DrawingFrame* frame, |
| 1607 const YUVVideoDrawQuad* quad) { | 1609 const YUVVideoDrawQuad* quad) { |
| 1608 SetBlendEnabled(quad->ShouldDrawWithBlending()); | 1610 SetBlendEnabled(quad->ShouldDrawWithBlending()); |
| 1609 | 1611 |
| 1610 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( | 1612 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( |
| 1611 context_, &highp_threshold_cache_, highp_threshold_min_, | 1613 gl_, &highp_threshold_cache_, highp_threshold_min_, |
| 1612 quad->shared_quad_state->visible_content_rect.bottom_right()); | 1614 quad->shared_quad_state->visible_content_rect.bottom_right()); |
| 1613 | 1615 |
| 1614 bool use_alpha_plane = quad->a_plane_resource_id != 0; | 1616 bool use_alpha_plane = quad->a_plane_resource_id != 0; |
| 1615 | 1617 |
| 1616 ResourceProvider::ScopedSamplerGL y_plane_lock( | 1618 ResourceProvider::ScopedSamplerGL y_plane_lock( |
| 1617 resource_provider_, | 1619 resource_provider_, |
| 1618 quad->y_plane_resource_id, | 1620 quad->y_plane_resource_id, |
| 1619 GL_TEXTURE1, | 1621 GL_TEXTURE1, |
| 1620 GL_LINEAR); | 1622 GL_LINEAR); |
| 1621 DCHECK_EQ(static_cast<GLenum>(GL_TEXTURE_2D), y_plane_lock.target()); | 1623 DCHECK_EQ(static_cast<GLenum>(GL_TEXTURE_2D), y_plane_lock.target()); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1714 | 1716 |
| 1715 void GLRenderer::DrawStreamVideoQuad(const DrawingFrame* frame, | 1717 void GLRenderer::DrawStreamVideoQuad(const DrawingFrame* frame, |
| 1716 const StreamVideoDrawQuad* quad) { | 1718 const StreamVideoDrawQuad* quad) { |
| 1717 SetBlendEnabled(quad->ShouldDrawWithBlending()); | 1719 SetBlendEnabled(quad->ShouldDrawWithBlending()); |
| 1718 | 1720 |
| 1719 static float gl_matrix[16]; | 1721 static float gl_matrix[16]; |
| 1720 | 1722 |
| 1721 DCHECK(capabilities_.using_egl_image); | 1723 DCHECK(capabilities_.using_egl_image); |
| 1722 | 1724 |
| 1723 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( | 1725 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( |
| 1724 context_, &highp_threshold_cache_, highp_threshold_min_, | 1726 gl_, &highp_threshold_cache_, highp_threshold_min_, |
| 1725 quad->shared_quad_state->visible_content_rect.bottom_right()); | 1727 quad->shared_quad_state->visible_content_rect.bottom_right()); |
| 1726 | 1728 |
| 1727 const VideoStreamTextureProgram* program = | 1729 const VideoStreamTextureProgram* program = |
| 1728 GetVideoStreamTextureProgram(tex_coord_precision); | 1730 GetVideoStreamTextureProgram(tex_coord_precision); |
| 1729 SetUseProgram(program->program()); | 1731 SetUseProgram(program->program()); |
| 1730 | 1732 |
| 1731 ToGLMatrix(&gl_matrix[0], quad->matrix); | 1733 ToGLMatrix(&gl_matrix[0], quad->matrix); |
| 1732 GLC(Context(), | 1734 GLC(Context(), |
| 1733 Context()->uniformMatrix4fv( | 1735 Context()->uniformMatrix4fv( |
| 1734 program->vertex_shader().tex_matrix_location(), 1, false, gl_matrix)); | 1736 program->vertex_shader().tex_matrix_location(), 1, false, gl_matrix)); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1896 // Clear the cache. | 1898 // Clear the cache. |
| 1897 draw_cache_.program_id = 0; | 1899 draw_cache_.program_id = 0; |
| 1898 draw_cache_.uv_xform_data.resize(0); | 1900 draw_cache_.uv_xform_data.resize(0); |
| 1899 draw_cache_.vertex_opacity_data.resize(0); | 1901 draw_cache_.vertex_opacity_data.resize(0); |
| 1900 draw_cache_.matrix_data.resize(0); | 1902 draw_cache_.matrix_data.resize(0); |
| 1901 } | 1903 } |
| 1902 | 1904 |
| 1903 void GLRenderer::EnqueueTextureQuad(const DrawingFrame* frame, | 1905 void GLRenderer::EnqueueTextureQuad(const DrawingFrame* frame, |
| 1904 const TextureDrawQuad* quad) { | 1906 const TextureDrawQuad* quad) { |
| 1905 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( | 1907 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( |
| 1906 context_, &highp_threshold_cache_, highp_threshold_min_, | 1908 gl_, &highp_threshold_cache_, highp_threshold_min_, |
| 1907 quad->shared_quad_state->visible_content_rect.bottom_right()); | 1909 quad->shared_quad_state->visible_content_rect.bottom_right()); |
| 1908 | 1910 |
| 1909 // Choose the correct texture program binding | 1911 // Choose the correct texture program binding |
| 1910 TexTransformTextureProgramBinding binding; | 1912 TexTransformTextureProgramBinding binding; |
| 1911 if (quad->premultiplied_alpha) { | 1913 if (quad->premultiplied_alpha) { |
| 1912 if (quad->background_color == SK_ColorTRANSPARENT) { | 1914 if (quad->background_color == SK_ColorTRANSPARENT) { |
| 1913 binding.Set(GetTextureProgram(tex_coord_precision)); | 1915 binding.Set(GetTextureProgram(tex_coord_precision)); |
| 1914 } else { | 1916 } else { |
| 1915 binding.Set(GetTextureBackgroundProgram(tex_coord_precision)); | 1917 binding.Set(GetTextureBackgroundProgram(tex_coord_precision)); |
| 1916 } | 1918 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1961 Float16 m; | 1963 Float16 m; |
| 1962 quad_rect_matrix.matrix().asColMajorf(m.data); | 1964 quad_rect_matrix.matrix().asColMajorf(m.data); |
| 1963 draw_cache_.matrix_data.push_back(m); | 1965 draw_cache_.matrix_data.push_back(m); |
| 1964 } | 1966 } |
| 1965 | 1967 |
| 1966 void GLRenderer::DrawIOSurfaceQuad(const DrawingFrame* frame, | 1968 void GLRenderer::DrawIOSurfaceQuad(const DrawingFrame* frame, |
| 1967 const IOSurfaceDrawQuad* quad) { | 1969 const IOSurfaceDrawQuad* quad) { |
| 1968 SetBlendEnabled(quad->ShouldDrawWithBlending()); | 1970 SetBlendEnabled(quad->ShouldDrawWithBlending()); |
| 1969 | 1971 |
| 1970 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( | 1972 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( |
| 1971 context_, &highp_threshold_cache_, highp_threshold_min_, | 1973 gl_, &highp_threshold_cache_, highp_threshold_min_, |
| 1972 quad->shared_quad_state->visible_content_rect.bottom_right()); | 1974 quad->shared_quad_state->visible_content_rect.bottom_right()); |
| 1973 | 1975 |
| 1974 TexTransformTextureProgramBinding binding; | 1976 TexTransformTextureProgramBinding binding; |
| 1975 binding.Set(GetTextureIOSurfaceProgram(tex_coord_precision)); | 1977 binding.Set(GetTextureIOSurfaceProgram(tex_coord_precision)); |
| 1976 | 1978 |
| 1977 SetUseProgram(binding.program_id); | 1979 SetUseProgram(binding.program_id); |
| 1978 GLC(Context(), Context()->uniform1i(binding.sampler_location, 0)); | 1980 GLC(Context(), Context()->uniform1i(binding.sampler_location, 0)); |
| 1979 if (quad->orientation == IOSurfaceDrawQuad::FLIPPED) { | 1981 if (quad->orientation == IOSurfaceDrawQuad::FLIPPED) { |
| 1980 GLC(Context(), | 1982 GLC(Context(), |
| 1981 Context()->uniform4f(binding.tex_transform_location, | 1983 Context()->uniform4f(binding.tex_transform_location, |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2093 if (enabled) | 2095 if (enabled) |
| 2094 GLC(context_, context_->enable(GL_BLEND)); | 2096 GLC(context_, context_->enable(GL_BLEND)); |
| 2095 else | 2097 else |
| 2096 GLC(context_, context_->disable(GL_BLEND)); | 2098 GLC(context_, context_->disable(GL_BLEND)); |
| 2097 blend_shadow_ = enabled; | 2099 blend_shadow_ = enabled; |
| 2098 } | 2100 } |
| 2099 | 2101 |
| 2100 void GLRenderer::SetUseProgram(unsigned program) { | 2102 void GLRenderer::SetUseProgram(unsigned program) { |
| 2101 if (program == program_shadow_) | 2103 if (program == program_shadow_) |
| 2102 return; | 2104 return; |
| 2103 GLC(context_, context_->useProgram(program)); | 2105 gl_->UseProgram(program); |
| 2104 program_shadow_ = program; | 2106 program_shadow_ = program; |
| 2105 } | 2107 } |
| 2106 | 2108 |
| 2107 void GLRenderer::DrawQuadGeometry(const DrawingFrame* frame, | 2109 void GLRenderer::DrawQuadGeometry(const DrawingFrame* frame, |
| 2108 const gfx::Transform& draw_transform, | 2110 const gfx::Transform& draw_transform, |
| 2109 const gfx::RectF& quad_rect, | 2111 const gfx::RectF& quad_rect, |
| 2110 int matrix_location) { | 2112 int matrix_location) { |
| 2111 gfx::Transform quad_rect_matrix; | 2113 gfx::Transform quad_rect_matrix; |
| 2112 QuadRectTransform(&quad_rect_matrix, draw_transform, quad_rect); | 2114 QuadRectTransform(&quad_rect_matrix, draw_transform, quad_rect); |
| 2113 static float gl_matrix[16]; | 2115 static float gl_matrix[16]; |
| 2114 ToGLMatrix(&gl_matrix[0], frame->projection_matrix * quad_rect_matrix); | 2116 ToGLMatrix(&gl_matrix[0], frame->projection_matrix * quad_rect_matrix); |
| 2115 GLC(context_, | 2117 GLC(context_, |
| 2116 context_->uniformMatrix4fv(matrix_location, 1, false, &gl_matrix[0])); | 2118 context_->uniformMatrix4fv(matrix_location, 1, false, &gl_matrix[0])); |
| 2117 | 2119 |
| 2118 GLC(context_, context_->drawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0)); | 2120 GLC(context_, context_->drawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0)); |
| 2119 } | 2121 } |
| 2120 | 2122 |
| 2121 void GLRenderer::CopyTextureToFramebuffer(const DrawingFrame* frame, | 2123 void GLRenderer::CopyTextureToFramebuffer(const DrawingFrame* frame, |
| 2122 int texture_id, | 2124 int texture_id, |
| 2123 gfx::Rect rect, | 2125 gfx::Rect rect, |
| 2124 const gfx::Transform& draw_matrix, | 2126 const gfx::Transform& draw_matrix, |
| 2125 bool flip_vertically) { | 2127 bool flip_vertically) { |
| 2126 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( | 2128 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( |
| 2127 context_, &highp_threshold_cache_, highp_threshold_min_, | 2129 gl_, &highp_threshold_cache_, highp_threshold_min_, |
| 2128 rect.bottom_right()); | 2130 rect.bottom_right()); |
| 2129 | 2131 |
| 2130 const RenderPassProgram* program = GetRenderPassProgram(tex_coord_precision); | 2132 const RenderPassProgram* program = GetRenderPassProgram(tex_coord_precision); |
| 2131 SetUseProgram(program->program()); | 2133 SetUseProgram(program->program()); |
| 2132 | 2134 |
| 2133 GLC(Context(), Context()->uniform1i( | 2135 GLC(Context(), Context()->uniform1i( |
| 2134 program->fragment_shader().sampler_location(), 0)); | 2136 program->fragment_shader().sampler_location(), 0)); |
| 2135 | 2137 |
| 2136 if (flip_vertically) { | 2138 if (flip_vertically) { |
| 2137 GLC(Context(), Context()->uniform4f( | 2139 GLC(Context(), Context()->uniform4f( |
| (...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3012 return program; | 3014 return program; |
| 3013 } | 3015 } |
| 3014 | 3016 |
| 3015 void GLRenderer::CleanupSharedObjects() { | 3017 void GLRenderer::CleanupSharedObjects() { |
| 3016 MakeContextCurrent(); | 3018 MakeContextCurrent(); |
| 3017 | 3019 |
| 3018 shared_geometry_.reset(); | 3020 shared_geometry_.reset(); |
| 3019 | 3021 |
| 3020 for (int i = 0; i < NumTexCoordPrecisions; ++i) { | 3022 for (int i = 0; i < NumTexCoordPrecisions; ++i) { |
| 3021 for (int j = 0; j < NumSamplerTypes; ++j) { | 3023 for (int j = 0; j < NumSamplerTypes; ++j) { |
| 3022 tile_program_[i][j].Cleanup(context_); | 3024 tile_program_[i][j].Cleanup(gl_); |
| 3023 tile_program_opaque_[i][j].Cleanup(context_); | 3025 tile_program_opaque_[i][j].Cleanup(gl_); |
| 3024 tile_program_swizzle_[i][j].Cleanup(context_); | 3026 tile_program_swizzle_[i][j].Cleanup(gl_); |
| 3025 tile_program_swizzle_opaque_[i][j].Cleanup(context_); | 3027 tile_program_swizzle_opaque_[i][j].Cleanup(gl_); |
| 3026 tile_program_aa_[i][j].Cleanup(context_); | 3028 tile_program_aa_[i][j].Cleanup(gl_); |
| 3027 tile_program_swizzle_aa_[i][j].Cleanup(context_); | 3029 tile_program_swizzle_aa_[i][j].Cleanup(gl_); |
| 3028 } | 3030 } |
| 3029 | 3031 |
| 3030 render_pass_mask_program_[i].Cleanup(context_); | 3032 render_pass_mask_program_[i].Cleanup(gl_); |
| 3031 render_pass_program_[i].Cleanup(context_); | 3033 render_pass_program_[i].Cleanup(gl_); |
| 3032 render_pass_mask_program_aa_[i].Cleanup(context_); | 3034 render_pass_mask_program_aa_[i].Cleanup(gl_); |
| 3033 render_pass_program_aa_[i].Cleanup(context_); | 3035 render_pass_program_aa_[i].Cleanup(gl_); |
| 3034 render_pass_color_matrix_program_[i].Cleanup(context_); | 3036 render_pass_color_matrix_program_[i].Cleanup(gl_); |
| 3035 render_pass_mask_color_matrix_program_aa_[i].Cleanup(context_); | 3037 render_pass_mask_color_matrix_program_aa_[i].Cleanup(gl_); |
| 3036 render_pass_color_matrix_program_aa_[i].Cleanup(context_); | 3038 render_pass_color_matrix_program_aa_[i].Cleanup(gl_); |
| 3037 render_pass_mask_color_matrix_program_[i].Cleanup(context_); | 3039 render_pass_mask_color_matrix_program_[i].Cleanup(gl_); |
| 3038 | 3040 |
| 3039 texture_program_[i].Cleanup(context_); | 3041 texture_program_[i].Cleanup(gl_); |
| 3040 nonpremultiplied_texture_program_[i].Cleanup(context_); | 3042 nonpremultiplied_texture_program_[i].Cleanup(gl_); |
| 3041 texture_background_program_[i].Cleanup(context_); | 3043 texture_background_program_[i].Cleanup(gl_); |
| 3042 nonpremultiplied_texture_background_program_[i].Cleanup(context_); | 3044 nonpremultiplied_texture_background_program_[i].Cleanup(gl_); |
| 3043 texture_io_surface_program_[i].Cleanup(context_); | 3045 texture_io_surface_program_[i].Cleanup(gl_); |
| 3044 | 3046 |
| 3045 video_yuv_program_[i].Cleanup(context_); | 3047 video_yuv_program_[i].Cleanup(gl_); |
| 3046 video_yuva_program_[i].Cleanup(context_); | 3048 video_yuva_program_[i].Cleanup(gl_); |
| 3047 video_stream_texture_program_[i].Cleanup(context_); | 3049 video_stream_texture_program_[i].Cleanup(gl_); |
| 3048 } | 3050 } |
| 3049 | 3051 |
| 3050 tile_checkerboard_program_.Cleanup(context_); | 3052 tile_checkerboard_program_.Cleanup(gl_); |
| 3051 | 3053 |
| 3052 debug_border_program_.Cleanup(context_); | 3054 debug_border_program_.Cleanup(gl_); |
| 3053 solid_color_program_.Cleanup(context_); | 3055 solid_color_program_.Cleanup(gl_); |
| 3054 solid_color_program_aa_.Cleanup(context_); | 3056 solid_color_program_aa_.Cleanup(gl_); |
| 3055 | 3057 |
| 3056 if (offscreen_framebuffer_id_) | 3058 if (offscreen_framebuffer_id_) |
| 3057 GLC(context_, context_->deleteFramebuffer(offscreen_framebuffer_id_)); | 3059 GLC(context_, context_->deleteFramebuffer(offscreen_framebuffer_id_)); |
| 3058 | 3060 |
| 3059 if (on_demand_tile_raster_resource_id_) | 3061 if (on_demand_tile_raster_resource_id_) |
| 3060 resource_provider_->DeleteResource(on_demand_tile_raster_resource_id_); | 3062 resource_provider_->DeleteResource(on_demand_tile_raster_resource_id_); |
| 3061 | 3063 |
| 3062 ReleaseRenderPassTextures(); | 3064 ReleaseRenderPassTextures(); |
| 3063 } | 3065 } |
| 3064 | 3066 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 3081 is_scissor_enabled_ = false; | 3083 is_scissor_enabled_ = false; |
| 3082 GLC(context_, context_->disable(GL_SCISSOR_TEST)); | 3084 GLC(context_, context_->disable(GL_SCISSOR_TEST)); |
| 3083 scissor_rect_needs_reset_ = true; | 3085 scissor_rect_needs_reset_ = true; |
| 3084 } | 3086 } |
| 3085 | 3087 |
| 3086 bool GLRenderer::IsContextLost() { | 3088 bool GLRenderer::IsContextLost() { |
| 3087 return output_surface_->context_provider()->IsContextLost(); | 3089 return output_surface_->context_provider()->IsContextLost(); |
| 3088 } | 3090 } |
| 3089 | 3091 |
| 3090 } // namespace cc | 3092 } // namespace cc |
| OLD | NEW |