blob: a05463458826ecfe65587eb29e05832a6460bad3 [file] [log] [blame]
static constexpr char SKSL_MINIFIED_sksl_shared[] =
"$pure $genType radians($genType degrees);$pure $genHType radians($genHType degrees"
");$pure $genType degrees($genType radians);$pure $genHType degrees($genHType"
" radians);$pure $genType sin($genType angle);$pure $genHType sin($genHType angle"
");$pure $genType cos($genType angle);$pure $genHType cos($genHType angle);$pure"
" $genType tan($genType angle);$pure $genHType tan($genHType angle);$pure $genType"
" asin($genType x);$pure $genHType asin($genHType x);$pure $genType acos($genType"
" x);$pure $genHType acos($genHType x);$pure $genType atan($genType y,$genType"
" x);$pure $genHType atan($genHType y,$genHType x);$pure $genType atan($genType"
" y_over_x);$pure $genHType atan($genHType y_over_x);$es3 $pure $genType sinh"
"($genType x);$es3 $pure $genHType sinh($genHType x);$es3 $pure $genType cosh"
"($genType x);$es3 $pure $genHType cosh($genHType x);$es3 $pure $genType tanh"
"($genType x);$es3 $pure $genHType tanh($genHType x);$es3 $pure $genType asinh"
"($genType x);$es3 $pure $genHType asinh($genHType x);$es3 $pure $genType acosh"
"($genType x);$es3 $pure $genHType acosh($genHType x);$es3 $pure $genType atanh"
"($genType x);$es3 $pure $genHType atanh($genHType x);$pure $genType pow($genType"
" x,$genType y);$pure $genHType pow($genHType x,$genHType y);$pure $genType exp"
"($genType x);$pure $genHType exp($genHType x);$pure $genType log($genType x"
");$pure $genHType log($genHType x);$pure $genType exp2($genType x);$pure $genHType"
" exp2($genHType x);$pure $genType log2($genType x);$pure $genHType log2($genHType"
" x);$pure $genType sqrt($genType x);$pure $genHType sqrt($genHType x);$pure"
" $genType inversesqrt($genType x);$pure $genHType inversesqrt($genHType x);"
"$pure $genType abs($genType x);$pure $genHType abs($genHType x);$pure $genType"
" sign($genType x);$pure $genHType sign($genHType x);$pure $genType floor($genType"
" x);$pure $genHType floor($genHType x);$pure $genType ceil($genType x);$pure"
" $genHType ceil($genHType x);$pure $genType fract($genType x);$pure $genHType"
" fract($genHType x);$pure $genType mod($genType x,float y);$pure $genType mod"
"($genType x,$genType y);$pure $genHType mod($genHType x,half y);$pure $genHType"
" mod($genHType x,$genHType y);$pure $genType min($genType x,$genType y);$pure"
" $genType min($genType x,float y);$pure $genHType min($genHType x,$genHType"
" y);$pure $genHType min($genHType x,half y);$pure $genType max($genType x,$genType"
" y);$pure $genType max($genType x,float y);$pure $genHType max($genHType x,"
"$genHType y);$pure $genHType max($genHType x,half y);$pure $genType clamp($genType"
" x,$genType minVal,$genType maxVal);$pure $genType clamp($genType x,float minVal"
",float maxVal);$pure $genHType clamp($genHType x,$genHType minVal,$genHType"
" maxVal);$pure $genHType clamp($genHType x,half minVal,half maxVal);$pure $genType"
" saturate($genType x);$pure $genHType saturate($genHType x);$pure $genType mix"
"($genType x,$genType y,$genType a);$pure $genType mix($genType x,$genType y"
",float a);$pure $genHType mix($genHType x,$genHType y,$genHType a);$pure $genHType"
" mix($genHType x,$genHType y,half a);$pure $genType step($genType edge,$genType"
" x);$pure $genType step(float edge,$genType x);$pure $genHType step($genHType"
" edge,$genHType x);$pure $genHType step(half edge,$genHType x);$pure $genType"
" smoothstep($genType edge0,$genType edge1,$genType x);$pure $genType smoothstep"
"(float edge0,float edge1,$genType x);$pure $genHType smoothstep($genHType edge0"
",$genHType edge1,$genHType x);$pure $genHType smoothstep(half edge0,half edge1"
",$genHType x);$es3 $pure $genIType abs($genIType x);$es3 $pure $genIType sign"
"($genIType x);$es3 $pure $genIType floatBitsToInt($genType value);$es3 $pure"
" $genUType floatBitsToUint($genType value);$es3 $pure $genType intBitsToFloat"
"($genIType value);$es3 $pure $genType uintBitsToFloat($genUType value);$es3"
" $pure $genType trunc($genType x);$es3 $pure $genHType trunc($genHType x);$es3"
" $pure $genType round($genType x);$es3 $pure $genHType round($genHType x);$es3"
" $pure $genType roundEven($genType x);$es3 $pure $genHType roundEven($genHType"
" x);$es3 $pure $genIType min($genIType x,$genIType y);$es3 $pure $genIType min"
"($genIType x,int y);$es3 $pure $genUType min($genUType x,$genUType y);$es3 $pure"
" $genUType min($genUType x,uint y);$es3 $pure $genIType max($genIType x,$genIType"
" y);$es3 $pure $genIType max($genIType x,int y);$es3 $pure $genUType max($genUType"
" x,$genUType y);$es3 $pure $genUType max($genUType x,uint y);$es3 $pure $genIType"
" clamp($genIType x,$genIType minVal,$genIType maxVal);$es3 $pure $genIType clamp"
"($genIType x,int minVal,int maxVal);$es3 $pure $genUType clamp($genUType x,"
"$genUType minVal,$genUType maxVal);$es3 $pure $genUType clamp($genUType x,uint"
" minVal,uint maxVal);$es3 $pure $genType mix($genType x,$genType y,$genBType"
" a);$es3 $pure $genHType mix($genHType x,$genHType y,$genBType a);$es3 $pure"
" $genBType isnan($genType x);$es3 $pure $genBType isnan($genHType x);$es3 $pure"
" $genBType isinf($genType x);$es3 $pure $genBType isinf($genHType x);$es3 $pure"
" $genType modf($genType x,out $genType i);$es3 $pure $genHType modf($genHType"
" x,out $genHType i);$es3 $pure uint packUnorm2x16(float2 v);$es3 $pure float2"
" unpackUnorm2x16(uint p);$pure float length($genType x);$pure half length($genHType"
" x);$pure float distance($genType p0,$genType p1);$pure half distance($genHType"
" p0,$genHType p1);$pure float dot($genType x,$genType y);$pure half dot($genHType"
" x,$genHType y);$pure float3 cross(float3 x,float3 y);$pure half3 cross(half3"
" x,half3 y);$pure $genType normalize($genType x);$pure $genHType normalize("
"$genHType x);$pure $genType faceforward($genType N,$genType I,$genType Nref"
");$pure $genHType faceforward($genHType N,$genHType I,$genHType Nref);$pure"
" $genType reflect($genType I,$genType N);$pure $genHType reflect($genHType I"
",$genHType N);$pure $genType refract($genType I,$genType N,float eta);$pure"
" $genHType refract($genHType I,$genHType N,half eta);$pure $squareMat matrixCompMult"
"($squareMat x,$squareMat y);$pure $squareHMat matrixCompMult($squareHMat x,"
"$squareHMat y);$es3 $pure $mat matrixCompMult($mat x,$mat y);$es3 $pure $hmat"
" matrixCompMult($hmat x,$hmat y);$pure $squareMat inverse($squareMat m);$pure"
" $squareHMat inverse($squareHMat m);$es3 $pure float determinant($squareMat"
" m);$es3 $pure half determinant($squareHMat m);$es3 $pure $squareMat transpose"
"($squareMat m);$es3 $pure $squareHMat transpose($squareHMat m);$es3 $pure float2x3"
" transpose(float3x2 m);$es3 $pure half2x3 transpose(half3x2 m);$es3 $pure float2x4"
" transpose(float4x2 m);$es3 $pure half2x4 transpose(half4x2 m);$es3 $pure float3x2"
" transpose(float2x3 m);$es3 $pure half3x2 transpose(half2x3 m);$es3 $pure float3x4"
" transpose(float4x3 m);$es3 $pure half3x4 transpose(half4x3 m);$es3 $pure float4x2"
" transpose(float2x4 m);$es3 $pure half4x2 transpose(half2x4 m);$es3 $pure float4x3"
" transpose(float3x4 m);$es3 $pure half4x3 transpose(half3x4 m);$es3 $pure $squareMat"
" outerProduct($vec c,$vec r);$es3 $pure $squareHMat outerProduct($hvec c,$hvec"
" r);$es3 $pure float2x3 outerProduct(float3 c,float2 r);$es3 $pure half2x3 outerProduct"
"(half3 c,half2 r);$es3 $pure float3x2 outerProduct(float2 c,float3 r);$es3 $pure"
" half3x2 outerProduct(half2 c,half3 r);$es3 $pure float2x4 outerProduct(float4"
" c,float2 r);$es3 $pure half2x4 outerProduct(half4 c,half2 r);$es3 $pure float4x2"
" outerProduct(float2 c,float4 r);$es3 $pure half4x2 outerProduct(half2 c,half4"
" r);$es3 $pure float3x4 outerProduct(float4 c,float3 r);$es3 $pure half3x4 outerProduct"
"(half4 c,half3 r);$es3 $pure float4x3 outerProduct(float3 c,float4 r);$es3 $pure"
" half4x3 outerProduct(half3 c,half4 r);$pure $bvec lessThan($vec x,$vec y);"
"$pure $bvec lessThan($hvec x,$hvec y);$pure $bvec lessThan($ivec x,$ivec y)"
";$pure $bvec lessThan($svec x,$svec y);$pure $bvec lessThanEqual($vec x,$vec"
" y);$pure $bvec lessThanEqual($hvec x,$hvec y);$pure $bvec lessThanEqual($ivec"
" x,$ivec y);$pure $bvec lessThanEqual($svec x,$svec y);$pure $bvec greaterThan"
"($vec x,$vec y);$pure $bvec greaterThan($hvec x,$hvec y);$pure $bvec greaterThan"
"($ivec x,$ivec y);$pure $bvec greaterThan($svec x,$svec y);$pure $bvec greaterThanEqual"
"($vec x,$vec y);$pure $bvec greaterThanEqual($hvec x,$hvec y);$pure $bvec greaterThanEqual"
"($ivec x,$ivec y);$pure $bvec greaterThanEqual($svec x,$svec y);$pure $bvec"
" equal($vec x,$vec y);$pure $bvec equal($hvec x,$hvec y);$pure $bvec equal("
"$ivec x,$ivec y);$pure $bvec equal($svec x,$svec y);$pure $bvec equal($bvec"
" x,$bvec y);$pure $bvec notEqual($vec x,$vec y);$pure $bvec notEqual($hvec x"
",$hvec y);$pure $bvec notEqual($ivec x,$ivec y);$pure $bvec notEqual($svec x"
",$svec y);$pure $bvec notEqual($bvec x,$bvec y);$es3 $pure $bvec lessThan($usvec"
" x,$usvec y);$es3 $pure $bvec lessThan($uvec x,$uvec y);$es3 $pure $bvec lessThanEqual"
"($uvec x,$uvec y);$es3 $pure $bvec lessThanEqual($usvec x,$usvec y);$es3 $pure"
" $bvec greaterThan($uvec x,$uvec y);$es3 $pure $bvec greaterThan($usvec x,$usvec"
" y);$es3 $pure $bvec greaterThanEqual($uvec x,$uvec y);$es3 $pure $bvec greaterThanEqual"
"($usvec x,$usvec y);$es3 $pure $bvec equal($uvec x,$uvec y);$es3 $pure $bvec"
" equal($usvec x,$usvec y);$es3 $pure $bvec notEqual($uvec x,$uvec y);$es3 $pure"
" $bvec notEqual($usvec x,$usvec y);$pure bool any($bvec x);$pure bool all($bvec"
" x);$pure $bvec not($bvec x);$es3 $pure $genType dFdx($genType p);$es3 $pure"
" $genType dFdy($genType p);$es3 $pure $genHType dFdx($genHType p);$es3 $pure"
" $genHType dFdy($genHType p);$es3 $pure $genType fwidth($genType p);$es3 $pure"
" $genHType fwidth($genHType p);$pure half4 unpremul(half4 color){return half4"
"(color.xyz/max(color.w,.0001),color.w);}$pure float4 unpremul(float4 color)"
"{return float4(color.xyz/max(color.w,.0001),color.w);}$export $pure half4 $unpremul_polar"
"(half4 color){return half4(color.x,color.yz/max(color.w,.0001),color.w);}$export"
" $pure half4 $rgb_to_hsl(half3 c,half a){half4 p=c.y<c.z?half4(c.zy,-1.,.6666667"
"):half4(c.yz,0.,-.333333343);half4 q=c.x<p.x?half4(p.x,c.x,p.yw):half4(c.x,"
"p.x,p.yz);const half kEps=.0001;half pmV=q.x;half pmC=pmV-min(q.y,q.z);half"
" pmL=pmV-pmC*.5;half H=abs(q.w+(q.y-q.z)/(pmC*6.+kEps));half S=pmC/((a+kEps"
")-abs(pmL*2.-a));half L=pmL/(a+kEps);return half4(H,S,L,a);}$export $pure half3"
" $hsl_to_rgb(half3 hsl){half C=(1.-abs(2.*hsl.z-1.))*hsl.y;half3 p=hsl.xxx+"
"half3(0.,.6666667,.333333343);half3 q=saturate(abs(fract(p)*6.-3.)-1.);return"
"(q-.5)*C+hsl.z;}$export $pure half4 $hsl_to_rgb(half3 hsl,half a){return saturate"
"(half4($hsl_to_rgb(hsl)*a,a));}$export $pure half3 $css_lab_to_xyz(half3 lab"
"){const half k=903.2963;const half e=.008856452;half3 f;f.y=(lab.x+16.)/116."
";f.x=lab.y/500.+f.y;f.z=f.y-lab.z/200.;half3 f_cubed=pow(f,half3(3.));half3"
" xyz=half3(f_cubed.x>e?f_cubed.x:(116.*f.x-16.)/k,lab.x>8.000001?f_cubed.y:"
"lab.x/k,f_cubed.z>e?f_cubed.z:(116.*f.z-16.)/k);const half3 D50=half3(.9642956"
",1.,.825104535);return xyz*D50;}$pure half3 $css_hcl_to_lab(half3 hcl){return"
" half3(hcl.z,hcl.y*cos(radians(hcl.x)),hcl.y*sin(radians(hcl.x)));}$export $pure"
" half3 $css_hcl_to_xyz(half3 hcl){return $css_lab_to_xyz($css_hcl_to_lab(hcl"
"));}$export $pure half3 $css_oklab_to_linear_srgb(half3 oklab){half l_=(oklab"
".x+.396337777*oklab.y)+.215803757*oklab.z;half m_=(oklab.x-.105561346*oklab"
".y)-.06385417*oklab.z;half s_=(oklab.x-.08948418*oklab.y)-1.29148555*oklab."
"z;half l=(l_*l_)*l_;half m=(m_*m_)*m_;half s=(s_*s_)*s_;return half3((4.0767417"
"*l-3.3077116*m)+.230969936*s,(-1.268438*l+2.60975742*m)-.341319382*s,(-.00419608643"
"*l-.7034186*m)+1.70761466*s);}$export $pure half3 $css_okhcl_to_linear_srgb"
"(half3 okhcl){return $css_oklab_to_linear_srgb($css_hcl_to_lab(okhcl));}$export"
" $pure half3 $css_hsl_to_srgb(half3 hsl){hsl.x=mod(hsl.x,360.);if(hsl.x<0.)"
"{hsl.x+=360.;}hsl.yz/=100.;half3 k=mod(half3(0.,8.,4.)+hsl.x/30.,12.);half a"
"=hsl.y*min(hsl.z,1.-hsl.z);return hsl.z-a*clamp(min(k-3.,9.-k),-1.,1.);}$export"
" $pure half3 $css_hwb_to_srgb(half3 hwb){hwb.yz/=100.;if(hwb.y+hwb.z>=1.){half"
" gray=hwb.y/(hwb.y+hwb.z);return half3(gray);}half3 rgb=$css_hsl_to_srgb(half3"
"(hwb.x,100.,50.));rgb*=(1.-hwb.y)-hwb.z;rgb+=hwb.y;return rgb;}";