aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp
diff options
context:
space:
mode:
authorGravatar wangyix <wangyix@google.com>2015-09-08 08:41:51 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-09-08 08:41:51 -0700
commit54a6b1a1228489161294e4fa1fc8f93797cff259 (patch)
treed4663fe8b04109640be41d7b109e99c5eb285e52 /src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp
parent43fe6185c5043247c47daa450b015e26d86728fe (diff)
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.
Diffstat (limited to 'src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp')
-rw-r--r--src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp b/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp
index 20bb3a3893..a5b3a99ebe 100644
--- a/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp
@@ -302,13 +302,17 @@ void GrGLFragmentShaderBuilder::addVarying(GrGLVarying* v, GrSLPrecision fsPrec)
}
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);
}