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" |
(...skipping 11 matching lines...) Expand all Loading... |
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 yuv_alpha_texture_mode_ == other.yuv_alpha_texture_mode_ && | 30 yuv_alpha_texture_mode_ == other.yuv_alpha_texture_mode_ && |
31 uv_texture_mode_ == other.uv_texture_mode_ && | 31 uv_texture_mode_ == other.uv_texture_mode_ && |
32 color_conversion_mode_ == other.color_conversion_mode_; | 32 has_resource_offset_ == other.has_resource_offset_ && |
| 33 has_lut_ == other.has_lut_; |
33 } | 34 } |
34 | 35 |
35 // static | 36 // static |
36 ProgramKey ProgramKey::DebugBorder() { | 37 ProgramKey ProgramKey::DebugBorder() { |
37 ProgramKey result; | 38 ProgramKey result; |
38 result.type_ = PROGRAM_TYPE_DEBUG_BORDER; | 39 result.type_ = PROGRAM_TYPE_DEBUG_BORDER; |
39 return result; | 40 return result; |
40 } | 41 } |
41 | 42 |
42 // static | 43 // static |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 result.precision_ = precision; | 105 result.precision_ = precision; |
105 result.sampler_ = SAMPLER_TYPE_EXTERNAL_OES; | 106 result.sampler_ = SAMPLER_TYPE_EXTERNAL_OES; |
106 return result; | 107 return result; |
107 } | 108 } |
108 | 109 |
109 // static | 110 // static |
110 ProgramKey ProgramKey::YUVVideo(TexCoordPrecision precision, | 111 ProgramKey ProgramKey::YUVVideo(TexCoordPrecision precision, |
111 SamplerType sampler, | 112 SamplerType sampler, |
112 YUVAlphaTextureMode yuv_alpha_texture_mode, | 113 YUVAlphaTextureMode yuv_alpha_texture_mode, |
113 UVTextureMode uv_texture_mode, | 114 UVTextureMode uv_texture_mode, |
114 ColorConversionMode color_conversion_mode) { | 115 bool use_lut) { |
115 ProgramKey result; | 116 ProgramKey result; |
116 result.type_ = PROGRAM_TYPE_YUV_VIDEO; | 117 result.type_ = PROGRAM_TYPE_YUV_VIDEO; |
117 result.precision_ = precision; | 118 result.precision_ = precision; |
118 result.sampler_ = sampler; | 119 result.sampler_ = sampler; |
119 result.yuv_alpha_texture_mode_ = yuv_alpha_texture_mode; | 120 result.yuv_alpha_texture_mode_ = yuv_alpha_texture_mode; |
120 DCHECK(yuv_alpha_texture_mode == YUV_NO_ALPHA_TEXTURE || | 121 DCHECK(yuv_alpha_texture_mode == YUV_NO_ALPHA_TEXTURE || |
121 yuv_alpha_texture_mode == YUV_HAS_ALPHA_TEXTURE); | 122 yuv_alpha_texture_mode == YUV_HAS_ALPHA_TEXTURE); |
122 result.uv_texture_mode_ = uv_texture_mode; | 123 result.uv_texture_mode_ = uv_texture_mode; |
123 DCHECK(uv_texture_mode == UV_TEXTURE_MODE_UV || | 124 DCHECK(uv_texture_mode == UV_TEXTURE_MODE_UV || |
124 uv_texture_mode == UV_TEXTURE_MODE_U_V); | 125 uv_texture_mode == UV_TEXTURE_MODE_U_V); |
125 result.color_conversion_mode_ = color_conversion_mode; | 126 if (use_lut) { |
| 127 result.has_lut_ = true; |
| 128 result.has_resource_offset_ = true; |
| 129 } else { |
| 130 result.has_color_matrix_ = true; |
| 131 } |
126 return result; | 132 return result; |
127 } | 133 } |
128 | 134 |
129 ProgramBindingBase::ProgramBindingBase() | 135 ProgramBindingBase::ProgramBindingBase() |
130 : program_(0), | 136 : program_(0), |
131 vertex_shader_id_(0), | 137 vertex_shader_id_(0), |
132 fragment_shader_id_(0), | 138 fragment_shader_id_(0), |
133 initialized_(false) {} | 139 initialized_(false) {} |
134 | 140 |
135 ProgramBindingBase::~ProgramBindingBase() { | 141 ProgramBindingBase::~ProgramBindingBase() { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 context->DeleteShader(fragment_shader_id_); | 256 context->DeleteShader(fragment_shader_id_); |
251 fragment_shader_id_ = 0; | 257 fragment_shader_id_ = 0; |
252 } | 258 } |
253 } | 259 } |
254 | 260 |
255 bool ProgramBindingBase::IsContextLost(GLES2Interface* context) { | 261 bool ProgramBindingBase::IsContextLost(GLES2Interface* context) { |
256 return context->GetGraphicsResetStatusKHR() != GL_NO_ERROR; | 262 return context->GetGraphicsResetStatusKHR() != GL_NO_ERROR; |
257 } | 263 } |
258 | 264 |
259 } // namespace cc | 265 } // namespace cc |
OLD | NEW |