Index: src/gpu/GrGeometryProcessor.cpp |
diff --git a/src/gpu/GrGeometryProcessor.cpp b/src/gpu/GrGeometryProcessor.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..39e47e5f1cd882f857b09ab2bf853f2e685684b0 |
--- /dev/null |
+++ b/src/gpu/GrGeometryProcessor.cpp |
@@ -0,0 +1,70 @@ |
+/* |
+ * Copyright 2014 Google Inc. |
+ * |
+ * Use of this source code is governed by a BSD-style license that can be |
+ * found in the LICENSE file. |
+ */ |
+ |
+#include "GrGeometryProcessor.h" |
+ |
+#include "gl/GrGLGeometryProcessor.h" |
+#include "GrInvariantOutput.h" |
+ |
+/////////////////////////////////////////////////////////////////////////////////////////////////// |
+ |
+void GrGeometryProcessor::getInvariantOutputColor(GrInitInvariantOutput* out) const { |
+ if (fHasVertexColor) { |
+ if (fOpaqueVertexColors) { |
+ out->setUnknownOpaqueFourComponents(); |
+ } else { |
+ out->setUnknownFourComponents(); |
+ } |
+ } else { |
+ out->setKnownFourComponents(fColor); |
+ } |
+ this->onGetInvariantOutputColor(out); |
+} |
+ |
+void GrGeometryProcessor::getInvariantOutputCoverage(GrInitInvariantOutput* out) const { |
+ this->onGetInvariantOutputCoverage(out); |
+} |
+ |
+/////////////////////////////////////////////////////////////////////////////////////////////////// |
+ |
+void GrPathProcessor::getInvariantOutputColor(GrInitInvariantOutput* out) const { |
+ out->setKnownFourComponents(fColor); |
+} |
+ |
+void GrPathProcessor::getInvariantOutputCoverage(GrInitInvariantOutput* out) const { |
+ out->setKnownSingleComponent(0xff); |
+} |
+ |
+GrPathProcessor::GrPathProcessor(GrColor color) : fColor(color) { |
+ this->initClassID<GrPathProcessor>(); |
+} |
+ |
+/////////////////////////////////////////////////////////////////////////////////////////////////// |
+ |
+#include "gl/builders/GrGLProgramBuilder.h" |
+ |
+void GrGLGeometryProcessor::setupColor(GrGLGPBuilder* pb, |
bsalomon
2014/12/15 15:31:13
Maybe call it setupPassThroughColor? Not sure if i
|
+ GrGPInput inputType, |
+ const char* outputName, |
+ const GrGeometryProcessor::GrAttribute* colorAttr, |
+ UniformHandle* colorUniform) { |
+ GrGLGPFragmentBuilder* fs = pb->getFragmentShaderBuilder(); |
+ if (kUniform_GrGPInput == inputType) { |
+ 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); |
+ } |
+} |