aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects
diff options
context:
space:
mode:
authorGravatar Ethan Nicholas <ethannicholas@google.com>2017-05-08 09:36:08 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-08 16:08:44 +0000
commit2983f4022d756def4f93579ee519cd31c8f24d61 (patch)
tree60b9bc416882a8b2b2d5826d5e6ad8c59e8c7901 /src/gpu/effects
parent0562eb9c6c98f07732ca96a1dd4e986f1ca089b8 (diff)
Re-land of "eliminated GrGLSLExpr".
This change is exactly the same as the last time it was landed; I believe the underlying optimizer bug that was causing this to cause problems has been fixed by a prior CL. Bug: skia: Change-Id: I5436422f094ea758caa3cd69e9338db31b1f93fa Reviewed-on: https://skia-review.googlesource.com/15768 Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src/gpu/effects')
-rw-r--r--src/gpu/effects/GrBicubicEffect.cpp5
-rw-r--r--src/gpu/effects/GrConvexPolyEffect.cpp6
-rw-r--r--src/gpu/effects/GrDitherEffect.cpp2
-rw-r--r--src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp5
-rw-r--r--src/gpu/effects/GrMatrixConvolutionEffect.cpp5
-rw-r--r--src/gpu/effects/GrOvalEffect.cpp6
-rw-r--r--src/gpu/effects/GrRRectEffect.cpp6
-rw-r--r--src/gpu/effects/GrXfermodeFragmentProcessor.cpp2
8 files changed, 12 insertions, 25 deletions
diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp
index c60400e383..70a00965af 100644
--- a/src/gpu/effects/GrBicubicEffect.cpp
+++ b/src/gpu/effects/GrBicubicEffect.cpp
@@ -112,9 +112,8 @@ void GrGLBicubicEffect::emitCode(EmitArgs& args) {
fragBuilder->appendColorGamutXform(&xformedColor, bicubicColor.c_str(), &fColorSpaceHelper);
bicubicColor.swap(xformedColor);
}
- fragBuilder->codeAppendf("%s = %s;",
- args.fOutputColor, (GrGLSLExpr4(bicubicColor.c_str()) *
- GrGLSLExpr4(args.fInputColor)).c_str());
+ fragBuilder->codeAppendf("%s = %s * %s;", args.fOutputColor, bicubicColor.c_str(),
+ args.fInputColor);
}
void GrGLBicubicEffect::onSetData(const GrGLSLProgramDataManager& pdman,
diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp
index 312c038201..4b9599ef32 100644
--- a/src/gpu/effects/GrConvexPolyEffect.cpp
+++ b/src/gpu/effects/GrConvexPolyEffect.cpp
@@ -132,8 +132,7 @@ void GLAARectEffect::emitCode(EmitArgs& args) {
if (GrProcessorEdgeTypeIsInverseFill(aare.getEdgeType())) {
fragBuilder->codeAppend("\t\talpha = 1.0 - alpha;\n");
}
- fragBuilder->codeAppendf("\t\t%s = %s;\n", args.fOutputColor,
- (GrGLSLExpr4(args.fInputColor) * GrGLSLExpr1("alpha")).c_str());
+ fragBuilder->codeAppendf("\t\t%s = %s * alpha;\n", args.fOutputColor, args.fInputColor);
}
void GLAARectEffect::onSetData(const GrGLSLProgramDataManager& pdman,
@@ -212,8 +211,7 @@ void GrGLConvexPolyEffect::emitCode(EmitArgs& args) {
if (GrProcessorEdgeTypeIsInverseFill(cpe.getEdgeType())) {
fragBuilder->codeAppend("\talpha = 1.0 - alpha;\n");
}
- fragBuilder->codeAppendf("\t%s = %s;\n", args.fOutputColor,
- (GrGLSLExpr4(args.fInputColor) * GrGLSLExpr1("alpha")).c_str());
+ fragBuilder->codeAppendf("\t%s = %s * alpha;\n", args.fOutputColor, args.fInputColor);
}
void GrGLConvexPolyEffect::onSetData(const GrGLSLProgramDataManager& pdman,
diff --git a/src/gpu/effects/GrDitherEffect.cpp b/src/gpu/effects/GrDitherEffect.cpp
index 864a5d2d81..0686750196 100644
--- a/src/gpu/effects/GrDitherEffect.cpp
+++ b/src/gpu/effects/GrDitherEffect.cpp
@@ -74,7 +74,7 @@ void GLDitherEffect::emitCode(EmitArgs& args) {
"fract(sin(dot(sk_FragCoord.xy, vec2(12.9898,78.233))) * "
"43758.5453);\n");
fragBuilder->codeAppendf("\t\t%s = clamp((1.0/255.0) * vec4(r, r, r, r) + %s, 0, 1);\n",
- args.fOutputColor, GrGLSLExpr4(args.fInputColor).c_str());
+ args.fOutputColor, args.fInputColor);
}
//////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
index b4f13143d8..324c61efeb 100644
--- a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
+++ b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
@@ -91,10 +91,7 @@ void GrGLConvolutionEffect::emitCode(EmitArgs& args) {
}
fragBuilder->codeAppendf("coord += %s;\n", imgInc);
}
-
- SkString modulate;
- GrGLSLMulVarBy4f(&modulate, args.fOutputColor, args.fInputColor);
- fragBuilder->codeAppend(modulate.c_str());
+ fragBuilder->codeAppendf("%s *= %s;\n", args.fOutputColor, args.fInputColor);
}
void GrGLConvolutionEffect::onSetData(const GrGLSLProgramDataManager& pdman,
diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.cpp b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
index 03d90ea675..b3ea81a643 100644
--- a/src/gpu/effects/GrMatrixConvolutionEffect.cpp
+++ b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
@@ -114,10 +114,7 @@ void GrGLMatrixConvolutionEffect::emitCode(EmitArgs& args) {
fragBuilder->codeAppendf("%s.rgb = clamp(sum.rgb * %s + %s, 0, 1);", args.fOutputColor, gain, bias);
fragBuilder->codeAppendf("%s.rgb *= %s.a;", args.fOutputColor, args.fOutputColor);
}
-
- SkString modulate;
- GrGLSLMulVarBy4f(&modulate, args.fOutputColor, args.fInputColor);
- fragBuilder->codeAppend(modulate.c_str());
+ fragBuilder->codeAppendf("%s *= %s;\n", args.fOutputColor, args.fInputColor);
}
void GrGLMatrixConvolutionEffect::GenKey(const GrProcessor& processor,
diff --git a/src/gpu/effects/GrOvalEffect.cpp b/src/gpu/effects/GrOvalEffect.cpp
index 672f5d873c..2eb1d85b1e 100644
--- a/src/gpu/effects/GrOvalEffect.cpp
+++ b/src/gpu/effects/GrOvalEffect.cpp
@@ -140,8 +140,7 @@ void GLCircleEffect::emitCode(EmitArgs& args) {
fragBuilder->codeAppend("d = d > 0.5 ? 1.0 : 0.0;");
}
- fragBuilder->codeAppendf("%s = %s;", args.fOutputColor,
- (GrGLSLExpr4(args.fInputColor) * GrGLSLExpr1("d")).c_str());
+ fragBuilder->codeAppendf("%s = %s * d;", args.fOutputColor, args.fInputColor);
}
void GLCircleEffect::GenKey(const GrProcessor& processor, const GrShaderCaps&,
@@ -333,8 +332,7 @@ void GLEllipseEffect::emitCode(EmitArgs& args) {
SkFAIL("Hairline not expected here.");
}
- fragBuilder->codeAppendf("%s = %s;", args.fOutputColor,
- (GrGLSLExpr4(args.fInputColor) * GrGLSLExpr1("alpha")).c_str());
+ fragBuilder->codeAppendf("%s = %s * alpha;", args.fOutputColor, args.fInputColor);
}
void GLEllipseEffect::GenKey(const GrProcessor& effect, const GrShaderCaps&,
diff --git a/src/gpu/effects/GrRRectEffect.cpp b/src/gpu/effects/GrRRectEffect.cpp
index 887bc00bda..8d18150a46 100644
--- a/src/gpu/effects/GrRRectEffect.cpp
+++ b/src/gpu/effects/GrRRectEffect.cpp
@@ -279,8 +279,7 @@ void GLCircularRRectEffect::emitCode(EmitArgs& args) {
fragBuilder->codeAppend("alpha = 1.0 - alpha;");
}
- fragBuilder->codeAppendf("%s = %s;", args.fOutputColor,
- (GrGLSLExpr4(args.fInputColor) * GrGLSLExpr1("alpha")).c_str());
+ fragBuilder->codeAppendf("%s = %s * alpha;", args.fOutputColor, args.fInputColor);
}
void GLCircularRRectEffect::GenKey(const GrProcessor& processor, const GrShaderCaps&,
@@ -590,8 +589,7 @@ void GLEllipticalRRectEffect::emitCode(EmitArgs& args) {
fragBuilder->codeAppend("float alpha = clamp(0.5 + approx_dist, 0.0, 1.0);");
}
- fragBuilder->codeAppendf("%s = %s;", args.fOutputColor,
- (GrGLSLExpr4(args.fInputColor) * GrGLSLExpr1("alpha")).c_str());
+ fragBuilder->codeAppendf("%s = %s * alpha;", args.fOutputColor, args.fInputColor);
}
void GLEllipticalRRectEffect::GenKey(const GrProcessor& effect, const GrShaderCaps&,
diff --git a/src/gpu/effects/GrXfermodeFragmentProcessor.cpp b/src/gpu/effects/GrXfermodeFragmentProcessor.cpp
index 30a9faaf08..aa799370a3 100644
--- a/src/gpu/effects/GrXfermodeFragmentProcessor.cpp
+++ b/src/gpu/effects/GrXfermodeFragmentProcessor.cpp
@@ -415,7 +415,7 @@ public:
ComposeOneFragmentProcessor::Child child =
args.fFp.cast<ComposeOneFragmentProcessor>().child();
SkString childColor("child");
- this->emitChild(0, nullptr, &childColor, args);
+ this->emitChild(0, &childColor, args);
const char* inputColor = args.fInputColor;
// We don't try to optimize for this case at all