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" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 const gfx::Size& max_size); | 76 const gfx::Size& max_size); |
77 | 77 |
78 class VertexShaderPosTex { | 78 class VertexShaderPosTex { |
79 public: | 79 public: |
80 VertexShaderPosTex(); | 80 VertexShaderPosTex(); |
81 | 81 |
82 void Init(gpu::gles2::GLES2Interface* context, | 82 void Init(gpu::gles2::GLES2Interface* context, |
83 unsigned program, | 83 unsigned program, |
84 int* base_uniform_index); | 84 int* base_uniform_index); |
85 std::string GetShaderString() const; | 85 std::string GetShaderString() const; |
| 86 static std::string GetShaderHead(); |
| 87 static std::string GetShaderBody(); |
86 | 88 |
87 int matrix_location() const { return matrix_location_; } | 89 int matrix_location() const { return matrix_location_; } |
88 | 90 |
89 private: | 91 private: |
90 int matrix_location_; | 92 int matrix_location_; |
91 | 93 |
92 DISALLOW_COPY_AND_ASSIGN(VertexShaderPosTex); | 94 DISALLOW_COPY_AND_ASSIGN(VertexShaderPosTex); |
93 }; | 95 }; |
94 | 96 |
95 class VertexShaderPosTexYUVStretchOffset { | 97 class VertexShaderPosTexYUVStretchOffset { |
96 public: | 98 public: |
97 VertexShaderPosTexYUVStretchOffset(); | 99 VertexShaderPosTexYUVStretchOffset(); |
98 | 100 |
99 void Init(gpu::gles2::GLES2Interface* context, | 101 void Init(gpu::gles2::GLES2Interface* context, |
100 unsigned program, | 102 unsigned program, |
101 int* base_uniform_index); | 103 int* base_uniform_index); |
102 std::string GetShaderString() const; | 104 std::string GetShaderString() const; |
| 105 static std::string GetShaderHead(); |
| 106 static std::string GetShaderBody(); |
103 | 107 |
104 int matrix_location() const { return matrix_location_; } | 108 int matrix_location() const { return matrix_location_; } |
105 int tex_scale_location() const { return tex_scale_location_; } | 109 int tex_scale_location() const { return tex_scale_location_; } |
106 int tex_offset_location() const { return tex_offset_location_; } | 110 int tex_offset_location() const { return tex_offset_location_; } |
107 | 111 |
108 private: | 112 private: |
109 int matrix_location_; | 113 int matrix_location_; |
110 int tex_scale_location_; | 114 int tex_scale_location_; |
111 int tex_offset_location_; | 115 int tex_offset_location_; |
112 | 116 |
113 DISALLOW_COPY_AND_ASSIGN(VertexShaderPosTexYUVStretchOffset); | 117 DISALLOW_COPY_AND_ASSIGN(VertexShaderPosTexYUVStretchOffset); |
114 }; | 118 }; |
115 | 119 |
116 class VertexShaderPos { | 120 class VertexShaderPos { |
117 public: | 121 public: |
118 VertexShaderPos(); | 122 VertexShaderPos(); |
119 | 123 |
120 void Init(gpu::gles2::GLES2Interface* context, | 124 void Init(gpu::gles2::GLES2Interface* context, |
121 unsigned program, | 125 unsigned program, |
122 int* base_uniform_index); | 126 int* base_uniform_index); |
123 std::string GetShaderString() const; | 127 std::string GetShaderString() const; |
| 128 static std::string GetShaderHead(); |
| 129 static std::string GetShaderBody(); |
124 | 130 |
125 int matrix_location() const { return matrix_location_; } | 131 int matrix_location() const { return matrix_location_; } |
126 | 132 |
127 private: | 133 private: |
128 int matrix_location_; | 134 int matrix_location_; |
129 | 135 |
130 DISALLOW_COPY_AND_ASSIGN(VertexShaderPos); | 136 DISALLOW_COPY_AND_ASSIGN(VertexShaderPos); |
131 }; | 137 }; |
132 | 138 |
133 class VertexShaderPosTexIdentity { | 139 class VertexShaderPosTexIdentity { |
134 public: | 140 public: |
135 void Init(gpu::gles2::GLES2Interface* context, | 141 void Init(gpu::gles2::GLES2Interface* context, |
136 unsigned program, | 142 unsigned program, |
137 int* base_uniform_index) {} | 143 int* base_uniform_index) {} |
138 std::string GetShaderString() const; | 144 std::string GetShaderString() const; |
| 145 static std::string GetShaderHead(); |
| 146 static std::string GetShaderBody(); |
139 }; | 147 }; |
140 | 148 |
141 class VertexShaderPosTexTransform { | 149 class VertexShaderPosTexTransform { |
142 public: | 150 public: |
143 VertexShaderPosTexTransform(); | 151 VertexShaderPosTexTransform(); |
144 | 152 |
145 void Init(gpu::gles2::GLES2Interface* context, | 153 void Init(gpu::gles2::GLES2Interface* context, |
146 unsigned program, | 154 unsigned program, |
147 int* base_uniform_index); | 155 int* base_uniform_index); |
148 std::string GetShaderString() const; | 156 std::string GetShaderString() const; |
| 157 static std::string GetShaderHead(); |
| 158 static std::string GetShaderBody(); |
149 | 159 |
150 int matrix_location() const { return matrix_location_; } | 160 int matrix_location() const { return matrix_location_; } |
151 int tex_transform_location() const { return tex_transform_location_; } | 161 int tex_transform_location() const { return tex_transform_location_; } |
152 int vertex_opacity_location() const { return vertex_opacity_location_; } | 162 int vertex_opacity_location() const { return vertex_opacity_location_; } |
153 | 163 |
154 private: | 164 private: |
155 int matrix_location_; | 165 int matrix_location_; |
156 int tex_transform_location_; | 166 int tex_transform_location_; |
157 int vertex_opacity_location_; | 167 int vertex_opacity_location_; |
158 | 168 |
159 DISALLOW_COPY_AND_ASSIGN(VertexShaderPosTexTransform); | 169 DISALLOW_COPY_AND_ASSIGN(VertexShaderPosTexTransform); |
160 }; | 170 }; |
161 | 171 |
162 class VertexShaderQuad { | 172 class VertexShaderQuad { |
163 public: | 173 public: |
164 VertexShaderQuad(); | 174 VertexShaderQuad(); |
165 | 175 |
166 void Init(gpu::gles2::GLES2Interface* context, | 176 void Init(gpu::gles2::GLES2Interface* context, |
167 unsigned program, | 177 unsigned program, |
168 int* base_uniform_index); | 178 int* base_uniform_index); |
169 std::string GetShaderString() const; | 179 std::string GetShaderString() const; |
| 180 static std::string GetShaderHead(); |
| 181 static std::string GetShaderBody(); |
170 | 182 |
171 int matrix_location() const { return matrix_location_; } | 183 int matrix_location() const { return matrix_location_; } |
172 int viewport_location() const { return -1; } | 184 int viewport_location() const { return -1; } |
173 int quad_location() const { return quad_location_; } | 185 int quad_location() const { return quad_location_; } |
174 int edge_location() const { return -1; } | 186 int edge_location() const { return -1; } |
175 | 187 |
176 private: | 188 private: |
177 int matrix_location_; | 189 int matrix_location_; |
178 int quad_location_; | 190 int quad_location_; |
179 | 191 |
180 DISALLOW_COPY_AND_ASSIGN(VertexShaderQuad); | 192 DISALLOW_COPY_AND_ASSIGN(VertexShaderQuad); |
181 }; | 193 }; |
182 | 194 |
183 class VertexShaderQuadAA { | 195 class VertexShaderQuadAA { |
184 public: | 196 public: |
185 VertexShaderQuadAA(); | 197 VertexShaderQuadAA(); |
186 | 198 |
187 void Init(gpu::gles2::GLES2Interface* context, | 199 void Init(gpu::gles2::GLES2Interface* context, |
188 unsigned program, | 200 unsigned program, |
189 int* base_uniform_index); | 201 int* base_uniform_index); |
190 std::string GetShaderString() const; | 202 std::string GetShaderString() const; |
| 203 static std::string GetShaderHead(); |
| 204 static std::string GetShaderBody(); |
191 | 205 |
192 int matrix_location() const { return matrix_location_; } | 206 int matrix_location() const { return matrix_location_; } |
193 int viewport_location() const { return viewport_location_; } | 207 int viewport_location() const { return viewport_location_; } |
194 int quad_location() const { return quad_location_; } | 208 int quad_location() const { return quad_location_; } |
195 int edge_location() const { return edge_location_; } | 209 int edge_location() const { return edge_location_; } |
196 | 210 |
197 private: | 211 private: |
198 int matrix_location_; | 212 int matrix_location_; |
199 int viewport_location_; | 213 int viewport_location_; |
200 int quad_location_; | 214 int quad_location_; |
201 int edge_location_; | 215 int edge_location_; |
202 | 216 |
203 DISALLOW_COPY_AND_ASSIGN(VertexShaderQuadAA); | 217 DISALLOW_COPY_AND_ASSIGN(VertexShaderQuadAA); |
204 }; | 218 }; |
205 | 219 |
206 | 220 |
207 class VertexShaderQuadTexTransformAA { | 221 class VertexShaderQuadTexTransformAA { |
208 public: | 222 public: |
209 VertexShaderQuadTexTransformAA(); | 223 VertexShaderQuadTexTransformAA(); |
210 | 224 |
211 void Init(gpu::gles2::GLES2Interface* context, | 225 void Init(gpu::gles2::GLES2Interface* context, |
212 unsigned program, | 226 unsigned program, |
213 int* base_uniform_index); | 227 int* base_uniform_index); |
214 std::string GetShaderString() const; | 228 std::string GetShaderString() const; |
| 229 static std::string GetShaderHead(); |
| 230 static std::string GetShaderBody(); |
215 | 231 |
216 int matrix_location() const { return matrix_location_; } | 232 int matrix_location() const { return matrix_location_; } |
217 int viewport_location() const { return viewport_location_; } | 233 int viewport_location() const { return viewport_location_; } |
218 int quad_location() const { return quad_location_; } | 234 int quad_location() const { return quad_location_; } |
219 int edge_location() const { return edge_location_; } | 235 int edge_location() const { return edge_location_; } |
220 int tex_transform_location() const { return tex_transform_location_; } | 236 int tex_transform_location() const { return tex_transform_location_; } |
221 | 237 |
222 private: | 238 private: |
223 int matrix_location_; | 239 int matrix_location_; |
224 int viewport_location_; | 240 int viewport_location_; |
225 int quad_location_; | 241 int quad_location_; |
226 int edge_location_; | 242 int edge_location_; |
227 int tex_transform_location_; | 243 int tex_transform_location_; |
228 | 244 |
229 DISALLOW_COPY_AND_ASSIGN(VertexShaderQuadTexTransformAA); | 245 DISALLOW_COPY_AND_ASSIGN(VertexShaderQuadTexTransformAA); |
230 }; | 246 }; |
231 | 247 |
232 class VertexShaderTile { | 248 class VertexShaderTile { |
233 public: | 249 public: |
234 VertexShaderTile(); | 250 VertexShaderTile(); |
235 | 251 |
236 void Init(gpu::gles2::GLES2Interface* context, | 252 void Init(gpu::gles2::GLES2Interface* context, |
237 unsigned program, | 253 unsigned program, |
238 int* base_uniform_index); | 254 int* base_uniform_index); |
239 std::string GetShaderString() const; | 255 std::string GetShaderString() const; |
| 256 static std::string GetShaderHead(); |
| 257 static std::string GetShaderBody(); |
240 | 258 |
241 int matrix_location() const { return matrix_location_; } | 259 int matrix_location() const { return matrix_location_; } |
242 int viewport_location() const { return -1; } | 260 int viewport_location() const { return -1; } |
243 int quad_location() const { return quad_location_; } | 261 int quad_location() const { return quad_location_; } |
244 int edge_location() const { return -1; } | 262 int edge_location() const { return -1; } |
245 int vertex_tex_transform_location() const { | 263 int vertex_tex_transform_location() const { |
246 return vertex_tex_transform_location_; | 264 return vertex_tex_transform_location_; |
247 } | 265 } |
248 | 266 |
249 private: | 267 private: |
250 int matrix_location_; | 268 int matrix_location_; |
251 int quad_location_; | 269 int quad_location_; |
252 int vertex_tex_transform_location_; | 270 int vertex_tex_transform_location_; |
253 | 271 |
254 DISALLOW_COPY_AND_ASSIGN(VertexShaderTile); | 272 DISALLOW_COPY_AND_ASSIGN(VertexShaderTile); |
255 }; | 273 }; |
256 | 274 |
257 class VertexShaderTileAA { | 275 class VertexShaderTileAA { |
258 public: | 276 public: |
259 VertexShaderTileAA(); | 277 VertexShaderTileAA(); |
260 | 278 |
261 void Init(gpu::gles2::GLES2Interface* context, | 279 void Init(gpu::gles2::GLES2Interface* context, |
262 unsigned program, | 280 unsigned program, |
263 int* base_uniform_index); | 281 int* base_uniform_index); |
264 std::string GetShaderString() const; | 282 std::string GetShaderString() const; |
| 283 static std::string GetShaderHead(); |
| 284 static std::string GetShaderBody(); |
265 | 285 |
266 int matrix_location() const { return matrix_location_; } | 286 int matrix_location() const { return matrix_location_; } |
267 int viewport_location() const { return viewport_location_; } | 287 int viewport_location() const { return viewport_location_; } |
268 int quad_location() const { return quad_location_; } | 288 int quad_location() const { return quad_location_; } |
269 int edge_location() const { return edge_location_; } | 289 int edge_location() const { return edge_location_; } |
270 int vertex_tex_transform_location() const { | 290 int vertex_tex_transform_location() const { |
271 return vertex_tex_transform_location_; | 291 return vertex_tex_transform_location_; |
272 } | 292 } |
273 | 293 |
274 private: | 294 private: |
275 int matrix_location_; | 295 int matrix_location_; |
276 int viewport_location_; | 296 int viewport_location_; |
277 int quad_location_; | 297 int quad_location_; |
278 int edge_location_; | 298 int edge_location_; |
279 int vertex_tex_transform_location_; | 299 int vertex_tex_transform_location_; |
280 | 300 |
281 DISALLOW_COPY_AND_ASSIGN(VertexShaderTileAA); | 301 DISALLOW_COPY_AND_ASSIGN(VertexShaderTileAA); |
282 }; | 302 }; |
283 | 303 |
284 class VertexShaderVideoTransform { | 304 class VertexShaderVideoTransform { |
285 public: | 305 public: |
286 VertexShaderVideoTransform(); | 306 VertexShaderVideoTransform(); |
287 | 307 |
288 void Init(gpu::gles2::GLES2Interface* context, | 308 void Init(gpu::gles2::GLES2Interface* context, |
289 unsigned program, | 309 unsigned program, |
290 int* base_uniform_index); | 310 int* base_uniform_index); |
291 std::string GetShaderString() const; | 311 std::string GetShaderString() const; |
| 312 static std::string GetShaderHead(); |
| 313 static std::string GetShaderBody(); |
292 | 314 |
293 int matrix_location() const { return matrix_location_; } | 315 int matrix_location() const { return matrix_location_; } |
294 int tex_matrix_location() const { return tex_matrix_location_; } | 316 int tex_matrix_location() const { return tex_matrix_location_; } |
295 | 317 |
296 private: | 318 private: |
297 int matrix_location_; | 319 int matrix_location_; |
298 int tex_matrix_location_; | 320 int tex_matrix_location_; |
299 | 321 |
300 DISALLOW_COPY_AND_ASSIGN(VertexShaderVideoTransform); | 322 DISALLOW_COPY_AND_ASSIGN(VertexShaderVideoTransform); |
301 }; | 323 }; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 int background_color_location_; | 417 int background_color_location_; |
396 int sampler_location_; | 418 int sampler_location_; |
397 | 419 |
398 DISALLOW_COPY_AND_ASSIGN(FragmentTexBackgroundBinding); | 420 DISALLOW_COPY_AND_ASSIGN(FragmentTexBackgroundBinding); |
399 }; | 421 }; |
400 | 422 |
401 class FragmentShaderRGBATexVaryingAlpha : public FragmentTexOpaqueBinding { | 423 class FragmentShaderRGBATexVaryingAlpha : public FragmentTexOpaqueBinding { |
402 public: | 424 public: |
403 std::string GetShaderString( | 425 std::string GetShaderString( |
404 TexCoordPrecision precision, SamplerType sampler) const; | 426 TexCoordPrecision precision, SamplerType sampler) const; |
| 427 static std::string GetShaderHead(); |
| 428 static std::string GetShaderBody(); |
405 }; | 429 }; |
406 | 430 |
407 class FragmentShaderRGBATexPremultiplyAlpha : public FragmentTexOpaqueBinding { | 431 class FragmentShaderRGBATexPremultiplyAlpha : public FragmentTexOpaqueBinding { |
408 public: | 432 public: |
409 std::string GetShaderString( | 433 std::string GetShaderString( |
410 TexCoordPrecision precision, SamplerType sampler) const; | 434 TexCoordPrecision precision, SamplerType sampler) const; |
| 435 static std::string GetShaderHead(); |
| 436 static std::string GetShaderBody(); |
411 }; | 437 }; |
412 | 438 |
413 class FragmentShaderTexBackgroundVaryingAlpha | 439 class FragmentShaderTexBackgroundVaryingAlpha |
414 : public FragmentTexBackgroundBinding { | 440 : public FragmentTexBackgroundBinding { |
415 public: | 441 public: |
416 std::string GetShaderString( | 442 std::string GetShaderString( |
417 TexCoordPrecision precision, SamplerType sampler) const; | 443 TexCoordPrecision precision, SamplerType sampler) const; |
| 444 static std::string GetShaderHead(); |
| 445 static std::string GetShaderBody(); |
418 }; | 446 }; |
419 | 447 |
420 class FragmentShaderTexBackgroundPremultiplyAlpha | 448 class FragmentShaderTexBackgroundPremultiplyAlpha |
421 : public FragmentTexBackgroundBinding { | 449 : public FragmentTexBackgroundBinding { |
422 public: | 450 public: |
423 std::string GetShaderString( | 451 std::string GetShaderString( |
424 TexCoordPrecision precision, SamplerType sampler) const; | 452 TexCoordPrecision precision, SamplerType sampler) const; |
| 453 static std::string GetShaderHead(); |
| 454 static std::string GetShaderBody(); |
425 }; | 455 }; |
426 | 456 |
427 class FragmentShaderRGBATexAlpha : public FragmentTexAlphaBinding { | 457 class FragmentShaderRGBATexAlpha : public FragmentTexAlphaBinding { |
428 public: | 458 public: |
429 std::string GetShaderString( | 459 std::string GetShaderString( |
430 TexCoordPrecision precision, SamplerType sampler) const; | 460 TexCoordPrecision precision, SamplerType sampler) const; |
| 461 static std::string GetShaderHead(); |
| 462 static std::string GetShaderBody(); |
431 }; | 463 }; |
432 | 464 |
433 class FragmentShaderRGBATexColorMatrixAlpha | 465 class FragmentShaderRGBATexColorMatrixAlpha |
434 : public FragmentTexColorMatrixAlphaBinding { | 466 : public FragmentTexColorMatrixAlphaBinding { |
435 public: | 467 public: |
436 std::string GetShaderString( | 468 std::string GetShaderString(TexCoordPrecision precision, |
437 TexCoordPrecision precision, SamplerType sampler) const; | 469 SamplerType sampler) const; |
| 470 static std::string GetShaderHead(); |
| 471 static std::string GetShaderBody(); |
438 }; | 472 }; |
439 | 473 |
440 class FragmentShaderRGBATexOpaque : public FragmentTexOpaqueBinding { | 474 class FragmentShaderRGBATexOpaque : public FragmentTexOpaqueBinding { |
441 public: | 475 public: |
442 std::string GetShaderString( | 476 std::string GetShaderString( |
443 TexCoordPrecision precision, SamplerType sampler) const; | 477 TexCoordPrecision precision, SamplerType sampler) const; |
| 478 static std::string GetShaderHead(); |
| 479 static std::string GetShaderBody(); |
444 }; | 480 }; |
445 | 481 |
446 class FragmentShaderRGBATex : public FragmentTexOpaqueBinding { | 482 class FragmentShaderRGBATex : public FragmentTexOpaqueBinding { |
447 public: | 483 public: |
448 std::string GetShaderString( | 484 std::string GetShaderString( |
449 TexCoordPrecision precision, SamplerType sampler) const; | 485 TexCoordPrecision precision, SamplerType sampler) const; |
| 486 static std::string GetShaderHead(); |
| 487 static std::string GetShaderBody(); |
450 }; | 488 }; |
451 | 489 |
452 // Swizzles the red and blue component of sampled texel with alpha. | 490 // Swizzles the red and blue component of sampled texel with alpha. |
453 class FragmentShaderRGBATexSwizzleAlpha : public FragmentTexAlphaBinding { | 491 class FragmentShaderRGBATexSwizzleAlpha : public FragmentTexAlphaBinding { |
454 public: | 492 public: |
455 std::string GetShaderString( | 493 std::string GetShaderString( |
456 TexCoordPrecision precision, SamplerType sampler) const; | 494 TexCoordPrecision precision, SamplerType sampler) const; |
| 495 static std::string GetShaderHead(); |
| 496 static std::string GetShaderBody(); |
457 }; | 497 }; |
458 | 498 |
459 // Swizzles the red and blue component of sampled texel without alpha. | 499 // Swizzles the red and blue component of sampled texel without alpha. |
460 class FragmentShaderRGBATexSwizzleOpaque : public FragmentTexOpaqueBinding { | 500 class FragmentShaderRGBATexSwizzleOpaque : public FragmentTexOpaqueBinding { |
461 public: | 501 public: |
462 std::string GetShaderString( | 502 std::string GetShaderString( |
463 TexCoordPrecision precision, SamplerType sampler) const; | 503 TexCoordPrecision precision, SamplerType sampler) const; |
| 504 static std::string GetShaderHead(); |
| 505 static std::string GetShaderBody(); |
464 }; | 506 }; |
465 | 507 |
466 class FragmentShaderRGBATexAlphaAA : public FragmentTexBlendMode { | 508 class FragmentShaderRGBATexAlphaAA : public FragmentTexBlendMode { |
467 public: | 509 public: |
468 FragmentShaderRGBATexAlphaAA(); | 510 FragmentShaderRGBATexAlphaAA(); |
469 | 511 |
470 void Init(gpu::gles2::GLES2Interface* context, | 512 void Init(gpu::gles2::GLES2Interface* context, |
471 unsigned program, | 513 unsigned program, |
472 int* base_uniform_index); | 514 int* base_uniform_index); |
473 std::string GetShaderString( | 515 std::string GetShaderString( |
474 TexCoordPrecision precision, SamplerType sampler) const; | 516 TexCoordPrecision precision, SamplerType sampler) const; |
| 517 static std::string GetShaderHead(); |
| 518 static std::string GetShaderBody(); |
475 | 519 |
476 int alpha_location() const { return alpha_location_; } | 520 int alpha_location() const { return alpha_location_; } |
477 int sampler_location() const { return sampler_location_; } | 521 int sampler_location() const { return sampler_location_; } |
478 | 522 |
479 private: | 523 private: |
480 int sampler_location_; | 524 int sampler_location_; |
481 int alpha_location_; | 525 int alpha_location_; |
482 | 526 |
483 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaAA); | 527 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaAA); |
484 }; | 528 }; |
(...skipping 17 matching lines...) Expand all Loading... |
502 int fragment_tex_transform_location_; | 546 int fragment_tex_transform_location_; |
503 | 547 |
504 DISALLOW_COPY_AND_ASSIGN(FragmentTexClampAlphaAABinding); | 548 DISALLOW_COPY_AND_ASSIGN(FragmentTexClampAlphaAABinding); |
505 }; | 549 }; |
506 | 550 |
507 class FragmentShaderRGBATexClampAlphaAA | 551 class FragmentShaderRGBATexClampAlphaAA |
508 : public FragmentTexClampAlphaAABinding { | 552 : public FragmentTexClampAlphaAABinding { |
509 public: | 553 public: |
510 std::string GetShaderString( | 554 std::string GetShaderString( |
511 TexCoordPrecision precision, SamplerType sampler) const; | 555 TexCoordPrecision precision, SamplerType sampler) const; |
| 556 static std::string GetShaderHead(); |
| 557 static std::string GetShaderBody(); |
512 }; | 558 }; |
513 | 559 |
514 // Swizzles the red and blue component of sampled texel. | 560 // Swizzles the red and blue component of sampled texel. |
515 class FragmentShaderRGBATexClampSwizzleAlphaAA | 561 class FragmentShaderRGBATexClampSwizzleAlphaAA |
516 : public FragmentTexClampAlphaAABinding { | 562 : public FragmentTexClampAlphaAABinding { |
517 public: | 563 public: |
518 std::string GetShaderString( | 564 std::string GetShaderString( |
519 TexCoordPrecision precision, SamplerType sampler) const; | 565 TexCoordPrecision precision, SamplerType sampler) const; |
| 566 static std::string GetShaderHead(); |
| 567 static std::string GetShaderBody(); |
520 }; | 568 }; |
521 | 569 |
522 class FragmentShaderRGBATexAlphaMask : public FragmentTexBlendMode { | 570 class FragmentShaderRGBATexAlphaMask : public FragmentTexBlendMode { |
523 public: | 571 public: |
524 FragmentShaderRGBATexAlphaMask(); | 572 FragmentShaderRGBATexAlphaMask(); |
525 std::string GetShaderString( | 573 std::string GetShaderString( |
526 TexCoordPrecision precision, SamplerType sampler) const; | 574 TexCoordPrecision precision, SamplerType sampler) const; |
| 575 static std::string GetShaderHead(); |
| 576 static std::string GetShaderBody(); |
527 | 577 |
528 void Init(gpu::gles2::GLES2Interface* context, | 578 void Init(gpu::gles2::GLES2Interface* context, |
529 unsigned program, | 579 unsigned program, |
530 int* base_uniform_index); | 580 int* base_uniform_index); |
531 int alpha_location() const { return alpha_location_; } | 581 int alpha_location() const { return alpha_location_; } |
532 int sampler_location() const { return sampler_location_; } | 582 int sampler_location() const { return sampler_location_; } |
533 int mask_sampler_location() const { return mask_sampler_location_; } | 583 int mask_sampler_location() const { return mask_sampler_location_; } |
534 int mask_tex_coord_scale_location() const { | 584 int mask_tex_coord_scale_location() const { |
535 return mask_tex_coord_scale_location_; | 585 return mask_tex_coord_scale_location_; |
536 } | 586 } |
537 int mask_tex_coord_offset_location() const { | 587 int mask_tex_coord_offset_location() const { |
538 return mask_tex_coord_offset_location_; | 588 return mask_tex_coord_offset_location_; |
539 } | 589 } |
540 | 590 |
541 private: | 591 private: |
542 int sampler_location_; | 592 int sampler_location_; |
543 int mask_sampler_location_; | 593 int mask_sampler_location_; |
544 int alpha_location_; | 594 int alpha_location_; |
545 int mask_tex_coord_scale_location_; | 595 int mask_tex_coord_scale_location_; |
546 int mask_tex_coord_offset_location_; | 596 int mask_tex_coord_offset_location_; |
547 | 597 |
548 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMask); | 598 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMask); |
549 }; | 599 }; |
550 | 600 |
551 class FragmentShaderRGBATexAlphaMaskAA : public FragmentTexBlendMode { | 601 class FragmentShaderRGBATexAlphaMaskAA : public FragmentTexBlendMode { |
552 public: | 602 public: |
553 FragmentShaderRGBATexAlphaMaskAA(); | 603 FragmentShaderRGBATexAlphaMaskAA(); |
554 std::string GetShaderString( | 604 std::string GetShaderString( |
555 TexCoordPrecision precision, SamplerType sampler) const; | 605 TexCoordPrecision precision, SamplerType sampler) const; |
| 606 static std::string GetShaderHead(); |
| 607 static std::string GetShaderBody(); |
556 | 608 |
557 void Init(gpu::gles2::GLES2Interface* context, | 609 void Init(gpu::gles2::GLES2Interface* context, |
558 unsigned program, | 610 unsigned program, |
559 int* base_uniform_index); | 611 int* base_uniform_index); |
560 int alpha_location() const { return alpha_location_; } | 612 int alpha_location() const { return alpha_location_; } |
561 int sampler_location() const { return sampler_location_; } | 613 int sampler_location() const { return sampler_location_; } |
562 int mask_sampler_location() const { return mask_sampler_location_; } | 614 int mask_sampler_location() const { return mask_sampler_location_; } |
563 int mask_tex_coord_scale_location() const { | 615 int mask_tex_coord_scale_location() const { |
564 return mask_tex_coord_scale_location_; | 616 return mask_tex_coord_scale_location_; |
565 } | 617 } |
(...skipping 10 matching lines...) Expand all Loading... |
576 | 628 |
577 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMaskAA); | 629 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMaskAA); |
578 }; | 630 }; |
579 | 631 |
580 class FragmentShaderRGBATexAlphaMaskColorMatrixAA | 632 class FragmentShaderRGBATexAlphaMaskColorMatrixAA |
581 : public FragmentTexBlendMode { | 633 : public FragmentTexBlendMode { |
582 public: | 634 public: |
583 FragmentShaderRGBATexAlphaMaskColorMatrixAA(); | 635 FragmentShaderRGBATexAlphaMaskColorMatrixAA(); |
584 std::string GetShaderString( | 636 std::string GetShaderString( |
585 TexCoordPrecision precision, SamplerType sampler) const; | 637 TexCoordPrecision precision, SamplerType sampler) const; |
| 638 static std::string GetShaderHead(); |
| 639 static std::string GetShaderBody(); |
586 | 640 |
587 void Init(gpu::gles2::GLES2Interface* context, | 641 void Init(gpu::gles2::GLES2Interface* context, |
588 unsigned program, | 642 unsigned program, |
589 int* base_uniform_index); | 643 int* base_uniform_index); |
590 int alpha_location() const { return alpha_location_; } | 644 int alpha_location() const { return alpha_location_; } |
591 int sampler_location() const { return sampler_location_; } | 645 int sampler_location() const { return sampler_location_; } |
592 int mask_sampler_location() const { return mask_sampler_location_; } | 646 int mask_sampler_location() const { return mask_sampler_location_; } |
593 int mask_tex_coord_scale_location() const { | 647 int mask_tex_coord_scale_location() const { |
594 return mask_tex_coord_scale_location_; | 648 return mask_tex_coord_scale_location_; |
595 } | 649 } |
(...skipping 11 matching lines...) Expand all Loading... |
607 int mask_tex_coord_offset_location_; | 661 int mask_tex_coord_offset_location_; |
608 int color_matrix_location_; | 662 int color_matrix_location_; |
609 int color_offset_location_; | 663 int color_offset_location_; |
610 }; | 664 }; |
611 | 665 |
612 class FragmentShaderRGBATexAlphaColorMatrixAA : public FragmentTexBlendMode { | 666 class FragmentShaderRGBATexAlphaColorMatrixAA : public FragmentTexBlendMode { |
613 public: | 667 public: |
614 FragmentShaderRGBATexAlphaColorMatrixAA(); | 668 FragmentShaderRGBATexAlphaColorMatrixAA(); |
615 std::string GetShaderString( | 669 std::string GetShaderString( |
616 TexCoordPrecision precision, SamplerType sampler) const; | 670 TexCoordPrecision precision, SamplerType sampler) const; |
| 671 static std::string GetShaderHead(); |
| 672 static std::string GetShaderBody(); |
617 | 673 |
618 void Init(gpu::gles2::GLES2Interface* context, | 674 void Init(gpu::gles2::GLES2Interface* context, |
619 unsigned program, | 675 unsigned program, |
620 int* base_uniform_index); | 676 int* base_uniform_index); |
621 int alpha_location() const { return alpha_location_; } | 677 int alpha_location() const { return alpha_location_; } |
622 int sampler_location() const { return sampler_location_; } | 678 int sampler_location() const { return sampler_location_; } |
623 int color_matrix_location() const { return color_matrix_location_; } | 679 int color_matrix_location() const { return color_matrix_location_; } |
624 int color_offset_location() const { return color_offset_location_; } | 680 int color_offset_location() const { return color_offset_location_; } |
625 | 681 |
626 private: | 682 private: |
627 int sampler_location_; | 683 int sampler_location_; |
628 int alpha_location_; | 684 int alpha_location_; |
629 int color_matrix_location_; | 685 int color_matrix_location_; |
630 int color_offset_location_; | 686 int color_offset_location_; |
631 }; | 687 }; |
632 | 688 |
633 class FragmentShaderRGBATexAlphaMaskColorMatrix : public FragmentTexBlendMode { | 689 class FragmentShaderRGBATexAlphaMaskColorMatrix : public FragmentTexBlendMode { |
634 public: | 690 public: |
635 FragmentShaderRGBATexAlphaMaskColorMatrix(); | 691 FragmentShaderRGBATexAlphaMaskColorMatrix(); |
636 std::string GetShaderString( | 692 std::string GetShaderString( |
637 TexCoordPrecision precision, SamplerType sampler) const; | 693 TexCoordPrecision precision, SamplerType sampler) const; |
| 694 static std::string GetShaderHead(); |
| 695 static std::string GetShaderBody(); |
638 | 696 |
639 void Init(gpu::gles2::GLES2Interface* context, | 697 void Init(gpu::gles2::GLES2Interface* context, |
640 unsigned program, | 698 unsigned program, |
641 int* base_uniform_index); | 699 int* base_uniform_index); |
642 int alpha_location() const { return alpha_location_; } | 700 int alpha_location() const { return alpha_location_; } |
643 int sampler_location() const { return sampler_location_; } | 701 int sampler_location() const { return sampler_location_; } |
644 int mask_sampler_location() const { return mask_sampler_location_; } | 702 int mask_sampler_location() const { return mask_sampler_location_; } |
645 int mask_tex_coord_scale_location() const { | 703 int mask_tex_coord_scale_location() const { |
646 return mask_tex_coord_scale_location_; | 704 return mask_tex_coord_scale_location_; |
647 } | 705 } |
(...skipping 11 matching lines...) Expand all Loading... |
659 int mask_tex_coord_offset_location_; | 717 int mask_tex_coord_offset_location_; |
660 int color_matrix_location_; | 718 int color_matrix_location_; |
661 int color_offset_location_; | 719 int color_offset_location_; |
662 }; | 720 }; |
663 | 721 |
664 class FragmentShaderYUVVideo : public FragmentTexBlendMode { | 722 class FragmentShaderYUVVideo : public FragmentTexBlendMode { |
665 public: | 723 public: |
666 FragmentShaderYUVVideo(); | 724 FragmentShaderYUVVideo(); |
667 std::string GetShaderString( | 725 std::string GetShaderString( |
668 TexCoordPrecision precision, SamplerType sampler) const; | 726 TexCoordPrecision precision, SamplerType sampler) const; |
| 727 static std::string GetShaderHead(); |
| 728 static std::string GetShaderBody(); |
669 | 729 |
670 void Init(gpu::gles2::GLES2Interface* context, | 730 void Init(gpu::gles2::GLES2Interface* context, |
671 unsigned program, | 731 unsigned program, |
672 int* base_uniform_index); | 732 int* base_uniform_index); |
673 int y_texture_location() const { return y_texture_location_; } | 733 int y_texture_location() const { return y_texture_location_; } |
674 int u_texture_location() const { return u_texture_location_; } | 734 int u_texture_location() const { return u_texture_location_; } |
675 int v_texture_location() const { return v_texture_location_; } | 735 int v_texture_location() const { return v_texture_location_; } |
676 int alpha_location() const { return alpha_location_; } | 736 int alpha_location() const { return alpha_location_; } |
677 int yuv_matrix_location() const { return yuv_matrix_location_; } | 737 int yuv_matrix_location() const { return yuv_matrix_location_; } |
678 int yuv_adj_location() const { return yuv_adj_location_; } | 738 int yuv_adj_location() const { return yuv_adj_location_; } |
679 int clamp_rect_location() const { return clamp_rect_location_; } | 739 int clamp_rect_location() const { return clamp_rect_location_; } |
680 | 740 |
681 private: | 741 private: |
682 int y_texture_location_; | 742 int y_texture_location_; |
683 int u_texture_location_; | 743 int u_texture_location_; |
684 int v_texture_location_; | 744 int v_texture_location_; |
685 int alpha_location_; | 745 int alpha_location_; |
686 int yuv_matrix_location_; | 746 int yuv_matrix_location_; |
687 int yuv_adj_location_; | 747 int yuv_adj_location_; |
688 int clamp_rect_location_; | 748 int clamp_rect_location_; |
689 | 749 |
690 DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVVideo); | 750 DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVVideo); |
691 }; | 751 }; |
692 | 752 |
693 class FragmentShaderYUVAVideo : public FragmentTexBlendMode { | 753 class FragmentShaderYUVAVideo : public FragmentTexBlendMode { |
694 public: | 754 public: |
695 FragmentShaderYUVAVideo(); | 755 FragmentShaderYUVAVideo(); |
696 std::string GetShaderString( | 756 std::string GetShaderString( |
697 TexCoordPrecision precision, SamplerType sampler) const; | 757 TexCoordPrecision precision, SamplerType sampler) const; |
| 758 static std::string GetShaderHead(); |
| 759 static std::string GetShaderBody(); |
698 | 760 |
699 void Init(gpu::gles2::GLES2Interface* context, | 761 void Init(gpu::gles2::GLES2Interface* context, |
700 unsigned program, | 762 unsigned program, |
701 int* base_uniform_index); | 763 int* base_uniform_index); |
702 | 764 |
703 int y_texture_location() const { return y_texture_location_; } | 765 int y_texture_location() const { return y_texture_location_; } |
704 int u_texture_location() const { return u_texture_location_; } | 766 int u_texture_location() const { return u_texture_location_; } |
705 int v_texture_location() const { return v_texture_location_; } | 767 int v_texture_location() const { return v_texture_location_; } |
706 int a_texture_location() const { return a_texture_location_; } | 768 int a_texture_location() const { return a_texture_location_; } |
707 int alpha_location() const { return alpha_location_; } | 769 int alpha_location() const { return alpha_location_; } |
(...skipping 12 matching lines...) Expand all Loading... |
720 int clamp_rect_location_; | 782 int clamp_rect_location_; |
721 | 783 |
722 DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVAVideo); | 784 DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVAVideo); |
723 }; | 785 }; |
724 | 786 |
725 class FragmentShaderColor : public FragmentTexBlendMode { | 787 class FragmentShaderColor : public FragmentTexBlendMode { |
726 public: | 788 public: |
727 FragmentShaderColor(); | 789 FragmentShaderColor(); |
728 std::string GetShaderString( | 790 std::string GetShaderString( |
729 TexCoordPrecision precision, SamplerType sampler) const; | 791 TexCoordPrecision precision, SamplerType sampler) const; |
| 792 static std::string GetShaderHead(); |
| 793 static std::string GetShaderBody(); |
730 | 794 |
731 void Init(gpu::gles2::GLES2Interface* context, | 795 void Init(gpu::gles2::GLES2Interface* context, |
732 unsigned program, | 796 unsigned program, |
733 int* base_uniform_index); | 797 int* base_uniform_index); |
734 int color_location() const { return color_location_; } | 798 int color_location() const { return color_location_; } |
735 | 799 |
736 private: | 800 private: |
737 int color_location_; | 801 int color_location_; |
738 | 802 |
739 DISALLOW_COPY_AND_ASSIGN(FragmentShaderColor); | 803 DISALLOW_COPY_AND_ASSIGN(FragmentShaderColor); |
740 }; | 804 }; |
741 | 805 |
742 class FragmentShaderColorAA : public FragmentTexBlendMode { | 806 class FragmentShaderColorAA : public FragmentTexBlendMode { |
743 public: | 807 public: |
744 FragmentShaderColorAA(); | 808 FragmentShaderColorAA(); |
745 std::string GetShaderString( | 809 std::string GetShaderString( |
746 TexCoordPrecision precision, SamplerType sampler) const; | 810 TexCoordPrecision precision, SamplerType sampler) const; |
| 811 static std::string GetShaderHead(); |
| 812 static std::string GetShaderBody(); |
747 | 813 |
748 void Init(gpu::gles2::GLES2Interface* context, | 814 void Init(gpu::gles2::GLES2Interface* context, |
749 unsigned program, | 815 unsigned program, |
750 int* base_uniform_index); | 816 int* base_uniform_index); |
751 int color_location() const { return color_location_; } | 817 int color_location() const { return color_location_; } |
752 | 818 |
753 private: | 819 private: |
754 int color_location_; | 820 int color_location_; |
755 | 821 |
756 DISALLOW_COPY_AND_ASSIGN(FragmentShaderColorAA); | 822 DISALLOW_COPY_AND_ASSIGN(FragmentShaderColorAA); |
757 }; | 823 }; |
758 | 824 |
759 class FragmentShaderCheckerboard : public FragmentTexBlendMode { | 825 class FragmentShaderCheckerboard : public FragmentTexBlendMode { |
760 public: | 826 public: |
761 FragmentShaderCheckerboard(); | 827 FragmentShaderCheckerboard(); |
762 std::string GetShaderString( | 828 std::string GetShaderString( |
763 TexCoordPrecision precision, SamplerType sampler) const; | 829 TexCoordPrecision precision, SamplerType sampler) const; |
| 830 static std::string GetShaderHead(); |
| 831 static std::string GetShaderBody(); |
764 | 832 |
765 void Init(gpu::gles2::GLES2Interface* context, | 833 void Init(gpu::gles2::GLES2Interface* context, |
766 unsigned program, | 834 unsigned program, |
767 int* base_uniform_index); | 835 int* base_uniform_index); |
768 int alpha_location() const { return alpha_location_; } | 836 int alpha_location() const { return alpha_location_; } |
769 int tex_transform_location() const { return tex_transform_location_; } | 837 int tex_transform_location() const { return tex_transform_location_; } |
770 int frequency_location() const { return frequency_location_; } | 838 int frequency_location() const { return frequency_location_; } |
771 int color_location() const { return color_location_; } | 839 int color_location() const { return color_location_; } |
772 | 840 |
773 private: | 841 private: |
774 int alpha_location_; | 842 int alpha_location_; |
775 int tex_transform_location_; | 843 int tex_transform_location_; |
776 int frequency_location_; | 844 int frequency_location_; |
777 int color_location_; | 845 int color_location_; |
778 | 846 |
779 DISALLOW_COPY_AND_ASSIGN(FragmentShaderCheckerboard); | 847 DISALLOW_COPY_AND_ASSIGN(FragmentShaderCheckerboard); |
780 }; | 848 }; |
781 | 849 |
782 } // namespace cc | 850 } // namespace cc |
783 | 851 |
784 #endif // CC_OUTPUT_SHADER_H_ | 852 #endif // CC_OUTPUT_SHADER_H_ |
OLD | NEW |