Index: src/gpu/glsl/GrGLSLProgramBuilder.cpp |
diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.cpp b/src/gpu/glsl/GrGLSLProgramBuilder.cpp |
index 31d1de29b3ba89da5a7b22a0fc2b716e9337b51a..f606768fb6a10b516bea1d32354cf832f2163711 100644 |
--- a/src/gpu/glsl/GrGLSLProgramBuilder.cpp |
+++ b/src/gpu/glsl/GrGLSLProgramBuilder.cpp |
@@ -87,6 +87,11 @@ void GrGLSLProgramBuilder::emitAndInstallPrimProc(const GrPrimitiveProcessor& pr |
this->nameExpression(outputColor, "outputColor"); |
this->nameExpression(outputCoverage, "outputCoverage"); |
+ if (this->fPipeline.usesDistanceVectorField() && proc.implementsDistanceVector()) { |
+ fFS.codeAppend( "// Un-normalized vector to the closed geometric edge (in source space)\n"); |
+ fFS.codeAppendf("vec2 %s = vec2(0.0, 0.0);", fFS.distanceVectorName()); |
+ } |
+ |
// Enclose custom code in a block to avoid namespace conflicts |
SkString openBrace; |
openBrace.printf("{ // Stage %d, %s\n", fStageIndex, proc.name()); |
@@ -161,7 +166,9 @@ void GrGLSLProgramBuilder::emitAndInstallFragProc(const GrFragmentProcessor& fp, |
input.isOnes() ? nullptr : input.c_str(), |
fOutCoords[index], |
texSamplers.begin(), |
- bufferSamplers.begin()); |
+ bufferSamplers.begin(), |
+ this->primitiveProcessor().implementsDistanceVector()); |
+ |
fragProc->emitCode(args); |
// We have to check that effects and the code they emit are consistent, ie if an effect |