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

Unified Diff: src/gpu/GrAAConvexPathRenderer.cpp

Issue 675193002: Revert of Added varying struct (Closed) Base URL: https://skia.googlesource.com/skia.git@gp_emit_struct
Patch Set: Created 6 years, 2 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
« no previous file with comments | « include/gpu/GrGeometryProcessor.h ('k') | src/gpu/GrAARectRenderer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrAAConvexPathRenderer.cpp
diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp
index eecc72270c6c278699abdafbd2ce9f5c0aa442d1..ef4a17107e76004a4e69c4e5e38bb0f495791e38 100644
--- a/src/gpu/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/GrAAConvexPathRenderer.cpp
@@ -529,38 +529,38 @@
: INHERITED (factory) {}
virtual void emitCode(const EmitArgs& args) SK_OVERRIDE {
- GrGLVertToFrag v(kVec4f_GrSLType);
- args.fPB->addVarying("QuadEdge", &v);
+ const char *vsName, *fsName;
+ args.fPB->addVarying(kVec4f_GrSLType, "QuadEdge", &vsName, &fsName);
GrGLGPFragmentBuilder* fsBuilder = args.fPB->getFragmentShaderBuilder();
SkAssertResult(fsBuilder->enableFeature(
GrGLFragmentShaderBuilder::kStandardDerivatives_GLSLFeature));
- fsBuilder->codeAppendf("float edgeAlpha;");
+ fsBuilder->codeAppendf("\t\tfloat edgeAlpha;\n");
// keep the derivative instructions outside the conditional
- fsBuilder->codeAppendf("vec2 duvdx = dFdx(%s.xy);", v.fsIn());
- fsBuilder->codeAppendf("vec2 duvdy = dFdy(%s.xy);", v.fsIn());
- fsBuilder->codeAppendf("if (%s.z > 0.0 && %s.w > 0.0) {", v.fsIn(), v.fsIn());
+ fsBuilder->codeAppendf("\t\tvec2 duvdx = dFdx(%s.xy);\n", fsName);
+ fsBuilder->codeAppendf("\t\tvec2 duvdy = dFdy(%s.xy);\n", fsName);
+ fsBuilder->codeAppendf("\t\tif (%s.z > 0.0 && %s.w > 0.0) {\n", fsName, fsName);
// today we know z and w are in device space. We could use derivatives
- fsBuilder->codeAppendf("edgeAlpha = min(min(%s.z, %s.w) + 0.5, 1.0);", v.fsIn(),
- v.fsIn());
- fsBuilder->codeAppendf ("} else {");
- fsBuilder->codeAppendf("vec2 gF = vec2(2.0*%s.x*duvdx.x - duvdx.y,"
- " 2.0*%s.x*duvdy.x - duvdy.y);",
- v.fsIn(), v.fsIn());
- fsBuilder->codeAppendf("edgeAlpha = (%s.x*%s.x - %s.y);", v.fsIn(), v.fsIn(),
- v.fsIn());
- fsBuilder->codeAppendf("edgeAlpha = "
- "clamp(0.5 - edgeAlpha / length(gF), 0.0, 1.0);}");
-
-
- fsBuilder->codeAppendf("%s = %s;", args.fOutput,
+ fsBuilder->codeAppendf("\t\t\tedgeAlpha = min(min(%s.z, %s.w) + 0.5, 1.0);\n", fsName,
+ fsName);
+ fsBuilder->codeAppendf ("\t\t} else {\n");
+ fsBuilder->codeAppendf("\t\t\tvec2 gF = vec2(2.0*%s.x*duvdx.x - duvdx.y,\n"
+ "\t\t\t 2.0*%s.x*duvdy.x - duvdy.y);\n",
+ fsName, fsName);
+ fsBuilder->codeAppendf("\t\t\tedgeAlpha = (%s.x*%s.x - %s.y);\n", fsName, fsName,
+ fsName);
+ fsBuilder->codeAppendf("\t\t\tedgeAlpha = "
+ "clamp(0.5 - edgeAlpha / length(gF), 0.0, 1.0);\n\t\t}\n");
+
+
+ fsBuilder->codeAppendf("\t%s = %s;\n", args.fOutput,
(GrGLSLExpr4(args.fInput) * GrGLSLExpr1("edgeAlpha")).c_str());
const GrShaderVar& inQuadEdge = args.fGP.cast<QuadEdgeEffect>().inQuadEdge();
GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
- vsBuilder->codeAppendf("\t%s = %s;\n", v.vsOut(), inQuadEdge.c_str());
+ vsBuilder->codeAppendf("\t%s = %s;\n", vsName, inQuadEdge.c_str());
}
static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilder*) {}
« no previous file with comments | « include/gpu/GrGeometryProcessor.h ('k') | src/gpu/GrAARectRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698