emitChild() used to generate a mangled outputColor based on the parent's outputColor; now it just accepts an outputColor string. It's now up to the programmer to declare outputColors if needed before emitting child code.
BUG=skia:4182
Review URL: https://codereview.chromium.org/1321253003
diff --git a/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp b/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp
index 20bb3a3..a5b3a99 100644
--- a/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp
@@ -302,13 +302,17 @@
}
void GrGLFragmentBuilder::onBeforeChildProcEmitCode() {
- fSubstageIndices.back()++;
+ SkASSERT(fSubstageIndices.count() >= 1);
fSubstageIndices.push_back(0);
- fMangleString.append(this->getMangleStringThisLevel());
+ // second-to-last value in the fSubstageIndices stack is the index of the child proc
+ // at that level which is currently emitting code.
+ fMangleString.appendf("_c%d", fSubstageIndices[fSubstageIndices.count() - 2]);
}
void GrGLFragmentBuilder::onAfterChildProcEmitCode() {
+ SkASSERT(fSubstageIndices.count() >= 2);
fSubstageIndices.pop_back();
+ fSubstageIndices.back()++;
int removeAt = fMangleString.findLastOf('_');
fMangleString.remove(removeAt, fMangleString.size() - removeAt);
}