aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-04-29 17:36:14 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-04-29 17:36:14 +0000
commitc718b35bce895aa945fc479451156985206fdae1 (patch)
treec0765ea774309721e12984d45be3c0a54c406e81 /src
parent49c55e9462a16506f36afd6f95e4b20275a88692 (diff)
Remove inout params from saturation helper func in XferEffect.
R=robertphillips@google.com, jvanverth@google.com Author: bsalomon@google.com Review URL: https://chromiumcodereview.appspot.com/14535004 git-svn-id: http://skia.googlecode.com/svn/trunk@8909 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r--src/core/SkXfermode.cpp43
1 files changed, 22 insertions, 21 deletions
diff --git a/src/core/SkXfermode.cpp b/src/core/SkXfermode.cpp
index 082f4071bd..916e1b83a5 100644
--- a/src/core/SkXfermode.cpp
+++ b/src/core/SkXfermode.cpp
@@ -1287,7 +1287,10 @@ public:
getSatBody.c_str(),
&getFunction);
- // Emit a helper that sets the saturation given sorted input channels
+ // Emit a helper that sets the saturation given sorted input channels. This used
+ // to use inout params for min, mid, and max components but that seems to cause
+ // problems on PowerVR drivers. So instead it returns a vec3 where r, g ,b are the
+ // adjusted min, mid, and max inputs, respectively.
SkString helperFunction;
GrGLShaderVar helperArgs[] = {
GrGLShaderVar("minComp", kFloat_GrSLType),
@@ -1295,22 +1298,20 @@ public:
GrGLShaderVar("maxComp", kFloat_GrSLType),
GrGLShaderVar("sat", kFloat_GrSLType),
};
- helperArgs[0].setTypeModifier(GrGLShaderVar::kInOut_TypeModifier);
- helperArgs[1].setTypeModifier(GrGLShaderVar::kInOut_TypeModifier);
- helperArgs[2].setTypeModifier(GrGLShaderVar::kInOut_TypeModifier);
- SkString helperBody;
- helperBody.append("\tif (minComp < maxComp) {\n"
- "\t\tmidComp = sat * (midComp - minComp) / (maxComp - minComp);\n"
- "\t\tmaxComp = sat;\n"
- "\t} else {\n"
- "\t\tmidComp = maxComp = 0.0;\n"
- "\t}\n"
- "\tminComp = 0.0;\n");
+ static const char kHelperBody[] = "\tif (minComp < maxComp) {\n"
+ "\t\tvec3 result;\n"
+ "\t\tresult.r = 0.0;\n"
+ "\t\tresult.g = sat * (midComp - minComp) / (maxComp - minComp);\n"
+ "\t\tresult.b = sat;\n"
+ "\t\treturn result;\n"
+ "\t} else {\n"
+ "\t\treturn vec3(0, 0, 0);\n"
+ "\t}\n";
builder->emitFunction(GrGLShaderBuilder::kFragment_ShaderType,
- kVoid_GrSLType,
+ kVec3f_GrSLType,
"set_saturation_helper",
SK_ARRAY_COUNT(helperArgs), helperArgs,
- helperBody.c_str(),
+ kHelperBody,
&helperFunction);
GrGLShaderVar setSatArgs[] = {
@@ -1322,20 +1323,20 @@ public:
setSatBody.appendf("\tfloat sat = %s(satColor);\n"
"\tif (hueLumColor.r <= hueLumColor.g) {\n"
"\t\tif (hueLumColor.g <= hueLumColor.b) {\n"
- "\t\t\t%s(hueLumColor.r, hueLumColor.g, hueLumColor.b, sat);\n"
+ "\t\t\thueLumColor.rgb = %s(hueLumColor.r, hueLumColor.g, hueLumColor.b, sat);\n"
"\t\t} else if (hueLumColor.r <= hueLumColor.b) {\n"
- "\t\t\t%s(hueLumColor.r, hueLumColor.b, hueLumColor.g, sat);\n"
+ "\t\t\thueLumColor.rbg = %s(hueLumColor.r, hueLumColor.b, hueLumColor.g, sat);\n"
"\t\t} else {\n"
- "\t\t\t%s(hueLumColor.b, hueLumColor.r, hueLumColor.g, sat);\n"
+ "\t\t\thueLumColor.brg = %s(hueLumColor.b, hueLumColor.r, hueLumColor.g, sat);\n"
"\t\t}\n"
"\t} else if (hueLumColor.r <= hueLumColor.b) {\n"
- "\t\t%s(hueLumColor.g, hueLumColor.r, hueLumColor.b, sat);\n"
+ "\t\thueLumColor.grb = %s(hueLumColor.g, hueLumColor.r, hueLumColor.b, sat);\n"
"\t} else if (hueLumColor.g <= hueLumColor.b) {\n"
- "\t\t%s(hueLumColor.g, hueLumColor.b, hueLumColor.r, sat);\n"
+ "\t\thueLumColor.gbr = %s(hueLumColor.g, hueLumColor.b, hueLumColor.r, sat);\n"
"\t} else {\n"
- "\t\t%s(hueLumColor.b, hueLumColor.g, hueLumColor.r, sat);\n"
+ "\t\thueLumColor.bgr = %s(hueLumColor.b, hueLumColor.g, hueLumColor.r, sat);\n"
"\t}\n"
- "\treturn hueLumColor;",
+ "\treturn hueLumColor;\n",
getFunction.c_str(), helpFunc, helpFunc, helpFunc, helpFunc,
helpFunc, helpFunc);
builder->emitFunction(GrGLShaderBuilder::kFragment_ShaderType,