blob: fc1edd128da431569977d04a4787d2732821e78e [file] [log] [blame]
static constexpr char SKSL_MINIFIED_sksl_gpu[] =
"$pure $genIType mix($genIType,$genIType,$genBType);$pure $genBType mix($genBType"
",$genBType,$genBType);$pure $genType fma($genType,$genType,$genType);$pure $genHType"
" fma($genHType,$genHType,$genHType);$genType frexp($genType,out $genIType);"
"$genHType frexp($genHType,out $genIType);$pure $genType ldexp($genType,$genIType"
");$pure $genHType ldexp($genHType,$genIType);$pure uint packSnorm2x16(float2"
");$pure uint packUnorm4x8(float4);$pure uint packSnorm4x8(float4);$pure float2"
" unpackSnorm2x16(uint);$pure float4 unpackUnorm4x8(uint);$pure float4 unpackSnorm4x8"
"(uint);$pure uint packHalf2x16(float2);$pure float2 unpackHalf2x16(uint);$pure"
" $genIType bitCount($genIType);$pure $genIType bitCount($genUType);$pure $genIType"
" findLSB($genIType);$pure $genIType findLSB($genUType);$pure $genIType findMSB"
"($genIType);$pure $genIType findMSB($genUType);$pure sampler2D makeSampler2D"
"(texture2D,sampler);$pure half4 sample(sampler2D,float2);$pure half4 sample"
"(sampler2D,float3);$pure half4 sample(sampler2D,float3,float);$pure half4 sample"
"(samplerExternalOES,float2);$pure half4 sample(samplerExternalOES,float2,float"
");$pure half4 sample(sampler2DRect,float2);$pure half4 sample(sampler2DRect"
",float3);$pure half4 sampleLod(sampler2D,float2,float);$pure half4 sampleLod"
"(sampler2D,float3,float);$pure half4 sampleGrad(sampler2D,float2,float2,float2"
");$pure half4 subpassLoad(subpassInput);$pure half4 subpassLoad(subpassInputMS"
",int);$pure uint atomicLoad(atomicUint);void atomicStore(atomicUint,uint);uint"
" atomicAdd(atomicUint,uint);$pure half4 blend_clear(half4 a,half4 b){return"
" half4(0.);}$pure half4 blend_src(half4 a,half4 b){return a;}$pure half4 blend_dst"
"(half4 a,half4 b){return b;}$pure half4 blend_src_over(half4 a,half4 b){return"
" a+(1.-a.w)*b;}$pure half4 blend_dst_over(half4 a,half4 b){return(1.-b.w)*a"
"+b;}$pure half4 blend_src_in(half4 a,half4 b){return a*b.w;}$pure half4 blend_dst_in"
"(half4 a,half4 b){return b*a.w;}$pure half4 blend_src_out(half4 a,half4 b){"
"return(1.-b.w)*a;}$pure half4 blend_dst_out(half4 a,half4 b){return(1.-a.w)"
"*b;}$pure half4 blend_src_atop(half4 a,half4 b){return b.w*a+(1.-a.w)*b;}$pure"
" half4 blend_dst_atop(half4 a,half4 b){return(1.-b.w)*a+a.w*b;}$pure half4 blend_xor"
"(half4 a,half4 b){return(1.-b.w)*a+(1.-a.w)*b;}$pure half4 blend_plus(half4"
" a,half4 b){return min(a+b,1.);}$pure half4 blend_porter_duff(half4 a,half4"
" b,half4 c){half2 d=a.xy+a.zw*(half2(c.w,b.w)+min(a.zw,0.));return min(half4"
"(1.),b*d.x+c*d.y);}$pure half4 blend_modulate(half4 a,half4 b){return a*b;}"
"$pure half4 blend_screen(half4 a,half4 b){return a+(1.-a)*b;}$pure half $b("
"half2 a,half2 b){return 2.*b.x<=b.y?(2.*a.x)*b.x:a.y*b.y-(2.*(b.y-b.x))*(a."
"y-a.x);}$pure half4 blend_overlay(half4 a,half4 b){half4 c=half4($b(a.xw,b."
"xw),$b(a.yw,b.yw),$b(a.zw,b.zw),a.w+(1.-a.w)*b.w);c.xyz+=b.xyz*(1.-a.w)+a.xyz"
"*(1.-b.w);return c;}$pure half4 blend_overlay(half c,half4 d,half4 e){return"
" blend_overlay(bool(c)?e:d,bool(c)?d:e);}$pure half4 blend_lighten(half4 a,"
"half4 b){half4 c=blend_src_over(a,b);c.xyz=max(c.xyz,(1.-b.w)*a.xyz+b.xyz);"
"return c;}$pure half4 blend_darken(half c,half4 d,half4 e){half4 f=blend_src_over"
"(d,e);half3 g=(1.-e.w)*d.xyz+e.xyz;f.xyz=c*min(f.xyz*c,g*c);return f;}$pure"
" half4 blend_darken(half4 a,half4 b){return blend_darken(1.,a,b);}const half"
" $kGuardedDivideEpsilon=half(sk_Caps.mustGuardDivisionEvenAfterExplicitZeroCheck"
"?1e-08:0.);$pure inline half $c(half a,half b){return a/(b+$kGuardedDivideEpsilon"
");}$pure inline half3 $c(half3 a,half b){return a/(b+$kGuardedDivideEpsilon"
");}$pure half $d(half2 a,half2 b){if(b.x==0.){return a.x*(1.-b.y);}else{half"
" c=a.y-a.x;if(c==0.){return(a.y*b.y+a.x*(1.-b.y))+b.x*(1.-a.y);}else{c=min("
"b.y,$c(b.x*a.y,c));return(c*a.y+a.x*(1.-b.y))+b.x*(1.-a.y);}}}$pure half4 blend_color_dodge"
"(half4 a,half4 b){return half4($d(a.xw,b.xw),$d(a.yw,b.yw),$d(a.zw,b.zw),a."
"w+(1.-a.w)*b.w);}$pure half $e(half2 a,half2 b){if(b.y==b.x){return(a.y*b.y"
"+a.x*(1.-b.y))+b.x*(1.-a.y);}else if(a.x==0.){return b.x*(1.-a.y);}else{half"
" c=max(0.,b.y-$c((b.y-b.x)*a.y,a.x));return(c*a.y+a.x*(1.-b.y))+b.x*(1.-a.y"
");}}$pure half4 blend_color_burn(half4 a,half4 b){return half4($e(a.xw,b.xw"
"),$e(a.yw,b.yw),$e(a.zw,b.zw),a.w+(1.-a.w)*b.w);}$pure half4 blend_hard_light"
"(half4 a,half4 b){return blend_overlay(b,a);}$pure half $f(half2 a,half2 b)"
"{if(2.*a.x<=a.y){return($c((b.x*b.x)*(a.y-2.*a.x),b.y)+(1.-b.y)*a.x)+b.x*(("
"-a.y+2.*a.x)+1.);}else if(4.*b.x<=b.y){half c=b.x*b.x;half e=c*b.x;half f=b"
".y*b.y;half g=f*b.y;return $c(((f*(a.x-b.x*((3.*a.y-6.*a.x)-1.))+((12.*b.y)"
"*c)*(a.y-2.*a.x))-(16.*e)*(a.y-2.*a.x))-g*a.x,f);}else{return((b.x*((a.y-2."
"*a.x)+1.)+a.x)-sqrt(b.y*b.x)*(a.y-2.*a.x))-b.y*a.x;}}$pure half4 blend_soft_light"
"(half4 a,half4 b){return b.w==0.?a:half4($f(a.xw,b.xw),$f(a.yw,b.yw),$f(a.zw"
",b.zw),a.w+(1.-a.w)*b.w);}$pure half4 blend_difference(half4 a,half4 b){return"
" half4((a.xyz+b.xyz)-2.*min(a.xyz*b.w,b.xyz*a.w),a.w+(1.-a.w)*b.w);}$pure half4"
" blend_exclusion(half4 a,half4 b){return half4((b.xyz+a.xyz)-(2.*b.xyz)*a.xyz"
",a.w+(1.-a.w)*b.w);}$pure half4 blend_multiply(half4 a,half4 b){return half4"
"(((1.-a.w)*b.xyz+(1.-b.w)*a.xyz)+a.xyz*b.xyz,a.w+(1.-a.w)*b.w);}$pure half $g"
"(half3 a){return dot(half3(.3,.59,.11),a);}$pure half3 $h(half3 a,half b,half3"
" c){half d=$g(c);half3 e=(d-$g(a))+a;half f=min(min(e.x,e.y),e.z);half g=max"
"(max(e.x,e.y),e.z);if(f<0.&&d!=f){e=d+(e-d)*$c(d,d-f);}if(g>b&&g!=d){e=d+$c"
"((e-d)*(b-d),g-d);}return e;}$pure half $i(half3 a){return max(max(a.x,a.y)"
",a.z)-min(min(a.x,a.y),a.z);}$pure half3 $j(half3 a,half3 b){half c=min(min"
"(a.x,a.y),a.z);half d=max(max(a.x,a.y),a.z);return d>c?((a-c)*$i(b))/(d-c):"
"half3(0.);}$pure half4 blend_hslc(half2 a,half4 b,half4 c){half d=c.w*b.w;half3"
" e=b.xyz*c.w;half3 f=c.xyz*b.w;half3 g=bool(a.x)?f:e;half3 h=bool(a.x)?e:f;"
"if(bool(a.y)){g=$j(g,h);h=f;}return half4(((($h(g,d,h)+c.xyz)-f)+b.xyz)-e,("
"b.w+c.w)-d);}$pure half4 blend_hue(half4 a,half4 b){return blend_hslc(half2"
"(0.,1.),a,b);}$pure half4 blend_saturation(half4 a,half4 b){return blend_hslc"
"(half2(1.),a,b);}$pure half4 blend_color(half4 a,half4 b){return blend_hslc"
"(half2(0.),a,b);}$pure half4 blend_luminosity(half4 a,half4 b){return blend_hslc"
"(half2(1.,0.),a,b);}$pure float2 proj(float3 a){return a.xy/a.z;}$pure float"
" cross_length_2d(float2 c,float2 d){return determinant(float2x2(c,d));}$pure"
" half cross_length_2d(half2 c,half2 d){return determinant(half2x2(c,d));}";