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

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

Issue 1321253003: emitChild() takes an outputColor instead of generating one (Closed) Base URL: https://skia.googlesource.com/skia@cs3_composeshader2
Patch Set: rebase Created 5 years, 3 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 is in device space (e.g. 0,0 is the top left and pixel centers are at ha lf-integers). */ 50 is in device space (e.g. 0,0 is the top left and pixel centers are at ha lf-integers). */
51 virtual const char* fragmentPosition() = 0; 51 virtual const char* fragmentPosition() = 0;
52 52
53 /** 53 /**
54 * Fragment procs with child procs should call these functions before/after calling emitCode 54 * Fragment procs with child procs should call these functions before/after calling emitCode
55 * on a child proc. 55 * on a child proc.
56 */ 56 */
57 void onBeforeChildProcEmitCode(); 57 void onBeforeChildProcEmitCode();
58 void onAfterChildProcEmitCode(); 58 void onAfterChildProcEmitCode();
59 59
60 int getChildNumberThisLevel() const {
61 if (fSubstageIndices.count() > 1) {
62 // second-to-last value in the fSubstageIndices stack is the index o f the child proc
63 // at that level which is currently emitting code.
64 return fSubstageIndices[fSubstageIndices.count() - 2];
65 }
66 return -1;
67 }
68
69 const SkString& getMangleString() const { return fMangleString; } 60 const SkString& getMangleString() const { return fMangleString; }
70 61
71 SkString getMangleStringThisLevel() const {
72 SkString ret;
73 int childNumber = this->getChildNumberThisLevel();
74 if (childNumber >= 0) {
75 ret.printf("_c%d", childNumber);
76 }
77 return ret;
78 }
79
80 private: 62 private:
81 /* 63 /*
82 * State that tracks which child proc in the proc tree is currently emitting code. This is 64 * 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 65 * 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 66 * 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 67 * 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 68 * 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. 69 * means we're currently emitting code for the base proc's 3rd child's 1st c hild's 2nd child.
88 */ 70 */
89 SkTArray<int> fSubstageIndices; 71 SkTArray<int> fSubstageIndices;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 // the program creator 194 // the program creator
213 bool fHasReadDstColor; 195 bool fHasReadDstColor;
214 bool fHasReadFragmentPosition; 196 bool fHasReadFragmentPosition;
215 197
216 friend class GrGLProgramBuilder; 198 friend class GrGLProgramBuilder;
217 199
218 typedef GrGLXPFragmentBuilder INHERITED; 200 typedef GrGLXPFragmentBuilder INHERITED;
219 }; 201 };
220 202
221 #endif 203 #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