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

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

Issue 2088273003: Video Color Managament (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: bugfix Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/output/gl_renderer.h" 5 #include "cc/output/gl_renderer.h"
6 6
7 #include <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/trace_event/trace_event.h" 24 #include "base/trace_event/trace_event.h"
24 #include "build/build_config.h" 25 #include "build/build_config.h"
25 #include "cc/base/container_util.h" 26 #include "cc/base/container_util.h"
26 #include "cc/base/math_util.h" 27 #include "cc/base/math_util.h"
(...skipping 12 matching lines...) Expand all
39 #include "cc/quads/picture_draw_quad.h" 40 #include "cc/quads/picture_draw_quad.h"
40 #include "cc/quads/render_pass.h" 41 #include "cc/quads/render_pass.h"
41 #include "cc/quads/stream_video_draw_quad.h" 42 #include "cc/quads/stream_video_draw_quad.h"
42 #include "cc/quads/texture_draw_quad.h" 43 #include "cc/quads/texture_draw_quad.h"
43 #include "cc/raster/scoped_gpu_raster.h" 44 #include "cc/raster/scoped_gpu_raster.h"
44 #include "cc/resources/scoped_resource.h" 45 #include "cc/resources/scoped_resource.h"
45 #include "gpu/GLES2/gl2extchromium.h" 46 #include "gpu/GLES2/gl2extchromium.h"
46 #include "gpu/command_buffer/client/context_support.h" 47 #include "gpu/command_buffer/client/context_support.h"
47 #include "gpu/command_buffer/client/gles2_interface.h" 48 #include "gpu/command_buffer/client/gles2_interface.h"
48 #include "gpu/command_buffer/common/gpu_memory_allocation.h" 49 #include "gpu/command_buffer/common/gpu_memory_allocation.h"
50 #include "media/base/media_switches.h"
49 #include "skia/ext/texture_handle.h" 51 #include "skia/ext/texture_handle.h"
50 #include "third_party/skia/include/core/SkBitmap.h" 52 #include "third_party/skia/include/core/SkBitmap.h"
51 #include "third_party/skia/include/core/SkColor.h" 53 #include "third_party/skia/include/core/SkColor.h"
52 #include "third_party/skia/include/core/SkColorFilter.h" 54 #include "third_party/skia/include/core/SkColorFilter.h"
53 #include "third_party/skia/include/core/SkImage.h" 55 #include "third_party/skia/include/core/SkImage.h"
54 #include "third_party/skia/include/core/SkSurface.h" 56 #include "third_party/skia/include/core/SkSurface.h"
55 #include "third_party/skia/include/gpu/GrContext.h" 57 #include "third_party/skia/include/gpu/GrContext.h"
56 #include "third_party/skia/include/gpu/gl/GrGLInterface.h" 58 #include "third_party/skia/include/gpu/gl/GrGLInterface.h"
57 #include "third_party/skia/include/gpu/gl/GrGLTypes.h" 59 #include "third_party/skia/include/gpu/gl/GrGLTypes.h"
60 #include "ui/gfx/color_space.h"
58 #include "ui/gfx/geometry/quad_f.h" 61 #include "ui/gfx/geometry/quad_f.h"
59 #include "ui/gfx/geometry/rect_conversions.h" 62 #include "ui/gfx/geometry/rect_conversions.h"
60 #include "ui/gfx/skia_util.h" 63 #include "ui/gfx/skia_util.h"
61 64
62 using gpu::gles2::GLES2Interface; 65 using gpu::gles2::GLES2Interface;
63 66
64 namespace cc { 67 namespace cc {
65 namespace { 68 namespace {
66 69
67 Float4 UVTransform(const TextureDrawQuad* quad) { 70 Float4 UVTransform(const TextureDrawQuad* quad) {
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 context_support_(output_surface->context_provider()->ContextSupport()), 326 context_support_(output_surface->context_provider()->ContextSupport()),
324 texture_mailbox_deleter_(texture_mailbox_deleter), 327 texture_mailbox_deleter_(texture_mailbox_deleter),
325 is_backbuffer_discarded_(false), 328 is_backbuffer_discarded_(false),
326 is_scissor_enabled_(false), 329 is_scissor_enabled_(false),
327 scissor_rect_needs_reset_(true), 330 scissor_rect_needs_reset_(true),
328 stencil_shadow_(false), 331 stencil_shadow_(false),
329 blend_shadow_(false), 332 blend_shadow_(false),
330 highp_threshold_min_(highp_threshold_min), 333 highp_threshold_min_(highp_threshold_min),
331 highp_threshold_cache_(0), 334 highp_threshold_cache_(0),
332 use_sync_query_(false), 335 use_sync_query_(false),
333 bound_geometry_(NO_BINDING) { 336 bound_geometry_(NO_BINDING),
337 color_lut_cache_(gl_) {
334 DCHECK(gl_); 338 DCHECK(gl_);
335 DCHECK(context_support_); 339 DCHECK(context_support_);
336 340
337 const auto& context_caps = 341 const auto& context_caps =
338 output_surface_->context_provider()->ContextCapabilities(); 342 output_surface_->context_provider()->ContextCapabilities();
339 343
340 capabilities_.using_partial_swap = 344 capabilities_.using_partial_swap =
341 settings_->partial_swap_enabled && context_caps.post_sub_buffer; 345 settings_->partial_swap_enabled && context_caps.post_sub_buffer;
342 capabilities_.allow_empty_swap = 346 capabilities_.allow_empty_swap =
343 capabilities_.using_partial_swap || context_caps.commit_overlay_planes; 347 capabilities_.using_partial_swap || context_caps.commit_overlay_planes;
(...skipping 1738 matching lines...) Expand 10 before | Expand all | Expand 10 after
2082 const YUVVideoDrawQuad* quad, 2086 const YUVVideoDrawQuad* quad,
2083 const gfx::QuadF* clip_region) { 2087 const gfx::QuadF* clip_region) {
2084 SetBlendEnabled(quad->ShouldDrawWithBlending()); 2088 SetBlendEnabled(quad->ShouldDrawWithBlending());
2085 2089
2086 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( 2090 TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired(
2087 gl_, &highp_threshold_cache_, highp_threshold_min_, 2091 gl_, &highp_threshold_cache_, highp_threshold_min_,
2088 quad->shared_quad_state->visible_quad_layer_rect.bottom_right()); 2092 quad->shared_quad_state->visible_quad_layer_rect.bottom_right());
2089 2093
2090 bool use_alpha_plane = quad->a_plane_resource_id() != 0; 2094 bool use_alpha_plane = quad->a_plane_resource_id() != 0;
2091 bool use_nv12 = quad->v_plane_resource_id() == quad->u_plane_resource_id(); 2095 bool use_nv12 = quad->v_plane_resource_id() == quad->u_plane_resource_id();
2092 2096 #if 1
2097 bool use_color_lut =
2098 base::FeatureList::IsEnabled(media::kVideoColorManagement);
2099 #else
2100 static bool use_color_lut;
2101 use_color_lut = !use_color_lut;
2102 #endif
2093 DCHECK(!(use_nv12 && use_alpha_plane)); 2103 DCHECK(!(use_nv12 && use_alpha_plane));
2094 2104
2095 ResourceProvider::ScopedSamplerGL y_plane_lock( 2105 ResourceProvider::ScopedSamplerGL y_plane_lock(
2096 resource_provider_, quad->y_plane_resource_id(), GL_TEXTURE1, GL_LINEAR); 2106 resource_provider_, quad->y_plane_resource_id(), GL_TEXTURE1, GL_LINEAR);
2097 ResourceProvider::ScopedSamplerGL u_plane_lock( 2107 ResourceProvider::ScopedSamplerGL u_plane_lock(
2098 resource_provider_, quad->u_plane_resource_id(), GL_TEXTURE2, GL_LINEAR); 2108 resource_provider_, quad->u_plane_resource_id(), GL_TEXTURE2, GL_LINEAR);
ccameron 2016/07/21 18:38:13 Here we'd get the gfx::ColorSpace from the y_plane
hubbe 2016/07/21 19:05:30 While entirely possible, it doesn't make any actua
2099 DCHECK_EQ(y_plane_lock.target(), u_plane_lock.target()); 2109 DCHECK_EQ(y_plane_lock.target(), u_plane_lock.target());
2100 // TODO(jbauman): Use base::Optional when available. 2110 // TODO(jbauman): Use base::Optional when available.
2101 std::unique_ptr<ResourceProvider::ScopedSamplerGL> v_plane_lock; 2111 std::unique_ptr<ResourceProvider::ScopedSamplerGL> v_plane_lock;
2102 if (!use_nv12) { 2112 if (!use_nv12) {
2103 v_plane_lock.reset(new ResourceProvider::ScopedSamplerGL( 2113 v_plane_lock.reset(new ResourceProvider::ScopedSamplerGL(
2104 resource_provider_, quad->v_plane_resource_id(), GL_TEXTURE3, 2114 resource_provider_, quad->v_plane_resource_id(), GL_TEXTURE3,
2105 GL_LINEAR)); 2115 GL_LINEAR));
2106 DCHECK_EQ(y_plane_lock.target(), v_plane_lock->target()); 2116 DCHECK_EQ(y_plane_lock.target(), v_plane_lock->target());
2107 } 2117 }
2108 std::unique_ptr<ResourceProvider::ScopedSamplerGL> a_plane_lock; 2118 std::unique_ptr<ResourceProvider::ScopedSamplerGL> a_plane_lock;
(...skipping 12 matching lines...) Expand all
2121 int ya_tex_offset_location = -1; 2131 int ya_tex_offset_location = -1;
2122 int uv_tex_scale_location = -1; 2132 int uv_tex_scale_location = -1;
2123 int uv_tex_offset_location = -1; 2133 int uv_tex_offset_location = -1;
2124 int ya_clamp_rect_location = -1; 2134 int ya_clamp_rect_location = -1;
2125 int uv_clamp_rect_location = -1; 2135 int uv_clamp_rect_location = -1;
2126 int y_texture_location = -1; 2136 int y_texture_location = -1;
2127 int u_texture_location = -1; 2137 int u_texture_location = -1;
2128 int v_texture_location = -1; 2138 int v_texture_location = -1;
2129 int uv_texture_location = -1; 2139 int uv_texture_location = -1;
2130 int a_texture_location = -1; 2140 int a_texture_location = -1;
2141 int lut_texture_location = -1;
2131 int yuv_matrix_location = -1; 2142 int yuv_matrix_location = -1;
2132 int yuv_adj_location = -1; 2143 int yuv_adj_location = -1;
2133 int alpha_location = -1; 2144 int alpha_location = -1;
2145 int resource_multiplier_location = -1;
2146 int resource_offset_location = -1;
2134 const VideoYUVProgram* program = GetVideoYUVProgram( 2147 const VideoYUVProgram* program = GetVideoYUVProgram(
2135 tex_coord_precision, sampler, use_alpha_plane, use_nv12); 2148 tex_coord_precision, sampler, use_alpha_plane, use_nv12, use_color_lut);
2136 DCHECK(program && (program->initialized() || IsContextLost())); 2149 DCHECK(program && (program->initialized() || IsContextLost()));
2137 SetUseProgram(program->program()); 2150 SetUseProgram(program->program());
2138 matrix_location = program->vertex_shader().matrix_location(); 2151 matrix_location = program->vertex_shader().matrix_location();
2139 ya_tex_scale_location = program->vertex_shader().ya_tex_scale_location(); 2152 ya_tex_scale_location = program->vertex_shader().ya_tex_scale_location();
2140 ya_tex_offset_location = program->vertex_shader().ya_tex_offset_location(); 2153 ya_tex_offset_location = program->vertex_shader().ya_tex_offset_location();
2141 uv_tex_scale_location = program->vertex_shader().uv_tex_scale_location(); 2154 uv_tex_scale_location = program->vertex_shader().uv_tex_scale_location();
2142 uv_tex_offset_location = program->vertex_shader().uv_tex_offset_location(); 2155 uv_tex_offset_location = program->vertex_shader().uv_tex_offset_location();
2143 y_texture_location = program->fragment_shader().y_texture_location(); 2156 y_texture_location = program->fragment_shader().y_texture_location();
2144 u_texture_location = program->fragment_shader().u_texture_location(); 2157 u_texture_location = program->fragment_shader().u_texture_location();
2145 v_texture_location = program->fragment_shader().v_texture_location(); 2158 v_texture_location = program->fragment_shader().v_texture_location();
2146 uv_texture_location = program->fragment_shader().uv_texture_location(); 2159 uv_texture_location = program->fragment_shader().uv_texture_location();
2147 a_texture_location = program->fragment_shader().a_texture_location(); 2160 a_texture_location = program->fragment_shader().a_texture_location();
2161 lut_texture_location = program->fragment_shader().lut_texture_location();
2148 yuv_matrix_location = program->fragment_shader().yuv_matrix_location(); 2162 yuv_matrix_location = program->fragment_shader().yuv_matrix_location();
2149 yuv_adj_location = program->fragment_shader().yuv_adj_location(); 2163 yuv_adj_location = program->fragment_shader().yuv_adj_location();
2150 ya_clamp_rect_location = program->fragment_shader().ya_clamp_rect_location(); 2164 ya_clamp_rect_location = program->fragment_shader().ya_clamp_rect_location();
2151 uv_clamp_rect_location = program->fragment_shader().uv_clamp_rect_location(); 2165 uv_clamp_rect_location = program->fragment_shader().uv_clamp_rect_location();
2152 alpha_location = program->fragment_shader().alpha_location(); 2166 alpha_location = program->fragment_shader().alpha_location();
2167 resource_multiplier_location =
2168 program->fragment_shader().resource_multiplier_location();
2169 resource_offset_location =
2170 program->fragment_shader().resource_offset_location();
2153 2171
2154 gfx::SizeF ya_tex_scale(1.0f, 1.0f); 2172 gfx::SizeF ya_tex_scale(1.0f, 1.0f);
2155 gfx::SizeF uv_tex_scale(1.0f, 1.0f); 2173 gfx::SizeF uv_tex_scale(1.0f, 1.0f);
2156 if (sampler != SAMPLER_TYPE_2D_RECT) { 2174 if (sampler != SAMPLER_TYPE_2D_RECT) {
2157 DCHECK(!quad->ya_tex_size.IsEmpty()); 2175 DCHECK(!quad->ya_tex_size.IsEmpty());
2158 DCHECK(!quad->uv_tex_size.IsEmpty()); 2176 DCHECK(!quad->uv_tex_size.IsEmpty());
2159 ya_tex_scale = gfx::SizeF(1.0f / quad->ya_tex_size.width(), 2177 ya_tex_scale = gfx::SizeF(1.0f / quad->ya_tex_size.width(),
2160 1.0f / quad->ya_tex_size.height()); 2178 1.0f / quad->ya_tex_size.height());
2161 uv_tex_scale = gfx::SizeF(1.0f / quad->uv_tex_size.width(), 2179 uv_tex_scale = gfx::SizeF(1.0f / quad->uv_tex_size.width(),
2162 1.0f / quad->uv_tex_size.height()); 2180 1.0f / quad->uv_tex_size.height());
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
2261 float yuv_to_rgb_multiplied[9]; 2279 float yuv_to_rgb_multiplied[9];
2262 float yuv_adjust_with_offset[3]; 2280 float yuv_adjust_with_offset[3];
2263 2281
2264 for (int i = 0; i < 9; ++i) 2282 for (int i = 0; i < 9; ++i)
2265 yuv_to_rgb_multiplied[i] = yuv_to_rgb[i] * quad->resource_multiplier; 2283 yuv_to_rgb_multiplied[i] = yuv_to_rgb[i] * quad->resource_multiplier;
2266 2284
2267 for (int i = 0; i < 3; ++i) 2285 for (int i = 0; i < 3; ++i)
2268 yuv_adjust_with_offset[i] = 2286 yuv_adjust_with_offset[i] =
2269 yuv_adjust[i] / quad->resource_multiplier - quad->resource_offset; 2287 yuv_adjust[i] / quad->resource_multiplier - quad->resource_offset;
2270 2288
2289 if (lut_texture_location != -1) {
2290 unsigned int lut_texture = color_lut_cache_.GetLUT(
2291 quad->video_color_space, output_surface_->color_space(), 32);
2292 gl_->ActiveTexture(GL_TEXTURE5);
2293 gl_->BindTexture(GL_TEXTURE_2D, lut_texture);
2294 gl_->Uniform1i(lut_texture_location, 5);
2295 gl_->ActiveTexture(GL_TEXTURE0);
2296 }
2297
2298 if (resource_multiplier_location != -1) {
2299 gl_->Uniform1f(resource_multiplier_location, quad->resource_multiplier);
2300 }
2301
2302 if (resource_offset_location != -1) {
2303 gl_->Uniform1f(resource_offset_location, quad->resource_offset);
2304 }
2305
2271 // The transform and vertex data are used to figure out the extents that the 2306 // The transform and vertex data are used to figure out the extents that the
2272 // un-antialiased quad should have and which vertex this is and the float 2307 // un-antialiased quad should have and which vertex this is and the float
2273 // quad passed in via uniform is the actual geometry that gets used to draw 2308 // quad passed in via uniform is the actual geometry that gets used to draw
2274 // it. This is why this centered rect is used and not the original quad_rect. 2309 // it. This is why this centered rect is used and not the original quad_rect.
2275 auto tile_rect = gfx::RectF(quad->rect); 2310 auto tile_rect = gfx::RectF(quad->rect);
2276 gl_->UniformMatrix3fv(yuv_matrix_location, 1, 0, yuv_to_rgb_multiplied); 2311 if (yuv_matrix_location != -1) {
2277 gl_->Uniform3fv(yuv_adj_location, 1, yuv_adjust_with_offset); 2312 gl_->UniformMatrix3fv(yuv_matrix_location, 1, 0, yuv_to_rgb_multiplied);
2313 }
2314
2315 if (yuv_adj_location) {
2316 gl_->Uniform3fv(yuv_adj_location, 1, yuv_adjust_with_offset);
2317 }
2278 2318
2279 SetShaderOpacity(quad->shared_quad_state->opacity, alpha_location); 2319 SetShaderOpacity(quad->shared_quad_state->opacity, alpha_location);
2280 if (!clip_region) { 2320 if (!clip_region) {
2281 DrawQuadGeometry(frame, quad->shared_quad_state->quad_to_target_transform, 2321 DrawQuadGeometry(frame, quad->shared_quad_state->quad_to_target_transform,
2282 tile_rect, matrix_location); 2322 tile_rect, matrix_location);
2283 } else { 2323 } else {
2284 float uvs[8] = {0}; 2324 float uvs[8] = {0};
2285 GetScaledUVs(quad->visible_rect, clip_region, uvs); 2325 GetScaledUVs(quad->visible_rect, clip_region, uvs);
2286 gfx::QuadF region_quad = *clip_region; 2326 gfx::QuadF region_quad = *clip_region;
2287 region_quad.Scale(1.0f / tile_rect.width(), 1.0f / tile_rect.height()); 2327 region_quad.Scale(1.0f / tile_rect.width(), 1.0f / tile_rect.height());
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
2792 } 2832 }
2793 2833
2794 void GLRenderer::DidReceiveTextureInUseResponses( 2834 void GLRenderer::DidReceiveTextureInUseResponses(
2795 const gpu::TextureInUseResponses& responses) { 2835 const gpu::TextureInUseResponses& responses) {
2796 DCHECK(settings_->release_overlay_resources_after_gpu_query); 2836 DCHECK(settings_->release_overlay_resources_after_gpu_query);
2797 for (const gpu::TextureInUseResponse& response : responses) { 2837 for (const gpu::TextureInUseResponse& response : responses) {
2798 if (!response.in_use) { 2838 if (!response.in_use) {
2799 swapped_and_acked_overlay_resources_.erase(response.texture); 2839 swapped_and_acked_overlay_resources_.erase(response.texture);
2800 } 2840 }
2801 } 2841 }
2842 color_lut_cache_.Swap();
2802 } 2843 }
2803 2844
2804 void GLRenderer::EnforceMemoryPolicy() { 2845 void GLRenderer::EnforceMemoryPolicy() {
2805 if (!visible()) { 2846 if (!visible()) {
2806 TRACE_EVENT0("cc", "GLRenderer::EnforceMemoryPolicy dropping resources"); 2847 TRACE_EVENT0("cc", "GLRenderer::EnforceMemoryPolicy dropping resources");
2807 ReleaseRenderPassTextures(); 2848 ReleaseRenderPassTextures();
2808 DiscardBackbuffer(); 2849 DiscardBackbuffer();
2809 output_surface_->context_provider()->DeleteCachedResources(); 2850 output_surface_->context_provider()->DeleteCachedResources();
2810 gl_->Flush(); 2851 gl_->Flush();
2811 } 2852 }
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
3483 program->Initialize(output_surface_->context_provider(), precision, 3524 program->Initialize(output_surface_->context_provider(), precision,
3484 sampler); 3525 sampler);
3485 } 3526 }
3486 return program; 3527 return program;
3487 } 3528 }
3488 3529
3489 const GLRenderer::VideoYUVProgram* GLRenderer::GetVideoYUVProgram( 3530 const GLRenderer::VideoYUVProgram* GLRenderer::GetVideoYUVProgram(
3490 TexCoordPrecision precision, 3531 TexCoordPrecision precision,
3491 SamplerType sampler, 3532 SamplerType sampler,
3492 bool use_alpha_plane, 3533 bool use_alpha_plane,
3493 bool use_nv12) { 3534 bool use_nv12,
3535 bool use_color_lut) {
3494 DCHECK_GE(precision, 0); 3536 DCHECK_GE(precision, 0);
3495 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); 3537 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION);
3496 DCHECK_GE(sampler, 0); 3538 DCHECK_GE(sampler, 0);
3497 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); 3539 DCHECK_LE(sampler, LAST_SAMPLER_TYPE);
3498 VideoYUVProgram* program = 3540 VideoYUVProgram* program =
3499 &video_yuv_program_[precision][sampler][use_alpha_plane][use_nv12]; 3541 &video_yuv_program_[precision][sampler][use_alpha_plane][use_nv12]
3542 [use_color_lut];
3500 if (!program->initialized()) { 3543 if (!program->initialized()) {
3501 TRACE_EVENT0("cc", "GLRenderer::videoYUVProgram::initialize"); 3544 TRACE_EVENT0("cc", "GLRenderer::videoYUVProgram::initialize");
3502 program->mutable_fragment_shader()->SetFeatures(use_alpha_plane, use_nv12); 3545 program->mutable_fragment_shader()->SetFeatures(use_alpha_plane, use_nv12,
3546 use_color_lut);
3503 program->Initialize(output_surface_->context_provider(), precision, 3547 program->Initialize(output_surface_->context_provider(), precision,
3504 sampler); 3548 sampler);
3505 } 3549 }
3506 return program; 3550 return program;
3507 } 3551 }
3508 3552
3509 const GLRenderer::VideoStreamTextureProgram* 3553 const GLRenderer::VideoStreamTextureProgram*
3510 GLRenderer::GetVideoStreamTextureProgram(TexCoordPrecision precision) { 3554 GLRenderer::GetVideoStreamTextureProgram(TexCoordPrecision precision) {
3511 DCHECK_GE(precision, 0); 3555 DCHECK_GE(precision, 0);
3512 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); 3556 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION);
(...skipping 23 matching lines...) Expand all
3536 for (int l = 0; l <= LAST_MASK_VALUE; ++l) { 3580 for (int l = 0; l <= LAST_MASK_VALUE; ++l) {
3537 render_pass_mask_program_[i][j][k][l].Cleanup(gl_); 3581 render_pass_mask_program_[i][j][k][l].Cleanup(gl_);
3538 render_pass_mask_program_aa_[i][j][k][l].Cleanup(gl_); 3582 render_pass_mask_program_aa_[i][j][k][l].Cleanup(gl_);
3539 render_pass_mask_color_matrix_program_aa_[i][j][k][l].Cleanup(gl_); 3583 render_pass_mask_color_matrix_program_aa_[i][j][k][l].Cleanup(gl_);
3540 render_pass_mask_color_matrix_program_[i][j][k][l].Cleanup(gl_); 3584 render_pass_mask_color_matrix_program_[i][j][k][l].Cleanup(gl_);
3541 } 3585 }
3542 } 3586 }
3543 3587
3544 for (int k = 0; k < 2; k++) { 3588 for (int k = 0; k < 2; k++) {
3545 for (int l = 0; l < 2; l++) { 3589 for (int l = 0; l < 2; l++) {
3546 video_yuv_program_[i][j][k][l].Cleanup(gl_); 3590 for (int m = 0; m < 2; m++) {
3591 video_yuv_program_[i][j][k][l][m].Cleanup(gl_);
3592 }
3547 } 3593 }
3548 } 3594 }
3549 } 3595 }
3550 for (int j = 0; j <= LAST_BLEND_MODE; j++) { 3596 for (int j = 0; j <= LAST_BLEND_MODE; j++) {
3551 render_pass_program_[i][j].Cleanup(gl_); 3597 render_pass_program_[i][j].Cleanup(gl_);
3552 render_pass_program_aa_[i][j].Cleanup(gl_); 3598 render_pass_program_aa_[i][j].Cleanup(gl_);
3553 render_pass_color_matrix_program_[i][j].Cleanup(gl_); 3599 render_pass_color_matrix_program_[i][j].Cleanup(gl_);
3554 render_pass_color_matrix_program_aa_[i][j].Cleanup(gl_); 3600 render_pass_color_matrix_program_aa_[i][j].Cleanup(gl_);
3555 } 3601 }
3556 3602
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
3684 texture_id = pending_overlay_resources_.back()->texture_id(); 3730 texture_id = pending_overlay_resources_.back()->texture_id();
3685 } 3731 }
3686 3732
3687 context_support_->ScheduleOverlayPlane( 3733 context_support_->ScheduleOverlayPlane(
3688 overlay.plane_z_order, overlay.transform, texture_id, 3734 overlay.plane_z_order, overlay.transform, texture_id,
3689 ToNearestRect(overlay.display_rect), overlay.uv_rect); 3735 ToNearestRect(overlay.display_rect), overlay.uv_rect);
3690 } 3736 }
3691 } 3737 }
3692 3738
3693 } // namespace cc 3739 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698