Lines Matching refs:fragBuilder
37 GrGLSLPPFragmentBuilder* fragBuilder = args.fFragBuilder; in onEmitCode() local
38 SkAssertResult(fragBuilder->enableFeature( in onEmitCode()
98 fragBuilder->codeAppend(GrGLSLShaderVar::PrecisionString(args.fGLSLCaps, in onEmitCode()
100 fragBuilder->codeAppendf("vec2 uv = %s;\n", uv.fsIn()); in onEmitCode()
102 fragBuilder->codeAppend("\tfloat texColor = "); in onEmitCode()
103 fragBuilder->appendTextureLookup(args.fSamplers[0], in onEmitCode()
106 fragBuilder->codeAppend(".r;\n"); in onEmitCode()
107 fragBuilder->codeAppend("\tfloat distance = " in onEmitCode()
111 fragBuilder->codeAppendf("distance -= %s;", distanceAdjustUniName); in onEmitCode()
114 fragBuilder->codeAppend("float afwidth;"); in onEmitCode()
122 fragBuilder->codeAppendf("afwidth = abs(" SK_DistanceFieldAAFactor "*dFdy(%s.y));", in onEmitCode()
128 fragBuilder->codeAppend("vec2 dist_grad = vec2(dFdx(distance), dFdy(distance));"); in onEmitCode()
131 fragBuilder->codeAppend("float dg_len2 = dot(dist_grad, dist_grad);"); in onEmitCode()
132 fragBuilder->codeAppend("if (dg_len2 < 0.0001) {"); in onEmitCode()
133 fragBuilder->codeAppend("dist_grad = vec2(0.7071, 0.7071);"); in onEmitCode()
134 fragBuilder->codeAppend("} else {"); in onEmitCode()
135 fragBuilder->codeAppend("dist_grad = dist_grad*inversesqrt(dg_len2);"); in onEmitCode()
136 fragBuilder->codeAppend("}"); in onEmitCode()
138 fragBuilder->codeAppendf("vec2 Jdx = dFdx(%s);", st.fsIn()); in onEmitCode()
139 fragBuilder->codeAppendf("vec2 Jdy = dFdy(%s);", st.fsIn()); in onEmitCode()
140 fragBuilder->codeAppend("vec2 grad = vec2(dist_grad.x*Jdx.x + dist_grad.y*Jdy.x,"); in onEmitCode()
141 fragBuilder->codeAppend(" dist_grad.x*Jdx.y + dist_grad.y*Jdy.y);"); in onEmitCode()
144 fragBuilder->codeAppend("afwidth = " SK_DistanceFieldAAFactor "*length(grad);"); in onEmitCode()
146 fragBuilder->codeAppend("float val = smoothstep(-afwidth, afwidth, distance);"); in onEmitCode()
148 fragBuilder->codeAppendf("%s = vec4(val);", args.fOutputCoverage); in onEmitCode()
279 GrGLSLPPFragmentBuilder* fragBuilder = args.fFragBuilder; in onEmitCode() local
280 SkAssertResult(fragBuilder->enableFeature( in onEmitCode()
322 fragBuilder->codeAppend(GrGLSLShaderVar::PrecisionString(args.fGLSLCaps, in onEmitCode()
324 fragBuilder->codeAppendf("vec2 uv = %s;", v.fsIn()); in onEmitCode()
326 fragBuilder->codeAppend("float texColor = "); in onEmitCode()
327 fragBuilder->appendTextureLookup(args.fSamplers[0], in onEmitCode()
330 fragBuilder->codeAppend(".r;"); in onEmitCode()
331 fragBuilder->codeAppend("float distance = " in onEmitCode()
334 fragBuilder->codeAppend(GrGLSLShaderVar::PrecisionString(args.fGLSLCaps, in onEmitCode()
336 fragBuilder->codeAppendf("vec2 st = uv*%s;", textureSizeUniName); in onEmitCode()
337 fragBuilder->codeAppend("float afwidth;"); in onEmitCode()
344 fragBuilder->codeAppend("afwidth = abs(" SK_DistanceFieldAAFactor "*dFdy(st.y));"); in onEmitCode()
349 fragBuilder->codeAppend("vec2 dist_grad = vec2(dFdx(distance), dFdy(distance));"); in onEmitCode()
352 fragBuilder->codeAppend("float dg_len2 = dot(dist_grad, dist_grad);"); in onEmitCode()
353 fragBuilder->codeAppend("if (dg_len2 < 0.0001) {"); in onEmitCode()
354 fragBuilder->codeAppend("dist_grad = vec2(0.7071, 0.7071);"); in onEmitCode()
355 fragBuilder->codeAppend("} else {"); in onEmitCode()
356 fragBuilder->codeAppend("dist_grad = dist_grad*inversesqrt(dg_len2);"); in onEmitCode()
357 fragBuilder->codeAppend("}"); in onEmitCode()
359 fragBuilder->codeAppend("vec2 Jdx = dFdx(st);"); in onEmitCode()
360 fragBuilder->codeAppend("vec2 Jdy = dFdy(st);"); in onEmitCode()
361 fragBuilder->codeAppend("vec2 grad = vec2(dist_grad.x*Jdx.x + dist_grad.y*Jdy.x,"); in onEmitCode()
362 fragBuilder->codeAppend(" dist_grad.x*Jdx.y + dist_grad.y*Jdy.y);"); in onEmitCode()
365 fragBuilder->codeAppend("afwidth = " SK_DistanceFieldAAFactor "*length(grad);"); in onEmitCode()
367 fragBuilder->codeAppend("float val = smoothstep(-afwidth, afwidth, distance);"); in onEmitCode()
369 fragBuilder->codeAppendf("%s = vec4(val);", args.fOutputCoverage); in onEmitCode()
496 GrGLSLPPFragmentBuilder* fragBuilder = args.fFragBuilder; in onEmitCode() local
540 SkAssertResult(fragBuilder->enableFeature( in onEmitCode()
545 fragBuilder->codeAppend(GrGLSLShaderVar::PrecisionString(args.fGLSLCaps, in onEmitCode()
547 fragBuilder->codeAppendf("vec2 uv = %s;\n", uv.fsIn()); in onEmitCode()
548 fragBuilder->codeAppend(GrGLSLShaderVar::PrecisionString(args.fGLSLCaps, in onEmitCode()
553 fragBuilder->codeAppendf("float delta = -%.*f;\n", SK_FLT_DECIMAL_DIG, lcdDelta); in onEmitCode()
555 fragBuilder->codeAppendf("float delta = %.*f;\n", SK_FLT_DECIMAL_DIG, lcdDelta); in onEmitCode()
558 fragBuilder->codeAppendf("float dy = abs(dFdy(%s.y));", st.fsIn()); in onEmitCode()
559 fragBuilder->codeAppend("vec2 offset = vec2(dy*delta, 0.0);"); in onEmitCode()
561 fragBuilder->codeAppendf("vec2 st = %s;\n", st.fsIn()); in onEmitCode()
563 fragBuilder->codeAppend("vec2 Jdx = dFdx(st);"); in onEmitCode()
564 fragBuilder->codeAppend("vec2 Jdy = dFdy(st);"); in onEmitCode()
565 fragBuilder->codeAppend("vec2 offset = delta*Jdx;"); in onEmitCode()
569 fragBuilder->codeAppend("\tvec4 texColor = "); in onEmitCode()
570 fragBuilder->appendTextureLookup(args.fSamplers[0], "uv", kVec2f_GrSLType); in onEmitCode()
571 fragBuilder->codeAppend(";\n"); in onEmitCode()
572 fragBuilder->codeAppend("\tvec3 distance;\n"); in onEmitCode()
573 fragBuilder->codeAppend("\tdistance.y = texColor.r;\n"); in onEmitCode()
575 fragBuilder->codeAppend("\tvec2 uv_adjusted = uv - offset;\n"); in onEmitCode()
576 fragBuilder->codeAppend("\ttexColor = "); in onEmitCode()
577 fragBuilder->appendTextureLookup(args.fSamplers[0], "uv_adjusted", kVec2f_GrSLType); in onEmitCode()
578 fragBuilder->codeAppend(";\n"); in onEmitCode()
579 fragBuilder->codeAppend("\tdistance.x = texColor.r;\n"); in onEmitCode()
581 fragBuilder->codeAppend("\tuv_adjusted = uv + offset;\n"); in onEmitCode()
582 fragBuilder->codeAppend("\ttexColor = "); in onEmitCode()
583 fragBuilder->appendTextureLookup(args.fSamplers[0], "uv_adjusted", kVec2f_GrSLType); in onEmitCode()
584 fragBuilder->codeAppend(";\n"); in onEmitCode()
585 fragBuilder->codeAppend("\tdistance.z = texColor.r;\n"); in onEmitCode()
587 fragBuilder->codeAppend("\tdistance = " in onEmitCode()
595 fragBuilder->codeAppendf("distance -= %s;", distanceAdjustUniName); in onEmitCode()
601 fragBuilder->codeAppend("float afwidth;"); in onEmitCode()
608 fragBuilder->codeAppend("afwidth = " SK_DistanceFieldAAFactor "*dy;"); in onEmitCode()
613 fragBuilder->codeAppend("vec2 dist_grad = vec2(dFdx(distance.r), dFdy(distance.r));"); in onEmitCode()
616 fragBuilder->codeAppend("float dg_len2 = dot(dist_grad, dist_grad);"); in onEmitCode()
617 fragBuilder->codeAppend("if (dg_len2 < 0.0001) {"); in onEmitCode()
618 fragBuilder->codeAppend("dist_grad = vec2(0.7071, 0.7071);"); in onEmitCode()
619 fragBuilder->codeAppend("} else {"); in onEmitCode()
620 fragBuilder->codeAppend("dist_grad = dist_grad*inversesqrt(dg_len2);"); in onEmitCode()
621 fragBuilder->codeAppend("}"); in onEmitCode()
622 fragBuilder->codeAppend("vec2 grad = vec2(dist_grad.x*Jdx.x + dist_grad.y*Jdy.x,"); in onEmitCode()
623 fragBuilder->codeAppend(" dist_grad.x*Jdx.y + dist_grad.y*Jdy.y);"); in onEmitCode()
626 fragBuilder->codeAppend("afwidth = " SK_DistanceFieldAAFactor "*length(grad);"); in onEmitCode()
629 fragBuilder->codeAppend( in onEmitCode()
632 fragBuilder->codeAppend("val.a = max(max(val.r, val.g), val.b);"); in onEmitCode()
634 fragBuilder->codeAppendf("%s = val;", args.fOutputCoverage); in onEmitCode()