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

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

Issue 959283004: Background filters are affected by masks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 9 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"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 int mask_sampler = -1; 69 int mask_sampler = -1;
70 int mask_tex_coord_scale = -1; 70 int mask_tex_coord_scale = -1;
71 int mask_tex_coord_offset = -1; 71 int mask_tex_coord_offset = -1;
72 int matrix = -1; 72 int matrix = -1;
73 int alpha = -1; 73 int alpha = -1;
74 int color_matrix = -1; 74 int color_matrix = -1;
75 int color_offset = -1; 75 int color_offset = -1;
76 int tex_transform = -1; 76 int tex_transform = -1;
77 int backdrop = -1; 77 int backdrop = -1;
78 int backdrop_rect = -1; 78 int backdrop_rect = -1;
79 int original_backdrop = -1;
79 }; 80 };
80 81
81 // Note: The highp_threshold_cache must be provided by the caller to make 82 // Note: The highp_threshold_cache must be provided by the caller to make
82 // the caching multi-thread/context safe in an easy low-overhead manner. 83 // the caching multi-thread/context safe in an easy low-overhead manner.
83 // The caller must make sure to clear highp_threshold_cache to 0, so it can be 84 // The caller must make sure to clear highp_threshold_cache to 0, so it can be
84 // reinitialized, if a new or different context is used. 85 // reinitialized, if a new or different context is used.
85 CC_EXPORT TexCoordPrecision 86 CC_EXPORT TexCoordPrecision
86 TexCoordPrecisionRequired(gpu::gles2::GLES2Interface* context, 87 TexCoordPrecisionRequired(gpu::gles2::GLES2Interface* context,
87 int* highp_threshold_cache, 88 int* highp_threshold_cache,
88 int highp_threshold_min, 89 int highp_threshold_min,
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 private: 340 private:
340 int matrix_location_; 341 int matrix_location_;
341 int tex_matrix_location_; 342 int tex_matrix_location_;
342 343
343 DISALLOW_COPY_AND_ASSIGN(VertexShaderVideoTransform); 344 DISALLOW_COPY_AND_ASSIGN(VertexShaderVideoTransform);
344 }; 345 };
345 346
346 class FragmentTexBlendMode { 347 class FragmentTexBlendMode {
347 public: 348 public:
348 int backdrop_location() const { return backdrop_location_; } 349 int backdrop_location() const { return backdrop_location_; }
350 int original_backdrop_location() const { return original_backdrop_location_; }
349 int backdrop_rect_location() const { return backdrop_rect_location_; } 351 int backdrop_rect_location() const { return backdrop_rect_location_; }
350 352
351 BlendMode blend_mode() const { return blend_mode_; } 353 BlendMode blend_mode() const { return blend_mode_; }
352 void set_blend_mode(BlendMode blend_mode) { blend_mode_ = blend_mode; } 354 void set_blend_mode(BlendMode blend_mode) { blend_mode_ = blend_mode; }
353 bool has_blend_mode() const { return blend_mode_ != BLEND_MODE_NONE; } 355 bool has_blend_mode() const { return blend_mode_ != BLEND_MODE_NONE; }
356 void set_mask_for_background(bool mask_for_background) {
357 mask_for_background_ = mask_for_background;
358 }
359 bool mask_for_background() const { return mask_for_background_; }
354 360
355 protected: 361 protected:
356 FragmentTexBlendMode(); 362 FragmentTexBlendMode();
357 363
358 std::string SetBlendModeFunctions(std::string shader_string) const; 364 std::string SetBlendModeFunctions(std::string shader_string) const;
359 365
360 int backdrop_location_; 366 int backdrop_location_;
367 int original_backdrop_location_;
361 int backdrop_rect_location_; 368 int backdrop_rect_location_;
362 369
363 private: 370 private:
364 BlendMode blend_mode_; 371 BlendMode blend_mode_;
372 bool mask_for_background_;
365 373
366 std::string GetHelperFunctions() const; 374 std::string GetHelperFunctions() const;
367 std::string GetBlendFunction() const; 375 std::string GetBlendFunction() const;
368 std::string GetBlendFunctionBodyForRGB() const; 376 std::string GetBlendFunctionBodyForRGB() const;
369 }; 377 };
370 378
371 class FragmentTexAlphaBinding : public FragmentTexBlendMode { 379 class FragmentTexAlphaBinding : public FragmentTexBlendMode {
372 public: 380 public:
373 FragmentTexAlphaBinding(); 381 FragmentTexAlphaBinding();
374 382
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 static std::string GetShaderHead(); 598 static std::string GetShaderHead();
591 static std::string GetShaderBody(); 599 static std::string GetShaderBody();
592 }; 600 };
593 601
594 class FragmentShaderRGBATexAlphaMask : public FragmentTexBlendMode { 602 class FragmentShaderRGBATexAlphaMask : public FragmentTexBlendMode {
595 public: 603 public:
596 FragmentShaderRGBATexAlphaMask(); 604 FragmentShaderRGBATexAlphaMask();
597 std::string GetShaderString( 605 std::string GetShaderString(
598 TexCoordPrecision precision, SamplerType sampler) const; 606 TexCoordPrecision precision, SamplerType sampler) const;
599 static std::string GetShaderHead(); 607 static std::string GetShaderHead();
600 static std::string GetShaderBody(); 608 static std::string GetShaderBody(bool mask_for_background);
601 void FillLocations(ShaderLocations* locations) const; 609 void FillLocations(ShaderLocations* locations) const;
602 void Init(gpu::gles2::GLES2Interface* context, 610 void Init(gpu::gles2::GLES2Interface* context,
603 unsigned program, 611 unsigned program,
604 int* base_uniform_index); 612 int* base_uniform_index);
605 int alpha_location() const { return alpha_location_; } 613 int alpha_location() const { return alpha_location_; }
606 int sampler_location() const { return sampler_location_; } 614 int sampler_location() const { return sampler_location_; }
607 int mask_sampler_location() const { return mask_sampler_location_; } 615 int mask_sampler_location() const { return mask_sampler_location_; }
608 int mask_tex_coord_scale_location() const { 616 int mask_tex_coord_scale_location() const {
609 return mask_tex_coord_scale_location_; 617 return mask_tex_coord_scale_location_;
610 } 618 }
(...skipping 10 matching lines...) Expand all
621 629
622 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMask); 630 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMask);
623 }; 631 };
624 632
625 class FragmentShaderRGBATexAlphaMaskAA : public FragmentTexBlendMode { 633 class FragmentShaderRGBATexAlphaMaskAA : public FragmentTexBlendMode {
626 public: 634 public:
627 FragmentShaderRGBATexAlphaMaskAA(); 635 FragmentShaderRGBATexAlphaMaskAA();
628 std::string GetShaderString( 636 std::string GetShaderString(
629 TexCoordPrecision precision, SamplerType sampler) const; 637 TexCoordPrecision precision, SamplerType sampler) const;
630 static std::string GetShaderHead(); 638 static std::string GetShaderHead();
631 static std::string GetShaderBody(); 639 static std::string GetShaderBody(bool mask_for_background);
632 void FillLocations(ShaderLocations* locations) const; 640 void FillLocations(ShaderLocations* locations) const;
633 void Init(gpu::gles2::GLES2Interface* context, 641 void Init(gpu::gles2::GLES2Interface* context,
634 unsigned program, 642 unsigned program,
635 int* base_uniform_index); 643 int* base_uniform_index);
636 int alpha_location() const { return alpha_location_; } 644 int alpha_location() const { return alpha_location_; }
637 int sampler_location() const { return sampler_location_; } 645 int sampler_location() const { return sampler_location_; }
638 int mask_sampler_location() const { return mask_sampler_location_; } 646 int mask_sampler_location() const { return mask_sampler_location_; }
639 int mask_tex_coord_scale_location() const { 647 int mask_tex_coord_scale_location() const {
640 return mask_tex_coord_scale_location_; 648 return mask_tex_coord_scale_location_;
641 } 649 }
(...skipping 11 matching lines...) Expand all
653 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMaskAA); 661 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMaskAA);
654 }; 662 };
655 663
656 class FragmentShaderRGBATexAlphaMaskColorMatrixAA 664 class FragmentShaderRGBATexAlphaMaskColorMatrixAA
657 : public FragmentTexBlendMode { 665 : public FragmentTexBlendMode {
658 public: 666 public:
659 FragmentShaderRGBATexAlphaMaskColorMatrixAA(); 667 FragmentShaderRGBATexAlphaMaskColorMatrixAA();
660 std::string GetShaderString( 668 std::string GetShaderString(
661 TexCoordPrecision precision, SamplerType sampler) const; 669 TexCoordPrecision precision, SamplerType sampler) const;
662 static std::string GetShaderHead(); 670 static std::string GetShaderHead();
663 static std::string GetShaderBody(); 671 static std::string GetShaderBody(bool mask_for_background);
664 void FillLocations(ShaderLocations* locations) const; 672 void FillLocations(ShaderLocations* locations) const;
665 void Init(gpu::gles2::GLES2Interface* context, 673 void Init(gpu::gles2::GLES2Interface* context,
666 unsigned program, 674 unsigned program,
667 int* base_uniform_index); 675 int* base_uniform_index);
668 int alpha_location() const { return alpha_location_; } 676 int alpha_location() const { return alpha_location_; }
669 int sampler_location() const { return sampler_location_; } 677 int sampler_location() const { return sampler_location_; }
670 int mask_sampler_location() const { return mask_sampler_location_; } 678 int mask_sampler_location() const { return mask_sampler_location_; }
671 int mask_tex_coord_scale_location() const { 679 int mask_tex_coord_scale_location() const {
672 return mask_tex_coord_scale_location_; 680 return mask_tex_coord_scale_location_;
673 } 681 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 int color_matrix_location_; 717 int color_matrix_location_;
710 int color_offset_location_; 718 int color_offset_location_;
711 }; 719 };
712 720
713 class FragmentShaderRGBATexAlphaMaskColorMatrix : public FragmentTexBlendMode { 721 class FragmentShaderRGBATexAlphaMaskColorMatrix : public FragmentTexBlendMode {
714 public: 722 public:
715 FragmentShaderRGBATexAlphaMaskColorMatrix(); 723 FragmentShaderRGBATexAlphaMaskColorMatrix();
716 std::string GetShaderString( 724 std::string GetShaderString(
717 TexCoordPrecision precision, SamplerType sampler) const; 725 TexCoordPrecision precision, SamplerType sampler) const;
718 static std::string GetShaderHead(); 726 static std::string GetShaderHead();
719 static std::string GetShaderBody(); 727 static std::string GetShaderBody(bool mask_for_background);
720 void FillLocations(ShaderLocations* locations) const; 728 void FillLocations(ShaderLocations* locations) const;
721 void Init(gpu::gles2::GLES2Interface* context, 729 void Init(gpu::gles2::GLES2Interface* context,
722 unsigned program, 730 unsigned program,
723 int* base_uniform_index); 731 int* base_uniform_index);
724 int alpha_location() const { return alpha_location_; } 732 int alpha_location() const { return alpha_location_; }
725 int sampler_location() const { return sampler_location_; } 733 int sampler_location() const { return sampler_location_; }
726 int mask_sampler_location() const { return mask_sampler_location_; } 734 int mask_sampler_location() const { return mask_sampler_location_; }
727 int mask_tex_coord_scale_location() const { 735 int mask_tex_coord_scale_location() const {
728 return mask_tex_coord_scale_location_; 736 return mask_tex_coord_scale_location_;
729 } 737 }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 int tex_transform_location_; 875 int tex_transform_location_;
868 int frequency_location_; 876 int frequency_location_;
869 int color_location_; 877 int color_location_;
870 878
871 DISALLOW_COPY_AND_ASSIGN(FragmentShaderCheckerboard); 879 DISALLOW_COPY_AND_ASSIGN(FragmentShaderCheckerboard);
872 }; 880 };
873 881
874 } // namespace cc 882 } // namespace cc
875 883
876 #endif // CC_OUTPUT_SHADER_H_ 884 #endif // CC_OUTPUT_SHADER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698