| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 YUV_ALPHA_TEXTURE_MODE_NA, | 127 YUV_ALPHA_TEXTURE_MODE_NA, |
| 128 YUV_NO_ALPHA_TEXTURE, | 128 YUV_NO_ALPHA_TEXTURE, |
| 129 YUV_HAS_ALPHA_TEXTURE, | 129 YUV_HAS_ALPHA_TEXTURE, |
| 130 }; | 130 }; |
| 131 | 131 |
| 132 enum ColorConversionMode { | 132 enum ColorConversionMode { |
| 133 // No color conversion is performed. | 133 // No color conversion is performed. |
| 134 COLOR_CONVERSION_MODE_NONE, | 134 COLOR_CONVERSION_MODE_NONE, |
| 135 // Conversion is done directly from YUV to output RGB space, via a 3D texture | 135 // Conversion is done directly from YUV to output RGB space, via a 3D texture |
| 136 // represented as a 2D texture. | 136 // represented as a 2D texture. |
| 137 COLOR_CONVERSION_MODE_2D_LUT_AS_3D_FROM_YUV, | 137 COLOR_CONVERSION_MODE_LUT_FROM_YUV, |
| 138 }; | 138 }; |
| 139 | 139 |
| 140 // TODO(ccameron): Merge this with BlendMode. | 140 // TODO(ccameron): Merge this with BlendMode. |
| 141 enum FragColorMode { | 141 enum FragColorMode { |
| 142 FRAG_COLOR_MODE_DEFAULT, | 142 FRAG_COLOR_MODE_DEFAULT, |
| 143 FRAG_COLOR_MODE_OPAQUE, | 143 FRAG_COLOR_MODE_OPAQUE, |
| 144 FRAG_COLOR_MODE_APPLY_BLEND_MODE, | 144 FRAG_COLOR_MODE_APPLY_BLEND_MODE, |
| 145 }; | 145 }; |
| 146 | 146 |
| 147 enum MaskMode { | 147 enum MaskMode { |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 UVTextureMode uv_texture_mode_ = UV_TEXTURE_MODE_UV; | 283 UVTextureMode uv_texture_mode_ = UV_TEXTURE_MODE_UV; |
| 284 | 284 |
| 285 ColorConversionMode color_conversion_mode_ = COLOR_CONVERSION_MODE_NONE; | 285 ColorConversionMode color_conversion_mode_ = COLOR_CONVERSION_MODE_NONE; |
| 286 | 286 |
| 287 // YUV uniform locations. | 287 // YUV uniform locations. |
| 288 int y_texture_location_ = -1; | 288 int y_texture_location_ = -1; |
| 289 int u_texture_location_ = -1; | 289 int u_texture_location_ = -1; |
| 290 int v_texture_location_ = -1; | 290 int v_texture_location_ = -1; |
| 291 int uv_texture_location_ = -1; | 291 int uv_texture_location_ = -1; |
| 292 int a_texture_location_ = -1; | 292 int a_texture_location_ = -1; |
| 293 int lut_texture_location_ = -1; | 293 int ya_clamp_rect_location_ = -1; |
| 294 int uv_clamp_rect_location_ = -1; |
| 295 |
| 296 // Analytic YUV to RGB convertion. |
| 294 int yuv_matrix_location_ = -1; | 297 int yuv_matrix_location_ = -1; |
| 295 int yuv_adj_location_ = -1; | 298 int yuv_adj_location_ = -1; |
| 296 int ya_clamp_rect_location_ = -1; | 299 |
| 297 int uv_clamp_rect_location_ = -1; | 300 // LUT YUV to color-converted RGB. |
| 301 int lut_texture_location_ = -1; |
| 302 int lut_size_location_ = -1; |
| 298 int resource_multiplier_location_ = -1; | 303 int resource_multiplier_location_ = -1; |
| 299 int resource_offset_location_ = -1; | 304 int resource_offset_location_ = -1; |
| 300 | 305 |
| 301 private: | 306 private: |
| 302 friend class Program; | 307 friend class Program; |
| 303 | 308 |
| 304 // Functions specific to YUV video. | |
| 305 std::string GetShaderStringYUVVideo() const; | |
| 306 void InitYUVVideo(gpu::gles2::GLES2Interface* context, | |
| 307 unsigned program, | |
| 308 int* base_uniform_index); | |
| 309 | |
| 310 std::string GetHelperFunctions() const; | 309 std::string GetHelperFunctions() const; |
| 311 std::string GetBlendFunction() const; | 310 std::string GetBlendFunction() const; |
| 312 std::string GetBlendFunctionBodyForRGB() const; | 311 std::string GetBlendFunctionBodyForRGB() const; |
| 313 | 312 |
| 314 DISALLOW_COPY_AND_ASSIGN(FragmentShader); | 313 DISALLOW_COPY_AND_ASSIGN(FragmentShader); |
| 315 }; | 314 }; |
| 316 | 315 |
| 317 } // namespace cc | 316 } // namespace cc |
| 318 | 317 |
| 319 #endif // CC_OUTPUT_SHADER_H_ | 318 #endif // CC_OUTPUT_SHADER_H_ |
| OLD | NEW |