Preliminary attempt to remove batch tracker
BUG=skia:
Committed: https://skia.googlesource.com/skia/+/cbfe91d82500f4ae8c3ff7bd74b3021a4b89fd84
Review URL: https://codereview.chromium.org/1139723004
diff --git a/src/gpu/gl/GrGLPrimitiveProcessor.cpp b/src/gpu/gl/GrGLPrimitiveProcessor.cpp
index 3213ffa..d719774 100644
--- a/src/gpu/gl/GrGLPrimitiveProcessor.cpp
+++ b/src/gpu/gl/GrGLPrimitiveProcessor.cpp
@@ -31,28 +31,18 @@
return combined;
}
-void
-GrGLPrimitiveProcessor::setupColorPassThrough(GrGLGPBuilder* pb,
- GrGPInput inputType,
- const char* outputName,
- const GrGeometryProcessor::Attribute* colorAttr,
- UniformHandle* colorUniform) {
+void GrGLPrimitiveProcessor::setupUniformColor(GrGLGPBuilder* pb,
+ const char* outputName,
+ UniformHandle* colorUniform) {
GrGLFragmentBuilder* fs = pb->getFragmentShaderBuilder();
- if (kUniform_GrGPInput == inputType) {
- SkASSERT(colorUniform);
- const char* stagedLocalVarName;
- *colorUniform = pb->addUniform(GrGLProgramBuilder::kFragment_Visibility,
- kVec4f_GrSLType,
- kDefault_GrSLPrecision,
- "Color",
- &stagedLocalVarName);
- fs->codeAppendf("%s = %s;", outputName, stagedLocalVarName);
- } else if (kAttribute_GrGPInput == inputType) {
- SkASSERT(colorAttr);
- pb->addPassThroughAttribute(colorAttr, outputName);
- } else if (kAllOnes_GrGPInput == inputType) {
- fs->codeAppendf("%s = vec4(1);", outputName);
- }
+ SkASSERT(colorUniform);
+ const char* stagedLocalVarName;
+ *colorUniform = pb->addUniform(GrGLProgramBuilder::kFragment_Visibility,
+ kVec4f_GrSLType,
+ kDefault_GrSLPrecision,
+ "Color",
+ &stagedLocalVarName);
+ fs->codeAppendf("%s = %s;", outputName, stagedLocalVarName);
}
void GrGLPrimitiveProcessor::addUniformViewMatrix(GrGLGPBuilder* pb) {
diff --git a/src/gpu/gl/GrGLPrimitiveProcessor.h b/src/gpu/gl/GrGLPrimitiveProcessor.h
index 30b1c17..90ee203 100644
--- a/src/gpu/gl/GrGLPrimitiveProcessor.h
+++ b/src/gpu/gl/GrGLPrimitiveProcessor.h
@@ -74,16 +74,7 @@
static SkMatrix GetTransformMatrix(const SkMatrix& localMatrix, const GrCoordTransform&);
protected:
- /** a helper which can setup vertex, constant, or uniform color depending on inputType.
- * This function will only do the minimum required to emit the correct shader code. If
- * inputType == attribute, then colorAttr must not be NULL. Likewise, if inputType == Uniform
- * then colorUniform must not be NULL.
- */
- void setupColorPassThrough(GrGLGPBuilder* pb,
- GrGPInput inputType,
- const char* inputName,
- const GrPrimitiveProcessor::Attribute* colorAttr,
- UniformHandle* colorUniform);
+ void setupUniformColor(GrGLGPBuilder* pb, const char* outputName, UniformHandle* colorUniform);
const char* uViewM() const { return fViewMatrixName; }