| 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/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "cc/base/cc_export.h" | 11 #include "cc/base/cc_export.h" |
| 12 #include "third_party/skia/include/core/SkColorPriv.h" | 12 #include "third_party/skia/include/core/SkColorPriv.h" |
| 13 | 13 |
| 14 namespace gfx { | 14 namespace gfx { |
| 15 class Point; | 15 class Point; |
| 16 class Size; | 16 class Size; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace WebKit { class WebGraphicsContext3D; } | 19 namespace blink { class WebGraphicsContext3D; } |
| 20 | 20 |
| 21 namespace cc { | 21 namespace cc { |
| 22 | 22 |
| 23 enum TexCoordPrecision { | 23 enum TexCoordPrecision { |
| 24 TexCoordPrecisionNA, | 24 TexCoordPrecisionNA, |
| 25 TexCoordPrecisionMedium, | 25 TexCoordPrecisionMedium, |
| 26 TexCoordPrecisionHigh, | 26 TexCoordPrecisionHigh, |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 // Note: The highp_threshold_cache must be provided by the caller to make | 29 // Note: The highp_threshold_cache must be provided by the caller to make |
| 30 // the caching multi-thread/context safe in an easy low-overhead manner. | 30 // the caching multi-thread/context safe in an easy low-overhead manner. |
| 31 // The caller must make sure to clear highp_threshold_cache to 0, so it can be | 31 // The caller must make sure to clear highp_threshold_cache to 0, so it can be |
| 32 // reinitialized, if a new or different context is used. | 32 // reinitialized, if a new or different context is used. |
| 33 CC_EXPORT TexCoordPrecision TexCoordPrecisionRequired( | 33 CC_EXPORT TexCoordPrecision TexCoordPrecisionRequired( |
| 34 WebKit::WebGraphicsContext3D* context, | 34 blink::WebGraphicsContext3D* context, |
| 35 int *highp_threshold_cache, | 35 int *highp_threshold_cache, |
| 36 int highp_threshold_min, | 36 int highp_threshold_min, |
| 37 gfx::Point max_coordinate); | 37 gfx::Point max_coordinate); |
| 38 | 38 |
| 39 CC_EXPORT TexCoordPrecision TexCoordPrecisionRequired( | 39 CC_EXPORT TexCoordPrecision TexCoordPrecisionRequired( |
| 40 WebKit::WebGraphicsContext3D* context, | 40 blink::WebGraphicsContext3D* context, |
| 41 int *highp_threshold_cache, | 41 int *highp_threshold_cache, |
| 42 int highp_threshold_min, | 42 int highp_threshold_min, |
| 43 gfx::Size max_size); | 43 gfx::Size max_size); |
| 44 | 44 |
| 45 class VertexShaderPosTex { | 45 class VertexShaderPosTex { |
| 46 public: | 46 public: |
| 47 VertexShaderPosTex(); | 47 VertexShaderPosTex(); |
| 48 | 48 |
| 49 void Init(WebKit::WebGraphicsContext3D* context, | 49 void Init(blink::WebGraphicsContext3D* context, |
| 50 unsigned program, | 50 unsigned program, |
| 51 int* base_uniform_index); | 51 int* base_uniform_index); |
| 52 std::string GetShaderString() const; | 52 std::string GetShaderString() const; |
| 53 | 53 |
| 54 int matrix_location() const { return matrix_location_; } | 54 int matrix_location() const { return matrix_location_; } |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 int matrix_location_; | 57 int matrix_location_; |
| 58 | 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(VertexShaderPosTex); | 59 DISALLOW_COPY_AND_ASSIGN(VertexShaderPosTex); |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 class VertexShaderPosTexYUVStretch { | 62 class VertexShaderPosTexYUVStretch { |
| 63 public: | 63 public: |
| 64 VertexShaderPosTexYUVStretch(); | 64 VertexShaderPosTexYUVStretch(); |
| 65 | 65 |
| 66 void Init(WebKit::WebGraphicsContext3D* context, | 66 void Init(blink::WebGraphicsContext3D* context, |
| 67 unsigned program, | 67 unsigned program, |
| 68 int* base_uniform_index); | 68 int* base_uniform_index); |
| 69 std::string GetShaderString() const; | 69 std::string GetShaderString() const; |
| 70 | 70 |
| 71 int matrix_location() const { return matrix_location_; } | 71 int matrix_location() const { return matrix_location_; } |
| 72 int tex_scale_location() const { return tex_scale_location_; } | 72 int tex_scale_location() const { return tex_scale_location_; } |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 int matrix_location_; | 75 int matrix_location_; |
| 76 int tex_scale_location_; | 76 int tex_scale_location_; |
| 77 | 77 |
| 78 DISALLOW_COPY_AND_ASSIGN(VertexShaderPosTexYUVStretch); | 78 DISALLOW_COPY_AND_ASSIGN(VertexShaderPosTexYUVStretch); |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 class VertexShaderPos { | 81 class VertexShaderPos { |
| 82 public: | 82 public: |
| 83 VertexShaderPos(); | 83 VertexShaderPos(); |
| 84 | 84 |
| 85 void Init(WebKit::WebGraphicsContext3D* context, | 85 void Init(blink::WebGraphicsContext3D* context, |
| 86 unsigned program, | 86 unsigned program, |
| 87 int* base_uniform_index); | 87 int* base_uniform_index); |
| 88 std::string GetShaderString() const; | 88 std::string GetShaderString() const; |
| 89 | 89 |
| 90 int matrix_location() const { return matrix_location_; } | 90 int matrix_location() const { return matrix_location_; } |
| 91 | 91 |
| 92 private: | 92 private: |
| 93 int matrix_location_; | 93 int matrix_location_; |
| 94 | 94 |
| 95 DISALLOW_COPY_AND_ASSIGN(VertexShaderPos); | 95 DISALLOW_COPY_AND_ASSIGN(VertexShaderPos); |
| 96 }; | 96 }; |
| 97 | 97 |
| 98 class VertexShaderPosTexIdentity { | 98 class VertexShaderPosTexIdentity { |
| 99 public: | 99 public: |
| 100 void Init(WebKit::WebGraphicsContext3D* context, | 100 void Init(blink::WebGraphicsContext3D* context, |
| 101 unsigned program, | 101 unsigned program, |
| 102 int* base_uniform_index) {} | 102 int* base_uniform_index) {} |
| 103 std::string GetShaderString() const; | 103 std::string GetShaderString() const; |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 class VertexShaderPosTexTransform { | 106 class VertexShaderPosTexTransform { |
| 107 public: | 107 public: |
| 108 VertexShaderPosTexTransform(); | 108 VertexShaderPosTexTransform(); |
| 109 | 109 |
| 110 void Init(WebKit::WebGraphicsContext3D* context, | 110 void Init(blink::WebGraphicsContext3D* context, |
| 111 unsigned program, | 111 unsigned program, |
| 112 int* base_uniform_index); | 112 int* base_uniform_index); |
| 113 std::string GetShaderString() const; | 113 std::string GetShaderString() const; |
| 114 | 114 |
| 115 int matrix_location() const { return matrix_location_; } | 115 int matrix_location() const { return matrix_location_; } |
| 116 int tex_transform_location() const { return tex_transform_location_; } | 116 int tex_transform_location() const { return tex_transform_location_; } |
| 117 int vertex_opacity_location() const { return vertex_opacity_location_; } | 117 int vertex_opacity_location() const { return vertex_opacity_location_; } |
| 118 | 118 |
| 119 private: | 119 private: |
| 120 int matrix_location_; | 120 int matrix_location_; |
| 121 int tex_transform_location_; | 121 int tex_transform_location_; |
| 122 int vertex_opacity_location_; | 122 int vertex_opacity_location_; |
| 123 | 123 |
| 124 DISALLOW_COPY_AND_ASSIGN(VertexShaderPosTexTransform); | 124 DISALLOW_COPY_AND_ASSIGN(VertexShaderPosTexTransform); |
| 125 }; | 125 }; |
| 126 | 126 |
| 127 class VertexShaderQuad { | 127 class VertexShaderQuad { |
| 128 public: | 128 public: |
| 129 VertexShaderQuad(); | 129 VertexShaderQuad(); |
| 130 | 130 |
| 131 void Init(WebKit::WebGraphicsContext3D* context, | 131 void Init(blink::WebGraphicsContext3D* context, |
| 132 unsigned program, | 132 unsigned program, |
| 133 int* base_uniform_index); | 133 int* base_uniform_index); |
| 134 std::string GetShaderString() const; | 134 std::string GetShaderString() const; |
| 135 | 135 |
| 136 int matrix_location() const { return matrix_location_; } | 136 int matrix_location() const { return matrix_location_; } |
| 137 int viewport_location() const { return -1; } | 137 int viewport_location() const { return -1; } |
| 138 int quad_location() const { return quad_location_; } | 138 int quad_location() const { return quad_location_; } |
| 139 int edge_location() const { return -1; } | 139 int edge_location() const { return -1; } |
| 140 | 140 |
| 141 private: | 141 private: |
| 142 int matrix_location_; | 142 int matrix_location_; |
| 143 int quad_location_; | 143 int quad_location_; |
| 144 | 144 |
| 145 DISALLOW_COPY_AND_ASSIGN(VertexShaderQuad); | 145 DISALLOW_COPY_AND_ASSIGN(VertexShaderQuad); |
| 146 }; | 146 }; |
| 147 | 147 |
| 148 class VertexShaderQuadAA { | 148 class VertexShaderQuadAA { |
| 149 public: | 149 public: |
| 150 VertexShaderQuadAA(); | 150 VertexShaderQuadAA(); |
| 151 | 151 |
| 152 void Init(WebKit::WebGraphicsContext3D* context, | 152 void Init(blink::WebGraphicsContext3D* context, |
| 153 unsigned program, | 153 unsigned program, |
| 154 int* base_uniform_index); | 154 int* base_uniform_index); |
| 155 std::string GetShaderString() const; | 155 std::string GetShaderString() const; |
| 156 | 156 |
| 157 int matrix_location() const { return matrix_location_; } | 157 int matrix_location() const { return matrix_location_; } |
| 158 int viewport_location() const { return viewport_location_; } | 158 int viewport_location() const { return viewport_location_; } |
| 159 int quad_location() const { return quad_location_; } | 159 int quad_location() const { return quad_location_; } |
| 160 int edge_location() const { return edge_location_; } | 160 int edge_location() const { return edge_location_; } |
| 161 | 161 |
| 162 private: | 162 private: |
| 163 int matrix_location_; | 163 int matrix_location_; |
| 164 int viewport_location_; | 164 int viewport_location_; |
| 165 int quad_location_; | 165 int quad_location_; |
| 166 int edge_location_; | 166 int edge_location_; |
| 167 | 167 |
| 168 DISALLOW_COPY_AND_ASSIGN(VertexShaderQuadAA); | 168 DISALLOW_COPY_AND_ASSIGN(VertexShaderQuadAA); |
| 169 }; | 169 }; |
| 170 | 170 |
| 171 | 171 |
| 172 class VertexShaderQuadTexTransformAA { | 172 class VertexShaderQuadTexTransformAA { |
| 173 public: | 173 public: |
| 174 VertexShaderQuadTexTransformAA(); | 174 VertexShaderQuadTexTransformAA(); |
| 175 | 175 |
| 176 void Init(WebKit::WebGraphicsContext3D* context, | 176 void Init(blink::WebGraphicsContext3D* context, |
| 177 unsigned program, | 177 unsigned program, |
| 178 int* base_uniform_index); | 178 int* base_uniform_index); |
| 179 std::string GetShaderString() const; | 179 std::string GetShaderString() const; |
| 180 | 180 |
| 181 int matrix_location() const { return matrix_location_; } | 181 int matrix_location() const { return matrix_location_; } |
| 182 int viewport_location() const { return viewport_location_; } | 182 int viewport_location() const { return viewport_location_; } |
| 183 int quad_location() const { return quad_location_; } | 183 int quad_location() const { return quad_location_; } |
| 184 int edge_location() const { return edge_location_; } | 184 int edge_location() const { return edge_location_; } |
| 185 int tex_transform_location() const { return tex_transform_location_; } | 185 int tex_transform_location() const { return tex_transform_location_; } |
| 186 | 186 |
| 187 private: | 187 private: |
| 188 int matrix_location_; | 188 int matrix_location_; |
| 189 int viewport_location_; | 189 int viewport_location_; |
| 190 int quad_location_; | 190 int quad_location_; |
| 191 int edge_location_; | 191 int edge_location_; |
| 192 int tex_transform_location_; | 192 int tex_transform_location_; |
| 193 | 193 |
| 194 DISALLOW_COPY_AND_ASSIGN(VertexShaderQuadTexTransformAA); | 194 DISALLOW_COPY_AND_ASSIGN(VertexShaderQuadTexTransformAA); |
| 195 }; | 195 }; |
| 196 | 196 |
| 197 class VertexShaderTile { | 197 class VertexShaderTile { |
| 198 public: | 198 public: |
| 199 VertexShaderTile(); | 199 VertexShaderTile(); |
| 200 | 200 |
| 201 void Init(WebKit::WebGraphicsContext3D* context, | 201 void Init(blink::WebGraphicsContext3D* context, |
| 202 unsigned program, | 202 unsigned program, |
| 203 int* base_uniform_index); | 203 int* base_uniform_index); |
| 204 std::string GetShaderString() const; | 204 std::string GetShaderString() const; |
| 205 | 205 |
| 206 int matrix_location() const { return matrix_location_; } | 206 int matrix_location() const { return matrix_location_; } |
| 207 int viewport_location() const { return -1; } | 207 int viewport_location() const { return -1; } |
| 208 int quad_location() const { return quad_location_; } | 208 int quad_location() const { return quad_location_; } |
| 209 int edge_location() const { return -1; } | 209 int edge_location() const { return -1; } |
| 210 int vertex_tex_transform_location() const { | 210 int vertex_tex_transform_location() const { |
| 211 return vertex_tex_transform_location_; | 211 return vertex_tex_transform_location_; |
| 212 } | 212 } |
| 213 | 213 |
| 214 private: | 214 private: |
| 215 int matrix_location_; | 215 int matrix_location_; |
| 216 int quad_location_; | 216 int quad_location_; |
| 217 int vertex_tex_transform_location_; | 217 int vertex_tex_transform_location_; |
| 218 | 218 |
| 219 DISALLOW_COPY_AND_ASSIGN(VertexShaderTile); | 219 DISALLOW_COPY_AND_ASSIGN(VertexShaderTile); |
| 220 }; | 220 }; |
| 221 | 221 |
| 222 class VertexShaderTileAA { | 222 class VertexShaderTileAA { |
| 223 public: | 223 public: |
| 224 VertexShaderTileAA(); | 224 VertexShaderTileAA(); |
| 225 | 225 |
| 226 void Init(WebKit::WebGraphicsContext3D* context, | 226 void Init(blink::WebGraphicsContext3D* context, |
| 227 unsigned program, | 227 unsigned program, |
| 228 int* base_uniform_index); | 228 int* base_uniform_index); |
| 229 std::string GetShaderString() const; | 229 std::string GetShaderString() const; |
| 230 | 230 |
| 231 int matrix_location() const { return matrix_location_; } | 231 int matrix_location() const { return matrix_location_; } |
| 232 int viewport_location() const { return viewport_location_; } | 232 int viewport_location() const { return viewport_location_; } |
| 233 int quad_location() const { return quad_location_; } | 233 int quad_location() const { return quad_location_; } |
| 234 int edge_location() const { return edge_location_; } | 234 int edge_location() const { return edge_location_; } |
| 235 int vertex_tex_transform_location() const { | 235 int vertex_tex_transform_location() const { |
| 236 return vertex_tex_transform_location_; | 236 return vertex_tex_transform_location_; |
| 237 } | 237 } |
| 238 | 238 |
| 239 private: | 239 private: |
| 240 int matrix_location_; | 240 int matrix_location_; |
| 241 int viewport_location_; | 241 int viewport_location_; |
| 242 int quad_location_; | 242 int quad_location_; |
| 243 int edge_location_; | 243 int edge_location_; |
| 244 int vertex_tex_transform_location_; | 244 int vertex_tex_transform_location_; |
| 245 | 245 |
| 246 DISALLOW_COPY_AND_ASSIGN(VertexShaderTileAA); | 246 DISALLOW_COPY_AND_ASSIGN(VertexShaderTileAA); |
| 247 }; | 247 }; |
| 248 | 248 |
| 249 class VertexShaderVideoTransform { | 249 class VertexShaderVideoTransform { |
| 250 public: | 250 public: |
| 251 VertexShaderVideoTransform(); | 251 VertexShaderVideoTransform(); |
| 252 | 252 |
| 253 void Init(WebKit::WebGraphicsContext3D* context, | 253 void Init(blink::WebGraphicsContext3D* context, |
| 254 unsigned program, | 254 unsigned program, |
| 255 int* base_uniform_index); | 255 int* base_uniform_index); |
| 256 std::string GetShaderString() const; | 256 std::string GetShaderString() const; |
| 257 | 257 |
| 258 int matrix_location() const { return matrix_location_; } | 258 int matrix_location() const { return matrix_location_; } |
| 259 int tex_matrix_location() const { return tex_matrix_location_; } | 259 int tex_matrix_location() const { return tex_matrix_location_; } |
| 260 | 260 |
| 261 private: | 261 private: |
| 262 int matrix_location_; | 262 int matrix_location_; |
| 263 int tex_matrix_location_; | 263 int tex_matrix_location_; |
| 264 | 264 |
| 265 DISALLOW_COPY_AND_ASSIGN(VertexShaderVideoTransform); | 265 DISALLOW_COPY_AND_ASSIGN(VertexShaderVideoTransform); |
| 266 }; | 266 }; |
| 267 | 267 |
| 268 class FragmentTexAlphaBinding { | 268 class FragmentTexAlphaBinding { |
| 269 public: | 269 public: |
| 270 FragmentTexAlphaBinding(); | 270 FragmentTexAlphaBinding(); |
| 271 | 271 |
| 272 void Init(WebKit::WebGraphicsContext3D* context, | 272 void Init(blink::WebGraphicsContext3D* context, |
| 273 unsigned program, | 273 unsigned program, |
| 274 int* base_uniform_index); | 274 int* base_uniform_index); |
| 275 int alpha_location() const { return alpha_location_; } | 275 int alpha_location() const { return alpha_location_; } |
| 276 int fragment_tex_transform_location() const { return -1; } | 276 int fragment_tex_transform_location() const { return -1; } |
| 277 int sampler_location() const { return sampler_location_; } | 277 int sampler_location() const { return sampler_location_; } |
| 278 | 278 |
| 279 private: | 279 private: |
| 280 int sampler_location_; | 280 int sampler_location_; |
| 281 int alpha_location_; | 281 int alpha_location_; |
| 282 | 282 |
| 283 DISALLOW_COPY_AND_ASSIGN(FragmentTexAlphaBinding); | 283 DISALLOW_COPY_AND_ASSIGN(FragmentTexAlphaBinding); |
| 284 }; | 284 }; |
| 285 | 285 |
| 286 class FragmentTexColorMatrixAlphaBinding { | 286 class FragmentTexColorMatrixAlphaBinding { |
| 287 public: | 287 public: |
| 288 FragmentTexColorMatrixAlphaBinding(); | 288 FragmentTexColorMatrixAlphaBinding(); |
| 289 | 289 |
| 290 void Init(WebKit::WebGraphicsContext3D* context, | 290 void Init(blink::WebGraphicsContext3D* context, |
| 291 unsigned program, | 291 unsigned program, |
| 292 int* base_uniform_index); | 292 int* base_uniform_index); |
| 293 int alpha_location() const { return alpha_location_; } | 293 int alpha_location() const { return alpha_location_; } |
| 294 int color_matrix_location() const { return color_matrix_location_; } | 294 int color_matrix_location() const { return color_matrix_location_; } |
| 295 int color_offset_location() const { return color_offset_location_; } | 295 int color_offset_location() const { return color_offset_location_; } |
| 296 int fragment_tex_transform_location() const { return -1; } | 296 int fragment_tex_transform_location() const { return -1; } |
| 297 int sampler_location() const { return sampler_location_; } | 297 int sampler_location() const { return sampler_location_; } |
| 298 | 298 |
| 299 private: | 299 private: |
| 300 int sampler_location_; | 300 int sampler_location_; |
| 301 int alpha_location_; | 301 int alpha_location_; |
| 302 int color_matrix_location_; | 302 int color_matrix_location_; |
| 303 int color_offset_location_; | 303 int color_offset_location_; |
| 304 }; | 304 }; |
| 305 | 305 |
| 306 class FragmentTexOpaqueBinding { | 306 class FragmentTexOpaqueBinding { |
| 307 public: | 307 public: |
| 308 FragmentTexOpaqueBinding(); | 308 FragmentTexOpaqueBinding(); |
| 309 | 309 |
| 310 void Init(WebKit::WebGraphicsContext3D* context, | 310 void Init(blink::WebGraphicsContext3D* context, |
| 311 unsigned program, | 311 unsigned program, |
| 312 int* base_uniform_index); | 312 int* base_uniform_index); |
| 313 int alpha_location() const { return -1; } | 313 int alpha_location() const { return -1; } |
| 314 int fragment_tex_transform_location() const { return -1; } | 314 int fragment_tex_transform_location() const { return -1; } |
| 315 int background_color_location() const { return -1; } | 315 int background_color_location() const { return -1; } |
| 316 int sampler_location() const { return sampler_location_; } | 316 int sampler_location() const { return sampler_location_; } |
| 317 | 317 |
| 318 private: | 318 private: |
| 319 int sampler_location_; | 319 int sampler_location_; |
| 320 | 320 |
| 321 DISALLOW_COPY_AND_ASSIGN(FragmentTexOpaqueBinding); | 321 DISALLOW_COPY_AND_ASSIGN(FragmentTexOpaqueBinding); |
| 322 }; | 322 }; |
| 323 | 323 |
| 324 class FragmentTexBackgroundBinding { | 324 class FragmentTexBackgroundBinding { |
| 325 public: | 325 public: |
| 326 FragmentTexBackgroundBinding(); | 326 FragmentTexBackgroundBinding(); |
| 327 | 327 |
| 328 void Init(WebKit::WebGraphicsContext3D* context, | 328 void Init(blink::WebGraphicsContext3D* context, |
| 329 unsigned program, | 329 unsigned program, |
| 330 int* base_uniform_index); | 330 int* base_uniform_index); |
| 331 int background_color_location() const { return background_color_location_; } | 331 int background_color_location() const { return background_color_location_; } |
| 332 int sampler_location() const { return sampler_location_; } | 332 int sampler_location() const { return sampler_location_; } |
| 333 | 333 |
| 334 private: | 334 private: |
| 335 int background_color_location_; | 335 int background_color_location_; |
| 336 int sampler_location_; | 336 int sampler_location_; |
| 337 | 337 |
| 338 DISALLOW_COPY_AND_ASSIGN(FragmentTexBackgroundBinding); | 338 DISALLOW_COPY_AND_ASSIGN(FragmentTexBackgroundBinding); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 public: | 397 public: |
| 398 std::string GetShaderString(TexCoordPrecision precision) const; | 398 std::string GetShaderString(TexCoordPrecision precision) const; |
| 399 }; | 399 }; |
| 400 | 400 |
| 401 // Fragment shader for external textures. | 401 // Fragment shader for external textures. |
| 402 class FragmentShaderOESImageExternal : public FragmentTexAlphaBinding { | 402 class FragmentShaderOESImageExternal : public FragmentTexAlphaBinding { |
| 403 public: | 403 public: |
| 404 FragmentShaderOESImageExternal(); | 404 FragmentShaderOESImageExternal(); |
| 405 | 405 |
| 406 std::string GetShaderString(TexCoordPrecision precision) const; | 406 std::string GetShaderString(TexCoordPrecision precision) const; |
| 407 void Init(WebKit::WebGraphicsContext3D* context, | 407 void Init(blink::WebGraphicsContext3D* context, |
| 408 unsigned program, | 408 unsigned program, |
| 409 int* base_uniform_index); | 409 int* base_uniform_index); |
| 410 private: | 410 private: |
| 411 int sampler_location_; | 411 int sampler_location_; |
| 412 | 412 |
| 413 DISALLOW_COPY_AND_ASSIGN(FragmentShaderOESImageExternal); | 413 DISALLOW_COPY_AND_ASSIGN(FragmentShaderOESImageExternal); |
| 414 }; | 414 }; |
| 415 | 415 |
| 416 class FragmentShaderRGBATexAlphaAA { | 416 class FragmentShaderRGBATexAlphaAA { |
| 417 public: | 417 public: |
| 418 FragmentShaderRGBATexAlphaAA(); | 418 FragmentShaderRGBATexAlphaAA(); |
| 419 | 419 |
| 420 void Init(WebKit::WebGraphicsContext3D* context, | 420 void Init(blink::WebGraphicsContext3D* context, |
| 421 unsigned program, | 421 unsigned program, |
| 422 int* base_uniform_index); | 422 int* base_uniform_index); |
| 423 std::string GetShaderString(TexCoordPrecision precision) const; | 423 std::string GetShaderString(TexCoordPrecision precision) const; |
| 424 | 424 |
| 425 int alpha_location() const { return alpha_location_; } | 425 int alpha_location() const { return alpha_location_; } |
| 426 int sampler_location() const { return sampler_location_; } | 426 int sampler_location() const { return sampler_location_; } |
| 427 | 427 |
| 428 private: | 428 private: |
| 429 int sampler_location_; | 429 int sampler_location_; |
| 430 int alpha_location_; | 430 int alpha_location_; |
| 431 | 431 |
| 432 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaAA); | 432 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaAA); |
| 433 }; | 433 }; |
| 434 | 434 |
| 435 class FragmentTexClampAlphaAABinding { | 435 class FragmentTexClampAlphaAABinding { |
| 436 public: | 436 public: |
| 437 FragmentTexClampAlphaAABinding(); | 437 FragmentTexClampAlphaAABinding(); |
| 438 | 438 |
| 439 void Init(WebKit::WebGraphicsContext3D* context, | 439 void Init(blink::WebGraphicsContext3D* context, |
| 440 unsigned program, | 440 unsigned program, |
| 441 int* base_uniform_index); | 441 int* base_uniform_index); |
| 442 int alpha_location() const { return alpha_location_; } | 442 int alpha_location() const { return alpha_location_; } |
| 443 int sampler_location() const { return sampler_location_; } | 443 int sampler_location() const { return sampler_location_; } |
| 444 int fragment_tex_transform_location() const { | 444 int fragment_tex_transform_location() const { |
| 445 return fragment_tex_transform_location_; | 445 return fragment_tex_transform_location_; |
| 446 } | 446 } |
| 447 | 447 |
| 448 private: | 448 private: |
| 449 int sampler_location_; | 449 int sampler_location_; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 464 : public FragmentTexClampAlphaAABinding { | 464 : public FragmentTexClampAlphaAABinding { |
| 465 public: | 465 public: |
| 466 std::string GetShaderString(TexCoordPrecision precision) const; | 466 std::string GetShaderString(TexCoordPrecision precision) const; |
| 467 }; | 467 }; |
| 468 | 468 |
| 469 class FragmentShaderRGBATexAlphaMask { | 469 class FragmentShaderRGBATexAlphaMask { |
| 470 public: | 470 public: |
| 471 FragmentShaderRGBATexAlphaMask(); | 471 FragmentShaderRGBATexAlphaMask(); |
| 472 std::string GetShaderString(TexCoordPrecision precision) const; | 472 std::string GetShaderString(TexCoordPrecision precision) const; |
| 473 | 473 |
| 474 void Init(WebKit::WebGraphicsContext3D* context, | 474 void Init(blink::WebGraphicsContext3D* context, |
| 475 unsigned program, | 475 unsigned program, |
| 476 int* base_uniform_index); | 476 int* base_uniform_index); |
| 477 int alpha_location() const { return alpha_location_; } | 477 int alpha_location() const { return alpha_location_; } |
| 478 int sampler_location() const { return sampler_location_; } | 478 int sampler_location() const { return sampler_location_; } |
| 479 int mask_sampler_location() const { return mask_sampler_location_; } | 479 int mask_sampler_location() const { return mask_sampler_location_; } |
| 480 int mask_tex_coord_scale_location() const { | 480 int mask_tex_coord_scale_location() const { |
| 481 return mask_tex_coord_scale_location_; | 481 return mask_tex_coord_scale_location_; |
| 482 } | 482 } |
| 483 int mask_tex_coord_offset_location() const { | 483 int mask_tex_coord_offset_location() const { |
| 484 return mask_tex_coord_offset_location_; | 484 return mask_tex_coord_offset_location_; |
| 485 } | 485 } |
| 486 | 486 |
| 487 private: | 487 private: |
| 488 int sampler_location_; | 488 int sampler_location_; |
| 489 int mask_sampler_location_; | 489 int mask_sampler_location_; |
| 490 int alpha_location_; | 490 int alpha_location_; |
| 491 int mask_tex_coord_scale_location_; | 491 int mask_tex_coord_scale_location_; |
| 492 int mask_tex_coord_offset_location_; | 492 int mask_tex_coord_offset_location_; |
| 493 | 493 |
| 494 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMask); | 494 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMask); |
| 495 }; | 495 }; |
| 496 | 496 |
| 497 class FragmentShaderRGBATexAlphaMaskAA { | 497 class FragmentShaderRGBATexAlphaMaskAA { |
| 498 public: | 498 public: |
| 499 FragmentShaderRGBATexAlphaMaskAA(); | 499 FragmentShaderRGBATexAlphaMaskAA(); |
| 500 std::string GetShaderString(TexCoordPrecision precision) const; | 500 std::string GetShaderString(TexCoordPrecision precision) const; |
| 501 | 501 |
| 502 void Init(WebKit::WebGraphicsContext3D* context, | 502 void Init(blink::WebGraphicsContext3D* context, |
| 503 unsigned program, | 503 unsigned program, |
| 504 int* base_uniform_index); | 504 int* base_uniform_index); |
| 505 int alpha_location() const { return alpha_location_; } | 505 int alpha_location() const { return alpha_location_; } |
| 506 int sampler_location() const { return sampler_location_; } | 506 int sampler_location() const { return sampler_location_; } |
| 507 int mask_sampler_location() const { return mask_sampler_location_; } | 507 int mask_sampler_location() const { return mask_sampler_location_; } |
| 508 int mask_tex_coord_scale_location() const { | 508 int mask_tex_coord_scale_location() const { |
| 509 return mask_tex_coord_scale_location_; | 509 return mask_tex_coord_scale_location_; |
| 510 } | 510 } |
| 511 int mask_tex_coord_offset_location() const { | 511 int mask_tex_coord_offset_location() const { |
| 512 return mask_tex_coord_offset_location_; | 512 return mask_tex_coord_offset_location_; |
| 513 } | 513 } |
| 514 | 514 |
| 515 private: | 515 private: |
| 516 int sampler_location_; | 516 int sampler_location_; |
| 517 int mask_sampler_location_; | 517 int mask_sampler_location_; |
| 518 int alpha_location_; | 518 int alpha_location_; |
| 519 int mask_tex_coord_scale_location_; | 519 int mask_tex_coord_scale_location_; |
| 520 int mask_tex_coord_offset_location_; | 520 int mask_tex_coord_offset_location_; |
| 521 | 521 |
| 522 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMaskAA); | 522 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMaskAA); |
| 523 }; | 523 }; |
| 524 | 524 |
| 525 class FragmentShaderRGBATexAlphaMaskColorMatrixAA { | 525 class FragmentShaderRGBATexAlphaMaskColorMatrixAA { |
| 526 public: | 526 public: |
| 527 FragmentShaderRGBATexAlphaMaskColorMatrixAA(); | 527 FragmentShaderRGBATexAlphaMaskColorMatrixAA(); |
| 528 std::string GetShaderString(TexCoordPrecision precision) const; | 528 std::string GetShaderString(TexCoordPrecision precision) const; |
| 529 | 529 |
| 530 void Init(WebKit::WebGraphicsContext3D* context, | 530 void Init(blink::WebGraphicsContext3D* context, |
| 531 unsigned program, | 531 unsigned program, |
| 532 int* base_uniform_index); | 532 int* base_uniform_index); |
| 533 int alpha_location() const { return alpha_location_; } | 533 int alpha_location() const { return alpha_location_; } |
| 534 int sampler_location() const { return sampler_location_; } | 534 int sampler_location() const { return sampler_location_; } |
| 535 int mask_sampler_location() const { return mask_sampler_location_; } | 535 int mask_sampler_location() const { return mask_sampler_location_; } |
| 536 int mask_tex_coord_scale_location() const { | 536 int mask_tex_coord_scale_location() const { |
| 537 return mask_tex_coord_scale_location_; | 537 return mask_tex_coord_scale_location_; |
| 538 } | 538 } |
| 539 int mask_tex_coord_offset_location() const { | 539 int mask_tex_coord_offset_location() const { |
| 540 return mask_tex_coord_offset_location_; | 540 return mask_tex_coord_offset_location_; |
| 541 } | 541 } |
| 542 int color_matrix_location() const { return color_matrix_location_; } | 542 int color_matrix_location() const { return color_matrix_location_; } |
| 543 int color_offset_location() const { return color_offset_location_; } | 543 int color_offset_location() const { return color_offset_location_; } |
| 544 | 544 |
| 545 private: | 545 private: |
| 546 int sampler_location_; | 546 int sampler_location_; |
| 547 int mask_sampler_location_; | 547 int mask_sampler_location_; |
| 548 int alpha_location_; | 548 int alpha_location_; |
| 549 int mask_tex_coord_scale_location_; | 549 int mask_tex_coord_scale_location_; |
| 550 int mask_tex_coord_offset_location_; | 550 int mask_tex_coord_offset_location_; |
| 551 int color_matrix_location_; | 551 int color_matrix_location_; |
| 552 int color_offset_location_; | 552 int color_offset_location_; |
| 553 }; | 553 }; |
| 554 | 554 |
| 555 class FragmentShaderRGBATexAlphaColorMatrixAA { | 555 class FragmentShaderRGBATexAlphaColorMatrixAA { |
| 556 public: | 556 public: |
| 557 FragmentShaderRGBATexAlphaColorMatrixAA(); | 557 FragmentShaderRGBATexAlphaColorMatrixAA(); |
| 558 std::string GetShaderString(TexCoordPrecision precision) const; | 558 std::string GetShaderString(TexCoordPrecision precision) const; |
| 559 | 559 |
| 560 void Init(WebKit::WebGraphicsContext3D* context, | 560 void Init(blink::WebGraphicsContext3D* context, |
| 561 unsigned program, | 561 unsigned program, |
| 562 int* base_uniform_index); | 562 int* base_uniform_index); |
| 563 int alpha_location() const { return alpha_location_; } | 563 int alpha_location() const { return alpha_location_; } |
| 564 int sampler_location() const { return sampler_location_; } | 564 int sampler_location() const { return sampler_location_; } |
| 565 int color_matrix_location() const { return color_matrix_location_; } | 565 int color_matrix_location() const { return color_matrix_location_; } |
| 566 int color_offset_location() const { return color_offset_location_; } | 566 int color_offset_location() const { return color_offset_location_; } |
| 567 | 567 |
| 568 private: | 568 private: |
| 569 int sampler_location_; | 569 int sampler_location_; |
| 570 int alpha_location_; | 570 int alpha_location_; |
| 571 int color_matrix_location_; | 571 int color_matrix_location_; |
| 572 int color_offset_location_; | 572 int color_offset_location_; |
| 573 }; | 573 }; |
| 574 | 574 |
| 575 class FragmentShaderRGBATexAlphaMaskColorMatrix { | 575 class FragmentShaderRGBATexAlphaMaskColorMatrix { |
| 576 public: | 576 public: |
| 577 FragmentShaderRGBATexAlphaMaskColorMatrix(); | 577 FragmentShaderRGBATexAlphaMaskColorMatrix(); |
| 578 std::string GetShaderString(TexCoordPrecision precision) const; | 578 std::string GetShaderString(TexCoordPrecision precision) const; |
| 579 | 579 |
| 580 void Init(WebKit::WebGraphicsContext3D* context, | 580 void Init(blink::WebGraphicsContext3D* context, |
| 581 unsigned program, | 581 unsigned program, |
| 582 int* base_uniform_index); | 582 int* base_uniform_index); |
| 583 int alpha_location() const { return alpha_location_; } | 583 int alpha_location() const { return alpha_location_; } |
| 584 int sampler_location() const { return sampler_location_; } | 584 int sampler_location() const { return sampler_location_; } |
| 585 int mask_sampler_location() const { return mask_sampler_location_; } | 585 int mask_sampler_location() const { return mask_sampler_location_; } |
| 586 int mask_tex_coord_scale_location() const { | 586 int mask_tex_coord_scale_location() const { |
| 587 return mask_tex_coord_scale_location_; | 587 return mask_tex_coord_scale_location_; |
| 588 } | 588 } |
| 589 int mask_tex_coord_offset_location() const { | 589 int mask_tex_coord_offset_location() const { |
| 590 return mask_tex_coord_offset_location_; | 590 return mask_tex_coord_offset_location_; |
| 591 } | 591 } |
| 592 int color_matrix_location() const { return color_matrix_location_; } | 592 int color_matrix_location() const { return color_matrix_location_; } |
| 593 int color_offset_location() const { return color_offset_location_; } | 593 int color_offset_location() const { return color_offset_location_; } |
| 594 | 594 |
| 595 private: | 595 private: |
| 596 int sampler_location_; | 596 int sampler_location_; |
| 597 int mask_sampler_location_; | 597 int mask_sampler_location_; |
| 598 int alpha_location_; | 598 int alpha_location_; |
| 599 int mask_tex_coord_scale_location_; | 599 int mask_tex_coord_scale_location_; |
| 600 int mask_tex_coord_offset_location_; | 600 int mask_tex_coord_offset_location_; |
| 601 int color_matrix_location_; | 601 int color_matrix_location_; |
| 602 int color_offset_location_; | 602 int color_offset_location_; |
| 603 }; | 603 }; |
| 604 | 604 |
| 605 class FragmentShaderYUVVideo { | 605 class FragmentShaderYUVVideo { |
| 606 public: | 606 public: |
| 607 FragmentShaderYUVVideo(); | 607 FragmentShaderYUVVideo(); |
| 608 std::string GetShaderString(TexCoordPrecision precision) const; | 608 std::string GetShaderString(TexCoordPrecision precision) const; |
| 609 | 609 |
| 610 void Init(WebKit::WebGraphicsContext3D* context, | 610 void Init(blink::WebGraphicsContext3D* context, |
| 611 unsigned program, | 611 unsigned program, |
| 612 int* base_uniform_index); | 612 int* base_uniform_index); |
| 613 int y_texture_location() const { return y_texture_location_; } | 613 int y_texture_location() const { return y_texture_location_; } |
| 614 int u_texture_location() const { return u_texture_location_; } | 614 int u_texture_location() const { return u_texture_location_; } |
| 615 int v_texture_location() const { return v_texture_location_; } | 615 int v_texture_location() const { return v_texture_location_; } |
| 616 int alpha_location() const { return alpha_location_; } | 616 int alpha_location() const { return alpha_location_; } |
| 617 int yuv_matrix_location() const { return yuv_matrix_location_; } | 617 int yuv_matrix_location() const { return yuv_matrix_location_; } |
| 618 int yuv_adj_location() const { return yuv_adj_location_; } | 618 int yuv_adj_location() const { return yuv_adj_location_; } |
| 619 | 619 |
| 620 private: | 620 private: |
| 621 int y_texture_location_; | 621 int y_texture_location_; |
| 622 int u_texture_location_; | 622 int u_texture_location_; |
| 623 int v_texture_location_; | 623 int v_texture_location_; |
| 624 int alpha_location_; | 624 int alpha_location_; |
| 625 int yuv_matrix_location_; | 625 int yuv_matrix_location_; |
| 626 int yuv_adj_location_; | 626 int yuv_adj_location_; |
| 627 | 627 |
| 628 DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVVideo); | 628 DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVVideo); |
| 629 }; | 629 }; |
| 630 | 630 |
| 631 | 631 |
| 632 class FragmentShaderYUVAVideo { | 632 class FragmentShaderYUVAVideo { |
| 633 public: | 633 public: |
| 634 FragmentShaderYUVAVideo(); | 634 FragmentShaderYUVAVideo(); |
| 635 std::string GetShaderString(TexCoordPrecision precision) const; | 635 std::string GetShaderString(TexCoordPrecision precision) const; |
| 636 | 636 |
| 637 void Init(WebKit::WebGraphicsContext3D* context, | 637 void Init(blink::WebGraphicsContext3D* context, |
| 638 unsigned program, | 638 unsigned program, |
| 639 int* base_uniform_index); | 639 int* base_uniform_index); |
| 640 | 640 |
| 641 int y_texture_location() const { return y_texture_location_; } | 641 int y_texture_location() const { return y_texture_location_; } |
| 642 int u_texture_location() const { return u_texture_location_; } | 642 int u_texture_location() const { return u_texture_location_; } |
| 643 int v_texture_location() const { return v_texture_location_; } | 643 int v_texture_location() const { return v_texture_location_; } |
| 644 int a_texture_location() const { return a_texture_location_; } | 644 int a_texture_location() const { return a_texture_location_; } |
| 645 int alpha_location() const { return alpha_location_; } | 645 int alpha_location() const { return alpha_location_; } |
| 646 int yuv_matrix_location() const { return yuv_matrix_location_; } | 646 int yuv_matrix_location() const { return yuv_matrix_location_; } |
| 647 int yuv_adj_location() const { return yuv_adj_location_; } | 647 int yuv_adj_location() const { return yuv_adj_location_; } |
| 648 | 648 |
| 649 private: | 649 private: |
| 650 int y_texture_location_; | 650 int y_texture_location_; |
| 651 int u_texture_location_; | 651 int u_texture_location_; |
| 652 int v_texture_location_; | 652 int v_texture_location_; |
| 653 int a_texture_location_; | 653 int a_texture_location_; |
| 654 int alpha_location_; | 654 int alpha_location_; |
| 655 int yuv_matrix_location_; | 655 int yuv_matrix_location_; |
| 656 int yuv_adj_location_; | 656 int yuv_adj_location_; |
| 657 | 657 |
| 658 DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVAVideo); | 658 DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVAVideo); |
| 659 }; | 659 }; |
| 660 | 660 |
| 661 class FragmentShaderColor { | 661 class FragmentShaderColor { |
| 662 public: | 662 public: |
| 663 FragmentShaderColor(); | 663 FragmentShaderColor(); |
| 664 std::string GetShaderString(TexCoordPrecision precision) const; | 664 std::string GetShaderString(TexCoordPrecision precision) const; |
| 665 | 665 |
| 666 void Init(WebKit::WebGraphicsContext3D* context, | 666 void Init(blink::WebGraphicsContext3D* context, |
| 667 unsigned program, | 667 unsigned program, |
| 668 int* base_uniform_index); | 668 int* base_uniform_index); |
| 669 int color_location() const { return color_location_; } | 669 int color_location() const { return color_location_; } |
| 670 | 670 |
| 671 private: | 671 private: |
| 672 int color_location_; | 672 int color_location_; |
| 673 | 673 |
| 674 DISALLOW_COPY_AND_ASSIGN(FragmentShaderColor); | 674 DISALLOW_COPY_AND_ASSIGN(FragmentShaderColor); |
| 675 }; | 675 }; |
| 676 | 676 |
| 677 class FragmentShaderColorAA { | 677 class FragmentShaderColorAA { |
| 678 public: | 678 public: |
| 679 FragmentShaderColorAA(); | 679 FragmentShaderColorAA(); |
| 680 std::string GetShaderString(TexCoordPrecision precision) const; | 680 std::string GetShaderString(TexCoordPrecision precision) const; |
| 681 | 681 |
| 682 void Init(WebKit::WebGraphicsContext3D* context, | 682 void Init(blink::WebGraphicsContext3D* context, |
| 683 unsigned program, | 683 unsigned program, |
| 684 int* base_uniform_index); | 684 int* base_uniform_index); |
| 685 int color_location() const { return color_location_; } | 685 int color_location() const { return color_location_; } |
| 686 | 686 |
| 687 private: | 687 private: |
| 688 int color_location_; | 688 int color_location_; |
| 689 | 689 |
| 690 DISALLOW_COPY_AND_ASSIGN(FragmentShaderColorAA); | 690 DISALLOW_COPY_AND_ASSIGN(FragmentShaderColorAA); |
| 691 }; | 691 }; |
| 692 | 692 |
| 693 class FragmentShaderCheckerboard { | 693 class FragmentShaderCheckerboard { |
| 694 public: | 694 public: |
| 695 FragmentShaderCheckerboard(); | 695 FragmentShaderCheckerboard(); |
| 696 std::string GetShaderString(TexCoordPrecision precision) const; | 696 std::string GetShaderString(TexCoordPrecision precision) const; |
| 697 | 697 |
| 698 void Init(WebKit::WebGraphicsContext3D* context, | 698 void Init(blink::WebGraphicsContext3D* context, |
| 699 unsigned program, | 699 unsigned program, |
| 700 int* base_uniform_index); | 700 int* base_uniform_index); |
| 701 int alpha_location() const { return alpha_location_; } | 701 int alpha_location() const { return alpha_location_; } |
| 702 int tex_transform_location() const { return tex_transform_location_; } | 702 int tex_transform_location() const { return tex_transform_location_; } |
| 703 int frequency_location() const { return frequency_location_; } | 703 int frequency_location() const { return frequency_location_; } |
| 704 int color_location() const { return color_location_; } | 704 int color_location() const { return color_location_; } |
| 705 | 705 |
| 706 private: | 706 private: |
| 707 int alpha_location_; | 707 int alpha_location_; |
| 708 int tex_transform_location_; | 708 int tex_transform_location_; |
| 709 int frequency_location_; | 709 int frequency_location_; |
| 710 int color_location_; | 710 int color_location_; |
| 711 | 711 |
| 712 DISALLOW_COPY_AND_ASSIGN(FragmentShaderCheckerboard); | 712 DISALLOW_COPY_AND_ASSIGN(FragmentShaderCheckerboard); |
| 713 }; | 713 }; |
| 714 | 714 |
| 715 } // namespace cc | 715 } // namespace cc |
| 716 | 716 |
| 717 #endif // CC_OUTPUT_SHADER_H_ | 717 #endif // CC_OUTPUT_SHADER_H_ |
| OLD | NEW |