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

Side by Side Diff: src/gpu/gl/builders/GrGLFragmentShaderBuilder.h

Issue 1301523003: added emitChild() to GrGLFragmentProcessor; removed AutoFragmentChildProcAdvance class (Closed) Base URL: https://skia.googlesource.com/skia@cs3_glinstances2
Patch Set: changed emitted comment before child's emitted code Created 5 years, 4 months 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 | « src/gpu/gl/GrGLFragmentProcessor.cpp ('k') | src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp » ('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 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
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
111 private: 80 private:
112 /* 81 /*
113 * State that tracks which child proc in the proc tree is currently emitting code. This is 82 * State that tracks which child proc in the proc tree is currently emitting code. This is
114 * used to update the fMangleString, which is used to mangle the names of un iforms and functions 83 * used to update the fMangleString, which is used to mangle the names of un iforms and functions
115 * emitted by the proc. fSubstageIndices is a stack: its count indicates ho w many levels deep 84 * emitted by the proc. fSubstageIndices is a stack: its count indicates ho w many levels deep
116 * we are in the tree, and its second-to-last value is the index of the chil d proc at that 85 * we are in the tree, and its second-to-last value is the index of the chil d proc at that
117 * level which is currently emitting code. For example, if fSubstageIndices = [3, 1, 2, 0], that 86 * level which is currently emitting code. For example, if fSubstageIndices = [3, 1, 2, 0], that
118 * means we're currently emitting code for the base proc's 3rd child's 1st c hild's 2nd child. 87 * means we're currently emitting code for the base proc's 3rd child's 1st c hild's 2nd child.
119 */ 88 */
120 SkTArray<int> fSubstageIndices; 89 SkTArray<int> fSubstageIndices;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 // the program creator 212 // the program creator
244 bool fHasReadDstColor; 213 bool fHasReadDstColor;
245 bool fHasReadFragmentPosition; 214 bool fHasReadFragmentPosition;
246 215
247 friend class GrGLProgramBuilder; 216 friend class GrGLProgramBuilder;
248 217
249 typedef GrGLXPFragmentBuilder INHERITED; 218 typedef GrGLXPFragmentBuilder INHERITED;
250 }; 219 };
251 220
252 #endif 221 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLFragmentProcessor.cpp ('k') | src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698