blob: 8d3d722290f529cd6ab95b8c635a1b6d39aefcca [file] [log] [blame]
static constexpr char SKSL_MINIFIED_sksl_graphite_vert[] =
"$pure float curve_type_using_inf_support(float4 a){if(isinf(a.z)){return 2."
";}if(isinf(a.w)){return 1.;}return 0.;}$pure bool $k(float a){return a!=0.;"
"}$pure bool $l(float a){return a==2.;}$pure float $m(float2 a,float2 b,float2"
" c,float2 d,float2x2 e){float2 f=e*(fma(float2(-2.),b,c)+a);float2 g=e*(fma"
"(float2(-2.),c,d)+b);return max(dot(f,f),dot(g,g));}$pure float $n(float2 a"
",float2 b,float2 c,float2 d,float2x2 e){float f=$m(a,b,c,d,e);return max(ceil"
"(sqrt(3.*sqrt(f))),1.);}$pure float $o(float2 a,float2 b,float2 c,float2 d,"
"float2x2 e){float f=$m(a,b,c,d,e);return ceil(log2(max(9.*f,1.))*.25);}$pure"
" float $p(float2 a,float2 b,float2 c,float d){float2 e=(min(min(a,b),c)+max"
"(max(a,b),c))*.5;a-=e;b-=e;c-=e;float f=sqrt(max(max(dot(a,a),dot(b,b)),dot"
"(c,c)));float2 g=fma(float2(-2.*d),b,a)+c;float h=abs(fma(-2.,d,2.));float i"
"=max(0.,fma(f,4.,-1.));float j=length(g)*4.+i*h;float k=4.*min(d,1.);return"
" j/k;}$pure float $q(float2 a,float2 b,float2 c,float d){float e=$p(a,b,c,d"
");return max(ceil(sqrt(e)),1.);}$pure float $r(float2 a,float2 b,float2 c,float"
" d){float e=$p(a,b,c,d);return ceil(log2(max(e,1.))*.5);}$pure float2 $s(float2"
" c,float2 d){float2 e=c-d;if(e==float2(0.)){return float2(0.);}else{float f"
"=1./max(abs(e.x),abs(e.y));return normalize(f*e);}}$pure float $t(float2 c,"
"float2 d){return clamp(dot(c,d),-1.,1.);}$pure float $u(float a,float b){float"
" c=fma(a,.5,.5);return(c*b)*b>=1.?inversesqrt(c):sqrt(c);}$pure float $v(float"
" a){return.5/acos(max(1.-.25/a,-1.));}$pure float $w(float c,float d,float e"
"){return fma(d-c,e,c);}$pure float2 $w(float2 c,float2 d,float e){return fma"
"(d-c,float2(e),c);}$pure float4 $w(float4 c,float4 d,float4 e){return fma(d"
"-c,e,c);}$pure float2 tessellate_filled_curve(float2x2 a,float b,float c,float4"
" d,float4 e,float f){float2 g;if($l(f)){g=b!=0.?d.zw:(c!=0.?e.xy:d.xy);}else"
"{float2 h=d.xy;float2 i=d.zw;float2 j=e.xy;float2 k=e.zw;float l=-1.;float m"
";if($k(f)){l=k.x;m=$r(a*h,a*i,a*j,l);i*=l;k=j;}else{m=$o(h,i,j,k,a);}if(b>m"
"){c=floor(ldexp(c,int(m-b)));b=m;}float n=floor(.5+ldexp(c,int(5.-b)));if(0."
"<n&&n<32.){float o=n*.03125;float2 p=mix(h,i,o);float2 q=mix(i,j,o);float2 r"
"=mix(j,k,o);float2 s=mix(p,q,o);float2 t=mix(q,r,o);float2 x=mix(s,t,o);float"
" y=mix(1.,l,o);float z=(l+1.)-y;float A=mix(y,z,o);g=l<0.?x:s/A;}else{g=n=="
"0.?h:k;}}return g;}$pure float4 tessellate_stroked_curve(float a,float b,float2x2"
" c,float2 d,float e,float4 f,float4 g,float2 h,float2 i,float j){float2 k=f"
".xy;float2 l=f.zw;float2 m=g.xy;float2 n=g.zw;float o=-1.;if($k(j)){o=n.x;n"
"=m;}float p;if(o<0.){if(k==l&&m==n){p=1.;}else{p=$n(k,l,m,n,c);}}else{p=$q("
"c*k,c*l,c*m,o);}float q=i.x;float r=i.y;bool s=i.x==0.;float t;if(s){t=$v(1."
");q=.5;}else{t=$v(e*i.x);}if(s){k=c*k;l=c*l;m=c*m;n=c*n;h=c*h;}float2 u=$s("
"k==l?(l==m?n:m):l,k);float2 v=$s(n,n==m?(m==l?k:l):m);if(u==float2(0.)){u=float2"
"(1.,0.);v=float2(-1.,0.);}float x;if(r>=0.){x=(sign(r)+1.)+2.;}else{float2 y"
"=$s(k,h);float z=acos($t(y,u));float A=max(ceil(z*t),1.);x=A+2.;x=min(x,b-2."
");}float y=cross_length_2d(m-k,n-l);float z=abs(a)-x;if(z<0.){v=u;if(h!=k){"
"u=$s(k,h);}y=cross_length_2d(u,v);}float A=$t(u,v);float B=acos(A);if(y<0.)"
"{B=-B;}float C;float D=sign(a);if(z<0.){C=x-2.;p=1.;n=(m=(l=k));z+=C+1.;float"
" E=.01;bool F=abs(y)*inversesqrt(dot(u,u)*dot(v,v))<E;if(!F||dot(u,v)<0.){if"
"(z>=0.){D=y<0.?min(D,0.):max(D,0.);}}z=max(z,0.);}else{float E=(b-x)-1.;C=max"
"(ceil(abs(B)*t),1.);C=min(C,E);p=min(p,(E-C)+1.);}float E=B/C;float F=(p+C)"
"-1.;bool G=z>=F;if(z>F){D=0.;}if(abs(a)==2.&&r>0.){D*=$u(A,r);}float2 H;float2"
" I;if(z!=0.&&!G){float2 J;float2 K;float2 L=l-k;float2 M=n-k;if(o>=0.){L*=o"
";K=.5*M-L;J=(o-1.)*M;l*=o;}else{float2 N=m-l;K=N-L;J=fma(float2(-3.),N,M);}"
"float2 N=K*(p*2.);float2 O=L*(p*p);float P=0.;float Q=min(p-1.,z);float R=-"
"abs(E);float S=(1.+z)*abs(E);for(int U=4;U>=0;--U){float V=P+exp2(float(U))"
";if(V<=Q){float2 W=fma(float2(V),J,N);W=fma(float2(V),W,O);float X=dot(normalize"
"(W),u);float Y=fma(V,R,S);Y=min(Y,3.14159274);if(X>=cos(Y)){P=V;}}}float U="
"P/p;float V=z-P;float W=acos(clamp(u.x,-1.,1.));W=u.y>=0.?W:-W;float X=fma("
"V,E,W);H=float2(cos(X),sin(X));float2 Y=float2(-H.y,H.x);float Z=dot(Y,J);float"
" aa=dot(Y,K);float ac=dot(Y,L);float ad=max(aa*aa-Z*ac,0.);float ae=sqrt(ad"
");if(aa>0.){ae=-ae;}ae-=aa;float af=(-.5*ae)*Z;float2 ag=abs(fma(ae,ae,af))"
"<abs(fma(Z,ac,af))?float2(ae,Z):float2(ac,ae);float ah=ag.y!=0.?ag.x/ag.y:0."
";ah=clamp(ah,0.,1.);if(V==0.){ah=0.;}float ai=max(U,ah);float2 aj=$w(k,l,ai"
");float2 ak=$w(l,m,ai);float2 al=$w(m,n,ai);float2 am=$w(aj,ak,ai);float2 an"
"=$w(ak,al,ai);float2 ao=$w(am,an,ai);float ap=$w(1.,o,ai);float aq=(o+1.)-ap"
";float ar=$w(ap,aq,ai);if(ai!=ah){H=o>=0.?$s(ak*ap,aj*aq):$s(an,am);}I=o>=0."
"?am/ar:ao;}else{H=z==0.?u:v;I=z==0.?k:n;}float2 J=float2(H.y,-H.x);I+=J*(q*"
"D);if(s){return float4(I+d,inverse(c)*I);}else{return float4(c*I+d,I);}}float2"
" ortho(float2 a){return float2(-a.y,a.x);}float distance_to_line(float2 a,float2"
" b,float2 c){return dot(b,a)-dot(b,c);}float2 normalize_with_length(float2 a"
",out float b){b=length(a);return a/b;}";