| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| 11 #include <limits> | 11 #include <limits> |
| 12 #include <memory> | 12 #include <memory> |
| 13 #include <set> | 13 #include <set> |
| 14 #include <string> | 14 #include <string> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "base/feature_list.h" |
| 17 #include "base/logging.h" | 18 #include "base/logging.h" |
| 18 #include "base/macros.h" | 19 #include "base/macros.h" |
| 19 #include "base/memory/ptr_util.h" | 20 #include "base/memory/ptr_util.h" |
| 20 #include "base/strings/string_split.h" | 21 #include "base/strings/string_split.h" |
| 21 #include "base/strings/string_util.h" | 22 #include "base/strings/string_util.h" |
| 22 #include "base/strings/stringprintf.h" | 23 #include "base/strings/stringprintf.h" |
| 23 #include "base/threading/thread_task_runner_handle.h" | 24 #include "base/threading/thread_task_runner_handle.h" |
| 24 #include "base/trace_event/trace_event.h" | 25 #include "base/trace_event/trace_event.h" |
| 25 #include "build/build_config.h" | 26 #include "build/build_config.h" |
| 26 #include "cc/base/container_util.h" | 27 #include "cc/base/container_util.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 41 #include "cc/quads/render_pass.h" | 42 #include "cc/quads/render_pass.h" |
| 42 #include "cc/quads/stream_video_draw_quad.h" | 43 #include "cc/quads/stream_video_draw_quad.h" |
| 43 #include "cc/quads/texture_draw_quad.h" | 44 #include "cc/quads/texture_draw_quad.h" |
| 44 #include "cc/raster/scoped_gpu_raster.h" | 45 #include "cc/raster/scoped_gpu_raster.h" |
| 45 #include "cc/resources/resource_pool.h" | 46 #include "cc/resources/resource_pool.h" |
| 46 #include "cc/resources/scoped_resource.h" | 47 #include "cc/resources/scoped_resource.h" |
| 47 #include "gpu/GLES2/gl2extchromium.h" | 48 #include "gpu/GLES2/gl2extchromium.h" |
| 48 #include "gpu/command_buffer/client/context_support.h" | 49 #include "gpu/command_buffer/client/context_support.h" |
| 49 #include "gpu/command_buffer/client/gles2_interface.h" | 50 #include "gpu/command_buffer/client/gles2_interface.h" |
| 50 #include "gpu/command_buffer/common/gpu_memory_allocation.h" | 51 #include "gpu/command_buffer/common/gpu_memory_allocation.h" |
| 52 #include "media/base/media_switches.h" |
| 51 #include "skia/ext/texture_handle.h" | 53 #include "skia/ext/texture_handle.h" |
| 52 #include "third_party/skia/include/core/SkBitmap.h" | 54 #include "third_party/skia/include/core/SkBitmap.h" |
| 53 #include "third_party/skia/include/core/SkColor.h" | 55 #include "third_party/skia/include/core/SkColor.h" |
| 54 #include "third_party/skia/include/core/SkColorFilter.h" | 56 #include "third_party/skia/include/core/SkColorFilter.h" |
| 55 #include "third_party/skia/include/core/SkImage.h" | 57 #include "third_party/skia/include/core/SkImage.h" |
| 56 #include "third_party/skia/include/core/SkSurface.h" | 58 #include "third_party/skia/include/core/SkSurface.h" |
| 57 #include "third_party/skia/include/gpu/GrContext.h" | 59 #include "third_party/skia/include/gpu/GrContext.h" |
| 58 #include "third_party/skia/include/gpu/gl/GrGLInterface.h" | 60 #include "third_party/skia/include/gpu/gl/GrGLInterface.h" |
| 59 #include "third_party/skia/include/gpu/gl/GrGLTypes.h" | 61 #include "third_party/skia/include/gpu/gl/GrGLTypes.h" |
| 62 #include "ui/gfx/color_space.h" |
| 60 #include "ui/gfx/geometry/quad_f.h" | 63 #include "ui/gfx/geometry/quad_f.h" |
| 61 #include "ui/gfx/geometry/rect_conversions.h" | 64 #include "ui/gfx/geometry/rect_conversions.h" |
| 62 #include "ui/gfx/skia_util.h" | 65 #include "ui/gfx/skia_util.h" |
| 63 | 66 |
| 64 using gpu::gles2::GLES2Interface; | 67 using gpu::gles2::GLES2Interface; |
| 65 | 68 |
| 66 namespace cc { | 69 namespace cc { |
| 67 namespace { | 70 namespace { |
| 68 | 71 |
| 69 Float4 UVTransform(const TextureDrawQuad* quad) { | 72 Float4 UVTransform(const TextureDrawQuad* quad) { |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 is_backbuffer_discarded_(false), | 393 is_backbuffer_discarded_(false), |
| 391 is_scissor_enabled_(false), | 394 is_scissor_enabled_(false), |
| 392 scissor_rect_needs_reset_(true), | 395 scissor_rect_needs_reset_(true), |
| 393 stencil_shadow_(false), | 396 stencil_shadow_(false), |
| 394 blend_shadow_(false), | 397 blend_shadow_(false), |
| 395 highp_threshold_min_(highp_threshold_min), | 398 highp_threshold_min_(highp_threshold_min), |
| 396 highp_threshold_cache_(0), | 399 highp_threshold_cache_(0), |
| 397 use_sync_query_(false), | 400 use_sync_query_(false), |
| 398 gl_composited_texture_quad_border_( | 401 gl_composited_texture_quad_border_( |
| 399 settings->gl_composited_texture_quad_border), | 402 settings->gl_composited_texture_quad_border), |
| 400 bound_geometry_(NO_BINDING) { | 403 bound_geometry_(NO_BINDING), |
| 404 color_lut_cache_(gl_) { |
| 401 DCHECK(gl_); | 405 DCHECK(gl_); |
| 402 DCHECK(context_support_); | 406 DCHECK(context_support_); |
| 403 | 407 |
| 404 const auto& context_caps = | 408 const auto& context_caps = |
| 405 output_surface_->context_provider()->ContextCapabilities(); | 409 output_surface_->context_provider()->ContextCapabilities(); |
| 406 | 410 |
| 407 capabilities_.using_partial_swap = | 411 capabilities_.using_partial_swap = |
| 408 settings_->partial_swap_enabled && context_caps.post_sub_buffer; | 412 settings_->partial_swap_enabled && context_caps.post_sub_buffer; |
| 409 capabilities_.allow_empty_swap = | 413 capabilities_.allow_empty_swap = |
| 410 capabilities_.using_partial_swap || context_caps.commit_overlay_planes; | 414 capabilities_.using_partial_swap || context_caps.commit_overlay_planes; |
| (...skipping 1792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2203 const YUVVideoDrawQuad* quad, | 2207 const YUVVideoDrawQuad* quad, |
| 2204 const gfx::QuadF* clip_region) { | 2208 const gfx::QuadF* clip_region) { |
| 2205 SetBlendEnabled(quad->ShouldDrawWithBlending()); | 2209 SetBlendEnabled(quad->ShouldDrawWithBlending()); |
| 2206 | 2210 |
| 2207 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( | 2211 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( |
| 2208 gl_, &highp_threshold_cache_, highp_threshold_min_, | 2212 gl_, &highp_threshold_cache_, highp_threshold_min_, |
| 2209 quad->shared_quad_state->visible_quad_layer_rect.bottom_right()); | 2213 quad->shared_quad_state->visible_quad_layer_rect.bottom_right()); |
| 2210 | 2214 |
| 2211 bool use_alpha_plane = quad->a_plane_resource_id() != 0; | 2215 bool use_alpha_plane = quad->a_plane_resource_id() != 0; |
| 2212 bool use_nv12 = quad->v_plane_resource_id() == quad->u_plane_resource_id(); | 2216 bool use_nv12 = quad->v_plane_resource_id() == quad->u_plane_resource_id(); |
| 2213 | 2217 bool use_color_lut = |
| 2218 base::FeatureList::IsEnabled(media::kVideoColorManagement); |
| 2214 DCHECK(!(use_nv12 && use_alpha_plane)); | 2219 DCHECK(!(use_nv12 && use_alpha_plane)); |
| 2215 | 2220 |
| 2216 ResourceProvider::ScopedSamplerGL y_plane_lock( | 2221 ResourceProvider::ScopedSamplerGL y_plane_lock( |
| 2217 resource_provider_, quad->y_plane_resource_id(), GL_TEXTURE1, GL_LINEAR); | 2222 resource_provider_, quad->y_plane_resource_id(), GL_TEXTURE1, GL_LINEAR); |
| 2218 ResourceProvider::ScopedSamplerGL u_plane_lock( | 2223 ResourceProvider::ScopedSamplerGL u_plane_lock( |
| 2219 resource_provider_, quad->u_plane_resource_id(), GL_TEXTURE2, GL_LINEAR); | 2224 resource_provider_, quad->u_plane_resource_id(), GL_TEXTURE2, GL_LINEAR); |
| 2220 DCHECK_EQ(y_plane_lock.target(), u_plane_lock.target()); | 2225 DCHECK_EQ(y_plane_lock.target(), u_plane_lock.target()); |
| 2221 // TODO(jbauman): Use base::Optional when available. | 2226 // TODO(jbauman): Use base::Optional when available. |
| 2222 std::unique_ptr<ResourceProvider::ScopedSamplerGL> v_plane_lock; | 2227 std::unique_ptr<ResourceProvider::ScopedSamplerGL> v_plane_lock; |
| 2223 if (!use_nv12) { | 2228 if (!use_nv12) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2242 int ya_tex_offset_location = -1; | 2247 int ya_tex_offset_location = -1; |
| 2243 int uv_tex_scale_location = -1; | 2248 int uv_tex_scale_location = -1; |
| 2244 int uv_tex_offset_location = -1; | 2249 int uv_tex_offset_location = -1; |
| 2245 int ya_clamp_rect_location = -1; | 2250 int ya_clamp_rect_location = -1; |
| 2246 int uv_clamp_rect_location = -1; | 2251 int uv_clamp_rect_location = -1; |
| 2247 int y_texture_location = -1; | 2252 int y_texture_location = -1; |
| 2248 int u_texture_location = -1; | 2253 int u_texture_location = -1; |
| 2249 int v_texture_location = -1; | 2254 int v_texture_location = -1; |
| 2250 int uv_texture_location = -1; | 2255 int uv_texture_location = -1; |
| 2251 int a_texture_location = -1; | 2256 int a_texture_location = -1; |
| 2257 int lut_texture_location = -1; |
| 2252 int yuv_matrix_location = -1; | 2258 int yuv_matrix_location = -1; |
| 2253 int yuv_adj_location = -1; | 2259 int yuv_adj_location = -1; |
| 2254 int alpha_location = -1; | 2260 int alpha_location = -1; |
| 2261 int resource_multiplier_location = -1; |
| 2262 int resource_offset_location = -1; |
| 2255 const VideoYUVProgram* program = GetVideoYUVProgram( | 2263 const VideoYUVProgram* program = GetVideoYUVProgram( |
| 2256 tex_coord_precision, sampler, use_alpha_plane, use_nv12); | 2264 tex_coord_precision, sampler, use_alpha_plane, use_nv12, use_color_lut); |
| 2257 DCHECK(program && (program->initialized() || IsContextLost())); | 2265 DCHECK(program && (program->initialized() || IsContextLost())); |
| 2258 SetUseProgram(program->program()); | 2266 SetUseProgram(program->program()); |
| 2259 matrix_location = program->vertex_shader().matrix_location(); | 2267 matrix_location = program->vertex_shader().matrix_location(); |
| 2260 ya_tex_scale_location = program->vertex_shader().ya_tex_scale_location(); | 2268 ya_tex_scale_location = program->vertex_shader().ya_tex_scale_location(); |
| 2261 ya_tex_offset_location = program->vertex_shader().ya_tex_offset_location(); | 2269 ya_tex_offset_location = program->vertex_shader().ya_tex_offset_location(); |
| 2262 uv_tex_scale_location = program->vertex_shader().uv_tex_scale_location(); | 2270 uv_tex_scale_location = program->vertex_shader().uv_tex_scale_location(); |
| 2263 uv_tex_offset_location = program->vertex_shader().uv_tex_offset_location(); | 2271 uv_tex_offset_location = program->vertex_shader().uv_tex_offset_location(); |
| 2264 y_texture_location = program->fragment_shader().y_texture_location(); | 2272 y_texture_location = program->fragment_shader().y_texture_location(); |
| 2265 u_texture_location = program->fragment_shader().u_texture_location(); | 2273 u_texture_location = program->fragment_shader().u_texture_location(); |
| 2266 v_texture_location = program->fragment_shader().v_texture_location(); | 2274 v_texture_location = program->fragment_shader().v_texture_location(); |
| 2267 uv_texture_location = program->fragment_shader().uv_texture_location(); | 2275 uv_texture_location = program->fragment_shader().uv_texture_location(); |
| 2268 a_texture_location = program->fragment_shader().a_texture_location(); | 2276 a_texture_location = program->fragment_shader().a_texture_location(); |
| 2277 lut_texture_location = program->fragment_shader().lut_texture_location(); |
| 2269 yuv_matrix_location = program->fragment_shader().yuv_matrix_location(); | 2278 yuv_matrix_location = program->fragment_shader().yuv_matrix_location(); |
| 2270 yuv_adj_location = program->fragment_shader().yuv_adj_location(); | 2279 yuv_adj_location = program->fragment_shader().yuv_adj_location(); |
| 2271 ya_clamp_rect_location = program->fragment_shader().ya_clamp_rect_location(); | 2280 ya_clamp_rect_location = program->fragment_shader().ya_clamp_rect_location(); |
| 2272 uv_clamp_rect_location = program->fragment_shader().uv_clamp_rect_location(); | 2281 uv_clamp_rect_location = program->fragment_shader().uv_clamp_rect_location(); |
| 2273 alpha_location = program->fragment_shader().alpha_location(); | 2282 alpha_location = program->fragment_shader().alpha_location(); |
| 2283 resource_multiplier_location = |
| 2284 program->fragment_shader().resource_multiplier_location(); |
| 2285 resource_offset_location = |
| 2286 program->fragment_shader().resource_offset_location(); |
| 2274 | 2287 |
| 2275 gfx::SizeF ya_tex_scale(1.0f, 1.0f); | 2288 gfx::SizeF ya_tex_scale(1.0f, 1.0f); |
| 2276 gfx::SizeF uv_tex_scale(1.0f, 1.0f); | 2289 gfx::SizeF uv_tex_scale(1.0f, 1.0f); |
| 2277 if (sampler != SAMPLER_TYPE_2D_RECT) { | 2290 if (sampler != SAMPLER_TYPE_2D_RECT) { |
| 2278 DCHECK(!quad->ya_tex_size.IsEmpty()); | 2291 DCHECK(!quad->ya_tex_size.IsEmpty()); |
| 2279 DCHECK(!quad->uv_tex_size.IsEmpty()); | 2292 DCHECK(!quad->uv_tex_size.IsEmpty()); |
| 2280 ya_tex_scale = gfx::SizeF(1.0f / quad->ya_tex_size.width(), | 2293 ya_tex_scale = gfx::SizeF(1.0f / quad->ya_tex_size.width(), |
| 2281 1.0f / quad->ya_tex_size.height()); | 2294 1.0f / quad->ya_tex_size.height()); |
| 2282 uv_tex_scale = gfx::SizeF(1.0f / quad->uv_tex_size.width(), | 2295 uv_tex_scale = gfx::SizeF(1.0f / quad->uv_tex_size.width(), |
| 2283 1.0f / quad->uv_tex_size.height()); | 2296 1.0f / quad->uv_tex_size.height()); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2388 | 2401 |
| 2389 for (int i = 0; i < 9; ++i) | 2402 for (int i = 0; i < 9; ++i) |
| 2390 yuv_to_rgb_multiplied[i] = yuv_to_rgb[i] * quad->resource_multiplier; | 2403 yuv_to_rgb_multiplied[i] = yuv_to_rgb[i] * quad->resource_multiplier; |
| 2391 | 2404 |
| 2392 for (int i = 0; i < 3; ++i) { | 2405 for (int i = 0; i < 3; ++i) { |
| 2393 yuv_adjust_with_offset[i] = | 2406 yuv_adjust_with_offset[i] = |
| 2394 yuv_adjust[i] * adjustment_multiplier / quad->resource_multiplier - | 2407 yuv_adjust[i] * adjustment_multiplier / quad->resource_multiplier - |
| 2395 quad->resource_offset; | 2408 quad->resource_offset; |
| 2396 } | 2409 } |
| 2397 | 2410 |
| 2411 if (lut_texture_location != -1) { |
| 2412 unsigned int lut_texture = color_lut_cache_.GetLUT( |
| 2413 quad->video_color_space, output_surface_->color_space(), 32); |
| 2414 gl_->ActiveTexture(GL_TEXTURE5); |
| 2415 gl_->BindTexture(GL_TEXTURE_2D, lut_texture); |
| 2416 gl_->Uniform1i(lut_texture_location, 5); |
| 2417 gl_->ActiveTexture(GL_TEXTURE0); |
| 2418 } |
| 2419 |
| 2420 if (resource_multiplier_location != -1) { |
| 2421 gl_->Uniform1f(resource_multiplier_location, quad->resource_multiplier); |
| 2422 } |
| 2423 |
| 2424 if (resource_offset_location != -1) { |
| 2425 gl_->Uniform1f(resource_offset_location, quad->resource_offset); |
| 2426 } |
| 2427 |
| 2398 // The transform and vertex data are used to figure out the extents that the | 2428 // The transform and vertex data are used to figure out the extents that the |
| 2399 // un-antialiased quad should have and which vertex this is and the float | 2429 // un-antialiased quad should have and which vertex this is and the float |
| 2400 // quad passed in via uniform is the actual geometry that gets used to draw | 2430 // quad passed in via uniform is the actual geometry that gets used to draw |
| 2401 // it. This is why this centered rect is used and not the original quad_rect. | 2431 // it. This is why this centered rect is used and not the original quad_rect. |
| 2402 auto tile_rect = gfx::RectF(quad->rect); | 2432 auto tile_rect = gfx::RectF(quad->rect); |
| 2403 gl_->UniformMatrix3fv(yuv_matrix_location, 1, 0, yuv_to_rgb_multiplied); | 2433 if (yuv_matrix_location != -1) { |
| 2404 gl_->Uniform3fv(yuv_adj_location, 1, yuv_adjust_with_offset); | 2434 gl_->UniformMatrix3fv(yuv_matrix_location, 1, 0, yuv_to_rgb_multiplied); |
| 2435 } |
| 2436 |
| 2437 if (yuv_adj_location) { |
| 2438 gl_->Uniform3fv(yuv_adj_location, 1, yuv_adjust_with_offset); |
| 2439 } |
| 2405 | 2440 |
| 2406 SetShaderOpacity(quad->shared_quad_state->opacity, alpha_location); | 2441 SetShaderOpacity(quad->shared_quad_state->opacity, alpha_location); |
| 2407 if (!clip_region) { | 2442 if (!clip_region) { |
| 2408 DrawQuadGeometry(frame->projection_matrix, | 2443 DrawQuadGeometry(frame->projection_matrix, |
| 2409 quad->shared_quad_state->quad_to_target_transform, | 2444 quad->shared_quad_state->quad_to_target_transform, |
| 2410 tile_rect, matrix_location); | 2445 tile_rect, matrix_location); |
| 2411 } else { | 2446 } else { |
| 2412 float uvs[8] = {0}; | 2447 float uvs[8] = {0}; |
| 2413 GetScaledUVs(quad->visible_rect, clip_region, uvs); | 2448 GetScaledUVs(quad->visible_rect, clip_region, uvs); |
| 2414 gfx::QuadF region_quad = *clip_region; | 2449 gfx::QuadF region_quad = *clip_region; |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2944 } | 2979 } |
| 2945 | 2980 |
| 2946 void GLRenderer::DidReceiveTextureInUseResponses( | 2981 void GLRenderer::DidReceiveTextureInUseResponses( |
| 2947 const gpu::TextureInUseResponses& responses) { | 2982 const gpu::TextureInUseResponses& responses) { |
| 2948 DCHECK(settings_->release_overlay_resources_after_gpu_query); | 2983 DCHECK(settings_->release_overlay_resources_after_gpu_query); |
| 2949 for (const gpu::TextureInUseResponse& response : responses) { | 2984 for (const gpu::TextureInUseResponse& response : responses) { |
| 2950 if (!response.in_use) { | 2985 if (!response.in_use) { |
| 2951 swapped_and_acked_overlay_resources_.erase(response.texture); | 2986 swapped_and_acked_overlay_resources_.erase(response.texture); |
| 2952 } | 2987 } |
| 2953 } | 2988 } |
| 2989 color_lut_cache_.Swap(); |
| 2954 } | 2990 } |
| 2955 | 2991 |
| 2956 void GLRenderer::EnforceMemoryPolicy() { | 2992 void GLRenderer::EnforceMemoryPolicy() { |
| 2957 if (!visible()) { | 2993 if (!visible()) { |
| 2958 TRACE_EVENT0("cc", "GLRenderer::EnforceMemoryPolicy dropping resources"); | 2994 TRACE_EVENT0("cc", "GLRenderer::EnforceMemoryPolicy dropping resources"); |
| 2959 ReleaseRenderPassTextures(); | 2995 ReleaseRenderPassTextures(); |
| 2960 DiscardBackbuffer(); | 2996 DiscardBackbuffer(); |
| 2961 output_surface_->context_provider()->DeleteCachedResources(); | 2997 output_surface_->context_provider()->DeleteCachedResources(); |
| 2962 gl_->Flush(); | 2998 gl_->Flush(); |
| 2963 } | 2999 } |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3635 program->Initialize(output_surface_->context_provider(), precision, | 3671 program->Initialize(output_surface_->context_provider(), precision, |
| 3636 sampler); | 3672 sampler); |
| 3637 } | 3673 } |
| 3638 return program; | 3674 return program; |
| 3639 } | 3675 } |
| 3640 | 3676 |
| 3641 const GLRenderer::VideoYUVProgram* GLRenderer::GetVideoYUVProgram( | 3677 const GLRenderer::VideoYUVProgram* GLRenderer::GetVideoYUVProgram( |
| 3642 TexCoordPrecision precision, | 3678 TexCoordPrecision precision, |
| 3643 SamplerType sampler, | 3679 SamplerType sampler, |
| 3644 bool use_alpha_plane, | 3680 bool use_alpha_plane, |
| 3645 bool use_nv12) { | 3681 bool use_nv12, |
| 3682 bool use_color_lut) { |
| 3646 DCHECK_GE(precision, 0); | 3683 DCHECK_GE(precision, 0); |
| 3647 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 3684 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); |
| 3648 DCHECK_GE(sampler, 0); | 3685 DCHECK_GE(sampler, 0); |
| 3649 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); | 3686 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); |
| 3650 VideoYUVProgram* program = | 3687 VideoYUVProgram* program = |
| 3651 &video_yuv_program_[precision][sampler][use_alpha_plane][use_nv12]; | 3688 &video_yuv_program_[precision][sampler][use_alpha_plane][use_nv12] |
| 3689 [use_color_lut]; |
| 3652 if (!program->initialized()) { | 3690 if (!program->initialized()) { |
| 3653 TRACE_EVENT0("cc", "GLRenderer::videoYUVProgram::initialize"); | 3691 TRACE_EVENT0("cc", "GLRenderer::videoYUVProgram::initialize"); |
| 3654 program->mutable_fragment_shader()->SetFeatures(use_alpha_plane, use_nv12); | 3692 program->mutable_fragment_shader()->SetFeatures(use_alpha_plane, use_nv12, |
| 3693 use_color_lut); |
| 3655 program->Initialize(output_surface_->context_provider(), precision, | 3694 program->Initialize(output_surface_->context_provider(), precision, |
| 3656 sampler); | 3695 sampler); |
| 3657 } | 3696 } |
| 3658 return program; | 3697 return program; |
| 3659 } | 3698 } |
| 3660 | 3699 |
| 3661 const GLRenderer::VideoStreamTextureProgram* | 3700 const GLRenderer::VideoStreamTextureProgram* |
| 3662 GLRenderer::GetVideoStreamTextureProgram(TexCoordPrecision precision) { | 3701 GLRenderer::GetVideoStreamTextureProgram(TexCoordPrecision precision) { |
| 3663 DCHECK_GE(precision, 0); | 3702 DCHECK_GE(precision, 0); |
| 3664 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 3703 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 3688 for (int l = 0; l <= LAST_MASK_VALUE; ++l) { | 3727 for (int l = 0; l <= LAST_MASK_VALUE; ++l) { |
| 3689 render_pass_mask_program_[i][j][k][l].Cleanup(gl_); | 3728 render_pass_mask_program_[i][j][k][l].Cleanup(gl_); |
| 3690 render_pass_mask_program_aa_[i][j][k][l].Cleanup(gl_); | 3729 render_pass_mask_program_aa_[i][j][k][l].Cleanup(gl_); |
| 3691 render_pass_mask_color_matrix_program_aa_[i][j][k][l].Cleanup(gl_); | 3730 render_pass_mask_color_matrix_program_aa_[i][j][k][l].Cleanup(gl_); |
| 3692 render_pass_mask_color_matrix_program_[i][j][k][l].Cleanup(gl_); | 3731 render_pass_mask_color_matrix_program_[i][j][k][l].Cleanup(gl_); |
| 3693 } | 3732 } |
| 3694 } | 3733 } |
| 3695 | 3734 |
| 3696 for (int k = 0; k < 2; k++) { | 3735 for (int k = 0; k < 2; k++) { |
| 3697 for (int l = 0; l < 2; l++) { | 3736 for (int l = 0; l < 2; l++) { |
| 3698 video_yuv_program_[i][j][k][l].Cleanup(gl_); | 3737 for (int m = 0; m < 2; m++) { |
| 3738 video_yuv_program_[i][j][k][l][m].Cleanup(gl_); |
| 3739 } |
| 3699 } | 3740 } |
| 3700 } | 3741 } |
| 3701 } | 3742 } |
| 3702 for (int j = 0; j <= LAST_BLEND_MODE; j++) { | 3743 for (int j = 0; j <= LAST_BLEND_MODE; j++) { |
| 3703 render_pass_program_[i][j].Cleanup(gl_); | 3744 render_pass_program_[i][j].Cleanup(gl_); |
| 3704 render_pass_program_aa_[i][j].Cleanup(gl_); | 3745 render_pass_program_aa_[i][j].Cleanup(gl_); |
| 3705 render_pass_color_matrix_program_[i][j].Cleanup(gl_); | 3746 render_pass_color_matrix_program_[i][j].Cleanup(gl_); |
| 3706 render_pass_color_matrix_program_aa_[i][j].Cleanup(gl_); | 3747 render_pass_color_matrix_program_aa_[i][j].Cleanup(gl_); |
| 3707 } | 3748 } |
| 3708 | 3749 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3848 texture_id = pending_overlay_resources_.back()->texture_id(); | 3889 texture_id = pending_overlay_resources_.back()->texture_id(); |
| 3849 } | 3890 } |
| 3850 | 3891 |
| 3851 context_support_->ScheduleOverlayPlane( | 3892 context_support_->ScheduleOverlayPlane( |
| 3852 overlay.plane_z_order, overlay.transform, texture_id, | 3893 overlay.plane_z_order, overlay.transform, texture_id, |
| 3853 ToNearestRect(overlay.display_rect), overlay.uv_rect); | 3894 ToNearestRect(overlay.display_rect), overlay.uv_rect); |
| 3854 } | 3895 } |
| 3855 } | 3896 } |
| 3856 | 3897 |
| 3857 } // namespace cc | 3898 } // namespace cc |
| OLD | NEW |