Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(583)

Side by Side Diff: cc/output/shader.h

Issue 658483003: Implement mix-blend-mode in GL renderer using shaders. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing antialiasing issues Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/SkXfermode.h"
12 13
13 namespace gfx { 14 namespace gfx {
14 class Point; 15 class Point;
15 class Size; 16 class Size;
16 } 17 }
17 18
18 namespace gpu { 19 namespace gpu {
19 namespace gles2 { 20 namespace gles2 {
20 class GLES2Interface; 21 class GLES2Interface;
21 } 22 }
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 int matrix_location() const { return matrix_location_; } 273 int matrix_location() const { return matrix_location_; }
273 int tex_matrix_location() const { return tex_matrix_location_; } 274 int tex_matrix_location() const { return tex_matrix_location_; }
274 275
275 private: 276 private:
276 int matrix_location_; 277 int matrix_location_;
277 int tex_matrix_location_; 278 int tex_matrix_location_;
278 279
279 DISALLOW_COPY_AND_ASSIGN(VertexShaderVideoTransform); 280 DISALLOW_COPY_AND_ASSIGN(VertexShaderVideoTransform);
280 }; 281 };
281 282
282 class FragmentTexAlphaBinding { 283 class FragmentTexBlendMode {
284 public:
285 int backdrop_location() const { return backdrop_location_; }
286 int backdrop_rect_location() const { return backdrop_rect_location_; }
287
288 SkXfermode::Mode blend_mode() const { return blend_mode_; }
289 bool is_default_blend_mode() const {
290 return blend_mode_ == SkXfermode::kSrcOver_Mode;
291 }
292 inline static bool is_blend_mode_supported(SkXfermode::Mode blend_mode);
293
294 void SetBlendMode(SkXfermode::Mode blend_mode);
295
296 protected:
297 FragmentTexBlendMode();
298
299 std::string SetBlendModeFunctions(std::string shader_string) const;
300
301 int backdrop_location_;
302 int backdrop_rect_location_;
303
304 private:
305 SkXfermode::Mode blend_mode_;
306
307 std::string GetHelperFunctions() const;
308 std::string GetMainBlendingCode() const;
309 };
310
311 class FragmentTexAlphaBinding : public FragmentTexBlendMode {
283 public: 312 public:
284 FragmentTexAlphaBinding(); 313 FragmentTexAlphaBinding();
285 314
286 void Init(gpu::gles2::GLES2Interface* context, 315 void Init(gpu::gles2::GLES2Interface* context,
287 unsigned program, 316 unsigned program,
288 int* base_uniform_index); 317 int* base_uniform_index);
289 int alpha_location() const { return alpha_location_; } 318 int alpha_location() const { return alpha_location_; }
290 int fragment_tex_transform_location() const { return -1; } 319 int fragment_tex_transform_location() const { return -1; }
291 int sampler_location() const { return sampler_location_; } 320 int sampler_location() const { return sampler_location_; }
292 321
293 private: 322 private:
294 int sampler_location_; 323 int sampler_location_;
295 int alpha_location_; 324 int alpha_location_;
296 325
297 DISALLOW_COPY_AND_ASSIGN(FragmentTexAlphaBinding); 326 DISALLOW_COPY_AND_ASSIGN(FragmentTexAlphaBinding);
298 }; 327 };
299 328
300 class FragmentTexColorMatrixAlphaBinding { 329 class FragmentTexColorMatrixAlphaBinding : public FragmentTexBlendMode {
301 public: 330 public:
302 FragmentTexColorMatrixAlphaBinding(); 331 FragmentTexColorMatrixAlphaBinding();
303 332
304 void Init(gpu::gles2::GLES2Interface* context, 333 void Init(gpu::gles2::GLES2Interface* context,
305 unsigned program, 334 unsigned program,
306 int* base_uniform_index); 335 int* base_uniform_index);
307 int alpha_location() const { return alpha_location_; } 336 int alpha_location() const { return alpha_location_; }
308 int color_matrix_location() const { return color_matrix_location_; } 337 int color_matrix_location() const { return color_matrix_location_; }
309 int color_offset_location() const { return color_offset_location_; } 338 int color_offset_location() const { return color_offset_location_; }
310 int fragment_tex_transform_location() const { return -1; } 339 int fragment_tex_transform_location() const { return -1; }
311 int sampler_location() const { return sampler_location_; } 340 int sampler_location() const { return sampler_location_; }
312 341
313 private: 342 private:
314 int sampler_location_; 343 int sampler_location_;
315 int alpha_location_; 344 int alpha_location_;
316 int color_matrix_location_; 345 int color_matrix_location_;
317 int color_offset_location_; 346 int color_offset_location_;
318 }; 347 };
319 348
320 class FragmentTexOpaqueBinding { 349 class FragmentTexOpaqueBinding : public FragmentTexBlendMode {
321 public: 350 public:
322 FragmentTexOpaqueBinding(); 351 FragmentTexOpaqueBinding();
323 352
324 void Init(gpu::gles2::GLES2Interface* context, 353 void Init(gpu::gles2::GLES2Interface* context,
325 unsigned program, 354 unsigned program,
326 int* base_uniform_index); 355 int* base_uniform_index);
327 int alpha_location() const { return -1; } 356 int alpha_location() const { return -1; }
328 int fragment_tex_transform_location() const { return -1; } 357 int fragment_tex_transform_location() const { return -1; }
329 int background_color_location() const { return -1; } 358 int background_color_location() const { return -1; }
330 int sampler_location() const { return sampler_location_; } 359 int sampler_location() const { return sampler_location_; }
331 360
332 private: 361 private:
333 int sampler_location_; 362 int sampler_location_;
334 363
335 DISALLOW_COPY_AND_ASSIGN(FragmentTexOpaqueBinding); 364 DISALLOW_COPY_AND_ASSIGN(FragmentTexOpaqueBinding);
336 }; 365 };
337 366
338 class FragmentTexBackgroundBinding { 367 class FragmentTexBackgroundBinding : public FragmentTexBlendMode {
339 public: 368 public:
340 FragmentTexBackgroundBinding(); 369 FragmentTexBackgroundBinding();
341 370
342 void Init(gpu::gles2::GLES2Interface* context, 371 void Init(gpu::gles2::GLES2Interface* context,
343 unsigned program, 372 unsigned program,
344 int* base_uniform_index); 373 int* base_uniform_index);
345 int background_color_location() const { return background_color_location_; } 374 int background_color_location() const { return background_color_location_; }
346 int sampler_location() const { return sampler_location_; } 375 int sampler_location() const { return sampler_location_; }
347 376
348 private: 377 private:
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 TexCoordPrecision precision, SamplerType sampler) const; 439 TexCoordPrecision precision, SamplerType sampler) const;
411 }; 440 };
412 441
413 // Swizzles the red and blue component of sampled texel without alpha. 442 // Swizzles the red and blue component of sampled texel without alpha.
414 class FragmentShaderRGBATexSwizzleOpaque : public FragmentTexOpaqueBinding { 443 class FragmentShaderRGBATexSwizzleOpaque : public FragmentTexOpaqueBinding {
415 public: 444 public:
416 std::string GetShaderString( 445 std::string GetShaderString(
417 TexCoordPrecision precision, SamplerType sampler) const; 446 TexCoordPrecision precision, SamplerType sampler) const;
418 }; 447 };
419 448
420 class FragmentShaderRGBATexAlphaAA { 449 class FragmentShaderRGBATexAlphaAA : public FragmentTexBlendMode {
421 public: 450 public:
422 FragmentShaderRGBATexAlphaAA(); 451 FragmentShaderRGBATexAlphaAA();
423 452
424 void Init(gpu::gles2::GLES2Interface* context, 453 void Init(gpu::gles2::GLES2Interface* context,
425 unsigned program, 454 unsigned program,
426 int* base_uniform_index); 455 int* base_uniform_index);
427 std::string GetShaderString( 456 std::string GetShaderString(
428 TexCoordPrecision precision, SamplerType sampler) const; 457 TexCoordPrecision precision, SamplerType sampler) const;
429 458
430 int alpha_location() const { return alpha_location_; } 459 int alpha_location() const { return alpha_location_; }
431 int sampler_location() const { return sampler_location_; } 460 int sampler_location() const { return sampler_location_; }
432 461
433 private: 462 private:
434 int sampler_location_; 463 int sampler_location_;
435 int alpha_location_; 464 int alpha_location_;
436 465
437 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaAA); 466 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaAA);
438 }; 467 };
439 468
440 class FragmentTexClampAlphaAABinding { 469 class FragmentTexClampAlphaAABinding : public FragmentTexBlendMode {
441 public: 470 public:
442 FragmentTexClampAlphaAABinding(); 471 FragmentTexClampAlphaAABinding();
443 472
444 void Init(gpu::gles2::GLES2Interface* context, 473 void Init(gpu::gles2::GLES2Interface* context,
445 unsigned program, 474 unsigned program,
446 int* base_uniform_index); 475 int* base_uniform_index);
447 int alpha_location() const { return alpha_location_; } 476 int alpha_location() const { return alpha_location_; }
448 int sampler_location() const { return sampler_location_; } 477 int sampler_location() const { return sampler_location_; }
449 int fragment_tex_transform_location() const { 478 int fragment_tex_transform_location() const {
450 return fragment_tex_transform_location_; 479 return fragment_tex_transform_location_;
(...skipping 15 matching lines...) Expand all
466 }; 495 };
467 496
468 // Swizzles the red and blue component of sampled texel. 497 // Swizzles the red and blue component of sampled texel.
469 class FragmentShaderRGBATexClampSwizzleAlphaAA 498 class FragmentShaderRGBATexClampSwizzleAlphaAA
470 : public FragmentTexClampAlphaAABinding { 499 : public FragmentTexClampAlphaAABinding {
471 public: 500 public:
472 std::string GetShaderString( 501 std::string GetShaderString(
473 TexCoordPrecision precision, SamplerType sampler) const; 502 TexCoordPrecision precision, SamplerType sampler) const;
474 }; 503 };
475 504
476 class FragmentShaderRGBATexAlphaMask { 505 class FragmentShaderRGBATexAlphaMask : public FragmentTexBlendMode {
477 public: 506 public:
478 FragmentShaderRGBATexAlphaMask(); 507 FragmentShaderRGBATexAlphaMask();
479 std::string GetShaderString( 508 std::string GetShaderString(
480 TexCoordPrecision precision, SamplerType sampler) const; 509 TexCoordPrecision precision, SamplerType sampler) const;
481 510
482 void Init(gpu::gles2::GLES2Interface* context, 511 void Init(gpu::gles2::GLES2Interface* context,
483 unsigned program, 512 unsigned program,
484 int* base_uniform_index); 513 int* base_uniform_index);
485 int alpha_location() const { return alpha_location_; } 514 int alpha_location() const { return alpha_location_; }
486 int sampler_location() const { return sampler_location_; } 515 int sampler_location() const { return sampler_location_; }
487 int mask_sampler_location() const { return mask_sampler_location_; } 516 int mask_sampler_location() const { return mask_sampler_location_; }
488 int mask_tex_coord_scale_location() const { 517 int mask_tex_coord_scale_location() const {
489 return mask_tex_coord_scale_location_; 518 return mask_tex_coord_scale_location_;
490 } 519 }
491 int mask_tex_coord_offset_location() const { 520 int mask_tex_coord_offset_location() const {
492 return mask_tex_coord_offset_location_; 521 return mask_tex_coord_offset_location_;
493 } 522 }
494 523
495 private: 524 private:
496 int sampler_location_; 525 int sampler_location_;
497 int mask_sampler_location_; 526 int mask_sampler_location_;
498 int alpha_location_; 527 int alpha_location_;
499 int mask_tex_coord_scale_location_; 528 int mask_tex_coord_scale_location_;
500 int mask_tex_coord_offset_location_; 529 int mask_tex_coord_offset_location_;
501 530
502 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMask); 531 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMask);
503 }; 532 };
504 533
505 class FragmentShaderRGBATexAlphaMaskAA { 534 class FragmentShaderRGBATexAlphaMaskAA : public FragmentTexBlendMode {
506 public: 535 public:
507 FragmentShaderRGBATexAlphaMaskAA(); 536 FragmentShaderRGBATexAlphaMaskAA();
508 std::string GetShaderString( 537 std::string GetShaderString(
509 TexCoordPrecision precision, SamplerType sampler) const; 538 TexCoordPrecision precision, SamplerType sampler) const;
510 539
511 void Init(gpu::gles2::GLES2Interface* context, 540 void Init(gpu::gles2::GLES2Interface* context,
512 unsigned program, 541 unsigned program,
513 int* base_uniform_index); 542 int* base_uniform_index);
514 int alpha_location() const { return alpha_location_; } 543 int alpha_location() const { return alpha_location_; }
515 int sampler_location() const { return sampler_location_; } 544 int sampler_location() const { return sampler_location_; }
516 int mask_sampler_location() const { return mask_sampler_location_; } 545 int mask_sampler_location() const { return mask_sampler_location_; }
517 int mask_tex_coord_scale_location() const { 546 int mask_tex_coord_scale_location() const {
518 return mask_tex_coord_scale_location_; 547 return mask_tex_coord_scale_location_;
519 } 548 }
520 int mask_tex_coord_offset_location() const { 549 int mask_tex_coord_offset_location() const {
521 return mask_tex_coord_offset_location_; 550 return mask_tex_coord_offset_location_;
522 } 551 }
523 552
524 private: 553 private:
525 int sampler_location_; 554 int sampler_location_;
526 int mask_sampler_location_; 555 int mask_sampler_location_;
527 int alpha_location_; 556 int alpha_location_;
528 int mask_tex_coord_scale_location_; 557 int mask_tex_coord_scale_location_;
529 int mask_tex_coord_offset_location_; 558 int mask_tex_coord_offset_location_;
530 559
531 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMaskAA); 560 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMaskAA);
532 }; 561 };
533 562
534 class FragmentShaderRGBATexAlphaMaskColorMatrixAA { 563 class FragmentShaderRGBATexAlphaMaskColorMatrixAA
564 : public FragmentTexBlendMode {
535 public: 565 public:
536 FragmentShaderRGBATexAlphaMaskColorMatrixAA(); 566 FragmentShaderRGBATexAlphaMaskColorMatrixAA();
537 std::string GetShaderString( 567 std::string GetShaderString(
538 TexCoordPrecision precision, SamplerType sampler) const; 568 TexCoordPrecision precision, SamplerType sampler) const;
539 569
540 void Init(gpu::gles2::GLES2Interface* context, 570 void Init(gpu::gles2::GLES2Interface* context,
541 unsigned program, 571 unsigned program,
542 int* base_uniform_index); 572 int* base_uniform_index);
543 int alpha_location() const { return alpha_location_; } 573 int alpha_location() const { return alpha_location_; }
544 int sampler_location() const { return sampler_location_; } 574 int sampler_location() const { return sampler_location_; }
(...skipping 10 matching lines...) Expand all
555 private: 585 private:
556 int sampler_location_; 586 int sampler_location_;
557 int mask_sampler_location_; 587 int mask_sampler_location_;
558 int alpha_location_; 588 int alpha_location_;
559 int mask_tex_coord_scale_location_; 589 int mask_tex_coord_scale_location_;
560 int mask_tex_coord_offset_location_; 590 int mask_tex_coord_offset_location_;
561 int color_matrix_location_; 591 int color_matrix_location_;
562 int color_offset_location_; 592 int color_offset_location_;
563 }; 593 };
564 594
565 class FragmentShaderRGBATexAlphaColorMatrixAA { 595 class FragmentShaderRGBATexAlphaColorMatrixAA : public FragmentTexBlendMode {
566 public: 596 public:
567 FragmentShaderRGBATexAlphaColorMatrixAA(); 597 FragmentShaderRGBATexAlphaColorMatrixAA();
568 std::string GetShaderString( 598 std::string GetShaderString(
569 TexCoordPrecision precision, SamplerType sampler) const; 599 TexCoordPrecision precision, SamplerType sampler) const;
570 600
571 void Init(gpu::gles2::GLES2Interface* context, 601 void Init(gpu::gles2::GLES2Interface* context,
572 unsigned program, 602 unsigned program,
573 int* base_uniform_index); 603 int* base_uniform_index);
574 int alpha_location() const { return alpha_location_; } 604 int alpha_location() const { return alpha_location_; }
575 int sampler_location() const { return sampler_location_; } 605 int sampler_location() const { return sampler_location_; }
576 int color_matrix_location() const { return color_matrix_location_; } 606 int color_matrix_location() const { return color_matrix_location_; }
577 int color_offset_location() const { return color_offset_location_; } 607 int color_offset_location() const { return color_offset_location_; }
578 608
579 private: 609 private:
580 int sampler_location_; 610 int sampler_location_;
581 int alpha_location_; 611 int alpha_location_;
582 int color_matrix_location_; 612 int color_matrix_location_;
583 int color_offset_location_; 613 int color_offset_location_;
584 }; 614 };
585 615
586 class FragmentShaderRGBATexAlphaMaskColorMatrix { 616 class FragmentShaderRGBATexAlphaMaskColorMatrix : public FragmentTexBlendMode {
587 public: 617 public:
588 FragmentShaderRGBATexAlphaMaskColorMatrix(); 618 FragmentShaderRGBATexAlphaMaskColorMatrix();
589 std::string GetShaderString( 619 std::string GetShaderString(
590 TexCoordPrecision precision, SamplerType sampler) const; 620 TexCoordPrecision precision, SamplerType sampler) const;
591 621
592 void Init(gpu::gles2::GLES2Interface* context, 622 void Init(gpu::gles2::GLES2Interface* context,
593 unsigned program, 623 unsigned program,
594 int* base_uniform_index); 624 int* base_uniform_index);
595 int alpha_location() const { return alpha_location_; } 625 int alpha_location() const { return alpha_location_; }
596 int sampler_location() const { return sampler_location_; } 626 int sampler_location() const { return sampler_location_; }
(...skipping 10 matching lines...) Expand all
607 private: 637 private:
608 int sampler_location_; 638 int sampler_location_;
609 int mask_sampler_location_; 639 int mask_sampler_location_;
610 int alpha_location_; 640 int alpha_location_;
611 int mask_tex_coord_scale_location_; 641 int mask_tex_coord_scale_location_;
612 int mask_tex_coord_offset_location_; 642 int mask_tex_coord_offset_location_;
613 int color_matrix_location_; 643 int color_matrix_location_;
614 int color_offset_location_; 644 int color_offset_location_;
615 }; 645 };
616 646
617 class FragmentShaderYUVVideo { 647 class FragmentShaderYUVVideo : public FragmentTexBlendMode {
618 public: 648 public:
619 FragmentShaderYUVVideo(); 649 FragmentShaderYUVVideo();
620 std::string GetShaderString( 650 std::string GetShaderString(
621 TexCoordPrecision precision, SamplerType sampler) const; 651 TexCoordPrecision precision, SamplerType sampler) const;
622 652
623 void Init(gpu::gles2::GLES2Interface* context, 653 void Init(gpu::gles2::GLES2Interface* context,
624 unsigned program, 654 unsigned program,
625 int* base_uniform_index); 655 int* base_uniform_index);
626 int y_texture_location() const { return y_texture_location_; } 656 int y_texture_location() const { return y_texture_location_; }
627 int u_texture_location() const { return u_texture_location_; } 657 int u_texture_location() const { return u_texture_location_; }
628 int v_texture_location() const { return v_texture_location_; } 658 int v_texture_location() const { return v_texture_location_; }
629 int alpha_location() const { return alpha_location_; } 659 int alpha_location() const { return alpha_location_; }
630 int yuv_matrix_location() const { return yuv_matrix_location_; } 660 int yuv_matrix_location() const { return yuv_matrix_location_; }
631 int yuv_adj_location() const { return yuv_adj_location_; } 661 int yuv_adj_location() const { return yuv_adj_location_; }
632 662
633 private: 663 private:
634 int y_texture_location_; 664 int y_texture_location_;
635 int u_texture_location_; 665 int u_texture_location_;
636 int v_texture_location_; 666 int v_texture_location_;
637 int alpha_location_; 667 int alpha_location_;
638 int yuv_matrix_location_; 668 int yuv_matrix_location_;
639 int yuv_adj_location_; 669 int yuv_adj_location_;
640 670
641 DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVVideo); 671 DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVVideo);
642 }; 672 };
643 673
644 674 class FragmentShaderYUVAVideo : public FragmentTexBlendMode {
645 class FragmentShaderYUVAVideo {
646 public: 675 public:
647 FragmentShaderYUVAVideo(); 676 FragmentShaderYUVAVideo();
648 std::string GetShaderString( 677 std::string GetShaderString(
649 TexCoordPrecision precision, SamplerType sampler) const; 678 TexCoordPrecision precision, SamplerType sampler) const;
650 679
651 void Init(gpu::gles2::GLES2Interface* context, 680 void Init(gpu::gles2::GLES2Interface* context,
652 unsigned program, 681 unsigned program,
653 int* base_uniform_index); 682 int* base_uniform_index);
654 683
655 int y_texture_location() const { return y_texture_location_; } 684 int y_texture_location() const { return y_texture_location_; }
656 int u_texture_location() const { return u_texture_location_; } 685 int u_texture_location() const { return u_texture_location_; }
657 int v_texture_location() const { return v_texture_location_; } 686 int v_texture_location() const { return v_texture_location_; }
658 int a_texture_location() const { return a_texture_location_; } 687 int a_texture_location() const { return a_texture_location_; }
659 int alpha_location() const { return alpha_location_; } 688 int alpha_location() const { return alpha_location_; }
660 int yuv_matrix_location() const { return yuv_matrix_location_; } 689 int yuv_matrix_location() const { return yuv_matrix_location_; }
661 int yuv_adj_location() const { return yuv_adj_location_; } 690 int yuv_adj_location() const { return yuv_adj_location_; }
662 691
663 private: 692 private:
664 int y_texture_location_; 693 int y_texture_location_;
665 int u_texture_location_; 694 int u_texture_location_;
666 int v_texture_location_; 695 int v_texture_location_;
667 int a_texture_location_; 696 int a_texture_location_;
668 int alpha_location_; 697 int alpha_location_;
669 int yuv_matrix_location_; 698 int yuv_matrix_location_;
670 int yuv_adj_location_; 699 int yuv_adj_location_;
671 700
672 DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVAVideo); 701 DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVAVideo);
673 }; 702 };
674 703
675 class FragmentShaderColor { 704 class FragmentShaderColor : public FragmentTexBlendMode {
676 public: 705 public:
677 FragmentShaderColor(); 706 FragmentShaderColor();
678 std::string GetShaderString( 707 std::string GetShaderString(
679 TexCoordPrecision precision, SamplerType sampler) const; 708 TexCoordPrecision precision, SamplerType sampler) const;
680 709
681 void Init(gpu::gles2::GLES2Interface* context, 710 void Init(gpu::gles2::GLES2Interface* context,
682 unsigned program, 711 unsigned program,
683 int* base_uniform_index); 712 int* base_uniform_index);
684 int color_location() const { return color_location_; } 713 int color_location() const { return color_location_; }
685 714
686 private: 715 private:
687 int color_location_; 716 int color_location_;
688 717
689 DISALLOW_COPY_AND_ASSIGN(FragmentShaderColor); 718 DISALLOW_COPY_AND_ASSIGN(FragmentShaderColor);
690 }; 719 };
691 720
692 class FragmentShaderColorAA { 721 class FragmentShaderColorAA : public FragmentTexBlendMode {
693 public: 722 public:
694 FragmentShaderColorAA(); 723 FragmentShaderColorAA();
695 std::string GetShaderString( 724 std::string GetShaderString(
696 TexCoordPrecision precision, SamplerType sampler) const; 725 TexCoordPrecision precision, SamplerType sampler) const;
697 726
698 void Init(gpu::gles2::GLES2Interface* context, 727 void Init(gpu::gles2::GLES2Interface* context,
699 unsigned program, 728 unsigned program,
700 int* base_uniform_index); 729 int* base_uniform_index);
701 int color_location() const { return color_location_; } 730 int color_location() const { return color_location_; }
702 731
703 private: 732 private:
704 int color_location_; 733 int color_location_;
705 734
706 DISALLOW_COPY_AND_ASSIGN(FragmentShaderColorAA); 735 DISALLOW_COPY_AND_ASSIGN(FragmentShaderColorAA);
707 }; 736 };
708 737
709 class FragmentShaderCheckerboard { 738 class FragmentShaderCheckerboard : public FragmentTexBlendMode {
710 public: 739 public:
711 FragmentShaderCheckerboard(); 740 FragmentShaderCheckerboard();
712 std::string GetShaderString( 741 std::string GetShaderString(
713 TexCoordPrecision precision, SamplerType sampler) const; 742 TexCoordPrecision precision, SamplerType sampler) const;
714 743
715 void Init(gpu::gles2::GLES2Interface* context, 744 void Init(gpu::gles2::GLES2Interface* context,
716 unsigned program, 745 unsigned program,
717 int* base_uniform_index); 746 int* base_uniform_index);
718 int alpha_location() const { return alpha_location_; } 747 int alpha_location() const { return alpha_location_; }
719 int tex_transform_location() const { return tex_transform_location_; } 748 int tex_transform_location() const { return tex_transform_location_; }
720 int frequency_location() const { return frequency_location_; } 749 int frequency_location() const { return frequency_location_; }
721 int color_location() const { return color_location_; } 750 int color_location() const { return color_location_; }
722 751
723 private: 752 private:
724 int alpha_location_; 753 int alpha_location_;
725 int tex_transform_location_; 754 int tex_transform_location_;
726 int frequency_location_; 755 int frequency_location_;
727 int color_location_; 756 int color_location_;
728 757
729 DISALLOW_COPY_AND_ASSIGN(FragmentShaderCheckerboard); 758 DISALLOW_COPY_AND_ASSIGN(FragmentShaderCheckerboard);
730 }; 759 };
731 760
732 } // namespace cc 761 } // namespace cc
733 762
734 #endif // CC_OUTPUT_SHADER_H_ 763 #endif // CC_OUTPUT_SHADER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698