| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 107 |
| 108 enum InputColorSource { | 108 enum InputColorSource { |
| 109 // This includes RGB and RGBA textures. | 109 // This includes RGB and RGBA textures. |
| 110 INPUT_COLOR_SOURCE_RGBA_TEXTURE, | 110 INPUT_COLOR_SOURCE_RGBA_TEXTURE, |
| 111 // This includes Y and either UV or U-and-V textures. | 111 // This includes Y and either UV or U-and-V textures. |
| 112 INPUT_COLOR_SOURCE_YUV_TEXTURES, | 112 INPUT_COLOR_SOURCE_YUV_TEXTURES, |
| 113 // A solid color specified as a uniform value. | 113 // A solid color specified as a uniform value. |
| 114 INPUT_COLOR_SOURCE_UNIFORM, | 114 INPUT_COLOR_SOURCE_UNIFORM, |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 enum UVTextureMode { |
| 118 // Shader does not use YUV textures. |
| 119 UV_TEXTURE_MODE_NA, |
| 120 // UV plane is a single texture. |
| 121 UV_TEXTURE_MODE_UV, |
| 122 // U and V planes have separate textures. |
| 123 UV_TEXTURE_MODE_U_V, |
| 124 }; |
| 125 |
| 126 enum YUVAlphaTextureMode { |
| 127 YUV_ALPHA_TEXTURE_MODE_NA, |
| 128 YUV_NO_ALPHA_TEXTURE, |
| 129 YUV_HAS_ALPHA_TEXTURE, |
| 130 }; |
| 131 |
| 132 enum ColorConversionMode { |
| 133 // No color conversion is performed. |
| 134 COLOR_CONVERSION_MODE_NONE, |
| 135 // Conversion is done directly from YUV to output RGB space, via a 3D texture |
| 136 // represented as a 2D texture. |
| 137 COLOR_CONVERSION_MODE_2D_LUT_AS_3D_FROM_YUV, |
| 138 }; |
| 139 |
| 117 // TODO(ccameron): Merge this with BlendMode. | 140 // TODO(ccameron): Merge this with BlendMode. |
| 118 enum FragColorMode { | 141 enum FragColorMode { |
| 119 FRAG_COLOR_MODE_DEFAULT, | 142 FRAG_COLOR_MODE_DEFAULT, |
| 120 FRAG_COLOR_MODE_OPAQUE, | 143 FRAG_COLOR_MODE_OPAQUE, |
| 121 FRAG_COLOR_MODE_APPLY_BLEND_MODE, | 144 FRAG_COLOR_MODE_APPLY_BLEND_MODE, |
| 122 }; | 145 }; |
| 123 | 146 |
| 124 enum MaskMode { | 147 enum MaskMode { |
| 125 NO_MASK = 0, | 148 NO_MASK = 0, |
| 126 HAS_MASK = 1, | 149 HAS_MASK = 1, |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 bool has_background_color_ = false; | 272 bool has_background_color_ = false; |
| 250 int background_color_location_ = -1; | 273 int background_color_location_ = -1; |
| 251 | 274 |
| 252 TexCoordPrecision tex_coord_precision_ = TEX_COORD_PRECISION_NA; | 275 TexCoordPrecision tex_coord_precision_ = TEX_COORD_PRECISION_NA; |
| 253 SamplerType sampler_type_ = SAMPLER_TYPE_NA; | 276 SamplerType sampler_type_ = SAMPLER_TYPE_NA; |
| 254 | 277 |
| 255 BlendMode blend_mode_ = BLEND_MODE_NONE; | 278 BlendMode blend_mode_ = BLEND_MODE_NONE; |
| 256 bool mask_for_background_ = false; | 279 bool mask_for_background_ = false; |
| 257 | 280 |
| 258 // YUV-only parameters. | 281 // YUV-only parameters. |
| 259 bool use_alpha_texture_ = false; | 282 YUVAlphaTextureMode yuv_alpha_texture_mode_ = YUV_ALPHA_TEXTURE_MODE_NA; |
| 260 bool use_nv12_ = false; | 283 UVTextureMode uv_texture_mode_ = UV_TEXTURE_MODE_UV; |
| 261 bool use_color_lut_ = false; | 284 |
| 285 ColorConversionMode color_conversion_mode_ = COLOR_CONVERSION_MODE_NONE; |
| 262 | 286 |
| 263 // YUV uniform locations. | 287 // YUV uniform locations. |
| 264 int y_texture_location_ = -1; | 288 int y_texture_location_ = -1; |
| 265 int u_texture_location_ = -1; | 289 int u_texture_location_ = -1; |
| 266 int v_texture_location_ = -1; | 290 int v_texture_location_ = -1; |
| 267 int uv_texture_location_ = -1; | 291 int uv_texture_location_ = -1; |
| 268 int a_texture_location_ = -1; | 292 int a_texture_location_ = -1; |
| 269 int lut_texture_location_ = -1; | 293 int lut_texture_location_ = -1; |
| 270 int yuv_matrix_location_ = -1; | 294 int yuv_matrix_location_ = -1; |
| 271 int yuv_adj_location_ = -1; | 295 int yuv_adj_location_ = -1; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 286 std::string GetHelperFunctions() const; | 310 std::string GetHelperFunctions() const; |
| 287 std::string GetBlendFunction() const; | 311 std::string GetBlendFunction() const; |
| 288 std::string GetBlendFunctionBodyForRGB() const; | 312 std::string GetBlendFunctionBodyForRGB() const; |
| 289 | 313 |
| 290 DISALLOW_COPY_AND_ASSIGN(FragmentShader); | 314 DISALLOW_COPY_AND_ASSIGN(FragmentShader); |
| 291 }; | 315 }; |
| 292 | 316 |
| 293 } // namespace cc | 317 } // namespace cc |
| 294 | 318 |
| 295 #endif // CC_OUTPUT_SHADER_H_ | 319 #endif // CC_OUTPUT_SHADER_H_ |
| OLD | NEW |