| 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> |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 texture_mailbox_deleter_(texture_mailbox_deleter), | 383 texture_mailbox_deleter_(texture_mailbox_deleter), |
| 384 is_scissor_enabled_(false), | 384 is_scissor_enabled_(false), |
| 385 stencil_shadow_(false), | 385 stencil_shadow_(false), |
| 386 blend_shadow_(false), | 386 blend_shadow_(false), |
| 387 highp_threshold_min_(highp_threshold_min), | 387 highp_threshold_min_(highp_threshold_min), |
| 388 highp_threshold_cache_(0), | 388 highp_threshold_cache_(0), |
| 389 use_sync_query_(false), | 389 use_sync_query_(false), |
| 390 gl_composited_texture_quad_border_( | 390 gl_composited_texture_quad_border_( |
| 391 settings->gl_composited_texture_quad_border), | 391 settings->gl_composited_texture_quad_border), |
| 392 bound_geometry_(NO_BINDING), | 392 bound_geometry_(NO_BINDING), |
| 393 color_lut_cache_(gl_), | 393 color_lut_cache_(gl_, |
| 394 output_surface_->context_provider() |
| 395 ->ContextCapabilities() |
| 396 .texture_half_float_linear), |
| 394 weak_ptr_factory_(this) { | 397 weak_ptr_factory_(this) { |
| 395 DCHECK(gl_); | 398 DCHECK(gl_); |
| 396 DCHECK(context_support_); | 399 DCHECK(context_support_); |
| 397 | 400 |
| 398 const auto& context_caps = | 401 const auto& context_caps = |
| 399 output_surface_->context_provider()->ContextCapabilities(); | 402 output_surface_->context_provider()->ContextCapabilities(); |
| 400 DCHECK(!context_caps.iosurface || context_caps.texture_rectangle); | 403 DCHECK(!context_caps.iosurface || context_caps.texture_rectangle); |
| 401 | 404 |
| 402 use_discard_framebuffer_ = context_caps.discard_framebuffer; | 405 use_discard_framebuffer_ = context_caps.discard_framebuffer; |
| 403 use_sync_query_ = context_caps.sync_query; | 406 use_sync_query_ = context_caps.sync_query; |
| (...skipping 1859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2263 if (uv_texture_mode == UV_TEXTURE_MODE_UV) { | 2266 if (uv_texture_mode == UV_TEXTURE_MODE_UV) { |
| 2264 gl_->Uniform1i(program->uv_texture_location(), 2); | 2267 gl_->Uniform1i(program->uv_texture_location(), 2); |
| 2265 } else { | 2268 } else { |
| 2266 gl_->Uniform1i(program->u_texture_location(), 2); | 2269 gl_->Uniform1i(program->u_texture_location(), 2); |
| 2267 gl_->Uniform1i(program->v_texture_location(), 3); | 2270 gl_->Uniform1i(program->v_texture_location(), 3); |
| 2268 } | 2271 } |
| 2269 if (alpha_texture_mode == YUV_HAS_ALPHA_TEXTURE) | 2272 if (alpha_texture_mode == YUV_HAS_ALPHA_TEXTURE) |
| 2270 gl_->Uniform1i(program->a_texture_location(), 4); | 2273 gl_->Uniform1i(program->a_texture_location(), 4); |
| 2271 | 2274 |
| 2272 if (color_conversion_mode == COLOR_CONVERSION_MODE_LUT_FROM_YUV) { | 2275 if (color_conversion_mode == COLOR_CONVERSION_MODE_LUT_FROM_YUV) { |
| 2273 const int kLUTSize = 17; | 2276 ColorLUTCache::LUT lut = color_lut_cache_.GetLUT(quad->video_color_space, |
| 2274 unsigned int lut_texture = color_lut_cache_.GetLUT( | 2277 frame->device_color_space); |
| 2275 quad->video_color_space, frame->device_color_space, kLUTSize); | |
| 2276 gl_->ActiveTexture(GL_TEXTURE5); | 2278 gl_->ActiveTexture(GL_TEXTURE5); |
| 2277 gl_->BindTexture(GL_TEXTURE_2D, lut_texture); | 2279 gl_->BindTexture(GL_TEXTURE_2D, lut.texture); |
| 2278 gl_->Uniform1i(program->lut_texture_location(), 5); | 2280 gl_->Uniform1i(program->lut_texture_location(), 5); |
| 2279 gl_->Uniform1f(program->lut_size_location(), kLUTSize); | 2281 gl_->Uniform1f(program->lut_size_location(), lut.size); |
| 2280 gl_->ActiveTexture(GL_TEXTURE0); | 2282 gl_->ActiveTexture(GL_TEXTURE0); |
| 2281 gl_->Uniform1f(program->resource_multiplier_location(), | 2283 gl_->Uniform1f(program->resource_multiplier_location(), |
| 2282 quad->resource_multiplier); | 2284 quad->resource_multiplier); |
| 2283 gl_->Uniform1f(program->resource_offset_location(), quad->resource_offset); | 2285 gl_->Uniform1f(program->resource_offset_location(), quad->resource_offset); |
| 2284 } else { | 2286 } else { |
| 2285 float yuv_to_rgb_multiplied[9] = {0}; | 2287 float yuv_to_rgb_multiplied[9] = {0}; |
| 2286 float yuv_adjust_with_offset[3] = {0}; | 2288 float yuv_adjust_with_offset[3] = {0}; |
| 2287 ComputeYUVToRGBMatrices(quad->color_space, quad->bits_per_channel, | 2289 ComputeYUVToRGBMatrices(quad->color_space, quad->bits_per_channel, |
| 2288 quad->resource_multiplier, quad->resource_offset, | 2290 quad->resource_multiplier, quad->resource_offset, |
| 2289 yuv_to_rgb_multiplied, yuv_adjust_with_offset); | 2291 yuv_to_rgb_multiplied, yuv_adjust_with_offset); |
| (...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3588 return; | 3590 return; |
| 3589 | 3591 |
| 3590 // Report GPU overdraw as a percentage of |max_result|. | 3592 // Report GPU overdraw as a percentage of |max_result|. |
| 3591 TRACE_COUNTER1( | 3593 TRACE_COUNTER1( |
| 3592 TRACE_DISABLED_BY_DEFAULT("cc.debug.overdraw"), "GPU Overdraw", | 3594 TRACE_DISABLED_BY_DEFAULT("cc.debug.overdraw"), "GPU Overdraw", |
| 3593 (std::accumulate(overdraw->begin(), overdraw->end(), 0) * 100) / | 3595 (std::accumulate(overdraw->begin(), overdraw->end(), 0) * 100) / |
| 3594 max_result); | 3596 max_result); |
| 3595 } | 3597 } |
| 3596 | 3598 |
| 3597 } // namespace cc | 3599 } // namespace cc |
| OLD | NEW |