aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects
diff options
context:
space:
mode:
authorGravatar egdaniel <egdaniel@google.com>2015-11-19 07:23:45 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-11-19 07:23:45 -0800
commita2e3e0f7f8ceed2ab152428d7ee2812ad8c842c3 (patch)
tree7de5c916ac1dc4e50f9f679f530a9f7dcde1b1e3 /src/effects
parentc0604609cef6a14ca25e794b5db4500f96e2e3b4 (diff)
Move glsl onto EmitArgs struct for emitCode
Diffstat (limited to 'src/effects')
-rw-r--r--src/effects/SkBlurMaskFilter.cpp3
-rw-r--r--src/effects/SkDisplacementMapEffect.cpp6
-rw-r--r--src/effects/gradients/SkGradientShader.cpp6
-rw-r--r--src/effects/gradients/SkGradientShaderPriv.h1
-rw-r--r--src/effects/gradients/SkLinearGradient.cpp1
-rw-r--r--src/effects/gradients/SkRadialGradient.cpp1
-rw-r--r--src/effects/gradients/SkSweepGradient.cpp3
-rw-r--r--src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp5
8 files changed, 20 insertions, 6 deletions
diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp
index a44563ea08..0dedf0208c 100644
--- a/src/effects/SkBlurMaskFilter.cpp
+++ b/src/effects/SkBlurMaskFilter.cpp
@@ -724,8 +724,7 @@ void GrGLRectBlurEffect::emitCode(EmitArgs& args) {
const char *rectName;
const char *profileSizeName;
- const char* precisionString = GrGLSLShaderVar::PrecisionString(args.fBuilder->glslCaps(),
- fPrecision);
+ const char* precisionString = GrGLSLShaderVar::PrecisionString(args.fGLSLCaps, fPrecision);
fProxyRectUniform = args.fBuilder->addUniform(GrGLSLProgramBuilder::kFragment_Visibility,
kVec4f_GrSLType,
fPrecision,
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index cd8b741d3d..77d6cb84aa 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -608,7 +608,11 @@ void GrGLDisplacementMapEffect::emitCode(EmitArgs& args) {
}
fragBuilder->codeAppend("-vec2(0.5));\t\t");
- fGLDomain.sampleTexture(fragBuilder, domain, args.fOutputColor, SkString(cCoords),
+ fGLDomain.sampleTexture(fragBuilder,
+ args.fGLSLCaps,
+ domain,
+ args.fOutputColor,
+ SkString(cCoords),
args.fSamplers[1]);
fragBuilder->codeAppend(";\n");
}
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index 8c944bae55..e486e08a64 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -1028,6 +1028,7 @@ uint32_t GrGLGradientEffect::GenBaseGradientKey(const GrProcessor& processor) {
void GrGLGradientEffect::emitColor(GrGLSLFPBuilder* builder,
GrGLSLFragmentBuilder* fragBuilder,
+ const GrGLSLCaps* glslCaps,
const GrGradientEffect& ge,
const char* gradientTValue,
const char* outputColor,
@@ -1042,7 +1043,8 @@ void GrGLGradientEffect::emitColor(GrGLSLFPBuilder* builder,
// considerations:
// The gradient SkShader reporting opaque is more restrictive than necessary in the two pt
// case. Make sure the key reflects this optimization (and note that it can use the same
- // shader as thekBeforeIterp case). This same optimization applies to the 3 color case below.
+ // shader as thekBeforeIterp case). This same optimization applies to the 3 color case
+ // below.
if (GrGradientEffect::kAfterInterp_PremulType == ge.getPremulType()) {
fragBuilder->codeAppend("\tcolorTemp.rgb *= colorTemp.a;\n");
}
@@ -1054,7 +1056,7 @@ void GrGLGradientEffect::emitColor(GrGLSLFPBuilder* builder,
gradientTValue);
fragBuilder->codeAppendf("\tvec4 colorTemp = clamp(oneMinus2t, 0.0, 1.0) * %s;\n",
builder->getUniformVariable(fColorStartUni).c_str());
- if (!builder->glslCaps()->canUseMinAndAbsTogether()) {
+ if (!glslCaps->canUseMinAndAbsTogether()) {
// The Tegra3 compiler will sometimes never return if we have
// min(abs(oneMinus2t), 1.0), or do the abs first in a separate expression.
fragBuilder->codeAppend("\tfloat minAbs = abs(oneMinus2t);\n");
diff --git a/src/effects/gradients/SkGradientShaderPriv.h b/src/effects/gradients/SkGradientShaderPriv.h
index 8af65a47b7..3c19152d90 100644
--- a/src/effects/gradients/SkGradientShaderPriv.h
+++ b/src/effects/gradients/SkGradientShaderPriv.h
@@ -427,6 +427,7 @@ protected:
// native GLSL mix), and 4+ color gradients that use the traditional texture lookup.
void emitColor(GrGLSLFPBuilder* builder,
GrGLSLFragmentBuilder* fragBuilder,
+ const GrGLSLCaps* caps,
const GrGradientEffect&,
const char* gradientTValue,
const char* outputColor,
diff --git a/src/effects/gradients/SkLinearGradient.cpp b/src/effects/gradients/SkLinearGradient.cpp
index b60ee971f8..0bb896959e 100644
--- a/src/effects/gradients/SkLinearGradient.cpp
+++ b/src/effects/gradients/SkLinearGradient.cpp
@@ -608,6 +608,7 @@ void GrGLLinearGradient::emitCode(EmitArgs& args) {
t.append(".x");
this->emitColor(args.fBuilder,
args.fFragBuilder,
+ args.fGLSLCaps,
ge, t.c_str(),
args.fOutputColor,
args.fInputColor,
diff --git a/src/effects/gradients/SkRadialGradient.cpp b/src/effects/gradients/SkRadialGradient.cpp
index efd41c4a8a..7be8ed111b 100644
--- a/src/effects/gradients/SkRadialGradient.cpp
+++ b/src/effects/gradients/SkRadialGradient.cpp
@@ -505,6 +505,7 @@ void GrGLRadialGradient::emitCode(EmitArgs& args) {
t.append(")");
this->emitColor(args.fBuilder,
args.fFragBuilder,
+ args.fGLSLCaps,
ge, t.c_str(),
args.fOutputColor,
args.fInputColor,
diff --git a/src/effects/gradients/SkSweepGradient.cpp b/src/effects/gradients/SkSweepGradient.cpp
index f2f14c4b58..3df7144337 100644
--- a/src/effects/gradients/SkSweepGradient.cpp
+++ b/src/effects/gradients/SkSweepGradient.cpp
@@ -253,7 +253,7 @@ void GrGLSweepGradient::emitCode(EmitArgs& args) {
// 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
// thus must us -1.0 * %s.x to work correctly
- if (args.fBuilder->glslCaps()->mustForceNegatedAtanParamToFloat()){
+ if (args.fGLSLCaps->mustForceNegatedAtanParamToFloat()){
t.printf("atan(- %s.y, -1.0 * %s.x) * 0.1591549430918 + 0.5",
coords2D.c_str(), coords2D.c_str());
} else {
@@ -262,6 +262,7 @@ void GrGLSweepGradient::emitCode(EmitArgs& args) {
}
this->emitColor(args.fBuilder,
args.fFragBuilder,
+ args.fGLSLCaps,
ge, t.c_str(),
args.fOutputColor,
args.fInputColor,
diff --git a/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp b/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp
index 4633bc25e1..31ceda4f2a 100644
--- a/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp
+++ b/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp
@@ -272,6 +272,7 @@ void GLEdge2PtConicalEffect::emitCode(EmitArgs& args) {
fragBuilder->codeAppend("\t");
this->emitColor(args.fBuilder,
fragBuilder,
+ args.fGLSLCaps,
ge,
tName.c_str(),
args.fOutputColor,
@@ -544,6 +545,7 @@ void GLFocalOutside2PtConicalEffect::emitCode(EmitArgs& args) {
fragBuilder->codeAppend("\t\t");
this->emitColor(args.fBuilder,
fragBuilder,
+ args.fGLSLCaps,
ge,
tName.c_str(),
args.fOutputColor,
@@ -733,6 +735,7 @@ void GLFocalInside2PtConicalEffect::emitCode(EmitArgs& args) {
this->emitColor(args.fBuilder,
fragBuilder,
+ args.fGLSLCaps,
ge,
tName.c_str(),
args.fOutputColor,
@@ -998,6 +1001,7 @@ void GLCircleInside2PtConicalEffect::emitCode(EmitArgs& args) {
this->emitColor(args.fBuilder,
fragBuilder,
+ args.fGLSLCaps,
ge,
tName.c_str(),
args.fOutputColor,
@@ -1248,6 +1252,7 @@ void GLCircleOutside2PtConicalEffect::emitCode(EmitArgs& args) {
fragBuilder->codeAppend("\t\t");
this->emitColor(args.fBuilder,
fragBuilder,
+ args.fGLSLCaps,
ge,
tName.c_str(),
args.fOutputColor,