aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2016-09-12 09:30:36 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-09-12 09:30:36 -0700
commit1a1aa9303484106a955e5549bf8ae24950f54e7a (patch)
tree512123db32ff1045b74f8ac2ef95d60bc4573a62 /src/effects
parenta316395e66095aa1bf495525e34c991688467a45 (diff)
Remove unneeded GrGLSLTransformedCoordsArray type
Rename GrGLSLFragmentBuilder::ensureFSCoords2D to ensureCoords2D and make it take an arbitrary GrShaderVar. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2324663004 Review-Url: https://codereview.chromium.org/2324663004
Diffstat (limited to 'src/effects')
-rw-r--r--src/effects/GrAlphaThresholdFragmentProcessor.cpp4
-rw-r--r--src/effects/SkDisplacementMapEffect.cpp6
-rw-r--r--src/effects/SkLightingImageFilter.cpp2
-rw-r--r--src/effects/SkMagnifierImageFilter.cpp2
-rw-r--r--src/effects/SkMorphologyImageFilter.cpp2
-rw-r--r--src/effects/SkPerlinNoiseShader.cpp2
-rw-r--r--src/effects/gradients/SkLinearGradient.cpp2
-rw-r--r--src/effects/gradients/SkRadialGradient.cpp2
-rw-r--r--src/effects/gradients/SkSweepGradient.cpp2
-rw-r--r--src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp22
10 files changed, 24 insertions, 22 deletions
diff --git a/src/effects/GrAlphaThresholdFragmentProcessor.cpp b/src/effects/GrAlphaThresholdFragmentProcessor.cpp
index 03a4515191..3559694f05 100644
--- a/src/effects/GrAlphaThresholdFragmentProcessor.cpp
+++ b/src/effects/GrAlphaThresholdFragmentProcessor.cpp
@@ -99,8 +99,8 @@ void GrGLAlphaThresholdFragmentProcessor::emitCode(EmitArgs& args) {
"outer_threshold");
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
- SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0);
- SkString maskCoords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 1);
+ SkString coords2D = fragBuilder->ensureCoords2D(args.fTransformedCoords[0]);
+ SkString maskCoords2D = fragBuilder->ensureCoords2D(args.fTransformedCoords[1]);
fragBuilder->codeAppendf("vec2 coord = %s;", coords2D.c_str());
fragBuilder->codeAppendf("vec2 mask_coord = %s;", maskCoords2D.c_str());
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index df4103cf06..e74ca4fe3f 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -544,15 +544,15 @@ void GrGLDisplacementMapEffect::emitCode(EmitArgs& args) {
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
fragBuilder->codeAppendf("\t\tvec4 %s = ", dColor);
- fragBuilder->appendTextureLookup(args.fTexSamplers[0], args.fCoords[0].c_str(),
- args.fCoords[0].getType());
+ fragBuilder->appendTextureLookup(args.fTexSamplers[0], args.fTransformedCoords[0].c_str(),
+ args.fTransformedCoords[0].getType());
fragBuilder->codeAppend(";\n");
// Unpremultiply the displacement
fragBuilder->codeAppendf(
"\t\t%s.rgb = (%s.a < %s) ? vec3(0.0) : clamp(%s.rgb / %s.a, 0.0, 1.0);",
dColor, dColor, nearZero, dColor, dColor);
- SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 1);
+ SkString coords2D = fragBuilder->ensureCoords2D(args.fTransformedCoords[1]);
fragBuilder->codeAppendf("\t\tvec2 %s = %s + %s*(%s.",
cCoords, coords2D.c_str(), scaleUni, dColor);
diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp
index 5e5aca96af..0c82b1655e 100644
--- a/src/effects/SkLightingImageFilter.cpp
+++ b/src/effects/SkLightingImageFilter.cpp
@@ -1803,7 +1803,7 @@ void GrGLLightingEffect::emitCode(EmitArgs& args) {
GrGLSLShaderVar("scale", kFloat_GrSLType),
};
SkString sobelFuncName;
- SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0);
+ SkString coords2D = fragBuilder->ensureCoords2D(args.fTransformedCoords[0]);
fragBuilder->emitFunction(kFloat_GrSLType,
"sobel",
diff --git a/src/effects/SkMagnifierImageFilter.cpp b/src/effects/SkMagnifierImageFilter.cpp
index 59be8fb86e..eee9ce2d0c 100644
--- a/src/effects/SkMagnifierImageFilter.cpp
+++ b/src/effects/SkMagnifierImageFilter.cpp
@@ -135,7 +135,7 @@ void GrGLMagnifierEffect::emitCode(EmitArgs& args) {
"Bounds");
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
- SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0);
+ SkString coords2D = fragBuilder->ensureCoords2D(args.fTransformedCoords[0]);
fragBuilder->codeAppendf("\t\tvec2 coord = %s;\n", coords2D.c_str());
fragBuilder->codeAppendf("\t\tvec2 zoom_coord = %s + %s * %s;\n",
uniformHandler->getUniformCStr(fOffsetVar),
diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp
index cdc236b63a..ebce1b3c5d 100644
--- a/src/effects/SkMorphologyImageFilter.cpp
+++ b/src/effects/SkMorphologyImageFilter.cpp
@@ -218,7 +218,7 @@ void GrGLMorphologyEffect::emitCode(EmitArgs& args) {
const char* range = uniformHandler->getUniformCStr(fRangeUni);
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
- SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0);
+ SkString coords2D = fragBuilder->ensureCoords2D(args.fTransformedCoords[0]);
const char* func;
switch (me.type()) {
case GrMorphologyEffect::kErode_MorphologyType:
diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp
index 7e4911730e..cacec1e2b4 100644
--- a/src/effects/SkPerlinNoiseShader.cpp
+++ b/src/effects/SkPerlinNoiseShader.cpp
@@ -603,7 +603,7 @@ void GrGLPerlinNoise::emitCode(EmitArgs& args) {
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
GrGLSLUniformHandler* uniformHandler = args.fUniformHandler;
- SkString vCoords = fragBuilder->ensureFSCoords2D(args.fCoords, 0);
+ SkString vCoords = fragBuilder->ensureCoords2D(args.fTransformedCoords[0]);
fBaseFrequencyUni = uniformHandler->addUniform(kFragment_GrShaderFlag,
kVec2f_GrSLType, kDefault_GrSLPrecision,
diff --git a/src/effects/gradients/SkLinearGradient.cpp b/src/effects/gradients/SkLinearGradient.cpp
index 872c6e81d1..98b621ec8e 100644
--- a/src/effects/gradients/SkLinearGradient.cpp
+++ b/src/effects/gradients/SkLinearGradient.cpp
@@ -437,7 +437,7 @@ sk_sp<GrFragmentProcessor> GrLinearGradient::TestCreate(GrProcessorTestData* d)
void GrLinearGradient::GLSLLinearProcessor::emitCode(EmitArgs& args) {
const GrLinearGradient& ge = args.fFp.cast<GrLinearGradient>();
this->emitUniforms(args.fUniformHandler, ge);
- SkString t = args.fFragBuilder->ensureFSCoords2D(args.fCoords, 0);
+ SkString t = args.fFragBuilder->ensureCoords2D(args.fTransformedCoords[0]);
t.append(".x");
this->emitColor(args.fFragBuilder,
args.fUniformHandler,
diff --git a/src/effects/gradients/SkRadialGradient.cpp b/src/effects/gradients/SkRadialGradient.cpp
index 78ecffae1a..1fbd1716ab 100644
--- a/src/effects/gradients/SkRadialGradient.cpp
+++ b/src/effects/gradients/SkRadialGradient.cpp
@@ -333,7 +333,7 @@ void GrRadialGradient::GLSLRadialProcessor::emitCode(EmitArgs& args) {
const GrRadialGradient& ge = args.fFp.cast<GrRadialGradient>();
this->emitUniforms(args.fUniformHandler, ge);
SkString t("length(");
- t.append(args.fFragBuilder->ensureFSCoords2D(args.fCoords, 0));
+ t.append(args.fFragBuilder->ensureCoords2D(args.fTransformedCoords[0]));
t.append(")");
this->emitColor(args.fFragBuilder,
args.fUniformHandler,
diff --git a/src/effects/gradients/SkSweepGradient.cpp b/src/effects/gradients/SkSweepGradient.cpp
index 505cfd2c95..bdb0e1ce25 100644
--- a/src/effects/gradients/SkSweepGradient.cpp
+++ b/src/effects/gradients/SkSweepGradient.cpp
@@ -212,7 +212,7 @@ sk_sp<GrFragmentProcessor> GrSweepGradient::TestCreate(GrProcessorTestData* d) {
void GrSweepGradient::GLSLSweepProcessor::emitCode(EmitArgs& args) {
const GrSweepGradient& ge = args.fFp.cast<GrSweepGradient>();
this->emitUniforms(args.fUniformHandler, ge);
- SkString coords2D = args.fFragBuilder->ensureFSCoords2D(args.fCoords, 0);
+ SkString coords2D = args.fFragBuilder->ensureCoords2D(args.fTransformedCoords[0]);
SkString t;
// 0.1591549430918 is 1/(2*pi), used since atan returns values [-pi, pi]
// On Intel GPU there is an issue where it reads the second arguement to atan "- %s.x" as an int
diff --git a/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp b/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp
index f11ca65d0c..e89193ff55 100644
--- a/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp
+++ b/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp
@@ -243,19 +243,21 @@ void Edge2PtConicalEffect::GLSLEdge2PtConicalProcessor::emitCode(EmitArgs& args)
p2.appendf("%s.z", uniformHandler->getUniformVariable(fParamUni).getName().c_str());
// We interpolate the linear component in coords[1].
- SkASSERT(args.fCoords[0].getType() == args.fCoords[1].getType());
+ SkASSERT(args.fTransformedCoords[0].getType() == args.fTransformedCoords[1].getType());
const char* coords2D;
SkString bVar;
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
- if (kVec3f_GrSLType == args.fCoords[0].getType()) {
+ if (kVec3f_GrSLType == args.fTransformedCoords[0].getType()) {
fragBuilder->codeAppendf("\tvec3 interpolants = vec3(%s.xy / %s.z, %s.x / %s.z);\n",
- args.fCoords[0].c_str(), args.fCoords[0].c_str(),
- args.fCoords[1].c_str(), args.fCoords[1].c_str());
+ args.fTransformedCoords[0].c_str(),
+ args.fTransformedCoords[0].c_str(),
+ args.fTransformedCoords[1].c_str(),
+ args.fTransformedCoords[1].c_str());
coords2D = "interpolants.xy";
bVar = "interpolants.z";
} else {
- coords2D = args.fCoords[0].c_str();
- bVar.printf("%s.x", args.fCoords[1].c_str());
+ coords2D = args.fTransformedCoords[0].c_str();
+ bVar.printf("%s.x", args.fTransformedCoords[1].c_str());
}
// output will default to transparent black (we simply won't write anything
@@ -523,7 +525,7 @@ void FocalOutside2PtConicalEffect::GLSLFocalOutside2PtConicalProcessor::emitCode
// if we have a vec3 from being in perspective, convert it to a vec2 first
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
- SkString coords2DString = fragBuilder->ensureFSCoords2D(args.fCoords, 0);
+ SkString coords2DString = fragBuilder->ensureCoords2D(args.fTransformedCoords[0]);
const char* coords2D = coords2DString.c_str();
// t = p.x * focal.x +/- sqrt(p.x^2 + (1 - focal.x^2) * p.y^2)
@@ -731,7 +733,7 @@ void FocalInside2PtConicalEffect::GLSLFocalInside2PtConicalProcessor::emitCode(E
// if we have a vec3 from being in perspective, convert it to a vec2 first
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
- SkString coords2DString = fragBuilder->ensureFSCoords2D(args.fCoords, 0);
+ SkString coords2DString = fragBuilder->ensureCoords2D(args.fTransformedCoords[0]);
const char* coords2D = coords2DString.c_str();
// t = p.x * focalX + length(p)
@@ -994,7 +996,7 @@ void CircleInside2PtConicalEffect::GLSLCircleInside2PtConicalProcessor::emitCode
// if we have a vec3 from being in perspective, convert it to a vec2 first
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
- SkString coords2DString = fragBuilder->ensureFSCoords2D(args.fCoords, 0);
+ SkString coords2DString = fragBuilder->ensureCoords2D(args.fTransformedCoords[0]);
const char* coords2D = coords2DString.c_str();
// p = coords2D
@@ -1237,7 +1239,7 @@ void CircleOutside2PtConicalEffect::GLSLCircleOutside2PtConicalProcessor::emitCo
// if we have a vec3 from being in perspective, convert it to a vec2 first
GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
- SkString coords2DString = fragBuilder->ensureFSCoords2D(args.fCoords, 0);
+ SkString coords2DString = fragBuilder->ensureCoords2D(args.fTransformedCoords[0]);
const char* coords2D = coords2DString.c_str();
// output will default to transparent black (we simply won't write anything