| 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 2985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2996 clipped_geometry_->PrepareForDraw(); | 2996 clipped_geometry_->PrepareForDraw(); |
| 2997 break; | 2997 break; |
| 2998 case NO_BINDING: | 2998 case NO_BINDING: |
| 2999 break; | 2999 break; |
| 3000 } | 3000 } |
| 3001 bound_geometry_ = binding; | 3001 bound_geometry_ = binding; |
| 3002 } | 3002 } |
| 3003 | 3003 |
| 3004 void GLRenderer::SetUseProgram(const ProgramKey& program_key, | 3004 void GLRenderer::SetUseProgram(const ProgramKey& program_key, |
| 3005 const gfx::ColorSpace& src_color_space) { | 3005 const gfx::ColorSpace& src_color_space) { |
| 3006 // The source color space for non-YUV draw quads should always be full-range |
| 3007 // RGB. |
| 3008 if (!disable_color_checks_for_testing_) |
| 3009 DCHECK_EQ(src_color_space, src_color_space.GetAsFullRangeRGB()); |
| 3010 |
| 3006 // Ensure that we do not apply any color conversion unless the color correct | 3011 // Ensure that we do not apply any color conversion unless the color correct |
| 3007 // rendering flag has been specified. This is because media mailboxes will | 3012 // rendering flag has been specified. This is because media mailboxes will |
| 3008 // provide YUV color spaces despite YUV to RGB conversion already having been | 3013 // provide YUV color spaces despite YUV to RGB conversion already having been |
| 3009 // performed. | 3014 // performed. |
| 3010 // TODO(ccameron): Ensure that media mailboxes be accurate. | |
| 3011 // https://crbug.com/699243 | |
| 3012 // The source color space for non-YUV draw quads should always be full-range | |
| 3013 // RGB. | |
| 3014 if (settings_->enable_color_correct_rendering) { | 3015 if (settings_->enable_color_correct_rendering) { |
| 3015 SetUseProgram(program_key, src_color_space, | 3016 SetUseProgram(program_key, src_color_space, |
| 3016 current_frame()->current_render_pass->color_space); | 3017 current_frame()->current_render_pass->color_space); |
| 3017 } else { | 3018 } else { |
| 3018 DCHECK_EQ(src_color_space, src_color_space.GetAsFullRangeRGB()); | |
| 3019 SetUseProgram(program_key, gfx::ColorSpace(), gfx::ColorSpace()); | 3019 SetUseProgram(program_key, gfx::ColorSpace(), gfx::ColorSpace()); |
| 3020 } | 3020 } |
| 3021 } | 3021 } |
| 3022 | 3022 |
| 3023 void GLRenderer::SetUseProgram(const ProgramKey& program_key_no_color, | 3023 void GLRenderer::SetUseProgram(const ProgramKey& program_key_no_color, |
| 3024 const gfx::ColorSpace& src_color_space, | 3024 const gfx::ColorSpace& src_color_space, |
| 3025 const gfx::ColorSpace& dst_color_space) { | 3025 const gfx::ColorSpace& dst_color_space) { |
| 3026 ProgramKey program_key = program_key_no_color; | 3026 ProgramKey program_key = program_key_no_color; |
| 3027 const gfx::ColorTransform* color_transform = | 3027 const gfx::ColorTransform* color_transform = |
| 3028 GetColorTransform(src_color_space, dst_color_space); | 3028 GetColorTransform(src_color_space, dst_color_space); |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3596 return; | 3596 return; |
| 3597 | 3597 |
| 3598 // Report GPU overdraw as a percentage of |max_result|. | 3598 // Report GPU overdraw as a percentage of |max_result|. |
| 3599 TRACE_COUNTER1( | 3599 TRACE_COUNTER1( |
| 3600 TRACE_DISABLED_BY_DEFAULT("cc.debug.overdraw"), "GPU Overdraw", | 3600 TRACE_DISABLED_BY_DEFAULT("cc.debug.overdraw"), "GPU Overdraw", |
| 3601 (std::accumulate(overdraw->begin(), overdraw->end(), 0) * 100) / | 3601 (std::accumulate(overdraw->begin(), overdraw->end(), 0) * 100) / |
| 3602 max_result); | 3602 max_result); |
| 3603 } | 3603 } |
| 3604 | 3604 |
| 3605 } // namespace cc | 3605 } // namespace cc |
| OLD | NEW |