OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrFragmentProcessor_DEFINED | 8 #ifndef GrFragmentProcessor_DEFINED |
9 #define GrFragmentProcessor_DEFINED | 9 #define GrFragmentProcessor_DEFINED |
10 | 10 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 } | 77 } |
78 | 78 |
79 /** Do any of the coordtransforms for this processor require local coords? * / | 79 /** Do any of the coordtransforms for this processor require local coords? * / |
80 bool usesLocalCoords() const { return fUsesLocalCoords; } | 80 bool usesLocalCoords() const { return fUsesLocalCoords; } |
81 | 81 |
82 /** Returns true if this and other processor conservatively draw identically . It can only return | 82 /** Returns true if this and other processor conservatively draw identically . It can only return |
83 true when the two processor are of the same subclass (i.e. they return t he same object from | 83 true when the two processor are of the same subclass (i.e. they return t he same object from |
84 from getFactory()). | 84 from getFactory()). |
85 | 85 |
86 A return value of true from isEqual() should not be used to test whether the processor would | 86 A return value of true from isEqual() should not be used to test whether the processor would |
87 generate the same shader code. To test for identical code generation use getGLProcessorKey*/ | 87 generate the same shader code. To test for identical code generation use getGLProcessorKey*/ |
bsalomon
2015/08/05 17:22:11
update comment?
"Coord transforms may be applied
joshualitt
2015/08/05 17:46:21
Acknowledged.
| |
88 bool isEqual(const GrFragmentProcessor& that) const { | 88 bool isEqual(const GrFragmentProcessor& that, bool ignoreCoordTransforms) co nst { |
89 if (this->classID() != that.classID() || | 89 if (this->classID() != that.classID() || |
90 !this->hasSameTransforms(that) || | |
91 !this->hasSameTextureAccesses(that)) { | 90 !this->hasSameTextureAccesses(that)) { |
92 return false; | 91 return false; |
93 } | 92 } |
93 if (ignoreCoordTransforms) { | |
94 if (this->numTransforms() != that.numTransforms()) { | |
95 return false; | |
96 } | |
97 } else if (!this->hasSameTransforms(that)) { | |
98 return false; | |
99 } | |
94 return this->onIsEqual(that); | 100 return this->onIsEqual(that); |
95 } | 101 } |
96 | 102 |
97 /** | 103 /** |
98 * This function is used to perform optimizations. When called the invarient Ouput param | 104 * This function is used to perform optimizations. When called the invarient Ouput param |
99 * indicate whether the input components to this processor in the FS will ha ve known values. | 105 * indicate whether the input components to this processor in the FS will ha ve known values. |
100 * In inout the validFlags member is a bitfield of GrColorComponentFlags. Th e isSingleComponent | 106 * In inout the validFlags member is a bitfield of GrColorComponentFlags. Th e isSingleComponent |
101 * member indicates whether the input will be 1 or 4 bytes. The function upd ates the members of | 107 * member indicates whether the input will be 1 or 4 bytes. The function upd ates the members of |
102 * inout to indicate known values of its output. A component of the color me mber only has | 108 * inout to indicate known values of its output. A component of the color me mber only has |
103 * meaning if the corresponding bit in validFlags is set. | 109 * meaning if the corresponding bit in validFlags is set. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
154 bool hasSameTransforms(const GrFragmentProcessor&) const; | 160 bool hasSameTransforms(const GrFragmentProcessor&) const; |
155 | 161 |
156 SkSTArray<4, const GrCoordTransform*, true> fCoordTransforms; | 162 SkSTArray<4, const GrCoordTransform*, true> fCoordTransforms; |
157 bool fUsesLocalCoords; | 163 bool fUsesLocalCoords; |
158 SkTArray<GrFragmentProcessor*, false> fChildProcessors; | 164 SkTArray<GrFragmentProcessor*, false> fChildProcessors; |
159 | 165 |
160 typedef GrProcessor INHERITED; | 166 typedef GrProcessor INHERITED; |
161 }; | 167 }; |
162 | 168 |
163 #endif | 169 #endif |
OLD | NEW |