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

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

Issue 794843002: Revert of Remove GP from drawstate, revision of invariant output for GP (Closed) Base URL: https://skia.googlesource.com/skia.git@color-to-gp
Patch Set: Created 6 years 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 | « gm/convexpolyeffect.cpp ('k') | include/gpu/GrInvariantOutput.h » ('j') | no next file with comments »
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 generate the same shader code. To test for identical code generation use getGLProcessorKey*/ 60 generate the same shader code. To test for identical code generation use getGLProcessorKey*/
61 bool isEqual(const GrFragmentProcessor& that) const { 61 bool isEqual(const GrFragmentProcessor& that) const {
62 if (this->classID() != that.classID() || 62 if (this->classID() != that.classID() ||
63 !this->hasSameTransforms(that) || 63 !this->hasSameTransforms(that) ||
64 !this->hasSameTextureAccesses(that)) { 64 !this->hasSameTextureAccesses(that)) {
65 return false; 65 return false;
66 } 66 }
67 return this->onIsEqual(that); 67 return this->onIsEqual(that);
68 } 68 }
69 69
70 /**
71 * This function is used to perform optimizations. When called the invarient Ouput param
72 * indicate whether the input components to this processor in the FS will ha ve known values.
73 * In inout the validFlags member is a bitfield of GrColorComponentFlags. Th e isSingleComponent
74 * member indicates whether the input will be 1 or 4 bytes. The function upd ates the members of
75 * inout to indicate known values of its output. A component of the color me mber only has
76 * meaning if the corresponding bit in validFlags is set.
77 */
78 void computeInvariantOutput(GrInvariantOutput* inout) const;
79
80 protected: 70 protected:
81 /** 71 /**
82 * Fragment Processor subclasses call this from their constructor to registe r coordinate 72 * Fragment Processor subclasses call this from their constructor to registe r coordinate
83 * transformations. Coord transforms provide a mechanism for a processor to receive coordinates 73 * transformations. Coord transforms provide a mechanism for a processor to receive coordinates
84 * in their FS code. The matrix expresses a transformation from local space. For a given 74 * in their FS code. The matrix expresses a transformation from local space. For a given
85 * fragment the matrix will be applied to the local coordinate that maps to the fragment. 75 * fragment the matrix will be applied to the local coordinate that maps to the fragment.
86 * 76 *
87 * When the transformation has perspective, the transformed coordinates will have 77 * When the transformation has perspective, the transformed coordinates will have
88 * 3 components. Otherwise they'll have 2. 78 * 3 components. Otherwise they'll have 2.
89 * 79 *
(...skipping 14 matching lines...) Expand all
104 */ 94 */
105 void setWillReadDstColor() { fWillReadDstColor = true; } 95 void setWillReadDstColor() { fWillReadDstColor = true; }
106 96
107 /** 97 /**
108 * If the prceossor will generate a result that does not depend on the input color value then it 98 * If the prceossor will generate a result that does not depend on the input color value then it
109 * must call this function from its constructor. Otherwise, when its generat ed backend-specific 99 * must call this function from its constructor. Otherwise, when its generat ed backend-specific
110 * code might fail during variable binding due to unused variables. 100 * code might fail during variable binding due to unused variables.
111 */ 101 */
112 void setWillNotUseInputColor() { fWillUseInputColor = false; } 102 void setWillNotUseInputColor() { fWillUseInputColor = false; }
113 103
114 /**
115 * Subclass implements this to support getConstantColorComponents(...).
116 */
117 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const = 0;
118
119 private: 104 private:
120 /** 105 /**
121 * Subclass implements this to support isEqual(). It will only be called if it is known that 106 * Subclass implements this to support isEqual(). It will only be called if it is known that
122 * the two processors are of the same subclass (i.e. they return the same ob ject from 107 * the two processors are of the same subclass (i.e. they return the same ob ject from
123 * getFactory()). The processor subclass should not compare its coord transf orms as that will 108 * getFactory()). The processor subclass should not compare its coord transf orms as that will
124 * be performed automatically in the non-virtual isEqual(). 109 * be performed automatically in the non-virtual isEqual().
125 */ 110 */
126 virtual bool onIsEqual(const GrFragmentProcessor&) const = 0; 111 virtual bool onIsEqual(const GrFragmentProcessor&) const = 0;
127 112
128 bool hasSameTransforms(const GrFragmentProcessor&) const; 113 bool hasSameTransforms(const GrFragmentProcessor&) const;
129 114
130 SkSTArray<4, const GrCoordTransform*, true> fCoordTransforms; 115 SkSTArray<4, const GrCoordTransform*, true> fCoordTransforms;
131 bool fWillReadDstColor; 116 bool fWillReadDstColor;
132 bool fWillUseInputColor; 117 bool fWillUseInputColor;
133 118
134 typedef GrProcessor INHERITED; 119 typedef GrProcessor INHERITED;
135 }; 120 };
136 121
137 #endif 122 #endif
OLDNEW
« no previous file with comments | « gm/convexpolyeffect.cpp ('k') | include/gpu/GrInvariantOutput.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698