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 #ifndef CC_OUTPUT_SHADER_H_ | 5 #ifndef CC_OUTPUT_SHADER_H_ |
6 #define CC_OUTPUT_SHADER_H_ | 6 #define CC_OUTPUT_SHADER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
123 // U and V planes have separate textures. | 123 // U and V planes have separate textures. |
124 UV_TEXTURE_MODE_U_V, | 124 UV_TEXTURE_MODE_U_V, |
125 }; | 125 }; |
126 | 126 |
127 enum YUVAlphaTextureMode { | 127 enum YUVAlphaTextureMode { |
128 YUV_ALPHA_TEXTURE_MODE_NA, | 128 YUV_ALPHA_TEXTURE_MODE_NA, |
129 YUV_NO_ALPHA_TEXTURE, | 129 YUV_NO_ALPHA_TEXTURE, |
130 YUV_HAS_ALPHA_TEXTURE, | 130 YUV_HAS_ALPHA_TEXTURE, |
131 }; | 131 }; |
132 | 132 |
133 enum ColorConversionMode { | |
ccameron
2017/02/02 23:38:07
Please leave this as an enum instead of a boolean
| |
134 // No color conversion is performed. | |
135 COLOR_CONVERSION_MODE_NONE, | |
136 // Conversion is done directly from YUV to output RGB space, via a 3D texture | |
137 // represented as a 2D texture. | |
138 COLOR_CONVERSION_MODE_LUT_FROM_YUV, | |
139 }; | |
140 | |
141 // TODO(ccameron): Merge this with BlendMode. | 133 // TODO(ccameron): Merge this with BlendMode. |
142 enum FragColorMode { | 134 enum FragColorMode { |
143 FRAG_COLOR_MODE_DEFAULT, | 135 FRAG_COLOR_MODE_DEFAULT, |
144 FRAG_COLOR_MODE_OPAQUE, | 136 FRAG_COLOR_MODE_OPAQUE, |
145 FRAG_COLOR_MODE_APPLY_BLEND_MODE, | 137 FRAG_COLOR_MODE_APPLY_BLEND_MODE, |
146 }; | 138 }; |
147 | 139 |
148 enum MaskMode { | 140 enum MaskMode { |
149 NO_MASK = 0, | 141 NO_MASK = 0, |
150 HAS_MASK = 1, | 142 HAS_MASK = 1, |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
276 TexCoordPrecision tex_coord_precision_ = TEX_COORD_PRECISION_NA; | 268 TexCoordPrecision tex_coord_precision_ = TEX_COORD_PRECISION_NA; |
277 SamplerType sampler_type_ = SAMPLER_TYPE_NA; | 269 SamplerType sampler_type_ = SAMPLER_TYPE_NA; |
278 | 270 |
279 BlendMode blend_mode_ = BLEND_MODE_NONE; | 271 BlendMode blend_mode_ = BLEND_MODE_NONE; |
280 bool mask_for_background_ = false; | 272 bool mask_for_background_ = false; |
281 | 273 |
282 // YUV-only parameters. | 274 // YUV-only parameters. |
283 YUVAlphaTextureMode yuv_alpha_texture_mode_ = YUV_ALPHA_TEXTURE_MODE_NA; | 275 YUVAlphaTextureMode yuv_alpha_texture_mode_ = YUV_ALPHA_TEXTURE_MODE_NA; |
284 UVTextureMode uv_texture_mode_ = UV_TEXTURE_MODE_UV; | 276 UVTextureMode uv_texture_mode_ = UV_TEXTURE_MODE_UV; |
285 | 277 |
286 ColorConversionMode color_conversion_mode_ = COLOR_CONVERSION_MODE_NONE; | |
287 | |
288 // YUV uniform locations. | 278 // YUV uniform locations. |
289 int y_texture_location_ = -1; | 279 int y_texture_location_ = -1; |
290 int u_texture_location_ = -1; | 280 int u_texture_location_ = -1; |
291 int v_texture_location_ = -1; | 281 int v_texture_location_ = -1; |
292 int uv_texture_location_ = -1; | 282 int uv_texture_location_ = -1; |
293 int a_texture_location_ = -1; | 283 int a_texture_location_ = -1; |
294 int ya_clamp_rect_location_ = -1; | 284 int ya_clamp_rect_location_ = -1; |
295 int uv_clamp_rect_location_ = -1; | 285 int uv_clamp_rect_location_ = -1; |
296 | 286 |
297 // Analytic YUV to RGB convertion. | 287 // LUT |
298 int yuv_matrix_location_ = -1; | 288 bool has_lut_ = false; |
299 int yuv_adj_location_ = -1; | |
ccameron
2017/02/02 23:38:07
Please continue to use these uniforms instead of c
| |
300 | |
301 // LUT YUV to color-converted RGB. | |
302 int lut_texture_location_ = -1; | 289 int lut_texture_location_ = -1; |
303 int lut_size_location_ = -1; | 290 int lut_size_location_ = -1; |
291 | |
292 bool has_resource_offset_ = false; | |
304 int resource_multiplier_location_ = -1; | 293 int resource_multiplier_location_ = -1; |
305 int resource_offset_location_ = -1; | 294 int resource_offset_location_ = -1; |
306 | 295 |
307 private: | 296 private: |
308 friend class Program; | 297 friend class Program; |
309 | 298 |
310 std::string GetHelperFunctions() const; | 299 std::string GetHelperFunctions() const; |
311 std::string GetBlendFunction() const; | 300 std::string GetBlendFunction() const; |
312 std::string GetBlendFunctionBodyForAlpha() const; | 301 std::string GetBlendFunctionBodyForAlpha() const; |
313 std::string GetBlendFunctionBodyForRGB() const; | 302 std::string GetBlendFunctionBodyForRGB() const; |
314 | 303 |
315 DISALLOW_COPY_AND_ASSIGN(FragmentShader); | 304 DISALLOW_COPY_AND_ASSIGN(FragmentShader); |
316 }; | 305 }; |
317 | 306 |
318 } // namespace cc | 307 } // namespace cc |
319 | 308 |
320 #endif // CC_OUTPUT_SHADER_H_ | 309 #endif // CC_OUTPUT_SHADER_H_ |
OLD | NEW |