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 41 matching lines...) Loading... |
52 * series. The original input is passed to the first, the first's output is
passed to the | 52 * series. The original input is passed to the first, the first's output is
passed to the |
53 * second, etc. The output of the returned processor is the output of the la
st processor of the | 53 * second, etc. The output of the returned processor is the output of the la
st processor of the |
54 * series. | 54 * series. |
55 */ | 55 */ |
56 static const GrFragmentProcessor* RunInSeries(const GrFragmentProcessor*[],
int cnt); | 56 static const GrFragmentProcessor* RunInSeries(const GrFragmentProcessor*[],
int cnt); |
57 | 57 |
58 GrFragmentProcessor() | 58 GrFragmentProcessor() |
59 : INHERITED() | 59 : INHERITED() |
60 , fUsesLocalCoords(false) | 60 , fUsesLocalCoords(false) |
61 , fNumTexturesExclChildren(0) | 61 , fNumTexturesExclChildren(0) |
| 62 , fNumBuffersExclChildren(0) |
62 , fNumTransformsExclChildren(0) {} | 63 , fNumTransformsExclChildren(0) {} |
63 | 64 |
64 ~GrFragmentProcessor() override; | 65 ~GrFragmentProcessor() override; |
65 | 66 |
66 GrGLSLFragmentProcessor* createGLSLInstance() const; | 67 GrGLSLFragmentProcessor* createGLSLInstance() const; |
67 | 68 |
68 void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c
onst { | 69 void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c
onst { |
69 this->onGetGLSLProcessorKey(caps, b); | 70 this->onGetGLSLProcessorKey(caps, b); |
70 for (int i = 0; i < fChildProcessors.count(); ++i) { | 71 for (int i = 0; i < fChildProcessors.count(); ++i) { |
71 fChildProcessors[i]->getGLSLProcessorKey(caps, b); | 72 fChildProcessors[i]->getGLSLProcessorKey(caps, b); |
72 } | 73 } |
73 } | 74 } |
74 | 75 |
75 int numTexturesExclChildren() const { return fNumTexturesExclChildren; } | 76 int numTexturesExclChildren() const { return fNumTexturesExclChildren; } |
76 | 77 |
| 78 int numBuffersExclChildren() const { return fNumBuffersExclChildren; } |
| 79 |
77 int numTransformsExclChildren() const { return fNumTransformsExclChildren; } | 80 int numTransformsExclChildren() const { return fNumTransformsExclChildren; } |
78 | 81 |
79 int numTransforms() const { return fCoordTransforms.count(); } | 82 int numTransforms() const { return fCoordTransforms.count(); } |
80 | 83 |
81 /** Returns the coordinate transformation at index. index must be valid acco
rding to | 84 /** Returns the coordinate transformation at index. index must be valid acco
rding to |
82 numTransforms(). */ | 85 numTransforms(). */ |
83 const GrCoordTransform& coordTransform(int index) const { return *fCoordTran
sforms[index]; } | 86 const GrCoordTransform& coordTransform(int index) const { return *fCoordTran
sforms[index]; } |
84 | 87 |
85 const SkTArray<const GrCoordTransform*, true>& coordTransforms() const { | 88 const SkTArray<const GrCoordTransform*, true>& coordTransforms() const { |
86 return fCoordTransforms; | 89 return fCoordTransforms; |
(...skipping 28 matching lines...) Loading... |
115 * member indicates whether the input will be 1 or 4 bytes. The function upd
ates the members of | 118 * member indicates whether the input will be 1 or 4 bytes. The function upd
ates the members of |
116 * inout to indicate known values of its output. A component of the color me
mber only has | 119 * inout to indicate known values of its output. A component of the color me
mber only has |
117 * meaning if the corresponding bit in validFlags is set. | 120 * meaning if the corresponding bit in validFlags is set. |
118 */ | 121 */ |
119 void computeInvariantOutput(GrInvariantOutput* inout) const { | 122 void computeInvariantOutput(GrInvariantOutput* inout) const { |
120 this->onComputeInvariantOutput(inout); | 123 this->onComputeInvariantOutput(inout); |
121 } | 124 } |
122 | 125 |
123 protected: | 126 protected: |
124 void addTextureAccess(const GrTextureAccess* textureAccess) override; | 127 void addTextureAccess(const GrTextureAccess* textureAccess) override; |
| 128 void addBufferAccess(const GrBufferAccess*) override; |
125 | 129 |
126 /** | 130 /** |
127 * Fragment Processor subclasses call this from their constructor to registe
r coordinate | 131 * Fragment Processor subclasses call this from their constructor to registe
r coordinate |
128 * transformations. Coord transforms provide a mechanism for a processor to
receive coordinates | 132 * transformations. Coord transforms provide a mechanism for a processor to
receive coordinates |
129 * in their FS code. The matrix expresses a transformation from local space.
For a given | 133 * in their FS code. The matrix expresses a transformation from local space.
For a given |
130 * fragment the matrix will be applied to the local coordinate that maps to
the fragment. | 134 * fragment the matrix will be applied to the local coordinate that maps to
the fragment. |
131 * | 135 * |
132 * When the transformation has perspective, the transformed coordinates will
have | 136 * When the transformation has perspective, the transformed coordinates will
have |
133 * 3 components. Otherwise they'll have 2. | 137 * 3 components. Otherwise they'll have 2. |
134 * | 138 * |
(...skipping 68 matching lines...) Loading... |
203 * [b1,b2,c1] [d1,e1,e2,e3,f1,f2] | 207 * [b1,b2,c1] [d1,e1,e2,e3,f1,f2] |
204 * / / \ | 208 * / / \ |
205 * / / \ | 209 * / / \ |
206 * (C) (E) (F) | 210 * (C) (E) (F) |
207 * [c1] [e1,e2,e3] [f1,f2] | 211 * [c1] [e1,e2,e3] [f1,f2] |
208 * | 212 * |
209 * The same goes for fTextureAccesses with textures. | 213 * The same goes for fTextureAccesses with textures. |
210 */ | 214 */ |
211 SkSTArray<4, const GrCoordTransform*, true> fCoordTransforms; | 215 SkSTArray<4, const GrCoordTransform*, true> fCoordTransforms; |
212 int fNumTexturesExclChildren; | 216 int fNumTexturesExclChildren; |
| 217 int fNumBuffersExclChildren; |
213 int fNumTransformsExclChildren; | 218 int fNumTransformsExclChildren; |
214 SkSTArray<1, const GrFragmentProcessor*, true> fChildProcessors; | 219 SkSTArray<1, const GrFragmentProcessor*, true> fChildProcessors; |
215 | 220 |
216 typedef GrProcessor INHERITED; | 221 typedef GrProcessor INHERITED; |
217 }; | 222 }; |
218 | 223 |
219 #endif | 224 #endif |
OLD | NEW |