Lines Matching full:builder
19 virtual void emitCode(GrGLFullShaderBuilder* builder,
44 void GrGLConicEffect::emitCode(GrGLFullShaderBuilder* builder,
53 builder->addVarying(kVec4f_GrSLType, "ConicCoeffs",
56 builder->getEffectAttributeName(drawEffect.getVertexAttribIndices()[0]);
57 builder->vsCodeAppendf("\t%s = %s;\n", vsName, attr0Name->c_str());
59 builder->fsCodeAppend("\t\tfloat edgeAlpha;\n");
63 SkAssertResult(builder->enableFeature(
65 builder->fsCodeAppendf("\t\tvec3 dklmdx = dFdx(%s.xyz);\n", fsName);
66 builder->fsCodeAppendf("\t\tvec3 dklmdy = dFdy(%s.xyz);\n", fsName);
67 builder->fsCodeAppendf("\t\tfloat dfdx =\n"
70 builder->fsCodeAppendf("\t\tfloat dfdy =\n"
73 builder->fsCodeAppend("\t\tvec2 gF = vec2(dfdx, dfdy);\n");
74 builder->fsCodeAppend("\t\tfloat gFM = sqrt(dot(gF, gF));\n");
75 builder->fsCodeAppendf("\t\tfloat func = %s.x*%s.x - %s.y*%s.z;\n", fsName, fsName,
77 builder->fsCodeAppend("\t\tfunc = abs(func);\n");
78 builder->fsCodeAppend("\t\tedgeAlpha = func / gFM;\n");
79 builder->fsCodeAppend("\t\tedgeAlpha = max(1.0 - edgeAlpha, 0.0);\n");
81 // builder->fsCodeAppend("\t\tedgeAlpha = edgeAlpha*edgeAlpha*(3.0-2.0*edgeAlpha);\n");
85 SkAssertResult(builder->enableFeature(
87 builder->fsCodeAppendf("\t\tvec3 dklmdx = dFdx(%s.xyz);\n", fsName);
88 builder->fsCodeAppendf("\t\tvec3 dklmdy = dFdy(%s.xyz);\n", fsName);
89 builder->fsCodeAppendf("\t\tfloat dfdx =\n"
92 builder->fsCodeAppendf("\t\tfloat dfdy =\n"
95 builder->fsCodeAppend("\t\tvec2 gF = vec2(dfdx, dfdy);\n");
96 builder->fsCodeAppend("\t\tfloat gFM = sqrt(dot(gF, gF));\n");
97 builder->fsCodeAppendf("\t\tfloat func = %s.x*%s.x - %s.y*%s.z;\n", fsName, fsName,
99 builder->fsCodeAppend("\t\tedgeAlpha = func / gFM;\n");
100 builder->fsCodeAppend("\t\tedgeAlpha = clamp(1.0 - edgeAlpha, 0.0, 1.0);\n");
102 // builder->fsCodeAppend("\t\tedgeAlpha = edgeAlpha*edgeAlpha*(3.0-2.0*edgeAlpha);\n");
106 builder->fsCodeAppendf("\t\tedgeAlpha = %s.x*%s.x - %s.y*%s.z;\n", fsName, fsName,
108 builder->fsCodeAppend("\t\tedgeAlpha = float(edgeAlpha < 0.0);\n");
113 builder->fsCodeAppendf("\t%s = %s;\n", outputColor,
160 virtual void emitCode(GrGLFullShaderBuilder* builder,
185 void GrGLQuadEffect::emitCode(GrGLFullShaderBuilder* builder,
195 builder->getEffectAttributeName(drawEffect.getVertexAttribIndices()[0]);
196 builder->fsCodeAppendf("\t\tfloat edgeAlpha;\n");
198 builder->addVarying(kVec4f_GrSLType, "HairQuadEdge", &vsName, &fsName);
202 SkAssertResult(builder->enableFeature(
204 builder->fsCodeAppendf("\t\tvec2 duvdx = dFdx(%s.xy);\n", fsName);
205 builder->fsCodeAppendf("\t\tvec2 duvdy = dFdy(%s.xy);\n", fsName);
206 builder->fsCodeAppendf("\t\tvec2 gF = vec2(2.0*%s.x*duvdx.x - duvdx.y,\n"
209 builder->fsCodeAppendf("\t\tedgeAlpha = (%s.x*%s.x - %s.y);\n", fsName, fsName,
211 builder->fsCodeAppend("\t\tedgeAlpha = sqrt(edgeAlpha*edgeAlpha / dot(gF, gF));\n");
212 builder->fsCodeAppend("\t\tedgeAlpha = max(1.0 - edgeAlpha, 0.0);\n");
214 // builder->fsCodeAppend("\t\tedgeAlpha = edgeAlpha*edgeAlpha*(3.0-2.0*edgeAlpha);\n");
218 SkAssertResult(builder->enableFeature(
220 builder->fsCodeAppendf("\t\tvec2 duvdx = dFdx(%s.xy);\n", fsName);
221 builder->fsCodeAppendf("\t\tvec2 duvdy = dFdy(%s.xy);\n", fsName);
222 builder->fsCodeAppendf("\t\tvec2 gF = vec2(2.0*%s.x*duvdx.x - duvdx.y,\n"
225 builder->fsCodeAppendf("\t\tedgeAlpha = (%s.x*%s.x - %s.y);\n", fsName, fsName,
227 builder->fsCodeAppend("\t\tedgeAlpha = edgeAlpha / sqrt(dot(gF, gF));\n");
228 builder->fsCodeAppend("\t\tedgeAlpha = clamp(1.0 - edgeAlpha, 0.0, 1.0);\n");
230 // builder->fsCodeAppend("\t\tedgeAlpha = edgeAlpha*edgeAlpha*(3.0-2.0*edgeAlpha);\n");
234 builder->fsCodeAppendf("\t\tedgeAlpha = (%s.x*%s.x - %s.y);\n", fsName, fsName,
236 builder->fsCodeAppend("\t\tedgeAlpha = float(edgeAlpha < 0.0);\n");
241 builder->fsCodeAppendf("\t%s = %s;\n", outputColor,
245 builder->vsCodeAppendf("\t%s = %s;\n", vsName, attrName->c_str());
291 virtual void emitCode(GrGLFullShaderBuilder* builder,
316 void GrGLCubicEffect::emitCode(GrGLFullShaderBuilder* builder,
325 builder->addVarying(kVec4f_GrSLType, "CubicCoeffs",
328 builder->getEffectAttributeName(drawEffect.getVertexAttribIndices()[0]);
329 builder->vsCodeAppendf("\t%s = %s;\n", vsName, attr0Name->c_str());
331 builder->fsCodeAppend("\t\tfloat edgeAlpha;\n");
335 SkAssertResult(builder->enableFeature(
337 builder->fsCodeAppendf("\t\tvec3 dklmdx = dFdx(%s.xyz);\n", fsName);
338 builder->fsCodeAppendf("\t\tvec3 dklmdy = dFdy(%s.xyz);\n", fsName);
339 builder->fsCodeAppendf("\t\tfloat dfdx =\n"
342 builder->fsCodeAppendf("\t\tfloat dfdy =\n"
345 builder->fsCodeAppend("\t\tvec2 gF = vec2(dfdx, dfdy);\n");
346 builder->fsCodeAppend("\t\tfloat gFM = sqrt(dot(gF, gF));\n");
347 builder->fsCodeAppendf("\t\tfloat func = %s.x*%s.x*%s.x - %s.y*%s.z;\n",
349 builder->fsCodeAppend("\t\tfunc = abs(func);\n");
350 builder->fsCodeAppend("\t\tedgeAlpha = func / gFM;\n");
351 builder->fsCodeAppend("\t\tedgeAlpha = max(1.0 - edgeAlpha, 0.0);\n");
353 // builder->fsCodeAppend("\t\tedgeAlpha = edgeAlpha*edgeAlpha*(3.0-2.0*edgeAlpha);\n");
357 SkAssertResult(builder->enableFeature(
359 builder->fsCodeAppendf("\t\tvec3 dklmdx = dFdx(%s.xyz);\n", fsName);
360 builder
361 builder->fsCodeAppendf("\t\tfloat dfdx =\n"
364 builder->fsCodeAppendf("\t\tfloat dfdy =\n"
367 builder->fsCodeAppend("\t\tvec2 gF = vec2(dfdx, dfdy);\n");
368 builder->fsCodeAppend("\t\tfloat gFM = sqrt(dot(gF, gF));\n");
369 builder->fsCodeAppendf("\t\tfloat func = %s.x*%s.x*%s.x - %s.y*%s.z;\n",
371 builder->fsCodeAppend("\t\tedgeAlpha = func / gFM;\n");
372 builder->fsCodeAppend("\t\tedgeAlpha = clamp(1.0 - edgeAlpha, 0.0, 1.0);\n");
374 // builder->fsCodeAppend("\t\tedgeAlpha = edgeAlpha*edgeAlpha*(3.0-2.0*edgeAlpha);\n");
378 builder->fsCodeAppendf("\t\tedgeAlpha = %s.x*%s.x*%s.x - %s.y*%s.z;\n",
380 builder->fsCodeAppend("\t\tedgeAlpha = float(edgeAlpha < 0.0);\n");
385 builder->fsCodeAppendf("\t%s = %s;\n", outputColor,