| 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 GrGLFragmentShaderBuilder_DEFINED | 8 #ifndef GrGLFragmentShaderBuilder_DEFINED |
| 9 #define GrGLFragmentShaderBuilder_DEFINED | 9 #define GrGLFragmentShaderBuilder_DEFINED |
| 10 | 10 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 SkString getMangleStringThisLevel() const { | 71 SkString getMangleStringThisLevel() const { |
| 72 SkString ret; | 72 SkString ret; |
| 73 int childNumber = this->getChildNumberThisLevel(); | 73 int childNumber = this->getChildNumberThisLevel(); |
| 74 if (childNumber >= 0) { | 74 if (childNumber >= 0) { |
| 75 ret.printf("_c%d", childNumber); | 75 ret.printf("_c%d", childNumber); |
| 76 } | 76 } |
| 77 return ret; | 77 return ret; |
| 78 } | 78 } |
| 79 | 79 |
| 80 /* This class is like AutoStageAdvance but used for the child procs of a fra
gment proc. |
| 81 * Before a proc calls emitCode on one of its children, it should instantiat
e this |
| 82 * class inside its own scope. This which will update a state in GrGLFragmen
tBuilder that tracks |
| 83 * which proc in the tree is about to emit code (it does so by calling GrGL
FragmentBuilder:: |
| 84 * onBeforeChildProcEmitCode() in the constructor). |
| 85 * |
| 86 * After the child proc emitCode is called, the parent proc should end the s
cope so the |
| 87 * AutoFragmentChildProcAdvance destructor is called, which will again updat
e a state in |
| 88 * GrGLFragmentShaderBuilder notifying it that the child proc's code has bee
n emitted (it does |
| 89 * so by calling GrGLFragmentBuilder::onAfterChildProcEmitCode()). |
| 90 */ |
| 91 class AutoFragmentChildProcAdvance { |
| 92 typedef GrGLProcessor::TransformedCoordsArray TransformedCoordsArray; |
| 93 typedef GrGLProcessor::TextureSamplerArray TextureSamplerArray; |
| 94 public: |
| 95 AutoFragmentChildProcAdvance(int childProcIndex, |
| 96 GrGLFPBuilder* builder, |
| 97 const GrFragmentProcessor& fp, |
| 98 const char* outputColor, |
| 99 const TransformedCoordsArray& coords, |
| 100 const TextureSamplerArray& samplers, |
| 101 const GrFragmentProcessor** childFp, |
| 102 SkString* childOutputColor, |
| 103 TransformedCoordsArray* childCoords, |
| 104 TextureSamplerArray* childSamplers); |
| 105 |
| 106 ~AutoFragmentChildProcAdvance(); |
| 107 private: |
| 108 GrGLFragmentBuilder* fFsb; |
| 109 }; |
| 110 |
| 80 private: | 111 private: |
| 81 /* | 112 /* |
| 82 * State that tracks which child proc in the proc tree is currently emitting
code. This is | 113 * State that tracks which child proc in the proc tree is currently emitting
code. This is |
| 83 * used to update the fMangleString, which is used to mangle the names of un
iforms and functions | 114 * used to update the fMangleString, which is used to mangle the names of un
iforms and functions |
| 84 * emitted by the proc. fSubstageIndices is a stack: its count indicates ho
w many levels deep | 115 * emitted by the proc. fSubstageIndices is a stack: its count indicates ho
w many levels deep |
| 85 * we are in the tree, and its second-to-last value is the index of the chil
d proc at that | 116 * we are in the tree, and its second-to-last value is the index of the chil
d proc at that |
| 86 * level which is currently emitting code. For example, if fSubstageIndices
= [3, 1, 2, 0], that | 117 * level which is currently emitting code. For example, if fSubstageIndices
= [3, 1, 2, 0], that |
| 87 * means we're currently emitting code for the base proc's 3rd child's 1st c
hild's 2nd child. | 118 * means we're currently emitting code for the base proc's 3rd child's 1st c
hild's 2nd child. |
| 88 */ | 119 */ |
| 89 SkTArray<int> fSubstageIndices; | 120 SkTArray<int> fSubstageIndices; |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 // the program creator | 243 // the program creator |
| 213 bool fHasReadDstColor; | 244 bool fHasReadDstColor; |
| 214 bool fHasReadFragmentPosition; | 245 bool fHasReadFragmentPosition; |
| 215 | 246 |
| 216 friend class GrGLProgramBuilder; | 247 friend class GrGLProgramBuilder; |
| 217 | 248 |
| 218 typedef GrGLXPFragmentBuilder INHERITED; | 249 typedef GrGLXPFragmentBuilder INHERITED; |
| 219 }; | 250 }; |
| 220 | 251 |
| 221 #endif | 252 #endif |
| OLD | NEW |