Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(401)

Unified Diff: src/gpu/glsl/GrGLSLProgramBuilder.cpp

Issue 2114993002: GrFP can express distance vector field req., program builder declares variable for it (Closed) Base URL: https://skia.googlesource.com/skia@dvonbeck-bevel-api-change
Patch Set: rebase Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gpu/glsl/GrGLSLProgramBuilder.cpp
diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.cpp b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
index 31d1de29b3ba89da5a7b22a0fc2b716e9337b51a..2a828c4e2986bc76e52f69777f15e28bc0a9af73 100644
--- a/src/gpu/glsl/GrGLSLProgramBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
@@ -87,6 +87,14 @@ void GrGLSLProgramBuilder::emitAndInstallPrimProc(const GrPrimitiveProcessor& pr
this->nameExpression(outputColor, "outputColor");
this->nameExpression(outputCoverage, "outputCoverage");
+ if (this->fPipeline.usesDistanceVectorField()) {
+ SkString outputDistanceVectorStr;
+ this->nameVariable(&outputDistanceVectorStr, '\0', "outputDistanceVector");
egdaniel 2016/07/12 13:46:42 I think I would prefer hard coding the name we wan
dvonbeck 2016/07/13 15:17:13 The thing is, the Geometry Processors get their va
egdaniel 2016/07/13 15:47:02 I don't think there is any need for mangling the v
dvonbeck 2016/07/13 16:57:49 Done.
+ fFS.enableDistanceVector(outputDistanceVectorStr);
+
robertphillips 2016/07/11 17:55:40 Maybe emit a comment: // Un-normalized vector to
dvonbeck 2016/07/13 15:17:13 Done.
+ 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());

Powered by Google App Engine
This is Rietveld 408576698