Add more specialized fragment builders
Adds specialized fragment builders for primitive and fragment
processors. Removes fragment-specific functionality from the Xfer
fragment builder.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1709153002
Review URL: https://codereview.chromium.org/1709153002
diff --git a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp
index 8651827..4277cf4 100644
--- a/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLFragmentShaderBuilder.cpp
@@ -68,12 +68,15 @@
GrGLSLFragmentShaderBuilder::GrGLSLFragmentShaderBuilder(GrGLSLProgramBuilder* program,
uint8_t fragPosKey)
- : INHERITED(program)
+ : GrGLSLFragmentBuilder(program)
, fSetupFragPosition(false)
, fTopLeftFragPosRead(kTopLeftFragPosRead_FragPosKey == fragPosKey)
+ , fHasCustomColorOutput(false)
, fCustomColorOutputIndex(-1)
+ , fHasSecondaryOutput(false)
, fHasReadDstColor(false)
, fHasReadFragmentPosition(false) {
+ fSubstageIndices.push_back(0);
}
bool GrGLSLFragmentShaderBuilder::enableFeature(GLSLFeature feature) {
@@ -263,7 +266,7 @@
&this->precisionQualifier());
}
-void GrGLSLFragmentBuilder::onBeforeChildProcEmitCode() {
+void GrGLSLFragmentShaderBuilder::onBeforeChildProcEmitCode() {
SkASSERT(fSubstageIndices.count() >= 1);
fSubstageIndices.push_back(0);
// second-to-last value in the fSubstageIndices stack is the index of the child proc
@@ -271,7 +274,7 @@
fMangleString.appendf("_c%d", fSubstageIndices[fSubstageIndices.count() - 2]);
}
-void GrGLSLFragmentBuilder::onAfterChildProcEmitCode() {
+void GrGLSLFragmentShaderBuilder::onAfterChildProcEmitCode() {
SkASSERT(fSubstageIndices.count() >= 2);
fSubstageIndices.pop_back();
fSubstageIndices.back()++;