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 13 matching lines...) Expand all Loading... |
24 class GrFragmentProcessor : public GrProcessor { | 24 class GrFragmentProcessor : public GrProcessor { |
25 public: | 25 public: |
26 GrFragmentProcessor() | 26 GrFragmentProcessor() |
27 : INHERITED() | 27 : INHERITED() |
28 , fUsesLocalCoords(false) | 28 , fUsesLocalCoords(false) |
29 , fNumTexturesExclChildren(0) | 29 , fNumTexturesExclChildren(0) |
30 , fNumTransformsExclChildren(0) {} | 30 , fNumTransformsExclChildren(0) {} |
31 | 31 |
32 GrGLFragmentProcessor* createGLInstance() const; | 32 GrGLFragmentProcessor* createGLInstance() const; |
33 | 33 |
34 /** Human-meaningful string to identify this GrFragmentProcessor; may be emb
edded | |
35 in generated shader code. */ | |
36 virtual const char* name() const = 0; | |
37 | |
38 void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) con
st { | 34 void getGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) con
st { |
39 this->onGetGLProcessorKey(caps, b); | 35 this->onGetGLProcessorKey(caps, b); |
40 for (int i = 0; i < fChildProcessors.count(); ++i) { | 36 for (int i = 0; i < fChildProcessors.count(); ++i) { |
41 fChildProcessors[i].processor()->getGLProcessorKey(caps, b); | 37 fChildProcessors[i].processor()->getGLProcessorKey(caps, b); |
42 } | 38 } |
43 } | 39 } |
44 | 40 |
45 int numTexturesExclChildren() const { return fNumTexturesExclChildren; } | 41 int numTexturesExclChildren() const { return fNumTexturesExclChildren; } |
46 | 42 |
47 int numTransformsExclChildren() const { return fNumTransformsExclChildren; } | 43 int numTransformsExclChildren() const { return fNumTransformsExclChildren; } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 protected: | 88 protected: |
93 void addTextureAccess(const GrTextureAccess* textureAccess) override; | 89 void addTextureAccess(const GrTextureAccess* textureAccess) override; |
94 | 90 |
95 /** | 91 /** |
96 * Fragment Processor subclasses call this from their constructor to registe
r coordinate | 92 * Fragment Processor subclasses call this from their constructor to registe
r coordinate |
97 * transformations. Coord transforms provide a mechanism for a processor to
receive coordinates | 93 * transformations. Coord transforms provide a mechanism for a processor to
receive coordinates |
98 * in their FS code. The matrix expresses a transformation from local space.
For a given | 94 * in their FS code. The matrix expresses a transformation from local space.
For a given |
99 * fragment the matrix will be applied to the local coordinate that maps to
the fragment. | 95 * fragment the matrix will be applied to the local coordinate that maps to
the fragment. |
100 * | 96 * |
101 * When the transformation has perspective, the transformed coordinates will
have | 97 * When the transformation has perspective, the transformed coordinates will
have |
102 * 3 components. Otherwise they'll have 2. | 98 * 3 components. Otherwise they'll have 2. |
103 * | 99 * |
104 * This must only be called from the constructor because GrProcessors are im
mutable. The | 100 * This must only be called from the constructor because GrProcessors are im
mutable. The |
105 * processor subclass manages the lifetime of the transformations (this func
tion only stores a | 101 * processor subclass manages the lifetime of the transformations (this func
tion only stores a |
106 * pointer). The GrCoordTransform is typically a member field of the GrProce
ssor subclass. | 102 * pointer). The GrCoordTransform is typically a member field of the GrProce
ssor subclass. |
107 * | 103 * |
108 * A processor subclass that has multiple methods of construction should alw
ays add its coord | 104 * A processor subclass that has multiple methods of construction should alw
ays add its coord |
109 * transforms in a consistent order. The non-virtual implementation of isEqu
al() automatically | 105 * transforms in a consistent order. The non-virtual implementation of isEqu
al() automatically |
110 * compares transforms and will assume they line up across the two processor
instances. | 106 * compares transforms and will assume they line up across the two processor
instances. |
111 */ | 107 */ |
112 void addCoordTransform(const GrCoordTransform*); | 108 void addCoordTransform(const GrCoordTransform*); |
113 | 109 |
114 /** | 110 /** |
115 * FragmentProcessor subclasses call this from their constructor to register
any child | 111 * FragmentProcessor subclasses call this from their constructor to register
any child |
116 * FragmentProcessors they have. This must be called AFTER all texture acces
ses and coord | 112 * FragmentProcessors they have. This must be called AFTER all texture acces
ses and coord |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 175 |
180 int fNumTexturesExclChildren; | 176 int fNumTexturesExclChildren; |
181 int fNumTransformsExclChildren; | 177 int fNumTransformsExclChildren; |
182 | 178 |
183 SkTArray<GrFragmentStage, false> fChildProcessors; | 179 SkTArray<GrFragmentStage, false> fChildProcessors; |
184 | 180 |
185 typedef GrProcessor INHERITED; | 181 typedef GrProcessor INHERITED; |
186 }; | 182 }; |
187 | 183 |
188 #endif | 184 #endif |
OLD | NEW |