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 blink { 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 = 0, |
25 TexCoordPrecisionMedium, | 25 TexCoordPrecisionMedium = 1, |
26 TexCoordPrecisionHigh, | 26 TexCoordPrecisionHigh = 2, |
| 27 NumTexCoordPrecisions = 3 |
| 28 }; |
| 29 |
| 30 enum SamplerType { |
| 31 SamplerTypeNA = 0, |
| 32 SamplerType2D = 1, |
| 33 SamplerType2DRect = 2, |
| 34 SamplerTypeExternalOES = 3, |
| 35 NumSamplerTypes = 4 |
27 }; | 36 }; |
28 | 37 |
29 // Note: The highp_threshold_cache must be provided by the caller to make | 38 // 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. | 39 // 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 | 40 // 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. | 41 // reinitialized, if a new or different context is used. |
33 CC_EXPORT TexCoordPrecision TexCoordPrecisionRequired( | 42 CC_EXPORT TexCoordPrecision TexCoordPrecisionRequired( |
34 blink::WebGraphicsContext3D* context, | 43 blink::WebGraphicsContext3D* context, |
35 int *highp_threshold_cache, | 44 int *highp_threshold_cache, |
36 int highp_threshold_min, | 45 int highp_threshold_min, |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 | 342 |
334 private: | 343 private: |
335 int background_color_location_; | 344 int background_color_location_; |
336 int sampler_location_; | 345 int sampler_location_; |
337 | 346 |
338 DISALLOW_COPY_AND_ASSIGN(FragmentTexBackgroundBinding); | 347 DISALLOW_COPY_AND_ASSIGN(FragmentTexBackgroundBinding); |
339 }; | 348 }; |
340 | 349 |
341 class FragmentShaderRGBATexVaryingAlpha : public FragmentTexOpaqueBinding { | 350 class FragmentShaderRGBATexVaryingAlpha : public FragmentTexOpaqueBinding { |
342 public: | 351 public: |
343 std::string GetShaderString(TexCoordPrecision precision) const; | 352 std::string GetShaderString( |
| 353 TexCoordPrecision precision, SamplerType sampler) const; |
344 }; | 354 }; |
345 | 355 |
346 class FragmentShaderRGBATexPremultiplyAlpha : public FragmentTexOpaqueBinding { | 356 class FragmentShaderRGBATexPremultiplyAlpha : public FragmentTexOpaqueBinding { |
347 public: | 357 public: |
348 std::string GetShaderString(TexCoordPrecision precision) const; | 358 std::string GetShaderString( |
| 359 TexCoordPrecision precision, SamplerType sampler) const; |
349 }; | 360 }; |
350 | 361 |
351 class FragmentShaderTexBackgroundVaryingAlpha | 362 class FragmentShaderTexBackgroundVaryingAlpha |
352 : public FragmentTexBackgroundBinding { | 363 : public FragmentTexBackgroundBinding { |
353 public: | 364 public: |
354 std::string GetShaderString(TexCoordPrecision precision) const; | 365 std::string GetShaderString( |
| 366 TexCoordPrecision precision, SamplerType sampler) const; |
355 }; | 367 }; |
356 | 368 |
357 class FragmentShaderTexBackgroundPremultiplyAlpha | 369 class FragmentShaderTexBackgroundPremultiplyAlpha |
358 : public FragmentTexBackgroundBinding { | 370 : public FragmentTexBackgroundBinding { |
359 public: | 371 public: |
360 std::string GetShaderString(TexCoordPrecision precision) const; | 372 std::string GetShaderString( |
| 373 TexCoordPrecision precision, SamplerType sampler) const; |
361 }; | 374 }; |
362 | 375 |
363 class FragmentShaderRGBATexAlpha : public FragmentTexAlphaBinding { | 376 class FragmentShaderRGBATexAlpha : public FragmentTexAlphaBinding { |
364 public: | 377 public: |
365 std::string GetShaderString(TexCoordPrecision precision) const; | 378 std::string GetShaderString( |
| 379 TexCoordPrecision precision, SamplerType sampler) const; |
366 }; | 380 }; |
367 | 381 |
368 class FragmentShaderRGBATexColorMatrixAlpha | 382 class FragmentShaderRGBATexColorMatrixAlpha |
369 : public FragmentTexColorMatrixAlphaBinding { | 383 : public FragmentTexColorMatrixAlphaBinding { |
370 public: | 384 public: |
371 std::string GetShaderString(TexCoordPrecision precision) const; | 385 std::string GetShaderString( |
372 }; | 386 TexCoordPrecision precision, SamplerType sampler) const; |
373 | |
374 class FragmentShaderRGBATexRectVaryingAlpha : public FragmentTexOpaqueBinding { | |
375 public: | |
376 std::string GetShaderString(TexCoordPrecision precision) const; | |
377 }; | 387 }; |
378 | 388 |
379 class FragmentShaderRGBATexOpaque : public FragmentTexOpaqueBinding { | 389 class FragmentShaderRGBATexOpaque : public FragmentTexOpaqueBinding { |
380 public: | 390 public: |
381 std::string GetShaderString(TexCoordPrecision precision) const; | 391 std::string GetShaderString( |
| 392 TexCoordPrecision precision, SamplerType sampler) const; |
382 }; | 393 }; |
383 | 394 |
384 class FragmentShaderRGBATex : public FragmentTexOpaqueBinding { | 395 class FragmentShaderRGBATex : public FragmentTexOpaqueBinding { |
385 public: | 396 public: |
386 std::string GetShaderString(TexCoordPrecision precision) const; | 397 std::string GetShaderString( |
| 398 TexCoordPrecision precision, SamplerType sampler) const; |
387 }; | 399 }; |
388 | 400 |
389 // Swizzles the red and blue component of sampled texel with alpha. | 401 // Swizzles the red and blue component of sampled texel with alpha. |
390 class FragmentShaderRGBATexSwizzleAlpha : public FragmentTexAlphaBinding { | 402 class FragmentShaderRGBATexSwizzleAlpha : public FragmentTexAlphaBinding { |
391 public: | 403 public: |
392 std::string GetShaderString(TexCoordPrecision precision) const; | 404 std::string GetShaderString( |
| 405 TexCoordPrecision precision, SamplerType sampler) const; |
393 }; | 406 }; |
394 | 407 |
395 // Swizzles the red and blue component of sampled texel without alpha. | 408 // Swizzles the red and blue component of sampled texel without alpha. |
396 class FragmentShaderRGBATexSwizzleOpaque : public FragmentTexOpaqueBinding { | 409 class FragmentShaderRGBATexSwizzleOpaque : public FragmentTexOpaqueBinding { |
397 public: | 410 public: |
398 std::string GetShaderString(TexCoordPrecision precision) const; | 411 std::string GetShaderString( |
399 }; | 412 TexCoordPrecision precision, SamplerType sampler) const; |
400 | |
401 // Fragment shader for external textures. | |
402 class FragmentShaderOESImageExternal : public FragmentTexAlphaBinding { | |
403 public: | |
404 FragmentShaderOESImageExternal(); | |
405 | |
406 std::string GetShaderString(TexCoordPrecision precision) const; | |
407 void Init(blink::WebGraphicsContext3D* context, | |
408 unsigned program, | |
409 int* base_uniform_index); | |
410 private: | |
411 int sampler_location_; | |
412 | |
413 DISALLOW_COPY_AND_ASSIGN(FragmentShaderOESImageExternal); | |
414 }; | 413 }; |
415 | 414 |
416 class FragmentShaderRGBATexAlphaAA { | 415 class FragmentShaderRGBATexAlphaAA { |
417 public: | 416 public: |
418 FragmentShaderRGBATexAlphaAA(); | 417 FragmentShaderRGBATexAlphaAA(); |
419 | 418 |
420 void Init(blink::WebGraphicsContext3D* context, | 419 void Init(blink::WebGraphicsContext3D* context, |
421 unsigned program, | 420 unsigned program, |
422 int* base_uniform_index); | 421 int* base_uniform_index); |
423 std::string GetShaderString(TexCoordPrecision precision) const; | 422 std::string GetShaderString( |
| 423 TexCoordPrecision precision, SamplerType sampler) 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 }; |
(...skipping 15 matching lines...) Expand all Loading... |
449 int sampler_location_; | 449 int sampler_location_; |
450 int alpha_location_; | 450 int alpha_location_; |
451 int fragment_tex_transform_location_; | 451 int fragment_tex_transform_location_; |
452 | 452 |
453 DISALLOW_COPY_AND_ASSIGN(FragmentTexClampAlphaAABinding); | 453 DISALLOW_COPY_AND_ASSIGN(FragmentTexClampAlphaAABinding); |
454 }; | 454 }; |
455 | 455 |
456 class FragmentShaderRGBATexClampAlphaAA | 456 class FragmentShaderRGBATexClampAlphaAA |
457 : public FragmentTexClampAlphaAABinding { | 457 : public FragmentTexClampAlphaAABinding { |
458 public: | 458 public: |
459 std::string GetShaderString(TexCoordPrecision precision) const; | 459 std::string GetShaderString( |
| 460 TexCoordPrecision precision, SamplerType sampler) const; |
460 }; | 461 }; |
461 | 462 |
462 // Swizzles the red and blue component of sampled texel. | 463 // Swizzles the red and blue component of sampled texel. |
463 class FragmentShaderRGBATexClampSwizzleAlphaAA | 464 class FragmentShaderRGBATexClampSwizzleAlphaAA |
464 : public FragmentTexClampAlphaAABinding { | 465 : public FragmentTexClampAlphaAABinding { |
465 public: | 466 public: |
466 std::string GetShaderString(TexCoordPrecision precision) const; | 467 std::string GetShaderString( |
| 468 TexCoordPrecision precision, SamplerType sampler) const; |
467 }; | 469 }; |
468 | 470 |
469 class FragmentShaderRGBATexAlphaMask { | 471 class FragmentShaderRGBATexAlphaMask { |
470 public: | 472 public: |
471 FragmentShaderRGBATexAlphaMask(); | 473 FragmentShaderRGBATexAlphaMask(); |
472 std::string GetShaderString(TexCoordPrecision precision) const; | 474 std::string GetShaderString( |
| 475 TexCoordPrecision precision, SamplerType sampler) const; |
473 | 476 |
474 void Init(blink::WebGraphicsContext3D* context, | 477 void Init(blink::WebGraphicsContext3D* context, |
475 unsigned program, | 478 unsigned program, |
476 int* base_uniform_index); | 479 int* base_uniform_index); |
477 int alpha_location() const { return alpha_location_; } | 480 int alpha_location() const { return alpha_location_; } |
478 int sampler_location() const { return sampler_location_; } | 481 int sampler_location() const { return sampler_location_; } |
479 int mask_sampler_location() const { return mask_sampler_location_; } | 482 int mask_sampler_location() const { return mask_sampler_location_; } |
480 int mask_tex_coord_scale_location() const { | 483 int mask_tex_coord_scale_location() const { |
481 return mask_tex_coord_scale_location_; | 484 return mask_tex_coord_scale_location_; |
482 } | 485 } |
483 int mask_tex_coord_offset_location() const { | 486 int mask_tex_coord_offset_location() const { |
484 return mask_tex_coord_offset_location_; | 487 return mask_tex_coord_offset_location_; |
485 } | 488 } |
486 | 489 |
487 private: | 490 private: |
488 int sampler_location_; | 491 int sampler_location_; |
489 int mask_sampler_location_; | 492 int mask_sampler_location_; |
490 int alpha_location_; | 493 int alpha_location_; |
491 int mask_tex_coord_scale_location_; | 494 int mask_tex_coord_scale_location_; |
492 int mask_tex_coord_offset_location_; | 495 int mask_tex_coord_offset_location_; |
493 | 496 |
494 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMask); | 497 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMask); |
495 }; | 498 }; |
496 | 499 |
497 class FragmentShaderRGBATexAlphaMaskAA { | 500 class FragmentShaderRGBATexAlphaMaskAA { |
498 public: | 501 public: |
499 FragmentShaderRGBATexAlphaMaskAA(); | 502 FragmentShaderRGBATexAlphaMaskAA(); |
500 std::string GetShaderString(TexCoordPrecision precision) const; | 503 std::string GetShaderString( |
| 504 TexCoordPrecision precision, SamplerType sampler) const; |
501 | 505 |
502 void Init(blink::WebGraphicsContext3D* context, | 506 void Init(blink::WebGraphicsContext3D* context, |
503 unsigned program, | 507 unsigned program, |
504 int* base_uniform_index); | 508 int* base_uniform_index); |
505 int alpha_location() const { return alpha_location_; } | 509 int alpha_location() const { return alpha_location_; } |
506 int sampler_location() const { return sampler_location_; } | 510 int sampler_location() const { return sampler_location_; } |
507 int mask_sampler_location() const { return mask_sampler_location_; } | 511 int mask_sampler_location() const { return mask_sampler_location_; } |
508 int mask_tex_coord_scale_location() const { | 512 int mask_tex_coord_scale_location() const { |
509 return mask_tex_coord_scale_location_; | 513 return mask_tex_coord_scale_location_; |
510 } | 514 } |
511 int mask_tex_coord_offset_location() const { | 515 int mask_tex_coord_offset_location() const { |
512 return mask_tex_coord_offset_location_; | 516 return mask_tex_coord_offset_location_; |
513 } | 517 } |
514 | 518 |
515 private: | 519 private: |
516 int sampler_location_; | 520 int sampler_location_; |
517 int mask_sampler_location_; | 521 int mask_sampler_location_; |
518 int alpha_location_; | 522 int alpha_location_; |
519 int mask_tex_coord_scale_location_; | 523 int mask_tex_coord_scale_location_; |
520 int mask_tex_coord_offset_location_; | 524 int mask_tex_coord_offset_location_; |
521 | 525 |
522 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMaskAA); | 526 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMaskAA); |
523 }; | 527 }; |
524 | 528 |
525 class FragmentShaderRGBATexAlphaMaskColorMatrixAA { | 529 class FragmentShaderRGBATexAlphaMaskColorMatrixAA { |
526 public: | 530 public: |
527 FragmentShaderRGBATexAlphaMaskColorMatrixAA(); | 531 FragmentShaderRGBATexAlphaMaskColorMatrixAA(); |
528 std::string GetShaderString(TexCoordPrecision precision) const; | 532 std::string GetShaderString( |
| 533 TexCoordPrecision precision, SamplerType sampler) const; |
529 | 534 |
530 void Init(blink::WebGraphicsContext3D* context, | 535 void Init(blink::WebGraphicsContext3D* context, |
531 unsigned program, | 536 unsigned program, |
532 int* base_uniform_index); | 537 int* base_uniform_index); |
533 int alpha_location() const { return alpha_location_; } | 538 int alpha_location() const { return alpha_location_; } |
534 int sampler_location() const { return sampler_location_; } | 539 int sampler_location() const { return sampler_location_; } |
535 int mask_sampler_location() const { return mask_sampler_location_; } | 540 int mask_sampler_location() const { return mask_sampler_location_; } |
536 int mask_tex_coord_scale_location() const { | 541 int mask_tex_coord_scale_location() const { |
537 return mask_tex_coord_scale_location_; | 542 return mask_tex_coord_scale_location_; |
538 } | 543 } |
539 int mask_tex_coord_offset_location() const { | 544 int mask_tex_coord_offset_location() const { |
540 return mask_tex_coord_offset_location_; | 545 return mask_tex_coord_offset_location_; |
541 } | 546 } |
542 int color_matrix_location() const { return color_matrix_location_; } | 547 int color_matrix_location() const { return color_matrix_location_; } |
543 int color_offset_location() const { return color_offset_location_; } | 548 int color_offset_location() const { return color_offset_location_; } |
544 | 549 |
545 private: | 550 private: |
546 int sampler_location_; | 551 int sampler_location_; |
547 int mask_sampler_location_; | 552 int mask_sampler_location_; |
548 int alpha_location_; | 553 int alpha_location_; |
549 int mask_tex_coord_scale_location_; | 554 int mask_tex_coord_scale_location_; |
550 int mask_tex_coord_offset_location_; | 555 int mask_tex_coord_offset_location_; |
551 int color_matrix_location_; | 556 int color_matrix_location_; |
552 int color_offset_location_; | 557 int color_offset_location_; |
553 }; | 558 }; |
554 | 559 |
555 class FragmentShaderRGBATexAlphaColorMatrixAA { | 560 class FragmentShaderRGBATexAlphaColorMatrixAA { |
556 public: | 561 public: |
557 FragmentShaderRGBATexAlphaColorMatrixAA(); | 562 FragmentShaderRGBATexAlphaColorMatrixAA(); |
558 std::string GetShaderString(TexCoordPrecision precision) const; | 563 std::string GetShaderString( |
| 564 TexCoordPrecision precision, SamplerType sampler) const; |
559 | 565 |
560 void Init(blink::WebGraphicsContext3D* context, | 566 void Init(blink::WebGraphicsContext3D* context, |
561 unsigned program, | 567 unsigned program, |
562 int* base_uniform_index); | 568 int* base_uniform_index); |
563 int alpha_location() const { return alpha_location_; } | 569 int alpha_location() const { return alpha_location_; } |
564 int sampler_location() const { return sampler_location_; } | 570 int sampler_location() const { return sampler_location_; } |
565 int color_matrix_location() const { return color_matrix_location_; } | 571 int color_matrix_location() const { return color_matrix_location_; } |
566 int color_offset_location() const { return color_offset_location_; } | 572 int color_offset_location() const { return color_offset_location_; } |
567 | 573 |
568 private: | 574 private: |
569 int sampler_location_; | 575 int sampler_location_; |
570 int alpha_location_; | 576 int alpha_location_; |
571 int color_matrix_location_; | 577 int color_matrix_location_; |
572 int color_offset_location_; | 578 int color_offset_location_; |
573 }; | 579 }; |
574 | 580 |
575 class FragmentShaderRGBATexAlphaMaskColorMatrix { | 581 class FragmentShaderRGBATexAlphaMaskColorMatrix { |
576 public: | 582 public: |
577 FragmentShaderRGBATexAlphaMaskColorMatrix(); | 583 FragmentShaderRGBATexAlphaMaskColorMatrix(); |
578 std::string GetShaderString(TexCoordPrecision precision) const; | 584 std::string GetShaderString( |
| 585 TexCoordPrecision precision, SamplerType sampler) const; |
579 | 586 |
580 void Init(blink::WebGraphicsContext3D* context, | 587 void Init(blink::WebGraphicsContext3D* context, |
581 unsigned program, | 588 unsigned program, |
582 int* base_uniform_index); | 589 int* base_uniform_index); |
583 int alpha_location() const { return alpha_location_; } | 590 int alpha_location() const { return alpha_location_; } |
584 int sampler_location() const { return sampler_location_; } | 591 int sampler_location() const { return sampler_location_; } |
585 int mask_sampler_location() const { return mask_sampler_location_; } | 592 int mask_sampler_location() const { return mask_sampler_location_; } |
586 int mask_tex_coord_scale_location() const { | 593 int mask_tex_coord_scale_location() const { |
587 return mask_tex_coord_scale_location_; | 594 return mask_tex_coord_scale_location_; |
588 } | 595 } |
589 int mask_tex_coord_offset_location() const { | 596 int mask_tex_coord_offset_location() const { |
590 return mask_tex_coord_offset_location_; | 597 return mask_tex_coord_offset_location_; |
591 } | 598 } |
592 int color_matrix_location() const { return color_matrix_location_; } | 599 int color_matrix_location() const { return color_matrix_location_; } |
593 int color_offset_location() const { return color_offset_location_; } | 600 int color_offset_location() const { return color_offset_location_; } |
594 | 601 |
595 private: | 602 private: |
596 int sampler_location_; | 603 int sampler_location_; |
597 int mask_sampler_location_; | 604 int mask_sampler_location_; |
598 int alpha_location_; | 605 int alpha_location_; |
599 int mask_tex_coord_scale_location_; | 606 int mask_tex_coord_scale_location_; |
600 int mask_tex_coord_offset_location_; | 607 int mask_tex_coord_offset_location_; |
601 int color_matrix_location_; | 608 int color_matrix_location_; |
602 int color_offset_location_; | 609 int color_offset_location_; |
603 }; | 610 }; |
604 | 611 |
605 class FragmentShaderYUVVideo { | 612 class FragmentShaderYUVVideo { |
606 public: | 613 public: |
607 FragmentShaderYUVVideo(); | 614 FragmentShaderYUVVideo(); |
608 std::string GetShaderString(TexCoordPrecision precision) const; | 615 std::string GetShaderString( |
| 616 TexCoordPrecision precision, SamplerType sampler) const; |
609 | 617 |
610 void Init(blink::WebGraphicsContext3D* context, | 618 void Init(blink::WebGraphicsContext3D* context, |
611 unsigned program, | 619 unsigned program, |
612 int* base_uniform_index); | 620 int* base_uniform_index); |
613 int y_texture_location() const { return y_texture_location_; } | 621 int y_texture_location() const { return y_texture_location_; } |
614 int u_texture_location() const { return u_texture_location_; } | 622 int u_texture_location() const { return u_texture_location_; } |
615 int v_texture_location() const { return v_texture_location_; } | 623 int v_texture_location() const { return v_texture_location_; } |
616 int alpha_location() const { return alpha_location_; } | 624 int alpha_location() const { return alpha_location_; } |
617 int yuv_matrix_location() const { return yuv_matrix_location_; } | 625 int yuv_matrix_location() const { return yuv_matrix_location_; } |
618 int yuv_adj_location() const { return yuv_adj_location_; } | 626 int yuv_adj_location() const { return yuv_adj_location_; } |
619 | 627 |
620 private: | 628 private: |
621 int y_texture_location_; | 629 int y_texture_location_; |
622 int u_texture_location_; | 630 int u_texture_location_; |
623 int v_texture_location_; | 631 int v_texture_location_; |
624 int alpha_location_; | 632 int alpha_location_; |
625 int yuv_matrix_location_; | 633 int yuv_matrix_location_; |
626 int yuv_adj_location_; | 634 int yuv_adj_location_; |
627 | 635 |
628 DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVVideo); | 636 DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVVideo); |
629 }; | 637 }; |
630 | 638 |
631 | 639 |
632 class FragmentShaderYUVAVideo { | 640 class FragmentShaderYUVAVideo { |
633 public: | 641 public: |
634 FragmentShaderYUVAVideo(); | 642 FragmentShaderYUVAVideo(); |
635 std::string GetShaderString(TexCoordPrecision precision) const; | 643 std::string GetShaderString( |
| 644 TexCoordPrecision precision, SamplerType sampler) const; |
636 | 645 |
637 void Init(blink::WebGraphicsContext3D* context, | 646 void Init(blink::WebGraphicsContext3D* context, |
638 unsigned program, | 647 unsigned program, |
639 int* base_uniform_index); | 648 int* base_uniform_index); |
640 | 649 |
641 int y_texture_location() const { return y_texture_location_; } | 650 int y_texture_location() const { return y_texture_location_; } |
642 int u_texture_location() const { return u_texture_location_; } | 651 int u_texture_location() const { return u_texture_location_; } |
643 int v_texture_location() const { return v_texture_location_; } | 652 int v_texture_location() const { return v_texture_location_; } |
644 int a_texture_location() const { return a_texture_location_; } | 653 int a_texture_location() const { return a_texture_location_; } |
645 int alpha_location() const { return alpha_location_; } | 654 int alpha_location() const { return alpha_location_; } |
646 int yuv_matrix_location() const { return yuv_matrix_location_; } | 655 int yuv_matrix_location() const { return yuv_matrix_location_; } |
647 int yuv_adj_location() const { return yuv_adj_location_; } | 656 int yuv_adj_location() const { return yuv_adj_location_; } |
648 | 657 |
649 private: | 658 private: |
650 int y_texture_location_; | 659 int y_texture_location_; |
651 int u_texture_location_; | 660 int u_texture_location_; |
652 int v_texture_location_; | 661 int v_texture_location_; |
653 int a_texture_location_; | 662 int a_texture_location_; |
654 int alpha_location_; | 663 int alpha_location_; |
655 int yuv_matrix_location_; | 664 int yuv_matrix_location_; |
656 int yuv_adj_location_; | 665 int yuv_adj_location_; |
657 | 666 |
658 DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVAVideo); | 667 DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVAVideo); |
659 }; | 668 }; |
660 | 669 |
661 class FragmentShaderColor { | 670 class FragmentShaderColor { |
662 public: | 671 public: |
663 FragmentShaderColor(); | 672 FragmentShaderColor(); |
664 std::string GetShaderString(TexCoordPrecision precision) const; | 673 std::string GetShaderString( |
| 674 TexCoordPrecision precision, SamplerType sampler) const; |
665 | 675 |
666 void Init(blink::WebGraphicsContext3D* context, | 676 void Init(blink::WebGraphicsContext3D* context, |
667 unsigned program, | 677 unsigned program, |
668 int* base_uniform_index); | 678 int* base_uniform_index); |
669 int color_location() const { return color_location_; } | 679 int color_location() const { return color_location_; } |
670 | 680 |
671 private: | 681 private: |
672 int color_location_; | 682 int color_location_; |
673 | 683 |
674 DISALLOW_COPY_AND_ASSIGN(FragmentShaderColor); | 684 DISALLOW_COPY_AND_ASSIGN(FragmentShaderColor); |
675 }; | 685 }; |
676 | 686 |
677 class FragmentShaderColorAA { | 687 class FragmentShaderColorAA { |
678 public: | 688 public: |
679 FragmentShaderColorAA(); | 689 FragmentShaderColorAA(); |
680 std::string GetShaderString(TexCoordPrecision precision) const; | 690 std::string GetShaderString( |
| 691 TexCoordPrecision precision, SamplerType sampler) const; |
681 | 692 |
682 void Init(blink::WebGraphicsContext3D* context, | 693 void Init(blink::WebGraphicsContext3D* context, |
683 unsigned program, | 694 unsigned program, |
684 int* base_uniform_index); | 695 int* base_uniform_index); |
685 int color_location() const { return color_location_; } | 696 int color_location() const { return color_location_; } |
686 | 697 |
687 private: | 698 private: |
688 int color_location_; | 699 int color_location_; |
689 | 700 |
690 DISALLOW_COPY_AND_ASSIGN(FragmentShaderColorAA); | 701 DISALLOW_COPY_AND_ASSIGN(FragmentShaderColorAA); |
691 }; | 702 }; |
692 | 703 |
693 class FragmentShaderCheckerboard { | 704 class FragmentShaderCheckerboard { |
694 public: | 705 public: |
695 FragmentShaderCheckerboard(); | 706 FragmentShaderCheckerboard(); |
696 std::string GetShaderString(TexCoordPrecision precision) const; | 707 std::string GetShaderString( |
| 708 TexCoordPrecision precision, SamplerType sampler) const; |
697 | 709 |
698 void Init(blink::WebGraphicsContext3D* context, | 710 void Init(blink::WebGraphicsContext3D* context, |
699 unsigned program, | 711 unsigned program, |
700 int* base_uniform_index); | 712 int* base_uniform_index); |
701 int alpha_location() const { return alpha_location_; } | 713 int alpha_location() const { return alpha_location_; } |
702 int tex_transform_location() const { return tex_transform_location_; } | 714 int tex_transform_location() const { return tex_transform_location_; } |
703 int frequency_location() const { return frequency_location_; } | 715 int frequency_location() const { return frequency_location_; } |
704 int color_location() const { return color_location_; } | 716 int color_location() const { return color_location_; } |
705 | 717 |
706 private: | 718 private: |
707 int alpha_location_; | 719 int alpha_location_; |
708 int tex_transform_location_; | 720 int tex_transform_location_; |
709 int frequency_location_; | 721 int frequency_location_; |
710 int color_location_; | 722 int color_location_; |
711 | 723 |
712 DISALLOW_COPY_AND_ASSIGN(FragmentShaderCheckerboard); | 724 DISALLOW_COPY_AND_ASSIGN(FragmentShaderCheckerboard); |
713 }; | 725 }; |
714 | 726 |
715 } // namespace cc | 727 } // namespace cc |
716 | 728 |
717 #endif // CC_OUTPUT_SHADER_H_ | 729 #endif // CC_OUTPUT_SHADER_H_ |
OLD | NEW |