ccpr: Don't use flat interpolation when it is slow

Bug: skia:
Change-Id: I1bc087187541183fdbaa5f2b93e8b8d287ac8ef8
Reviewed-on: https://skia-review.googlesource.com/102100
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/ops/GrTextureOp.cpp b/src/gpu/ops/GrTextureOp.cpp
index 46d2630..565a658 100644
--- a/src/gpu/ops/GrTextureOp.cpp
+++ b/src/gpu/ops/GrTextureOp.cpp
@@ -116,6 +116,7 @@
 
         private:
             void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override {
+                using Interpolation = GrGLSLVaryingHandler::Interpolation;
                 const auto& textureGP = args.fGP.cast<TextureGeometryProcessor>();
                 fColorSpaceXformHelper.emitCode(
                         args.fUniformHandler, textureGP.fColorSpaceXform.get());
@@ -127,26 +128,19 @@
                                      args.fUniformHandler,
                                      textureGP.fTextureCoords.asShaderVar(),
                                      args.fFPCoordTransformHandler);
-                if (args.fShaderCaps->preferFlatInterpolation()) {
-                    args.fVaryingHandler->addFlatPassThroughAttribute(&textureGP.fColors,
-                                                                      args.fOutputColor);
-                } else {
-                    args.fVaryingHandler->addPassThroughAttribute(&textureGP.fColors,
-                                                                  args.fOutputColor);
-                }
+                args.fVaryingHandler->addPassThroughAttribute(&textureGP.fColors,
+                                                              args.fOutputColor,
+                                                              Interpolation::kCanBeFlat);
                 args.fFragBuilder->codeAppend("float2 texCoord;");
                 args.fVaryingHandler->addPassThroughAttribute(&textureGP.fTextureCoords,
                                                               "texCoord");
                 if (textureGP.numTextureSamplers() > 1) {
+                    // If this changes to float, reconsider Interpolation::kMustBeFlat.
+                    SkASSERT(kInt_GrVertexAttribType == textureGP.fTextureIdx.fType);
                     SkASSERT(args.fShaderCaps->integerSupport());
                     args.fFragBuilder->codeAppend("int texIdx;");
-                    if (args.fShaderCaps->flatInterpolationSupport()) {
-                        args.fVaryingHandler->addFlatPassThroughAttribute(&textureGP.fTextureIdx,
-                                                                          "texIdx");
-                    } else {
-                        args.fVaryingHandler->addPassThroughAttribute(&textureGP.fTextureIdx,
-                                                                      "texIdx");
-                    }
+                    args.fVaryingHandler->addPassThroughAttribute(&textureGP.fTextureIdx, "texIdx",
+                                                                  Interpolation::kMustBeFlat);
                     args.fFragBuilder->codeAppend("switch (texIdx) {");
                     for (int i = 0; i < textureGP.numTextureSamplers(); ++i) {
                         args.fFragBuilder->codeAppendf("case %d: %s = ", i, args.fOutputColor);