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_ && |
| 31 use_nv12_ == other.use_nv12_ && use_color_lut_ == other.use_color_lut_; |
30 } | 32 } |
31 | 33 |
32 // static | 34 // static |
33 ProgramKey ProgramKey::DebugBorder() { | 35 ProgramKey ProgramKey::DebugBorder() { |
34 ProgramKey result; | 36 ProgramKey result; |
35 result.type_ = PROGRAM_TYPE_DEBUG_BORDER; | 37 result.type_ = PROGRAM_TYPE_DEBUG_BORDER; |
36 return result; | 38 return result; |
37 } | 39 } |
38 | 40 |
39 // static | 41 // static |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 98 |
97 // static | 99 // static |
98 ProgramKey ProgramKey::VideoStream(TexCoordPrecision precision) { | 100 ProgramKey ProgramKey::VideoStream(TexCoordPrecision precision) { |
99 ProgramKey result; | 101 ProgramKey result; |
100 result.type_ = PROGRAM_TYPE_VIDEO_STREAM; | 102 result.type_ = PROGRAM_TYPE_VIDEO_STREAM; |
101 result.precision_ = precision; | 103 result.precision_ = precision; |
102 result.sampler_ = SAMPLER_TYPE_EXTERNAL_OES; | 104 result.sampler_ = SAMPLER_TYPE_EXTERNAL_OES; |
103 return result; | 105 return result; |
104 } | 106 } |
105 | 107 |
| 108 // static |
| 109 ProgramKey ProgramKey::YUVVideo(TexCoordPrecision precision, |
| 110 SamplerType sampler, |
| 111 bool use_alpha_texture, |
| 112 bool use_nv12, |
| 113 bool use_color_lut) { |
| 114 ProgramKey result; |
| 115 result.type_ = PROGRAM_TYPE_YUV_VIDEO; |
| 116 result.precision_ = precision; |
| 117 result.sampler_ = sampler; |
| 118 result.use_alpha_texture_ = use_alpha_texture; |
| 119 result.use_nv12_ = use_nv12; |
| 120 result.use_color_lut_ = use_color_lut; |
| 121 return result; |
| 122 } |
| 123 |
106 ProgramBindingBase::ProgramBindingBase() | 124 ProgramBindingBase::ProgramBindingBase() |
107 : program_(0), | 125 : program_(0), |
108 vertex_shader_id_(0), | 126 vertex_shader_id_(0), |
109 fragment_shader_id_(0), | 127 fragment_shader_id_(0), |
110 initialized_(false) {} | 128 initialized_(false) {} |
111 | 129 |
112 ProgramBindingBase::~ProgramBindingBase() { | 130 ProgramBindingBase::~ProgramBindingBase() { |
113 // If you hit these asserts, you initialized but forgot to call Cleanup(). | 131 // If you hit these asserts, you initialized but forgot to call Cleanup(). |
114 DCHECK(!program_); | 132 DCHECK(!program_); |
115 DCHECK(!vertex_shader_id_); | 133 DCHECK(!vertex_shader_id_); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 context->DeleteShader(fragment_shader_id_); | 245 context->DeleteShader(fragment_shader_id_); |
228 fragment_shader_id_ = 0; | 246 fragment_shader_id_ = 0; |
229 } | 247 } |
230 } | 248 } |
231 | 249 |
232 bool ProgramBindingBase::IsContextLost(GLES2Interface* context) { | 250 bool ProgramBindingBase::IsContextLost(GLES2Interface* context) { |
233 return context->GetGraphicsResetStatusKHR() != GL_NO_ERROR; | 251 return context->GetGraphicsResetStatusKHR() != GL_NO_ERROR; |
234 } | 252 } |
235 | 253 |
236 } // namespace cc | 254 } // namespace cc |
OLD | NEW |