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

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

Issue 2648043002: Create FP16 LUTs when needed (Closed)
Patch Set: upload floats, let gl convert Created 3 years, 11 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
« cc/output/color_lut_cache.cc ('K') | « cc/output/color_lut_cache.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 texture_mailbox_deleter_(texture_mailbox_deleter), 382 texture_mailbox_deleter_(texture_mailbox_deleter),
383 is_scissor_enabled_(false), 383 is_scissor_enabled_(false),
384 stencil_shadow_(false), 384 stencil_shadow_(false),
385 blend_shadow_(false), 385 blend_shadow_(false),
386 highp_threshold_min_(highp_threshold_min), 386 highp_threshold_min_(highp_threshold_min),
387 highp_threshold_cache_(0), 387 highp_threshold_cache_(0),
388 use_sync_query_(false), 388 use_sync_query_(false),
389 gl_composited_texture_quad_border_( 389 gl_composited_texture_quad_border_(
390 settings->gl_composited_texture_quad_border), 390 settings->gl_composited_texture_quad_border),
391 bound_geometry_(NO_BINDING), 391 bound_geometry_(NO_BINDING),
392 color_lut_cache_(gl_), 392 color_lut_cache_(gl_,
393 output_surface_->context_provider()
394 ->ContextCapabilities()
395 .texture_half_float_linear),
393 weak_ptr_factory_(this) { 396 weak_ptr_factory_(this) {
394 DCHECK(gl_); 397 DCHECK(gl_);
395 DCHECK(context_support_); 398 DCHECK(context_support_);
396 399
397 const auto& context_caps = 400 const auto& context_caps =
398 output_surface_->context_provider()->ContextCapabilities(); 401 output_surface_->context_provider()->ContextCapabilities();
399 DCHECK(!context_caps.iosurface || context_caps.texture_rectangle); 402 DCHECK(!context_caps.iosurface || context_caps.texture_rectangle);
400 403
401 use_discard_framebuffer_ = context_caps.discard_framebuffer; 404 use_discard_framebuffer_ = context_caps.discard_framebuffer;
402 use_sync_query_ = context_caps.sync_query; 405 use_sync_query_ = context_caps.sync_query;
(...skipping 1858 matching lines...) Expand 10 before | Expand all | Expand 10 after
2261 if (uv_texture_mode == UV_TEXTURE_MODE_UV) { 2264 if (uv_texture_mode == UV_TEXTURE_MODE_UV) {
2262 gl_->Uniform1i(program->uv_texture_location(), 2); 2265 gl_->Uniform1i(program->uv_texture_location(), 2);
2263 } else { 2266 } else {
2264 gl_->Uniform1i(program->u_texture_location(), 2); 2267 gl_->Uniform1i(program->u_texture_location(), 2);
2265 gl_->Uniform1i(program->v_texture_location(), 3); 2268 gl_->Uniform1i(program->v_texture_location(), 3);
2266 } 2269 }
2267 if (alpha_texture_mode == YUV_HAS_ALPHA_TEXTURE) 2270 if (alpha_texture_mode == YUV_HAS_ALPHA_TEXTURE)
2268 gl_->Uniform1i(program->a_texture_location(), 4); 2271 gl_->Uniform1i(program->a_texture_location(), 4);
2269 2272
2270 if (color_conversion_mode == COLOR_CONVERSION_MODE_LUT_FROM_YUV) { 2273 if (color_conversion_mode == COLOR_CONVERSION_MODE_LUT_FROM_YUV) {
2271 const int kLUTSize = 17; 2274 ColorLUTCache::LUT lut = color_lut_cache_.GetLUT(quad->video_color_space,
2272 unsigned int lut_texture = color_lut_cache_.GetLUT( 2275 frame->device_color_space);
2273 quad->video_color_space, frame->device_color_space, kLUTSize);
2274 gl_->ActiveTexture(GL_TEXTURE5); 2276 gl_->ActiveTexture(GL_TEXTURE5);
2275 gl_->BindTexture(GL_TEXTURE_2D, lut_texture); 2277 gl_->BindTexture(GL_TEXTURE_2D, lut.texture);
2276 gl_->Uniform1i(program->lut_texture_location(), 5); 2278 gl_->Uniform1i(program->lut_texture_location(), 5);
2277 gl_->Uniform1f(program->lut_size_location(), kLUTSize); 2279 gl_->Uniform1f(program->lut_size_location(), lut.size);
2278 gl_->ActiveTexture(GL_TEXTURE0); 2280 gl_->ActiveTexture(GL_TEXTURE0);
2279 gl_->Uniform1f(program->resource_multiplier_location(), 2281 gl_->Uniform1f(program->resource_multiplier_location(),
2280 quad->resource_multiplier); 2282 quad->resource_multiplier);
2281 gl_->Uniform1f(program->resource_offset_location(), quad->resource_offset); 2283 gl_->Uniform1f(program->resource_offset_location(), quad->resource_offset);
2282 } else { 2284 } else {
2283 float yuv_to_rgb_multiplied[9] = {0}; 2285 float yuv_to_rgb_multiplied[9] = {0};
2284 float yuv_adjust_with_offset[3] = {0}; 2286 float yuv_adjust_with_offset[3] = {0};
2285 ComputeYUVToRGBMatrices(quad->color_space, quad->bits_per_channel, 2287 ComputeYUVToRGBMatrices(quad->color_space, quad->bits_per_channel,
2286 quad->resource_multiplier, quad->resource_offset, 2288 quad->resource_multiplier, quad->resource_offset,
2287 yuv_to_rgb_multiplied, yuv_adjust_with_offset); 2289 yuv_to_rgb_multiplied, yuv_adjust_with_offset);
(...skipping 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after
3575 // Return early if we are expecting more results. 3577 // Return early if we are expecting more results.
3576 if (overdraw->size() < num_expected_results) 3578 if (overdraw->size() < num_expected_results)
3577 return; 3579 return;
3578 3580
3579 // Report the maximum amount of overdraw. 3581 // Report the maximum amount of overdraw.
3580 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("cc.debug.overdraw"), "GPU Overdraw", 3582 TRACE_COUNTER1(TRACE_DISABLED_BY_DEFAULT("cc.debug.overdraw"), "GPU Overdraw",
3581 *std::max_element(overdraw->begin(), overdraw->end())); 3583 *std::max_element(overdraw->begin(), overdraw->end()));
3582 } 3584 }
3583 3585
3584 } // namespace cc 3586 } // namespace cc
OLDNEW
« cc/output/color_lut_cache.cc ('K') | « cc/output/color_lut_cache.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698