Declare outputColor and outputCoverage inside emitCode.

This is useful because it allows the variables to be declared as `const`
when they are trivial values like `half4(1)`. This enables the constant
folder to simplify or eliminate them. In most cases, this is only a
small benefit, as you'd expect a competent GPU driver to do the same.
However, Mali-400 can benefit significantly from optimizing away the
multiplication against a constant half4(1) coverage in Porter-Duff.

Mali-400 performance is back to normal: http://screen/3cDxdaGkYE8oBcS

Change-Id: I21fd23f91f747079cd05b082f7b3444aeabafb93
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/382476
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/gpu/ops/GrLatticeOp.cpp b/src/gpu/ops/GrLatticeOp.cpp
index f3e090b..60f58a7 100644
--- a/src/gpu/ops/GrLatticeOp.cpp
+++ b/src/gpu/ops/GrLatticeOp.cpp
@@ -71,6 +71,7 @@
                 args.fFragBuilder->codeAppend("float4 textureDomain;");
                 args.fVaryingHandler->addPassThroughAttribute(
                         latticeGP.fInTextureDomain, "textureDomain", Interpolation::kCanBeFlat);
+                args.fFragBuilder->codeAppendf("half4 %s;", args.fOutputColor);
                 args.fVaryingHandler->addPassThroughAttribute(latticeGP.fInColor,
                                                               args.fOutputColor,
                                                               Interpolation::kCanBeFlat);
@@ -82,7 +83,7 @@
                         "clamp(textureCoords, textureDomain.xy, textureDomain.zw)",
                         &fColorSpaceXformHelper);
                 args.fFragBuilder->codeAppend(";");
-                args.fFragBuilder->codeAppendf("%s = half4(1);", args.fOutputCoverage);
+                args.fFragBuilder->codeAppendf("const half4 %s = half4(1);", args.fOutputCoverage);
             }
             GrGLSLColorSpaceXformHelper fColorSpaceXformHelper;
         };