| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 GLRenderer::GLRenderer(RendererClient* client, | 171 GLRenderer::GLRenderer(RendererClient* client, |
| 171 const LayerTreeSettings* settings, | 172 const LayerTreeSettings* settings, |
| 172 OutputSurface* output_surface, | 173 OutputSurface* output_surface, |
| 173 ResourceProvider* resource_provider, | 174 ResourceProvider* resource_provider, |
| 174 TextureMailboxDeleter* texture_mailbox_deleter, | 175 TextureMailboxDeleter* texture_mailbox_deleter, |
| 175 int highp_threshold_min) | 176 int highp_threshold_min) |
| 176 : DirectRenderer(client, settings, output_surface, resource_provider), | 177 : DirectRenderer(client, settings, output_surface, resource_provider), |
| 177 offscreen_framebuffer_id_(0), | 178 offscreen_framebuffer_id_(0), |
| 178 shared_geometry_quad_(gfx::RectF(-0.5f, -0.5f, 1.0f, 1.0f)), | 179 shared_geometry_quad_(gfx::RectF(-0.5f, -0.5f, 1.0f, 1.0f)), |
| 179 context_(output_surface->context_provider()->Context3d()), | 180 context_(output_surface->context_provider()->Context3d()), |
| 181 gl_(output_surface->context_provider()->ContextGL()), |
| 180 context_support_(output_surface->context_provider()->ContextSupport()), | 182 context_support_(output_surface->context_provider()->ContextSupport()), |
| 181 texture_mailbox_deleter_(texture_mailbox_deleter), | 183 texture_mailbox_deleter_(texture_mailbox_deleter), |
| 182 is_backbuffer_discarded_(false), | 184 is_backbuffer_discarded_(false), |
| 183 visible_(true), | 185 visible_(true), |
| 184 is_scissor_enabled_(false), | 186 is_scissor_enabled_(false), |
| 185 stencil_shadow_(false), | 187 stencil_shadow_(false), |
| 186 blend_shadow_(false), | 188 blend_shadow_(false), |
| 187 highp_threshold_min_(highp_threshold_min), | 189 highp_threshold_min_(highp_threshold_min), |
| 188 highp_threshold_cache_(0), | 190 highp_threshold_cache_(0), |
| 189 on_demand_tile_raster_resource_id_(0) { | 191 on_demand_tile_raster_resource_id_(0) { |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 } else { | 982 } else { |
| 981 contents_resource_lock = make_scoped_ptr( | 983 contents_resource_lock = make_scoped_ptr( |
| 982 new ResourceProvider::ScopedSamplerGL(resource_provider_, | 984 new ResourceProvider::ScopedSamplerGL(resource_provider_, |
| 983 contents_texture->id(), | 985 contents_texture->id(), |
| 984 GL_LINEAR)); | 986 GL_LINEAR)); |
| 985 DCHECK_EQ(static_cast<GLenum>(GL_TEXTURE_2D), | 987 DCHECK_EQ(static_cast<GLenum>(GL_TEXTURE_2D), |
| 986 contents_resource_lock->target()); | 988 contents_resource_lock->target()); |
| 987 } | 989 } |
| 988 | 990 |
| 989 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( | 991 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( |
| 990 context_, &highp_threshold_cache_, highp_threshold_min_, | 992 gl_, &highp_threshold_cache_, highp_threshold_min_, |
| 991 quad->shared_quad_state->visible_content_rect.bottom_right()); | 993 quad->shared_quad_state->visible_content_rect.bottom_right()); |
| 992 | 994 |
| 993 int shader_quad_location = -1; | 995 int shader_quad_location = -1; |
| 994 int shader_edge_location = -1; | 996 int shader_edge_location = -1; |
| 995 int shader_viewport_location = -1; | 997 int shader_viewport_location = -1; |
| 996 int shader_mask_sampler_location = -1; | 998 int shader_mask_sampler_location = -1; |
| 997 int shader_mask_tex_coord_scale_location = -1; | 999 int shader_mask_tex_coord_scale_location = -1; |
| 998 int shader_mask_tex_coord_offset_location = -1; | 1000 int shader_mask_tex_coord_offset_location = -1; |
| 999 int shader_matrix_location = -1; | 1001 int shader_matrix_location = -1; |
| 1000 int shader_alpha_location = -1; | 1002 int shader_alpha_location = -1; |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1486 clamp_tex_rect.Inset(tex_clamp_x, tex_clamp_y, tex_clamp_x, tex_clamp_y); | 1488 clamp_tex_rect.Inset(tex_clamp_x, tex_clamp_y, tex_clamp_x, tex_clamp_y); |
| 1487 | 1489 |
| 1488 // Map clamping rectangle to unit square. | 1490 // Map clamping rectangle to unit square. |
| 1489 float vertex_tex_translate_x = -clamp_geom_rect.x() / clamp_geom_rect.width(); | 1491 float vertex_tex_translate_x = -clamp_geom_rect.x() / clamp_geom_rect.width(); |
| 1490 float vertex_tex_translate_y = | 1492 float vertex_tex_translate_y = |
| 1491 -clamp_geom_rect.y() / clamp_geom_rect.height(); | 1493 -clamp_geom_rect.y() / clamp_geom_rect.height(); |
| 1492 float vertex_tex_scale_x = tile_rect.width() / clamp_geom_rect.width(); | 1494 float vertex_tex_scale_x = tile_rect.width() / clamp_geom_rect.width(); |
| 1493 float vertex_tex_scale_y = tile_rect.height() / clamp_geom_rect.height(); | 1495 float vertex_tex_scale_y = tile_rect.height() / clamp_geom_rect.height(); |
| 1494 | 1496 |
| 1495 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( | 1497 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( |
| 1496 context_, &highp_threshold_cache_, highp_threshold_min_, | 1498 gl_, &highp_threshold_cache_, highp_threshold_min_, |
| 1497 quad->texture_size); | 1499 quad->texture_size); |
| 1498 | 1500 |
| 1499 gfx::Transform device_transform = | 1501 gfx::Transform device_transform = |
| 1500 frame->window_matrix * frame->projection_matrix * quad->quadTransform(); | 1502 frame->window_matrix * frame->projection_matrix * quad->quadTransform(); |
| 1501 device_transform.FlattenTo2d(); | 1503 device_transform.FlattenTo2d(); |
| 1502 if (!device_transform.IsInvertible()) | 1504 if (!device_transform.IsInvertible()) |
| 1503 return; | 1505 return; |
| 1504 | 1506 |
| 1505 gfx::QuadF local_quad = gfx::QuadF(gfx::RectF(tile_rect)); | 1507 gfx::QuadF local_quad = gfx::QuadF(gfx::RectF(tile_rect)); |
| 1506 float edge[24]; | 1508 float edge[24]; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1629 tile_rect.size()); | 1631 tile_rect.size()); |
| 1630 DrawQuadGeometry( | 1632 DrawQuadGeometry( |
| 1631 frame, quad->quadTransform(), centered_rect, uniforms.matrix_location); | 1633 frame, quad->quadTransform(), centered_rect, uniforms.matrix_location); |
| 1632 } | 1634 } |
| 1633 | 1635 |
| 1634 void GLRenderer::DrawYUVVideoQuad(const DrawingFrame* frame, | 1636 void GLRenderer::DrawYUVVideoQuad(const DrawingFrame* frame, |
| 1635 const YUVVideoDrawQuad* quad) { | 1637 const YUVVideoDrawQuad* quad) { |
| 1636 SetBlendEnabled(quad->ShouldDrawWithBlending()); | 1638 SetBlendEnabled(quad->ShouldDrawWithBlending()); |
| 1637 | 1639 |
| 1638 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( | 1640 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( |
| 1639 context_, &highp_threshold_cache_, highp_threshold_min_, | 1641 gl_, &highp_threshold_cache_, highp_threshold_min_, |
| 1640 quad->shared_quad_state->visible_content_rect.bottom_right()); | 1642 quad->shared_quad_state->visible_content_rect.bottom_right()); |
| 1641 | 1643 |
| 1642 bool use_alpha_plane = quad->a_plane_resource_id != 0; | 1644 bool use_alpha_plane = quad->a_plane_resource_id != 0; |
| 1643 | 1645 |
| 1644 ResourceProvider::ScopedSamplerGL y_plane_lock( | 1646 ResourceProvider::ScopedSamplerGL y_plane_lock( |
| 1645 resource_provider_, | 1647 resource_provider_, |
| 1646 quad->y_plane_resource_id, | 1648 quad->y_plane_resource_id, |
| 1647 GL_TEXTURE1, | 1649 GL_TEXTURE1, |
| 1648 GL_LINEAR); | 1650 GL_LINEAR); |
| 1649 DCHECK_EQ(static_cast<GLenum>(GL_TEXTURE_2D), y_plane_lock.target()); | 1651 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... |
| 1742 | 1744 |
| 1743 void GLRenderer::DrawStreamVideoQuad(const DrawingFrame* frame, | 1745 void GLRenderer::DrawStreamVideoQuad(const DrawingFrame* frame, |
| 1744 const StreamVideoDrawQuad* quad) { | 1746 const StreamVideoDrawQuad* quad) { |
| 1745 SetBlendEnabled(quad->ShouldDrawWithBlending()); | 1747 SetBlendEnabled(quad->ShouldDrawWithBlending()); |
| 1746 | 1748 |
| 1747 static float gl_matrix[16]; | 1749 static float gl_matrix[16]; |
| 1748 | 1750 |
| 1749 DCHECK(capabilities_.using_egl_image); | 1751 DCHECK(capabilities_.using_egl_image); |
| 1750 | 1752 |
| 1751 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( | 1753 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( |
| 1752 context_, &highp_threshold_cache_, highp_threshold_min_, | 1754 gl_, &highp_threshold_cache_, highp_threshold_min_, |
| 1753 quad->shared_quad_state->visible_content_rect.bottom_right()); | 1755 quad->shared_quad_state->visible_content_rect.bottom_right()); |
| 1754 | 1756 |
| 1755 const VideoStreamTextureProgram* program = | 1757 const VideoStreamTextureProgram* program = |
| 1756 GetVideoStreamTextureProgram(tex_coord_precision); | 1758 GetVideoStreamTextureProgram(tex_coord_precision); |
| 1757 SetUseProgram(program->program()); | 1759 SetUseProgram(program->program()); |
| 1758 | 1760 |
| 1759 ToGLMatrix(&gl_matrix[0], quad->matrix); | 1761 ToGLMatrix(&gl_matrix[0], quad->matrix); |
| 1760 GLC(Context(), | 1762 GLC(Context(), |
| 1761 Context()->uniformMatrix4fv( | 1763 Context()->uniformMatrix4fv( |
| 1762 program->vertex_shader().tex_matrix_location(), 1, false, gl_matrix)); | 1764 program->vertex_shader().tex_matrix_location(), 1, false, gl_matrix)); |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1973 // Clear the cache. | 1975 // Clear the cache. |
| 1974 draw_cache_.program_id = 0; | 1976 draw_cache_.program_id = 0; |
| 1975 draw_cache_.uv_xform_data.resize(0); | 1977 draw_cache_.uv_xform_data.resize(0); |
| 1976 draw_cache_.vertex_opacity_data.resize(0); | 1978 draw_cache_.vertex_opacity_data.resize(0); |
| 1977 draw_cache_.matrix_data.resize(0); | 1979 draw_cache_.matrix_data.resize(0); |
| 1978 } | 1980 } |
| 1979 | 1981 |
| 1980 void GLRenderer::EnqueueTextureQuad(const DrawingFrame* frame, | 1982 void GLRenderer::EnqueueTextureQuad(const DrawingFrame* frame, |
| 1981 const TextureDrawQuad* quad) { | 1983 const TextureDrawQuad* quad) { |
| 1982 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( | 1984 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( |
| 1983 context_, &highp_threshold_cache_, highp_threshold_min_, | 1985 gl_, &highp_threshold_cache_, highp_threshold_min_, |
| 1984 quad->shared_quad_state->visible_content_rect.bottom_right()); | 1986 quad->shared_quad_state->visible_content_rect.bottom_right()); |
| 1985 | 1987 |
| 1986 // Choose the correct texture program binding | 1988 // Choose the correct texture program binding |
| 1987 TexTransformTextureProgramBinding binding; | 1989 TexTransformTextureProgramBinding binding; |
| 1988 if (quad->premultiplied_alpha) { | 1990 if (quad->premultiplied_alpha) { |
| 1989 if (quad->background_color == SK_ColorTRANSPARENT) { | 1991 if (quad->background_color == SK_ColorTRANSPARENT) { |
| 1990 binding.Set(GetTextureProgram(tex_coord_precision)); | 1992 binding.Set(GetTextureProgram(tex_coord_precision)); |
| 1991 } else { | 1993 } else { |
| 1992 binding.Set(GetTextureBackgroundProgram(tex_coord_precision)); | 1994 binding.Set(GetTextureBackgroundProgram(tex_coord_precision)); |
| 1993 } | 1995 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2038 Float16 m; | 2040 Float16 m; |
| 2039 quad_rect_matrix.matrix().asColMajorf(m.data); | 2041 quad_rect_matrix.matrix().asColMajorf(m.data); |
| 2040 draw_cache_.matrix_data.push_back(m); | 2042 draw_cache_.matrix_data.push_back(m); |
| 2041 } | 2043 } |
| 2042 | 2044 |
| 2043 void GLRenderer::DrawIOSurfaceQuad(const DrawingFrame* frame, | 2045 void GLRenderer::DrawIOSurfaceQuad(const DrawingFrame* frame, |
| 2044 const IOSurfaceDrawQuad* quad) { | 2046 const IOSurfaceDrawQuad* quad) { |
| 2045 SetBlendEnabled(quad->ShouldDrawWithBlending()); | 2047 SetBlendEnabled(quad->ShouldDrawWithBlending()); |
| 2046 | 2048 |
| 2047 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( | 2049 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( |
| 2048 context_, &highp_threshold_cache_, highp_threshold_min_, | 2050 gl_, &highp_threshold_cache_, highp_threshold_min_, |
| 2049 quad->shared_quad_state->visible_content_rect.bottom_right()); | 2051 quad->shared_quad_state->visible_content_rect.bottom_right()); |
| 2050 | 2052 |
| 2051 TexTransformTextureProgramBinding binding; | 2053 TexTransformTextureProgramBinding binding; |
| 2052 binding.Set(GetTextureIOSurfaceProgram(tex_coord_precision)); | 2054 binding.Set(GetTextureIOSurfaceProgram(tex_coord_precision)); |
| 2053 | 2055 |
| 2054 SetUseProgram(binding.program_id); | 2056 SetUseProgram(binding.program_id); |
| 2055 GLC(Context(), Context()->uniform1i(binding.sampler_location, 0)); | 2057 GLC(Context(), Context()->uniform1i(binding.sampler_location, 0)); |
| 2056 if (quad->orientation == IOSurfaceDrawQuad::FLIPPED) { | 2058 if (quad->orientation == IOSurfaceDrawQuad::FLIPPED) { |
| 2057 GLC(Context(), | 2059 GLC(Context(), |
| 2058 Context()->uniform4f(binding.tex_transform_location, | 2060 Context()->uniform4f(binding.tex_transform_location, |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2170 if (enabled) | 2172 if (enabled) |
| 2171 GLC(context_, context_->enable(GL_BLEND)); | 2173 GLC(context_, context_->enable(GL_BLEND)); |
| 2172 else | 2174 else |
| 2173 GLC(context_, context_->disable(GL_BLEND)); | 2175 GLC(context_, context_->disable(GL_BLEND)); |
| 2174 blend_shadow_ = enabled; | 2176 blend_shadow_ = enabled; |
| 2175 } | 2177 } |
| 2176 | 2178 |
| 2177 void GLRenderer::SetUseProgram(unsigned program) { | 2179 void GLRenderer::SetUseProgram(unsigned program) { |
| 2178 if (program == program_shadow_) | 2180 if (program == program_shadow_) |
| 2179 return; | 2181 return; |
| 2180 GLC(context_, context_->useProgram(program)); | 2182 gl_->UseProgram(program); |
| 2181 program_shadow_ = program; | 2183 program_shadow_ = program; |
| 2182 } | 2184 } |
| 2183 | 2185 |
| 2184 void GLRenderer::DrawQuadGeometry(const DrawingFrame* frame, | 2186 void GLRenderer::DrawQuadGeometry(const DrawingFrame* frame, |
| 2185 const gfx::Transform& draw_transform, | 2187 const gfx::Transform& draw_transform, |
| 2186 const gfx::RectF& quad_rect, | 2188 const gfx::RectF& quad_rect, |
| 2187 int matrix_location) { | 2189 int matrix_location) { |
| 2188 gfx::Transform quad_rect_matrix; | 2190 gfx::Transform quad_rect_matrix; |
| 2189 QuadRectTransform(&quad_rect_matrix, draw_transform, quad_rect); | 2191 QuadRectTransform(&quad_rect_matrix, draw_transform, quad_rect); |
| 2190 static float gl_matrix[16]; | 2192 static float gl_matrix[16]; |
| 2191 ToGLMatrix(&gl_matrix[0], frame->projection_matrix * quad_rect_matrix); | 2193 ToGLMatrix(&gl_matrix[0], frame->projection_matrix * quad_rect_matrix); |
| 2192 GLC(context_, | 2194 GLC(context_, |
| 2193 context_->uniformMatrix4fv(matrix_location, 1, false, &gl_matrix[0])); | 2195 context_->uniformMatrix4fv(matrix_location, 1, false, &gl_matrix[0])); |
| 2194 | 2196 |
| 2195 GLC(context_, context_->drawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0)); | 2197 GLC(context_, context_->drawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, 0)); |
| 2196 } | 2198 } |
| 2197 | 2199 |
| 2198 void GLRenderer::CopyTextureToFramebuffer(const DrawingFrame* frame, | 2200 void GLRenderer::CopyTextureToFramebuffer(const DrawingFrame* frame, |
| 2199 int texture_id, | 2201 int texture_id, |
| 2200 gfx::Rect rect, | 2202 gfx::Rect rect, |
| 2201 const gfx::Transform& draw_matrix, | 2203 const gfx::Transform& draw_matrix, |
| 2202 bool flip_vertically) { | 2204 bool flip_vertically) { |
| 2203 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( | 2205 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( |
| 2204 context_, &highp_threshold_cache_, highp_threshold_min_, | 2206 gl_, &highp_threshold_cache_, highp_threshold_min_, |
| 2205 rect.bottom_right()); | 2207 rect.bottom_right()); |
| 2206 | 2208 |
| 2207 const RenderPassProgram* program = GetRenderPassProgram(tex_coord_precision); | 2209 const RenderPassProgram* program = GetRenderPassProgram(tex_coord_precision); |
| 2208 SetUseProgram(program->program()); | 2210 SetUseProgram(program->program()); |
| 2209 | 2211 |
| 2210 GLC(Context(), Context()->uniform1i( | 2212 GLC(Context(), Context()->uniform1i( |
| 2211 program->fragment_shader().sampler_location(), 0)); | 2213 program->fragment_shader().sampler_location(), 0)); |
| 2212 | 2214 |
| 2213 if (flip_vertically) { | 2215 if (flip_vertically) { |
| 2214 GLC(Context(), Context()->uniform4f( | 2216 GLC(Context(), Context()->uniform4f( |
| (...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3061 return program; | 3063 return program; |
| 3062 } | 3064 } |
| 3063 | 3065 |
| 3064 void GLRenderer::CleanupSharedObjects() { | 3066 void GLRenderer::CleanupSharedObjects() { |
| 3065 MakeContextCurrent(); | 3067 MakeContextCurrent(); |
| 3066 | 3068 |
| 3067 shared_geometry_.reset(); | 3069 shared_geometry_.reset(); |
| 3068 | 3070 |
| 3069 for (int i = 0; i < NumTexCoordPrecisions; ++i) { | 3071 for (int i = 0; i < NumTexCoordPrecisions; ++i) { |
| 3070 for (int j = 0; j < NumSamplerTypes; ++j) { | 3072 for (int j = 0; j < NumSamplerTypes; ++j) { |
| 3071 tile_program_[i][j].Cleanup(context_); | 3073 tile_program_[i][j].Cleanup(gl_); |
| 3072 tile_program_opaque_[i][j].Cleanup(context_); | 3074 tile_program_opaque_[i][j].Cleanup(gl_); |
| 3073 tile_program_swizzle_[i][j].Cleanup(context_); | 3075 tile_program_swizzle_[i][j].Cleanup(gl_); |
| 3074 tile_program_swizzle_opaque_[i][j].Cleanup(context_); | 3076 tile_program_swizzle_opaque_[i][j].Cleanup(gl_); |
| 3075 tile_program_aa_[i][j].Cleanup(context_); | 3077 tile_program_aa_[i][j].Cleanup(gl_); |
| 3076 tile_program_swizzle_aa_[i][j].Cleanup(context_); | 3078 tile_program_swizzle_aa_[i][j].Cleanup(gl_); |
| 3077 } | 3079 } |
| 3078 | 3080 |
| 3079 render_pass_mask_program_[i].Cleanup(context_); | 3081 render_pass_mask_program_[i].Cleanup(gl_); |
| 3080 render_pass_program_[i].Cleanup(context_); | 3082 render_pass_program_[i].Cleanup(gl_); |
| 3081 render_pass_mask_program_aa_[i].Cleanup(context_); | 3083 render_pass_mask_program_aa_[i].Cleanup(gl_); |
| 3082 render_pass_program_aa_[i].Cleanup(context_); | 3084 render_pass_program_aa_[i].Cleanup(gl_); |
| 3083 render_pass_color_matrix_program_[i].Cleanup(context_); | 3085 render_pass_color_matrix_program_[i].Cleanup(gl_); |
| 3084 render_pass_mask_color_matrix_program_aa_[i].Cleanup(context_); | 3086 render_pass_mask_color_matrix_program_aa_[i].Cleanup(gl_); |
| 3085 render_pass_color_matrix_program_aa_[i].Cleanup(context_); | 3087 render_pass_color_matrix_program_aa_[i].Cleanup(gl_); |
| 3086 render_pass_mask_color_matrix_program_[i].Cleanup(context_); | 3088 render_pass_mask_color_matrix_program_[i].Cleanup(gl_); |
| 3087 | 3089 |
| 3088 texture_program_[i].Cleanup(context_); | 3090 texture_program_[i].Cleanup(gl_); |
| 3089 nonpremultiplied_texture_program_[i].Cleanup(context_); | 3091 nonpremultiplied_texture_program_[i].Cleanup(gl_); |
| 3090 texture_background_program_[i].Cleanup(context_); | 3092 texture_background_program_[i].Cleanup(gl_); |
| 3091 nonpremultiplied_texture_background_program_[i].Cleanup(context_); | 3093 nonpremultiplied_texture_background_program_[i].Cleanup(gl_); |
| 3092 texture_io_surface_program_[i].Cleanup(context_); | 3094 texture_io_surface_program_[i].Cleanup(gl_); |
| 3093 | 3095 |
| 3094 video_yuv_program_[i].Cleanup(context_); | 3096 video_yuv_program_[i].Cleanup(gl_); |
| 3095 video_yuva_program_[i].Cleanup(context_); | 3097 video_yuva_program_[i].Cleanup(gl_); |
| 3096 video_stream_texture_program_[i].Cleanup(context_); | 3098 video_stream_texture_program_[i].Cleanup(gl_); |
| 3097 } | 3099 } |
| 3098 | 3100 |
| 3099 tile_checkerboard_program_.Cleanup(context_); | 3101 tile_checkerboard_program_.Cleanup(gl_); |
| 3100 | 3102 |
| 3101 debug_border_program_.Cleanup(context_); | 3103 debug_border_program_.Cleanup(gl_); |
| 3102 solid_color_program_.Cleanup(context_); | 3104 solid_color_program_.Cleanup(gl_); |
| 3103 solid_color_program_aa_.Cleanup(context_); | 3105 solid_color_program_aa_.Cleanup(gl_); |
| 3104 | 3106 |
| 3105 if (offscreen_framebuffer_id_) | 3107 if (offscreen_framebuffer_id_) |
| 3106 GLC(context_, context_->deleteFramebuffer(offscreen_framebuffer_id_)); | 3108 GLC(context_, context_->deleteFramebuffer(offscreen_framebuffer_id_)); |
| 3107 | 3109 |
| 3108 if (on_demand_tile_raster_resource_id_) | 3110 if (on_demand_tile_raster_resource_id_) |
| 3109 resource_provider_->DeleteResource(on_demand_tile_raster_resource_id_); | 3111 resource_provider_->DeleteResource(on_demand_tile_raster_resource_id_); |
| 3110 | 3112 |
| 3111 ReleaseRenderPassTextures(); | 3113 ReleaseRenderPassTextures(); |
| 3112 } | 3114 } |
| 3113 | 3115 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3155 // The Skia GPU backend requires a stencil buffer. See ReinitializeGrCanvas | 3157 // The Skia GPU backend requires a stencil buffer. See ReinitializeGrCanvas |
| 3156 // implementation. | 3158 // implementation. |
| 3157 return gr_context_ && context_->getContextAttributes().stencil; | 3159 return gr_context_ && context_->getContextAttributes().stencil; |
| 3158 } | 3160 } |
| 3159 | 3161 |
| 3160 bool GLRenderer::IsContextLost() { | 3162 bool GLRenderer::IsContextLost() { |
| 3161 return output_surface_->context_provider()->IsContextLost(); | 3163 return output_surface_->context_provider()->IsContextLost(); |
| 3162 } | 3164 } |
| 3163 | 3165 |
| 3164 } // namespace cc | 3166 } // namespace cc |
| OLD | NEW |