Index: src/gpu/gl/GrGLPrimitiveProcessor.cpp |
diff --git a/src/gpu/gl/GrGLPrimitiveProcessor.cpp b/src/gpu/gl/GrGLPrimitiveProcessor.cpp |
index d719774a6623a02145b637fd150b58e79e0f3f65..3213ffa8e27549fbf684e0653d2e4ed82690cb76 100644 |
--- a/src/gpu/gl/GrGLPrimitiveProcessor.cpp |
+++ b/src/gpu/gl/GrGLPrimitiveProcessor.cpp |
@@ -31,18 +31,28 @@ |
return combined; |
} |
-void GrGLPrimitiveProcessor::setupUniformColor(GrGLGPBuilder* pb, |
- const char* outputName, |
- UniformHandle* colorUniform) { |
+void |
+GrGLPrimitiveProcessor::setupColorPassThrough(GrGLGPBuilder* pb, |
+ GrGPInput inputType, |
+ const char* outputName, |
+ const GrGeometryProcessor::Attribute* colorAttr, |
+ UniformHandle* colorUniform) { |
GrGLFragmentBuilder* fs = pb->getFragmentShaderBuilder(); |
- SkASSERT(colorUniform); |
- const char* stagedLocalVarName; |
- *colorUniform = pb->addUniform(GrGLProgramBuilder::kFragment_Visibility, |
- kVec4f_GrSLType, |
- kDefault_GrSLPrecision, |
- "Color", |
- &stagedLocalVarName); |
- fs->codeAppendf("%s = %s;", outputName, stagedLocalVarName); |
+ 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); |
+ } |
} |
void GrGLPrimitiveProcessor::addUniformViewMatrix(GrGLGPBuilder* pb) { |