| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/program_binding.h" | 5 #include "cc/output/program_binding.h" |
| 6 | 6 |
| 7 #include "base/trace_event/trace_event.h" | 7 #include "base/trace_event/trace_event.h" |
| 8 #include "cc/output/geometry_binding.h" | 8 #include "cc/output/geometry_binding.h" |
| 9 #include "gpu/GLES2/gl2extchromium.h" | 9 #include "gpu/GLES2/gl2extchromium.h" |
| 10 #include "gpu/command_buffer/client/gles2_interface.h" | 10 #include "gpu/command_buffer/client/gles2_interface.h" |
| 11 | 11 |
| 12 using gpu::gles2::GLES2Interface; | 12 using gpu::gles2::GLES2Interface; |
| 13 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 | 15 |
| 16 ProgramKey::ProgramKey() = default; | 16 ProgramKey::ProgramKey() = default; |
| 17 ProgramKey::ProgramKey(const ProgramKey& other) = default; | 17 ProgramKey::ProgramKey(const ProgramKey& other) = default; |
| 18 ProgramKey::~ProgramKey() = default; | 18 ProgramKey::~ProgramKey() = default; |
| 19 | 19 |
| 20 bool ProgramKey::operator==(const ProgramKey& other) const { | 20 bool ProgramKey::operator==(const ProgramKey& other) const { |
| 21 return type_ == other.type_ && precision_ == other.precision_ && | 21 return type_ == other.type_ && precision_ == other.precision_ && |
| 22 sampler_ == other.sampler_ && blend_mode_ == other.blend_mode_ && | 22 sampler_ == other.sampler_ && blend_mode_ == other.blend_mode_ && |
| 23 aa_mode_ == other.aa_mode_ && swizzle_mode_ == other.swizzle_mode_ && | 23 aa_mode_ == other.aa_mode_ && swizzle_mode_ == other.swizzle_mode_ && |
| 24 is_opaque_ == other.is_opaque_ && | 24 is_opaque_ == other.is_opaque_ && |
| 25 premultiplied_alpha_ == other.premultiplied_alpha_ && | 25 premultiplied_alpha_ == other.premultiplied_alpha_ && |
| 26 has_background_color_ == other.has_background_color_ && | 26 has_background_color_ == other.has_background_color_ && |
| 27 mask_mode_ == other.mask_mode_ && | 27 mask_mode_ == other.mask_mode_ && |
| 28 mask_for_background_ == other.mask_for_background_ && | 28 mask_for_background_ == other.mask_for_background_ && |
| 29 has_color_matrix_ == other.has_color_matrix_ && | 29 has_color_matrix_ == other.has_color_matrix_ && |
| 30 use_alpha_texture_ == other.use_alpha_texture_ && | 30 yuv_alpha_texture_mode_ == other.yuv_alpha_texture_mode_ && |
| 31 use_nv12_ == other.use_nv12_ && use_color_lut_ == other.use_color_lut_; | 31 uv_texture_mode_ == other.uv_texture_mode_ && |
| 32 color_conversion_mode_ == other.color_conversion_mode_; |
| 32 } | 33 } |
| 33 | 34 |
| 34 // static | 35 // static |
| 35 ProgramKey ProgramKey::DebugBorder() { | 36 ProgramKey ProgramKey::DebugBorder() { |
| 36 ProgramKey result; | 37 ProgramKey result; |
| 37 result.type_ = PROGRAM_TYPE_DEBUG_BORDER; | 38 result.type_ = PROGRAM_TYPE_DEBUG_BORDER; |
| 38 return result; | 39 return result; |
| 39 } | 40 } |
| 40 | 41 |
| 41 // static | 42 // static |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 ProgramKey result; | 102 ProgramKey result; |
| 102 result.type_ = PROGRAM_TYPE_VIDEO_STREAM; | 103 result.type_ = PROGRAM_TYPE_VIDEO_STREAM; |
| 103 result.precision_ = precision; | 104 result.precision_ = precision; |
| 104 result.sampler_ = SAMPLER_TYPE_EXTERNAL_OES; | 105 result.sampler_ = SAMPLER_TYPE_EXTERNAL_OES; |
| 105 return result; | 106 return result; |
| 106 } | 107 } |
| 107 | 108 |
| 108 // static | 109 // static |
| 109 ProgramKey ProgramKey::YUVVideo(TexCoordPrecision precision, | 110 ProgramKey ProgramKey::YUVVideo(TexCoordPrecision precision, |
| 110 SamplerType sampler, | 111 SamplerType sampler, |
| 111 bool use_alpha_texture, | 112 YUVAlphaTextureMode yuv_alpha_texture_mode, |
| 112 bool use_nv12, | 113 UVTextureMode uv_texture_mode, |
| 113 bool use_color_lut) { | 114 ColorConversionMode color_conversion_mode) { |
| 114 ProgramKey result; | 115 ProgramKey result; |
| 115 result.type_ = PROGRAM_TYPE_YUV_VIDEO; | 116 result.type_ = PROGRAM_TYPE_YUV_VIDEO; |
| 116 result.precision_ = precision; | 117 result.precision_ = precision; |
| 117 result.sampler_ = sampler; | 118 result.sampler_ = sampler; |
| 118 result.use_alpha_texture_ = use_alpha_texture; | 119 result.yuv_alpha_texture_mode_ = yuv_alpha_texture_mode; |
| 119 result.use_nv12_ = use_nv12; | 120 DCHECK(yuv_alpha_texture_mode == YUV_NO_ALPHA_TEXTURE || |
| 120 result.use_color_lut_ = use_color_lut; | 121 yuv_alpha_texture_mode == YUV_HAS_ALPHA_TEXTURE); |
| 122 result.uv_texture_mode_ = uv_texture_mode; |
| 123 DCHECK(uv_texture_mode == UV_TEXTURE_MODE_UV || |
| 124 uv_texture_mode == UV_TEXTURE_MODE_U_V); |
| 125 result.color_conversion_mode_ = color_conversion_mode; |
| 121 return result; | 126 return result; |
| 122 } | 127 } |
| 123 | 128 |
| 124 ProgramBindingBase::ProgramBindingBase() | 129 ProgramBindingBase::ProgramBindingBase() |
| 125 : program_(0), | 130 : program_(0), |
| 126 vertex_shader_id_(0), | 131 vertex_shader_id_(0), |
| 127 fragment_shader_id_(0), | 132 fragment_shader_id_(0), |
| 128 initialized_(false) {} | 133 initialized_(false) {} |
| 129 | 134 |
| 130 ProgramBindingBase::~ProgramBindingBase() { | 135 ProgramBindingBase::~ProgramBindingBase() { |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 context->DeleteShader(fragment_shader_id_); | 250 context->DeleteShader(fragment_shader_id_); |
| 246 fragment_shader_id_ = 0; | 251 fragment_shader_id_ = 0; |
| 247 } | 252 } |
| 248 } | 253 } |
| 249 | 254 |
| 250 bool ProgramBindingBase::IsContextLost(GLES2Interface* context) { | 255 bool ProgramBindingBase::IsContextLost(GLES2Interface* context) { |
| 251 return context->GetGraphicsResetStatusKHR() != GL_NO_ERROR; | 256 return context->GetGraphicsResetStatusKHR() != GL_NO_ERROR; |
| 252 } | 257 } |
| 253 | 258 |
| 254 } // namespace cc | 259 } // namespace cc |
| OLD | NEW |