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

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

Issue 1286293002: Added class AutoFragmentChildProcAdvance to be constructed before a child emitCode and destructed a… (Closed) Base URL: https://skia.googlesource.com/skia@cs3_onBeforeAfter
Patch Set: fixed Josh's nits; added comments explaining backwards linear search for child coords/samplers 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
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.
tomhudson 2015/08/14 15:58:48 This comment requires the reader to understand Aut
wangyix 2015/08/14 16:07:27 Acknowledged.
81 class AutoFragmentChildProcAdvance {
82 typedef GrGLProcessor::TransformedCoordsArray TransformedCoordsArray;
83 typedef GrGLProcessor::TextureSamplerArray TextureSamplerArray;
84 public:
85 AutoFragmentChildProcAdvance(int childProcIndex,
86 GrGLFPBuilder* builder,
87 const GrFragmentProcessor& fp,
88 const char* outputColor,
89 const TransformedCoordsArray& coords,
90 const TextureSamplerArray& samplers,
91 const GrFragmentProcessor** childFp,
92 SkString* childOutputColor,
93 TransformedCoordsArray* childCoords,
94 TextureSamplerArray* childSamplers);
95
96 ~AutoFragmentChildProcAdvance();
97 private:
98 GrGLFragmentBuilder* fFsb;
99 };
100
80 private: 101 private:
81 /* 102 /*
82 * State that tracks which child proc in the proc tree is currently emitting code. This is 103 * 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 104 * 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 105 * 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 106 * 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 107 * 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. 108 * means we're currently emitting code for the base proc's 3rd child's 1st c hild's 2nd child.
88 */ 109 */
89 SkTArray<int> fSubstageIndices; 110 SkTArray<int> fSubstageIndices;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 // the program creator 233 // the program creator
213 bool fHasReadDstColor; 234 bool fHasReadDstColor;
214 bool fHasReadFragmentPosition; 235 bool fHasReadFragmentPosition;
215 236
216 friend class GrGLProgramBuilder; 237 friend class GrGLProgramBuilder;
217 238
218 typedef GrGLXPFragmentBuilder INHERITED; 239 typedef GrGLXPFragmentBuilder INHERITED;
219 }; 240 };
220 241
221 #endif 242 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698