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