| 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" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "cc/base/cc_export.h" | 12 #include "cc/base/cc_export.h" |
| 13 | 13 |
| 14 namespace gfx { | 14 namespace gfx { |
| 15 class ColorTransform; |
| 15 class Point; | 16 class Point; |
| 16 class Size; | 17 class Size; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace gpu { | 20 namespace gpu { |
| 20 namespace gles2 { | 21 namespace gles2 { |
| 21 class GLES2Interface; | 22 class GLES2Interface; |
| 22 } | 23 } |
| 23 } | 24 } |
| 24 | 25 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 YUV_HAS_ALPHA_TEXTURE, | 131 YUV_HAS_ALPHA_TEXTURE, |
| 131 }; | 132 }; |
| 132 | 133 |
| 133 enum ColorConversionMode { | 134 enum ColorConversionMode { |
| 134 // No color conversion is performed. | 135 // No color conversion is performed. |
| 135 COLOR_CONVERSION_MODE_NONE, | 136 COLOR_CONVERSION_MODE_NONE, |
| 136 // Conversion is done directly from input RGB space (or YUV space if | 137 // Conversion is done directly from input RGB space (or YUV space if |
| 137 // applicable) to output RGB space, via a 3D texture represented as a 2D | 138 // applicable) to output RGB space, via a 3D texture represented as a 2D |
| 138 // texture. | 139 // texture. |
| 139 COLOR_CONVERSION_MODE_LUT, | 140 COLOR_CONVERSION_MODE_LUT, |
| 141 // Conversion is done analytically in the shader. |
| 142 COLOR_CONVERSION_MODE_SHADER, |
| 140 }; | 143 }; |
| 141 | 144 |
| 142 // TODO(ccameron): Merge this with BlendMode. | 145 // TODO(ccameron): Merge this with BlendMode. |
| 143 enum FragColorMode { | 146 enum FragColorMode { |
| 144 FRAG_COLOR_MODE_DEFAULT, | 147 FRAG_COLOR_MODE_DEFAULT, |
| 145 FRAG_COLOR_MODE_OPAQUE, | 148 FRAG_COLOR_MODE_OPAQUE, |
| 146 FRAG_COLOR_MODE_APPLY_BLEND_MODE, | 149 FRAG_COLOR_MODE_APPLY_BLEND_MODE, |
| 147 }; | 150 }; |
| 148 | 151 |
| 149 enum MaskMode { | 152 enum MaskMode { |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 SamplerType sampler_type_ = SAMPLER_TYPE_NA; | 281 SamplerType sampler_type_ = SAMPLER_TYPE_NA; |
| 279 | 282 |
| 280 BlendMode blend_mode_ = BLEND_MODE_NONE; | 283 BlendMode blend_mode_ = BLEND_MODE_NONE; |
| 281 bool mask_for_background_ = false; | 284 bool mask_for_background_ = false; |
| 282 | 285 |
| 283 // YUV-only parameters. | 286 // YUV-only parameters. |
| 284 YUVAlphaTextureMode yuv_alpha_texture_mode_ = YUV_ALPHA_TEXTURE_MODE_NA; | 287 YUVAlphaTextureMode yuv_alpha_texture_mode_ = YUV_ALPHA_TEXTURE_MODE_NA; |
| 285 UVTextureMode uv_texture_mode_ = UV_TEXTURE_MODE_UV; | 288 UVTextureMode uv_texture_mode_ = UV_TEXTURE_MODE_UV; |
| 286 | 289 |
| 287 ColorConversionMode color_conversion_mode_ = COLOR_CONVERSION_MODE_NONE; | 290 ColorConversionMode color_conversion_mode_ = COLOR_CONVERSION_MODE_NONE; |
| 291 const gfx::ColorTransform* color_transform_ = nullptr; |
| 288 | 292 |
| 289 // YUV uniform locations. | 293 // YUV uniform locations. |
| 290 int y_texture_location_ = -1; | 294 int y_texture_location_ = -1; |
| 291 int u_texture_location_ = -1; | 295 int u_texture_location_ = -1; |
| 292 int v_texture_location_ = -1; | 296 int v_texture_location_ = -1; |
| 293 int uv_texture_location_ = -1; | 297 int uv_texture_location_ = -1; |
| 294 int a_texture_location_ = -1; | 298 int a_texture_location_ = -1; |
| 295 int ya_clamp_rect_location_ = -1; | 299 int ya_clamp_rect_location_ = -1; |
| 296 int uv_clamp_rect_location_ = -1; | 300 int uv_clamp_rect_location_ = -1; |
| 297 | 301 |
| 298 // This matrix will convert from the values read in the YUV texture to | 302 // The resource offset and multiplier to adjust for bit depth. |
| 299 // RGB (including resource offset and scale). If we are using LUT based | 303 int resource_multiplier_location_ = -1; |
| 300 // color conversion, then this will only perform resource offset and scale. | 304 int resource_offset_location_ = -1; |
| 301 int yuv_and_resource_matrix_location_ = -1; | |
| 302 | 305 |
| 303 // LUT YUV to color-converted RGB. | 306 // LUT YUV to color-converted RGB. |
| 304 int lut_texture_location_ = -1; | 307 int lut_texture_location_ = -1; |
| 305 int lut_size_location_ = -1; | 308 int lut_size_location_ = -1; |
| 306 | 309 |
| 307 private: | 310 private: |
| 308 friend class Program; | 311 friend class Program; |
| 309 | 312 |
| 310 std::string GetHelperFunctions() const; | 313 std::string GetHelperFunctions() const; |
| 311 std::string GetBlendFunction() const; | 314 std::string GetBlendFunction() const; |
| 312 std::string GetBlendFunctionBodyForAlpha() const; | 315 std::string GetBlendFunctionBodyForAlpha() const; |
| 313 std::string GetBlendFunctionBodyForRGB() const; | 316 std::string GetBlendFunctionBodyForRGB() const; |
| 314 | 317 |
| 315 DISALLOW_COPY_AND_ASSIGN(FragmentShader); | 318 DISALLOW_COPY_AND_ASSIGN(FragmentShader); |
| 316 }; | 319 }; |
| 317 | 320 |
| 318 } // namespace cc | 321 } // namespace cc |
| 319 | 322 |
| 320 #endif // CC_OUTPUT_SHADER_H_ | 323 #endif // CC_OUTPUT_SHADER_H_ |
| OLD | NEW |