aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-10-19 12:54:52 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-10-23 15:27:12 +0000
commit1cb41717bc4a44272eab48bd47ca7579425dc22e (patch)
treeb8aa968f554069942403ceaa4d3e7ba9c3eb736e /src
parente25d119709899d3cb101a6de5fc901baf04d46db (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/effects/GrAlphaThresholdFragmentProcessor.cpp1
-rw-r--r--src/effects/GrAlphaThresholdFragmentProcessor.h1
-rw-r--r--src/effects/GrCircleBlurFragmentProcessor.cpp1
-rw-r--r--src/effects/GrCircleBlurFragmentProcessor.h1
-rw-r--r--src/effects/SkAlphaThresholdFilter.cpp1
-rw-r--r--src/effects/SkArithmeticImageFilter.cpp1
-rw-r--r--src/effects/SkXfermodeImageFilter.cpp1
-rw-r--r--src/gpu/GrTextureAdjuster.cpp1
-rw-r--r--src/gpu/GrTextureMaker.cpp1
-rw-r--r--src/gpu/SkGpuDevice.cpp1
-rw-r--r--src/gpu/SkGpuDevice_drawTexture.cpp1
-rw-r--r--src/gpu/SkGr.cpp1
-rw-r--r--src/gpu/effects/GrArithmeticFP.cpp1
-rw-r--r--src/gpu/effects/GrArithmeticFP.h1
-rw-r--r--src/gpu/effects/GrBlurredEdgeFragmentProcessor.cpp1
-rw-r--r--src/gpu/effects/GrBlurredEdgeFragmentProcessor.h1
-rw-r--r--src/gpu/effects/GrCircleEffect.cpp1
-rw-r--r--src/gpu/effects/GrCircleEffect.h1
-rw-r--r--src/gpu/effects/GrConfigConversionEffect.cpp1
-rw-r--r--src/gpu/effects/GrConfigConversionEffect.h1
-rw-r--r--src/gpu/effects/GrDitherEffect.cpp1
-rw-r--r--src/gpu/effects/GrDitherEffect.h1
-rw-r--r--src/gpu/effects/GrEllipseEffect.cpp1
-rw-r--r--src/gpu/effects/GrEllipseEffect.h1
-rw-r--r--src/gpu/effects/GrRectBlurEffect.cpp1
-rw-r--r--src/gpu/effects/GrRectBlurEffect.h1
-rw-r--r--src/gpu/effects/GrSimpleTextureEffect.cpp1
-rw-r--r--src/gpu/effects/GrSimpleTextureEffect.h1
-rw-r--r--src/shaders/SkImageShader.cpp1
-rw-r--r--src/sksl/README4
-rw-r--r--src/sksl/SkSLCPPCodeGenerator.cpp63
-rw-r--r--src/sksl/SkSLCPPCodeGenerator.h1
-rw-r--r--src/sksl/SkSLCompiler.cpp1
-rw-r--r--src/sksl/SkSLContext.h2
-rw-r--r--src/sksl/SkSLHCodeGenerator.cpp5
-rw-r--r--src/sksl/SkSLIRGenerator.cpp27
-rw-r--r--src/sksl/SkSLIRGenerator.h6
-rw-r--r--src/sksl/sksl_fp.include2
38 files changed, 15 insertions, 125 deletions
diff --git a/src/effects/GrAlphaThresholdFragmentProcessor.cpp b/src/effects/GrAlphaThresholdFragmentProcessor.cpp
index 871d6084d1..4a872e9c95 100644
--- a/src/effects/GrAlphaThresholdFragmentProcessor.cpp
+++ b/src/effects/GrAlphaThresholdFragmentProcessor.cpp
@@ -20,7 +20,6 @@ inline GrFragmentProcessor::OptimizationFlags GrAlphaThresholdFragmentProcessor:
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 c376bb1a80..5faf892ea4 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 647afb8076..962bf05f4d 100644
--- a/src/effects/GrCircleBlurFragmentProcessor.cpp
+++ b/src/effects/GrCircleBlurFragmentProcessor.cpp
@@ -249,7 +249,6 @@ std::unique_ptr<GrFragmentProcessor> GrCircleBlurFragmentProcessor::Make(
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 6f209c99cc..747c0adbf7 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 f5e4a689e0..fa77c85bf9 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 08deab20b0..f81863b7b8 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 da13beac61..5ac1ed733e 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 99716276ec..1a9b228390 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 cc3d490d3c..822d2141cb 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 cf4c261451..4a1ec824a6 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 c7aeeb1bd7..ad69413ae0 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 2d09f00719..fe34aa1fe3 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 fec3fbffad..1c47732e3e 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 ee151a1fa6..6e6b6a5cc2 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 2e42b238ab..80e2d37f62 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 e27905ca29..0cd9a8eb53 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 b181669d4d..4ca421004d 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 7f115050bf..c088fd5dba 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 d8c9044bbb..d32cb1d3f5 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 803a4ff5e6..cffd5a6194 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 88b8bdba9d..78d5591f4a 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 fb60b5aca2..deb20852ca 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 61b8f96c07..94470f013f 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 98f44a995a..97d7607b86 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 3b2d8a1927..940674e9bc 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 688bb3d545..8c43eaf9b0 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 d1438df4e9..387731e956 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 b0874977f2..ffa6da66a0 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 55a87fbe18..9e71027b1c 100644
--- a/src/shaders/SkImageShader.cpp
+++ b/src/shaders/SkImageShader.cpp
@@ -166,6 +166,7 @@ void SkImageShader::toString(SkString* str) const {
#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 d33217b7ee..1fdf09ffd3 100644
--- a/src/sksl/README
+++ b/src/sksl/README
@@ -110,10 +110,6 @@ Within an '.fp' fragment processor file:
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 0b2ef78016..b5362bf2b7 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 @@ void CPPCodeGenerator::writeIndexExpression(const IndexExpression& i) {
}
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 @@ void CPPCodeGenerator::writeVariableReference(const VariableReference& ref) {
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 @@ void CPPCodeGenerator::writeFunctionCall(const FunctionCall& c) {
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 @@ void CPPCodeGenerator::addUniform(const Variable& var) {
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 @@ bool CPPCodeGenerator::writeEmitCode(std::vector<const Variable*>& uniforms) {
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 @@ void CPPCodeGenerator::writeSetData(std::vector<const Variable*>& uniforms) {
" %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 @@ void CPPCodeGenerator::writeGetKey() {
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 @@ bool CPPCodeGenerator::generateCode() {
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 @@ bool CPPCodeGenerator::generateCode() {
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 a93b885a5c..2766522ef5 100644
--- a/src/sksl/SkSLCPPCodeGenerator.h
+++ b/src/sksl/SkSLCPPCodeGenerator.h
@@ -88,7 +88,6 @@ private:
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 23c09ac1c1..06c43485f4 100644
--- a/src/sksl/SkSLCompiler.cpp
+++ b/src/sksl/SkSLCompiler.cpp
@@ -184,7 +184,6 @@ Compiler::Compiler(Flags flags)
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 a8158be4a0..407dbf8e82 100644
--- a/src/sksl/SkSLContext.h
+++ b/src/sksl/SkSLContext.h
@@ -184,7 +184,6 @@ public:
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 @@ public:
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 a4a5c9a6ac..21f4f2842c 100644
--- a/src/sksl/SkSLHCodeGenerator.cpp
+++ b/src/sksl/SkSLHCodeGenerator.cpp
@@ -36,8 +36,6 @@ String HCodeGenerator::ParameterType(const Context& context, const Type& type) {
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 @@ bool HCodeGenerator::generateCode() {
"#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 0c872e4676..7608c420a2 100644
--- a/src/sksl/SkSLIRGenerator.cpp
+++ b/src/sksl/SkSLIRGenerator.cpp
@@ -922,9 +922,6 @@ std::unique_ptr<Expression> IRGenerator::coerce(std::unique_ptr<Expression> expr
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 @@ int IRGenerator::callCost(const FunctionDeclaration& function,
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 @@ std::unique_ptr<Expression> IRGenerator::call(int offset,
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 0a2979dd73..a1d23eec4c 100644
--- a/src/sksl/SkSLIRGenerator.h
+++ b/src/sksl/SkSLIRGenerator.h
@@ -156,12 +156,6 @@ private:
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 eacc7e802e..d407fd08f6 100644
--- a/src/sksl/sksl_fp.include
+++ b/src/sksl/sksl_fp.include
@@ -21,7 +21,5 @@ layout(builtin=10004) out half4 sk_OutColor;
layout(builtin=10005) float2[] sk_TransformedCoords2D;
layout(builtin=10006) sampler2D[] sk_TextureSamplers;
-half4 COLORSPACE(half4 color, colorSpaceXform colorSpace);
-
half4 process(fragmentProcessor fp);
)