Remove color space xform support from SkSL

Bug: skia:
Change-Id: Ia50c1f750e4626211f012ae7543db126b10134c3
Reviewed-on: https://skia-review.googlesource.com/61906
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/src/effects/GrAlphaThresholdFragmentProcessor.cpp b/src/effects/GrAlphaThresholdFragmentProcessor.cpp
index 871d608..4a872e9 100644
--- a/src/effects/GrAlphaThresholdFragmentProcessor.cpp
+++ b/src/effects/GrAlphaThresholdFragmentProcessor.cpp
@@ -20,7 +20,6 @@
         return kCompatibleWithCoverageAsAlpha_OptimizationFlag;
     }
 }
-#include "glsl/GrGLSLColorSpaceXformHelper.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
 #include "glsl/GrGLSLFragmentShaderBuilder.h"
 #include "glsl/GrGLSLProgramBuilder.h"
diff --git a/src/effects/GrAlphaThresholdFragmentProcessor.h b/src/effects/GrAlphaThresholdFragmentProcessor.h
index c376bb1..5faf892 100644
--- a/src/effects/GrAlphaThresholdFragmentProcessor.h
+++ b/src/effects/GrAlphaThresholdFragmentProcessor.h
@@ -14,7 +14,6 @@
 #if SK_SUPPORT_GPU
 #include "GrFragmentProcessor.h"
 #include "GrCoordTransform.h"
-#include "GrColorSpaceXform.h"
 class GrAlphaThresholdFragmentProcessor : public GrFragmentProcessor {
 public:
     inline OptimizationFlags optFlags(float outerThreshold);
diff --git a/src/effects/GrCircleBlurFragmentProcessor.cpp b/src/effects/GrCircleBlurFragmentProcessor.cpp
index 647afb8..962bf05 100644
--- a/src/effects/GrCircleBlurFragmentProcessor.cpp
+++ b/src/effects/GrCircleBlurFragmentProcessor.cpp
@@ -249,7 +249,6 @@
     return std::unique_ptr<GrFragmentProcessor>(new GrCircleBlurFragmentProcessor(
             circle, textureRadius, solidRadius, std::move(profile), resourceProvider));
 }
-#include "glsl/GrGLSLColorSpaceXformHelper.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
 #include "glsl/GrGLSLFragmentShaderBuilder.h"
 #include "glsl/GrGLSLProgramBuilder.h"
diff --git a/src/effects/GrCircleBlurFragmentProcessor.h b/src/effects/GrCircleBlurFragmentProcessor.h
index 6f209c9..747c0ad 100644
--- a/src/effects/GrCircleBlurFragmentProcessor.h
+++ b/src/effects/GrCircleBlurFragmentProcessor.h
@@ -14,7 +14,6 @@
 #if SK_SUPPORT_GPU
 #include "GrFragmentProcessor.h"
 #include "GrCoordTransform.h"
-#include "GrColorSpaceXform.h"
 class GrCircleBlurFragmentProcessor : public GrFragmentProcessor {
 public:
     SkRect circleRect() const { return fCircleRect; }
diff --git a/src/effects/SkAlphaThresholdFilter.cpp b/src/effects/SkAlphaThresholdFilter.cpp
index f5e4a68..fa77c85 100644
--- a/src/effects/SkAlphaThresholdFilter.cpp
+++ b/src/effects/SkAlphaThresholdFilter.cpp
@@ -16,6 +16,7 @@
 
 #if SK_SUPPORT_GPU
 #include "GrAlphaThresholdFragmentProcessor.h"
+#include "GrColorSpaceXform.h"
 #include "GrContext.h"
 #include "GrFixedClip.h"
 #include "GrRenderTargetContext.h"
diff --git a/src/effects/SkArithmeticImageFilter.cpp b/src/effects/SkArithmeticImageFilter.cpp
index 08deab2..f81863b 100644
--- a/src/effects/SkArithmeticImageFilter.cpp
+++ b/src/effects/SkArithmeticImageFilter.cpp
@@ -16,6 +16,7 @@
 #include "SkXfermodeImageFilter.h"
 #if SK_SUPPORT_GPU
 #include "GrClip.h"
+#include "GrColorSpaceXform.h"
 #include "GrContext.h"
 #include "GrRenderTargetContext.h"
 #include "GrTextureProxy.h"
diff --git a/src/effects/SkXfermodeImageFilter.cpp b/src/effects/SkXfermodeImageFilter.cpp
index da13bea..5ac1ed7 100644
--- a/src/effects/SkXfermodeImageFilter.cpp
+++ b/src/effects/SkXfermodeImageFilter.cpp
@@ -16,6 +16,7 @@
 #include "SkWriteBuffer.h"
 #if SK_SUPPORT_GPU
 #include "GrClip.h"
+#include "GrColorSpaceXform.h"
 #include "GrContext.h"
 #include "GrRenderTargetContext.h"
 #include "GrTextureProxy.h"
diff --git a/src/gpu/GrTextureAdjuster.cpp b/src/gpu/GrTextureAdjuster.cpp
index 9971627..1a9b228 100644
--- a/src/gpu/GrTextureAdjuster.cpp
+++ b/src/gpu/GrTextureAdjuster.cpp
@@ -7,6 +7,7 @@
 
 #include "GrTextureAdjuster.h"
 
+#include "GrColorSpaceXform.h"
 #include "GrContext.h"
 #include "GrGpu.h"
 #include "GrResourceProvider.h"
diff --git a/src/gpu/GrTextureMaker.cpp b/src/gpu/GrTextureMaker.cpp
index cc3d490..822d214 100644
--- a/src/gpu/GrTextureMaker.cpp
+++ b/src/gpu/GrTextureMaker.cpp
@@ -7,6 +7,7 @@
 
 #include "GrTextureMaker.h"
 
+#include "GrColorSpaceXform.h"
 #include "GrContext.h"
 #include "GrGpu.h"
 #include "GrResourceProvider.h"
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index cf4c261..4a1ec82 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -8,6 +8,7 @@
 #include "SkGpuDevice.h"
 #include "GrBitmapTextureMaker.h"
 #include "GrBlurUtils.h"
+#include "GrColorSpaceXform.h"
 #include "GrContext.h"
 #include "GrGpu.h"
 #include "GrImageTextureMaker.h"
diff --git a/src/gpu/SkGpuDevice_drawTexture.cpp b/src/gpu/SkGpuDevice_drawTexture.cpp
index c7aeeb1..ad69413 100644
--- a/src/gpu/SkGpuDevice_drawTexture.cpp
+++ b/src/gpu/SkGpuDevice_drawTexture.cpp
@@ -8,6 +8,7 @@
 #include "SkGpuDevice.h"
 #include "GrBlurUtils.h"
 #include "GrCaps.h"
+#include "GrColorSpaceXform.h"
 #include "GrRenderTargetContext.h"
 #include "GrStyle.h"
 #include "GrTextureAdjuster.h"
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index 2d09f00..fe34aa1 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -9,6 +9,7 @@
 
 #include "GrBitmapTextureMaker.h"
 #include "GrCaps.h"
+#include "GrColorSpaceXform.h"
 #include "GrContext.h"
 #include "GrContextPriv.h"
 #include "GrGpuResourcePriv.h"
diff --git a/src/gpu/effects/GrArithmeticFP.cpp b/src/gpu/effects/GrArithmeticFP.cpp
index fec3fbf..1c47732 100644
--- a/src/gpu/effects/GrArithmeticFP.cpp
+++ b/src/gpu/effects/GrArithmeticFP.cpp
@@ -10,7 +10,6 @@
  */
 #include "GrArithmeticFP.h"
 #if SK_SUPPORT_GPU
-#include "glsl/GrGLSLColorSpaceXformHelper.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
 #include "glsl/GrGLSLFragmentShaderBuilder.h"
 #include "glsl/GrGLSLProgramBuilder.h"
diff --git a/src/gpu/effects/GrArithmeticFP.h b/src/gpu/effects/GrArithmeticFP.h
index ee151a1..6e6b6a5 100644
--- a/src/gpu/effects/GrArithmeticFP.h
+++ b/src/gpu/effects/GrArithmeticFP.h
@@ -14,7 +14,6 @@
 #if SK_SUPPORT_GPU
 #include "GrFragmentProcessor.h"
 #include "GrCoordTransform.h"
-#include "GrColorSpaceXform.h"
 class GrArithmeticFP : public GrFragmentProcessor {
 public:
     float k1() const { return fK1; }
diff --git a/src/gpu/effects/GrBlurredEdgeFragmentProcessor.cpp b/src/gpu/effects/GrBlurredEdgeFragmentProcessor.cpp
index 2e42b23..80e2d37 100644
--- a/src/gpu/effects/GrBlurredEdgeFragmentProcessor.cpp
+++ b/src/gpu/effects/GrBlurredEdgeFragmentProcessor.cpp
@@ -10,7 +10,6 @@
  */
 #include "GrBlurredEdgeFragmentProcessor.h"
 #if SK_SUPPORT_GPU
-#include "glsl/GrGLSLColorSpaceXformHelper.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
 #include "glsl/GrGLSLFragmentShaderBuilder.h"
 #include "glsl/GrGLSLProgramBuilder.h"
diff --git a/src/gpu/effects/GrBlurredEdgeFragmentProcessor.h b/src/gpu/effects/GrBlurredEdgeFragmentProcessor.h
index e27905c..0cd9a8e 100644
--- a/src/gpu/effects/GrBlurredEdgeFragmentProcessor.h
+++ b/src/gpu/effects/GrBlurredEdgeFragmentProcessor.h
@@ -14,7 +14,6 @@
 #if SK_SUPPORT_GPU
 #include "GrFragmentProcessor.h"
 #include "GrCoordTransform.h"
-#include "GrColorSpaceXform.h"
 class GrBlurredEdgeFragmentProcessor : public GrFragmentProcessor {
 public:
     enum Mode { kGaussian_Mode = 0, kSmoothStep_Mode = 1 };
diff --git a/src/gpu/effects/GrCircleEffect.cpp b/src/gpu/effects/GrCircleEffect.cpp
index b181669..4ca4210 100644
--- a/src/gpu/effects/GrCircleEffect.cpp
+++ b/src/gpu/effects/GrCircleEffect.cpp
@@ -10,7 +10,6 @@
  */
 #include "GrCircleEffect.h"
 #if SK_SUPPORT_GPU
-#include "glsl/GrGLSLColorSpaceXformHelper.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
 #include "glsl/GrGLSLFragmentShaderBuilder.h"
 #include "glsl/GrGLSLProgramBuilder.h"
diff --git a/src/gpu/effects/GrCircleEffect.h b/src/gpu/effects/GrCircleEffect.h
index 7f11505..c088fd5 100644
--- a/src/gpu/effects/GrCircleEffect.h
+++ b/src/gpu/effects/GrCircleEffect.h
@@ -14,7 +14,6 @@
 #if SK_SUPPORT_GPU
 #include "GrFragmentProcessor.h"
 #include "GrCoordTransform.h"
-#include "GrColorSpaceXform.h"
 class GrCircleEffect : public GrFragmentProcessor {
 public:
     int edgeType() const { return fEdgeType; }
diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp
index d8c9044..d32cb1d 100644
--- a/src/gpu/effects/GrConfigConversionEffect.cpp
+++ b/src/gpu/effects/GrConfigConversionEffect.cpp
@@ -10,7 +10,6 @@
  */
 #include "GrConfigConversionEffect.h"
 #if SK_SUPPORT_GPU
-#include "glsl/GrGLSLColorSpaceXformHelper.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
 #include "glsl/GrGLSLFragmentShaderBuilder.h"
 #include "glsl/GrGLSLProgramBuilder.h"
diff --git a/src/gpu/effects/GrConfigConversionEffect.h b/src/gpu/effects/GrConfigConversionEffect.h
index 803a4ff..cffd5a6 100644
--- a/src/gpu/effects/GrConfigConversionEffect.h
+++ b/src/gpu/effects/GrConfigConversionEffect.h
@@ -18,7 +18,6 @@
 #include "GrRenderTargetContext.h"
 #include "GrFragmentProcessor.h"
 #include "GrCoordTransform.h"
-#include "GrColorSpaceXform.h"
 class GrConfigConversionEffect : public GrFragmentProcessor {
 public:
     enum PMConversion {
diff --git a/src/gpu/effects/GrDitherEffect.cpp b/src/gpu/effects/GrDitherEffect.cpp
index 88b8bdb..78d5591 100644
--- a/src/gpu/effects/GrDitherEffect.cpp
+++ b/src/gpu/effects/GrDitherEffect.cpp
@@ -10,7 +10,6 @@
  */
 #include "GrDitherEffect.h"
 #if SK_SUPPORT_GPU
-#include "glsl/GrGLSLColorSpaceXformHelper.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
 #include "glsl/GrGLSLFragmentShaderBuilder.h"
 #include "glsl/GrGLSLProgramBuilder.h"
diff --git a/src/gpu/effects/GrDitherEffect.h b/src/gpu/effects/GrDitherEffect.h
index fb60b5a..deb2085 100644
--- a/src/gpu/effects/GrDitherEffect.h
+++ b/src/gpu/effects/GrDitherEffect.h
@@ -14,7 +14,6 @@
 #if SK_SUPPORT_GPU
 #include "GrFragmentProcessor.h"
 #include "GrCoordTransform.h"
-#include "GrColorSpaceXform.h"
 class GrDitherEffect : public GrFragmentProcessor {
 public:
     int rangeType() const { return fRangeType; }
diff --git a/src/gpu/effects/GrEllipseEffect.cpp b/src/gpu/effects/GrEllipseEffect.cpp
index 61b8f96..94470f0 100644
--- a/src/gpu/effects/GrEllipseEffect.cpp
+++ b/src/gpu/effects/GrEllipseEffect.cpp
@@ -10,7 +10,6 @@
  */
 #include "GrEllipseEffect.h"
 #if SK_SUPPORT_GPU
-#include "glsl/GrGLSLColorSpaceXformHelper.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
 #include "glsl/GrGLSLFragmentShaderBuilder.h"
 #include "glsl/GrGLSLProgramBuilder.h"
diff --git a/src/gpu/effects/GrEllipseEffect.h b/src/gpu/effects/GrEllipseEffect.h
index 98f44a9..97d7607 100644
--- a/src/gpu/effects/GrEllipseEffect.h
+++ b/src/gpu/effects/GrEllipseEffect.h
@@ -14,7 +14,6 @@
 #if SK_SUPPORT_GPU
 #include "GrFragmentProcessor.h"
 #include "GrCoordTransform.h"
-#include "GrColorSpaceXform.h"
 class GrEllipseEffect : public GrFragmentProcessor {
 public:
     int edgeType() const { return fEdgeType; }
diff --git a/src/gpu/effects/GrRectBlurEffect.cpp b/src/gpu/effects/GrRectBlurEffect.cpp
index 3b2d8a1..940674e 100644
--- a/src/gpu/effects/GrRectBlurEffect.cpp
+++ b/src/gpu/effects/GrRectBlurEffect.cpp
@@ -10,7 +10,6 @@
  */
 #include "GrRectBlurEffect.h"
 #if SK_SUPPORT_GPU
-#include "glsl/GrGLSLColorSpaceXformHelper.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
 #include "glsl/GrGLSLFragmentShaderBuilder.h"
 #include "glsl/GrGLSLProgramBuilder.h"
diff --git a/src/gpu/effects/GrRectBlurEffect.h b/src/gpu/effects/GrRectBlurEffect.h
index 688bb3d..8c43eaf 100644
--- a/src/gpu/effects/GrRectBlurEffect.h
+++ b/src/gpu/effects/GrRectBlurEffect.h
@@ -17,7 +17,6 @@
 #include "../effects/SkBlurMask.h"
 #include "GrFragmentProcessor.h"
 #include "GrCoordTransform.h"
-#include "GrColorSpaceXform.h"
 class GrRectBlurEffect : public GrFragmentProcessor {
 public:
     static sk_sp<GrTextureProxy> CreateBlurProfileTexture(GrResourceProvider* resourceProvider,
diff --git a/src/gpu/effects/GrSimpleTextureEffect.cpp b/src/gpu/effects/GrSimpleTextureEffect.cpp
index d1438df..387731e 100644
--- a/src/gpu/effects/GrSimpleTextureEffect.cpp
+++ b/src/gpu/effects/GrSimpleTextureEffect.cpp
@@ -10,7 +10,6 @@
  */
 #include "GrSimpleTextureEffect.h"
 #if SK_SUPPORT_GPU
-#include "glsl/GrGLSLColorSpaceXformHelper.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
 #include "glsl/GrGLSLFragmentShaderBuilder.h"
 #include "glsl/GrGLSLProgramBuilder.h"
diff --git a/src/gpu/effects/GrSimpleTextureEffect.h b/src/gpu/effects/GrSimpleTextureEffect.h
index b087497..ffa6da6 100644
--- a/src/gpu/effects/GrSimpleTextureEffect.h
+++ b/src/gpu/effects/GrSimpleTextureEffect.h
@@ -14,7 +14,6 @@
 #if SK_SUPPORT_GPU
 #include "GrFragmentProcessor.h"
 #include "GrCoordTransform.h"
-#include "GrColorSpaceXform.h"
 class GrSimpleTextureEffect : public GrFragmentProcessor {
 public:
     SkMatrix44 matrix() const { return fMatrix; }
diff --git a/src/shaders/SkImageShader.cpp b/src/shaders/SkImageShader.cpp
index 55a87fb..9e71027 100644
--- a/src/shaders/SkImageShader.cpp
+++ b/src/shaders/SkImageShader.cpp
@@ -166,6 +166,7 @@
 #if SK_SUPPORT_GPU
 
 #include "SkGr.h"
+#include "GrColorSpaceXform.h"
 #include "GrContext.h"
 #include "effects/GrSimpleTextureEffect.h"
 #include "effects/GrBicubicEffect.h"
diff --git a/src/sksl/README b/src/sksl/README
index d33217b..1fdf09f 100644
--- a/src/sksl/README
+++ b/src/sksl/README
@@ -110,10 +110,6 @@
   coordinates. sk_TransformedCoords2D[0] is equivalent to calling
   fragBuilder->ensureCoords2D(args.fTransformedCoords[0]) (and the result is
   cached, so you need not worry about using the value repeatedly).
-* 'colorSpaceXform' is a supported type. It is reflected within SkSL as a mat4,
-  and on the C++ side as sk_sp<GrColorSpaceXform>.
-* the texture() function can be passed a colorSpaceXform as an additional
-  parameter
 * Uniform variables support an additional 'when' layout key.
   'layout(when=foo) uniform int x;' means that this uniform will only be
   emitted when the 'foo' expression is true.
diff --git a/src/sksl/SkSLCPPCodeGenerator.cpp b/src/sksl/SkSLCPPCodeGenerator.cpp
index 0b2ef78..b5362bf 100644
--- a/src/sksl/SkSLCPPCodeGenerator.cpp
+++ b/src/sksl/SkSLCPPCodeGenerator.cpp
@@ -13,8 +13,7 @@
 namespace SkSL {
 
 static bool needs_uniform_var(const Variable& var) {
-    return (var.fModifiers.fFlags & Modifiers::kUniform_Flag) &&
-           var.fType.fName != "colorSpaceXform";
+    return (var.fModifiers.fFlags & Modifiers::kUniform_Flag);
 }
 
 CPPCodeGenerator::CPPCodeGenerator(const Context* context, const Program* program,
@@ -116,9 +115,6 @@
 }
 
 static String default_value(const Type& type) {
-    if (type.fName == "colorSpaceXform") {
-        return "float4x4(1.0)";
-    }
     switch (type.kind()) {
         case Type::kScalar_Kind: return "0";
         case Type::kVector_Kind: return type.name() + "(0)";
@@ -224,17 +220,8 @@
             if (ref.fVariable.fModifiers.fFlags & Modifiers::kUniform_Flag) {
                 this->write("%s");
                 String name = ref.fVariable.fName;
-                String var;
-                if (ref.fVariable.fType == *fContext.fColorSpaceXform_Type) {
-                    ASSERT(fNeedColorSpaceHelper);
-                    var = String::printf("fColorSpaceHelper.isValid() ? "
-                                         "args.fUniformHandler->getUniformCStr("
-                                                  "fColorSpaceHelper.gamutXformUniform()) : \"%s\"",
-                           default_value(ref.fVariable.fType).c_str());
-                } else {
-                    var = String::printf("args.fUniformHandler->getUniformCStr(%sVar)",
-                                         HCodeGenerator::FieldName(name.c_str()).c_str());
-                }
+                String var = String::printf("args.fUniformHandler->getUniformCStr(%sVar)",
+                                            HCodeGenerator::FieldName(name.c_str()).c_str());
                 String code;
                 if (ref.fVariable.fModifiers.fLayout.fWhen.size()) {
                     code = String::printf("%sVar.isValid() ? %s : \"%s\"",
@@ -300,21 +287,6 @@
         fFormatArgs.push_back(childName + ".c_str()");
         return;
     }
-    if (c.fFunction.fBuiltin && c.fFunction.fName == "COLORSPACE") {
-        String tmpVar = "_tmpVar" + to_string(++fVarCount);
-        fFunctionHeader += "half4 " + tmpVar + ";";
-        ASSERT(c.fArguments.size() == 2);
-        this->write("%s");
-        fFormatArgs.push_back("fColorSpaceHelper.isValid() ? \"(" + tmpVar + " = \" : \"\"");
-        this->writeExpression(*c.fArguments[0], kTopLevel_Precedence);
-        ASSERT(c.fArguments[1]->fKind == Expression::kVariableReference_Kind);
-        String xform("args.fUniformHandler->getUniformCStr(fColorSpaceHelper.gamutXformUniform())");
-        this->write("%s");
-        fFormatArgs.push_back("fColorSpaceHelper.isValid() ? SkStringPrintf(\", "
-                              "half4(clamp((%s * half4(" + tmpVar + ".rgb, 1.0)).rgb, 0.0, " +
-                              tmpVar + ".a), " + tmpVar + ".a))\", " + xform + ").c_str() : \"\"");
-        return;
-    }
     INHERITED::writeFunctionCall(c);
     if (c.fFunction.fBuiltin && c.fFunction.fName == "texture") {
         this->write(".%s");
@@ -409,8 +381,7 @@
         type = "kFloat4_GrSLType";
     } else if (var.fType == *fContext.fHalf4_Type) {
         type = "kHalf4_GrSLType";
-    } else if (var.fType == *fContext.fFloat4x4_Type ||
-               var.fType == *fContext.fColorSpaceXform_Type) {
+    } else if (var.fType == *fContext.fFloat4x4_Type) {
         type = "kFloat4x4_GrSLType";
     } else if (var.fType == *fContext.fHalf4x4_Type) {
         type = "kHalf4x4_GrSLType";
@@ -534,15 +505,6 @@
     this->writePrivateVarValues();
     for (const auto u : uniforms) {
         this->addUniform(*u);
-        if (u->fType == *fContext.fColorSpaceXform_Type) {
-            if (fNeedColorSpaceHelper) {
-                fErrors.error(u->fOffset, "only a single ColorSpaceXform is supported");
-            }
-            fNeedColorSpaceHelper = true;
-            this->writef("        fColorSpaceHelper.emitCode(args.fUniformHandler, "
-                                                            "_outer.%s().get());\n",
-                         String(u->fName).c_str());
-        }
     }
     this->writeSection(EMIT_CODE_SECTION);
     OutputStream* old = fOut;
@@ -584,12 +546,6 @@
                              "        %s.setMatrix4f(%sVar, %sValue);\n",
                              name, name, name, pdman, HCodeGenerator::FieldName(name).c_str(),
                              name);
-            } else if (u->fType == *fContext.fColorSpaceXform_Type) {
-                ASSERT(fNeedColorSpaceHelper);
-                this->writef("        if (fColorSpaceHelper.isValid()) {\n"
-                             "            fColorSpaceHelper.setData(%s, _outer.%s().get());\n"
-                             "        }\n",
-                             pdman, name);
             } else if (u->fType == *fContext.fFragmentProcessor_Type) {
                 // do nothing
             } else {
@@ -702,11 +658,6 @@
     for (const auto& param : fSectionAndParameterHelper.getParameters()) {
         String nameString(param->fName);
         const char* name = nameString.c_str();
-        if (param->fType == *fContext.fColorSpaceXform_Type) {
-            this->writef("    b->add32(GrColorSpaceXform::XformKey(%s.get()));\n",
-                         HCodeGenerator::FieldName(name).c_str());
-            continue;
-        }
         if (param->fModifiers.fLayout.fKey != Layout::kNo_Key &&
             (param->fModifiers.fFlags & Modifiers::kUniform_Flag)) {
             fErrors.error(param->fOffset,
@@ -770,8 +721,7 @@
     this->writef("#include \"%s.h\"\n"
                  "#if SK_SUPPORT_GPU\n", fullName);
     this->writeSection(CPP_SECTION);
-    this->writef("#include \"glsl/GrGLSLColorSpaceXformHelper.h\"\n"
-                 "#include \"glsl/GrGLSLFragmentProcessor.h\"\n"
+    this->writef("#include \"glsl/GrGLSLFragmentProcessor.h\"\n"
                  "#include \"glsl/GrGLSLFragmentShaderBuilder.h\"\n"
                  "#include \"glsl/GrGLSLProgramBuilder.h\"\n"
                  "#include \"SkSLCPP.h\"\n"
@@ -796,9 +746,6 @@
                          HCodeGenerator::FieldName(String(param->fName).c_str()).c_str());
         }
     }
-    if (fNeedColorSpaceHelper) {
-        this->write("    GrGLSLColorSpaceXformHelper fColorSpaceHelper;\n");
-    }
     this->writef("};\n"
                  "GrGLSLFragmentProcessor* %s::onCreateGLSLInstance() const {\n"
                  "    return new GrGLSL%s();\n"
diff --git a/src/sksl/SkSLCPPCodeGenerator.h b/src/sksl/SkSLCPPCodeGenerator.h
index a93b885..2766522 100644
--- a/src/sksl/SkSLCPPCodeGenerator.h
+++ b/src/sksl/SkSLCPPCodeGenerator.h
@@ -88,7 +88,6 @@
     String fExtraEmitCodeCode;
     std::vector<String> fFormatArgs;
     std::set<int> fWrittenTransformedCoords;
-    bool fNeedColorSpaceHelper = false;
     // if true, we are writing a C++ expression instead of a GLSL expression
     bool fCPPMode = false;
 
diff --git a/src/sksl/SkSLCompiler.cpp b/src/sksl/SkSLCompiler.cpp
index 23c09ac..06c4348 100644
--- a/src/sksl/SkSLCompiler.cpp
+++ b/src/sksl/SkSLCompiler.cpp
@@ -184,7 +184,6 @@
     ADD_TYPE(SamplerCubeArrayShadow);
     ADD_TYPE(GSampler2DArrayShadow);
     ADD_TYPE(GSamplerCubeArrayShadow);
-    ADD_TYPE(ColorSpaceXform);
     ADD_TYPE(FragmentProcessor);
 
     StringFragment skCapsName("sk_Caps");
diff --git a/src/sksl/SkSLContext.h b/src/sksl/SkSLContext.h
index a8158be..407dbf8 100644
--- a/src/sksl/SkSLContext.h
+++ b/src/sksl/SkSLContext.h
@@ -184,7 +184,6 @@
                                      fBool3_Type.get(), fBool4_Type.get() }))
     , fSkCaps_Type(new Type("$sk_Caps"))
     , fSkArgs_Type(new Type("$sk_Args"))
-    , fColorSpaceXform_Type(new Type("colorSpaceXform", *fFloat_Type, 4, 4))
     , fFragmentProcessor_Type(new Type("fragmentProcessor"))
     , fDefined_Expression(new Defined(*fInvalid_Type)) {}
 
@@ -333,7 +332,6 @@
 
     const std::unique_ptr<Type> fSkCaps_Type;
     const std::unique_ptr<Type> fSkArgs_Type;
-    const std::unique_ptr<Type> fColorSpaceXform_Type;
     const std::unique_ptr<Type> fFragmentProcessor_Type;
 
     // dummy expression used to mark that a variable has a value during dataflow analysis (when it
diff --git a/src/sksl/SkSLHCodeGenerator.cpp b/src/sksl/SkSLHCodeGenerator.cpp
index a4a5c9a..21f4f28 100644
--- a/src/sksl/SkSLHCodeGenerator.cpp
+++ b/src/sksl/SkSLHCodeGenerator.cpp
@@ -36,8 +36,6 @@
         return "SkMatrix44";
     } else if (type.kind() == Type::kSampler_Kind) {
         return "sk_sp<GrTextureProxy>";
-    } else if (type == *context.fColorSpaceXform_Type) {
-        return "sk_sp<GrColorSpaceXform>";
     } else if (type == *context.fFragmentProcessor_Type) {
         return "std::unique_ptr<GrFragmentProcessor>";
     }
@@ -256,8 +254,7 @@
                  "#if SK_SUPPORT_GPU\n");
     this->writeSection(HEADER_SECTION);
     this->writef("#include \"GrFragmentProcessor.h\"\n"
-                 "#include \"GrCoordTransform.h\"\n"
-                 "#include \"GrColorSpaceXform.h\"\n");
+                 "#include \"GrCoordTransform.h\"\n");
     this->writef("class %s : public GrFragmentProcessor {\n"
                  "public:\n",
                  fFullName.c_str());
diff --git a/src/sksl/SkSLIRGenerator.cpp b/src/sksl/SkSLIRGenerator.cpp
index 0c872e4..7608c42 100644
--- a/src/sksl/SkSLIRGenerator.cpp
+++ b/src/sksl/SkSLIRGenerator.cpp
@@ -922,9 +922,6 @@
         ASSERT(ctor);
         return this->call(-1, std::move(ctor), std::move(args));
     }
-    if (type == *fContext.fColorSpaceXform_Type && expr->fType == *fContext.fFloat4x4_Type) {
-        return expr;
-    }
     std::vector<std::unique_ptr<Expression>> args;
     args.push_back(std::move(expr));
     return std::unique_ptr<Expression>(new Constructor(-1, type, std::move(args)));
@@ -1435,20 +1432,6 @@
     return total;
 }
 
-std::unique_ptr<Expression> IRGenerator::applyColorSpace(std::unique_ptr<Expression> texture,
-                                                         std::unique_ptr<Expression> xform) {
-    // Before: texture(img, coords, xform);
-    // After: COLORSPACE(texture(img, coords), xform)
-    int offset = texture->fOffset;
-    std::vector<std::unique_ptr<Expression>> args;
-    args.push_back(std::move(texture));
-    args.push_back(std::move(xform));
-    const Symbol* colorspaceSymbol = (*fSymbolTable)["COLORSPACE"];
-    ASSERT(colorspaceSymbol->fKind == Symbol::kFunctionDeclaration_Kind);
-    const FunctionDeclaration& colorspaceFunction = (FunctionDeclaration&) *colorspaceSymbol;
-    return this->call(offset, colorspaceFunction, std::move(args));
-}
-
 std::unique_ptr<Expression> IRGenerator::call(int offset,
                                               std::unique_ptr<Expression> functionValue,
                                               std::vector<std::unique_ptr<Expression>> arguments) {
@@ -1462,16 +1445,6 @@
         return nullptr;
     }
     FunctionReference* ref = (FunctionReference*) functionValue.get();
-    if (ref->fFunctions[0]->fName == "texture" &&
-        arguments.back()->fType == *fContext.fColorSpaceXform_Type) {
-        std::unique_ptr<Expression> colorspace = std::move(arguments.back());
-        arguments.pop_back();
-        return this->applyColorSpace(this->call(offset,
-                                                std::move(functionValue),
-                                                std::move(arguments)),
-                                     std::move(colorspace));
-    }
-
     int bestCost = INT_MAX;
     const FunctionDeclaration* best = nullptr;
     if (ref->fFunctions.size() > 1) {
diff --git a/src/sksl/SkSLIRGenerator.h b/src/sksl/SkSLIRGenerator.h
index 0a2979d..a1d23ee 100644
--- a/src/sksl/SkSLIRGenerator.h
+++ b/src/sksl/SkSLIRGenerator.h
@@ -156,12 +156,6 @@
                                                  std::unique_ptr<Block> main,
                                                  std::vector<std::unique_ptr<ProgramElement>>* out);
 
-    /**
-     * Wraps an expression in code that applies a colorspace transformation to it. This is used
-     * to implement texture(sampler, coord, colorSpaceXForm).
-     */
-    std::unique_ptr<Expression> applyColorSpace(std::unique_ptr<Expression> texture,
-                                                std::unique_ptr<Expression> xform);
     void fixRectSampling(std::vector<std::unique_ptr<Expression>>& arguments);
     void checkValid(const Expression& expr);
     void markWrittenTo(const Expression& expr, bool readWrite);
diff --git a/src/sksl/sksl_fp.include b/src/sksl/sksl_fp.include
index eacc7e8..d407fd0 100644
--- a/src/sksl/sksl_fp.include
+++ b/src/sksl/sksl_fp.include
@@ -21,7 +21,5 @@
 layout(builtin=10005) float2[] sk_TransformedCoords2D;
 layout(builtin=10006) sampler2D[] sk_TextureSamplers;
 
-half4 COLORSPACE(half4 color, colorSpaceXform colorSpace);
-
 half4 process(fragmentProcessor fp);
 )