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

Side by Side Diff: include/gpu/GrFragmentProcessor.h

Issue 1287343005: Made isEqual in GrFragmentProcessor recursive (Closed) Base URL: https://skia.googlesource.com/skia@cs3_autoAdvance
Patch Set: Created 5 years, 4 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
« no previous file with comments | « no previous file | src/gpu/GrProcessor.cpp » ('j') | src/gpu/GrProcessor.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 /** Do any of the coordtransforms for this processor require local coords? * / 68 /** Do any of the coordtransforms for this processor require local coords? * /
69 bool usesLocalCoords() const { return fUsesLocalCoords; } 69 bool usesLocalCoords() const { return fUsesLocalCoords; }
70 70
71 /** Returns true if this and other processor conservatively draw identically . It can only return 71 /** Returns true if this and other processor conservatively draw identically . It can only return
72 true when the two processor are of the same subclass (i.e. they return t he same object from 72 true when the two processor are of the same subclass (i.e. they return t he same object from
73 from getFactory()). 73 from getFactory()).
74 74
75 A return value of true from isEqual() should not be used to test whether the processor would 75 A return value of true from isEqual() should not be used to test whether the processor would
76 generate the same shader code. To test for identical code generation use getGLProcessorKey*/ 76 generate the same shader code. To test for identical code generation use getGLProcessorKey*/
77 bool isEqual(const GrFragmentProcessor& that, bool ignoreCoordTransforms) co nst { 77 bool isEqual(const GrFragmentProcessor& that, bool ignoreCoordTransforms) co nst;
78 if (this->classID() != that.classID() ||
79 !this->hasSameTextureAccesses(that)) {
80 return false;
81 }
82 if (ignoreCoordTransforms) {
83 if (this->numTransforms() != that.numTransforms()) {
84 return false;
85 }
86 } else if (!this->hasSameTransforms(that)) {
87 return false;
88 }
89 return this->onIsEqual(that);
90 }
91 78
92 /** 79 /**
93 * This function is used to perform optimizations. When called the invarient Ouput param 80 * This function is used to perform optimizations. When called the invarient Ouput param
94 * indicate whether the input components to this processor in the FS will ha ve known values. 81 * indicate whether the input components to this processor in the FS will ha ve known values.
95 * In inout the validFlags member is a bitfield of GrColorComponentFlags. Th e isSingleComponent 82 * In inout the validFlags member is a bitfield of GrColorComponentFlags. Th e isSingleComponent
96 * member indicates whether the input will be 1 or 4 bytes. The function upd ates the members of 83 * member indicates whether the input will be 1 or 4 bytes. The function upd ates the members of
97 * inout to indicate known values of its output. A component of the color me mber only has 84 * inout to indicate known values of its output. A component of the color me mber only has
98 * meaning if the corresponding bit in validFlags is set. 85 * meaning if the corresponding bit in validFlags is set.
86 *
87 * Note: this function will NOT be recursive; it will be up to the parent pr oc to figure out
88 * what invariants its output can have given its children.
tomhudson 2015/08/17 17:33:10 Please clarify: It's hard for me to understand how
joshualitt 2015/08/17 17:38:41 I think the confusion here is that the parent can
bsalomon 2015/08/17 18:04:16 Perhaps the comment should be on the virtual and n
wangyix 2015/08/17 19:07:46 Done.
99 */ 89 */
100 void computeInvariantOutput(GrInvariantOutput* inout) const; 90 void computeInvariantOutput(GrInvariantOutput* inout) const;
101 91
102 protected: 92 protected:
103 /** 93 /**
104 * Fragment Processor subclasses call this from their constructor to registe r coordinate 94 * Fragment Processor subclasses call this from their constructor to registe r coordinate
105 * transformations. Coord transforms provide a mechanism for a processor to receive coordinates 95 * transformations. Coord transforms provide a mechanism for a processor to receive coordinates
106 * in their FS code. The matrix expresses a transformation from local space. For a given 96 * in their FS code. The matrix expresses a transformation from local space. For a given
107 * fragment the matrix will be applied to the local coordinate that maps to the fragment. 97 * fragment the matrix will be applied to the local coordinate that maps to the fragment.
108 * 98 *
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 * The same goes for fTextureAccesses with textures. 165 * The same goes for fTextureAccesses with textures.
176 */ 166 */
177 SkSTArray<4, const GrCoordTransform*, true> fCoordTransforms; 167 SkSTArray<4, const GrCoordTransform*, true> fCoordTransforms;
178 168
179 SkTArray<GrFragmentStage, false> fChildProcessors; 169 SkTArray<GrFragmentStage, false> fChildProcessors;
180 170
181 typedef GrProcessor INHERITED; 171 typedef GrProcessor INHERITED;
182 }; 172 };
183 173
184 #endif 174 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrProcessor.cpp » ('j') | src/gpu/GrProcessor.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698