Chromium Code Reviews| Index: include/gpu/GrFragmentProcessor.h |
| diff --git a/include/gpu/GrFragmentProcessor.h b/include/gpu/GrFragmentProcessor.h |
| index a8baa53b4a0c0ec8d73c10be1b6500cf61198c30..fb3b5c2f69ebe461ca8bf73d515db7fc7c1073a1 100644 |
| --- a/include/gpu/GrFragmentProcessor.h |
| +++ b/include/gpu/GrFragmentProcessor.h |
| @@ -39,8 +39,22 @@ public: |
| in generated shader code. */ |
| virtual const char* name() const = 0; |
| + void getGLProcessorKeyIncludeChildProcs(const GrGLSLCaps& caps, |
| + GrProcessorKeyBuilder* b) const { |
| + this->getGLProcessorKey(caps, b); |
| + for (int i = 0; i < fChildProcessors.count(); ++i) |
|
joshualitt
2015/08/03 14:06:02
We put braces around single line for loops.
wangyix
2015/08/03 16:12:47
Done.
|
| + fChildProcessors[i]->getGLProcessorKeyIncludeChildProcs(caps, b); |
| + } |
| + |
| int numTransforms() const { return fCoordTransforms.count(); } |
| + int numTransformsIncludeChildProcs() const { |
| + int numTransforms = fCoordTransforms.count(); |
| + for (int i = 0; i < fChildProcessors.count(); ++i) |
|
joshualitt
2015/08/03 14:06:02
same
wangyix
2015/08/03 16:12:47
Done.
|
| + numTransforms += fChildProcessors[i]->numTransformsIncludeChildProcs(); |
| + return numTransforms; |
| + } |
| + |
| /** Returns the coordinate transformation at index. index must be valid according to |
| numTransforms(). */ |
| const GrCoordTransform& coordTransform(int index) const { return *fCoordTransforms[index]; } |
| @@ -49,6 +63,21 @@ public: |
| return fCoordTransforms; |
| } |
| + int numChildProcessors() const { return fChildProcessors.count(); } |
| + |
| + GrFragmentProcessor* childProcessor(int index) const { return fChildProcessors[index]; } |
| + |
| + const SkTArray<GrFragmentProcessor*, false>& childProcessors() const { |
| + return fChildProcessors; |
| + } |
| + |
| + int numTexturesIncludeChildProcs() const { |
| + int numTextures = this->numTextures(); |
| + for (int i = 0; i < fChildProcessors.count(); ++i) |
|
joshualitt
2015/08/03 14:06:02
same
wangyix
2015/08/03 16:12:47
Done.
|
| + numTextures += fChildProcessors[i]->numTexturesIncludeChildProcs(); |
| + return numTextures; |
| + } |
| + |
| /** Do any of the coordtransforms for this processor require local coords? */ |
| bool usesLocalCoords() const { return fUsesLocalCoords; } |
| @@ -98,6 +127,15 @@ protected: |
| void addCoordTransform(const GrCoordTransform*); |
| /** |
| + * FragmentProcessor subclasses call this to register any child FragmentProcessors they have. |
| + * This is for processors whose shader code will be composed of nested processors whose output |
| + * colors will be combined somehow to produce its output color. Registering these child |
| + * processors will allow the ProgramBuilder to automatically add their transformed coords and |
| + * texture accesses and mangle their uniform and output color names and |
| + */ |
| + void registerChildProcessor(GrFragmentProcessor* child); |
| + |
| + /** |
| * Subclass implements this to support getConstantColorComponents(...). |
| */ |
| virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const = 0; |
| @@ -115,7 +153,8 @@ private: |
| SkSTArray<4, const GrCoordTransform*, true> fCoordTransforms; |
| bool fUsesLocalCoords; |
| - |
| + SkTArray<GrFragmentProcessor*, false> fChildProcessors; |
| + |
|
joshualitt
2015/08/03 14:06:02
delete tab
wangyix
2015/08/03 16:12:47
Done.
|
| typedef GrProcessor INHERITED; |
| }; |