| 1 |
static constexpr char SKSL_MINIFIED_sksl_shared[] = |
| 2 |
"$pure $genType radians($genType);$pure $genHType radians($genHType);$pure $genType" |
| 3 |
" degrees($genType);$pure $genHType degrees($genHType);$pure $genType sin($genType" |
| 4 |
");$pure $genHType sin($genHType);$pure $genType cos($genType);$pure $genHType" |
| 5 |
" cos($genHType);$pure $genType tan($genType);$pure $genHType tan($genHType)" |
| 6 |
";$pure $genType asin($genType);$pure $genHType asin($genHType);$pure $genType" |
| 7 |
" acos($genType);$pure $genHType acos($genHType);$pure $genType atan($genType" |
| 8 |
",$genType);$pure $genHType atan($genHType,$genHType);$pure $genType atan($genType" |
| 9 |
");$pure $genHType atan($genHType);$es3 $pure $genType sinh($genType);$es3 $pure" |
| 10 |
" $genHType sinh($genHType);$es3 $pure $genType cosh($genType);$es3 $pure $genHType" |
| 11 |
" cosh($genHType);$es3 $pure $genType tanh($genType);$es3 $pure $genHType tanh" |
| 12 |
"($genHType);$es3 $pure $genType asinh($genType);$es3 $pure $genHType asinh(" |
| 13 |
"$genHType);$es3 $pure $genType acosh($genType);$es3 $pure $genHType acosh($genHType" |
| 14 |
");$es3 $pure $genType atanh($genType);$es3 $pure $genHType atanh($genHType)" |
| 15 |
";$pure $genType pow($genType,$genType);$pure $genHType pow($genHType,$genHType" |
| 16 |
");$pure $genType exp($genType);$pure $genHType exp($genHType);$pure $genType" |
| 17 |
" log($genType);$pure $genHType log($genHType);$pure $genType exp2($genType)" |
| 18 |
";$pure $genHType exp2($genHType);$pure $genType log2($genType);$pure $genHType" |
| 19 |
" log2($genHType);$pure $genType sqrt($genType);$pure $genHType sqrt($genHType" |
| 20 |
");$pure $genType inversesqrt($genType);$pure $genHType inversesqrt($genHType" |
| 21 |
");$pure $genType abs($genType);$pure $genHType abs($genHType);$pure $genType" |
| 22 |
" sign($genType);$pure $genHType sign($genHType);$pure $genType floor($genType" |
| 23 |
");$pure $genHType floor($genHType);$pure $genType ceil($genType);$pure $genHType" |
| 24 |
" ceil($genHType);$pure $genType fract($genType);$pure $genHType fract($genHType" |
| 25 |
");$pure $genType mod($genType,float);$pure $genType mod($genType,$genType);" |
| 26 |
"$pure $genHType mod($genHType,half);$pure $genHType mod($genHType,$genHType" |
| 27 |
");$pure $genType min($genType,$genType);$pure $genType min($genType,float);" |
| 28 |
"$pure $genHType min($genHType,$genHType);$pure $genHType min($genHType,half" |
| 29 |
");$pure $genType max($genType,$genType);$pure $genType max($genType,float);" |
| 30 |
"$pure $genHType max($genHType,$genHType);$pure $genHType max($genHType,half" |
| 31 |
");$pure $genType clamp($genType,$genType,$genType);$pure $genType clamp($genType" |
| 32 |
",float,float);$pure $genHType clamp($genHType,$genHType,$genHType);$pure $genHType" |
| 33 |
" clamp($genHType,half,half);$pure $genType saturate($genType);$pure $genHType" |
| 34 |
" saturate($genHType);$pure $genType mix($genType,$genType,$genType);$pure $genType" |
| 35 |
" mix($genType,$genType,float);$pure $genHType mix($genHType,$genHType,$genHType" |
| 36 |
");$pure $genHType mix($genHType,$genHType,half);$pure $genType step($genType" |
| 37 |
",$genType);$pure $genType step(float,$genType);$pure $genHType step($genHType" |
| 38 |
",$genHType);$pure $genHType step(half,$genHType);$pure $genType smoothstep(" |
| 39 |
"$genType,$genType,$genType);$pure $genType smoothstep(float,float,$genType)" |
| 40 |
";$pure $genHType smoothstep($genHType,$genHType,$genHType);$pure $genHType smoothstep" |
| 41 |
"(half,half,$genHType);$es3 $pure $genIType abs($genIType);$es3 $pure $genIType" |
| 42 |
" sign($genIType);$es3 $pure $genIType floatBitsToInt($genType);$es3 $pure $genUType" |
| 43 |
" floatBitsToUint($genType);$es3 $pure $genType intBitsToFloat($genIType);$es3" |
| 44 |
" $pure $genType uintBitsToFloat($genUType);$es3 $pure $genType trunc($genType" |
| 45 |
");$es3 $pure $genHType trunc($genHType);$es3 $pure $genType round($genType)" |
| 46 |
";$es3 $pure $genHType round($genHType);$es3 $pure $genType roundEven($genType" |
| 47 |
");$es3 $pure $genHType roundEven($genHType);$es3 $pure $genIType min($genIType" |
| 48 |
",$genIType);$es3 $pure $genIType min($genIType,int);$es3 $pure $genUType min" |
| 49 |
"($genUType,$genUType);$es3 $pure $genUType min($genUType,uint);$es3 $pure $genIType" |
| 50 |
" max($genIType,$genIType);$es3 $pure $genIType max($genIType,int);$es3 $pure" |
| 51 |
" $genUType max($genUType,$genUType);$es3 $pure $genUType max($genUType,uint" |
| 52 |
");$es3 $pure $genIType clamp($genIType,$genIType,$genIType);$es3 $pure $genIType" |
| 53 |
" clamp($genIType,int,int);$es3 $pure $genUType clamp($genUType,$genUType,$genUType" |
| 54 |
");$es3 $pure $genUType clamp($genUType,uint,uint);$es3 $pure $genType mix($genType" |
| 55 |
",$genType,$genBType);$es3 $pure $genHType mix($genHType,$genHType,$genBType" |
| 56 |
");$es3 $pure $genBType isnan($genType);$es3 $pure $genBType isnan($genHType" |
| 57 |
");$es3 $pure $genBType isinf($genType);$es3 $pure $genBType isinf($genHType" |
| 58 |
");$es3 $genType modf($genType,out $genType);$es3 $genHType modf($genHType,out" |
| 59 |
" $genHType);$es3 $pure uint packUnorm2x16(float2);$es3 $pure float2 unpackUnorm2x16" |
| 60 |
"(uint);$pure float length($genType);$pure half length($genHType);$pure float" |
| 61 |
" distance($genType,$genType);$pure half distance($genHType,$genHType);$pure" |
| 62 |
" float dot($genType,$genType);$pure half dot($genHType,$genHType);$pure float3" |
| 63 |
" cross(float3,float3);$pure half3 cross(half3,half3);$pure $genType normalize" |
| 64 |
"($genType);$pure $genHType normalize($genHType);$pure $genType faceforward(" |
| 65 |
"$genType,$genType,$genType);$pure $genHType faceforward($genHType,$genHType" |
| 66 |
",$genHType);$pure $genType reflect($genType,$genType);$pure $genHType reflect" |
| 67 |
"($genHType,$genHType);$pure $genType refract($genType,$genType,float);$pure" |
| 68 |
" $genHType refract($genHType,$genHType,half);$pure $squareMat matrixCompMult" |
| 69 |
"($squareMat,$squareMat);$pure $squareHMat matrixCompMult($squareHMat,$squareHMat" |
| 70 |
");$es3 $pure $mat matrixCompMult($mat,$mat);$es3 $pure $hmat matrixCompMult" |
| 71 |
"($hmat,$hmat);$pure $squareMat inverse($squareMat);$pure $squareHMat inverse" |
| 72 |
"($squareHMat);$es3 $pure float determinant($squareMat);$es3 $pure half determinant" |
| 73 |
"($squareHMat);$es3 $pure $squareMat transpose($squareMat);$es3 $pure $squareHMat" |
| 74 |
" transpose($squareHMat);$es3 $pure float2x3 transpose(float3x2);$es3 $pure half2x3" |
| 75 |
" transpose(half3x2);$es3 $pure float2x4 transpose(float4x2);$es3 $pure half2x4" |
| 76 |
" transpose(half4x2);$es3 $pure float3x2 transpose(float2x3);$es3 $pure half3x2" |
| 77 |
" transpose(half2x3);$es3 $pure float3x4 transpose(float4x3);$es3 $pure half3x4" |
| 78 |
" transpose(half4x3);$es3 $pure float4x2 transpose(float2x4);$es3 $pure half4x2" |
| 79 |
" transpose(half2x4);$es3 $pure float4x3 transpose(float3x4);$es3 $pure half4x3" |
| 80 |
" transpose(half3x4);$es3 $pure $squareMat outerProduct($vec,$vec);$es3 $pure" |
| 81 |
" $squareHMat outerProduct($hvec,$hvec);$es3 $pure float2x3 outerProduct(float3" |
| 82 |
",float2);$es3 $pure half2x3 outerProduct(half3,half2);$es3 $pure float3x2 outerProduct" |
| 83 |
"(float2,float3);$es3 $pure half3x2 outerProduct(half2,half3);$es3 $pure float2x4" |
| 84 |
" outerProduct(float4,float2);$es3 $pure half2x4 outerProduct(half4,half2);$es3" |
| 85 |
" $pure float4x2 outerProduct(float2,float4);$es3 $pure half4x2 outerProduct" |
| 86 |
"(half2,half4);$es3 $pure float3x4 outerProduct(float4,float3);$es3 $pure half3x4" |
| 87 |
" outerProduct(half4,half3);$es3 $pure float4x3 outerProduct(float3,float4);" |
| 88 |
"$es3 $pure half4x3 outerProduct(half3,half4);$pure $bvec lessThan($vec,$vec" |
| 89 |
");$pure $bvec lessThan($hvec,$hvec);$pure $bvec lessThan($ivec,$ivec);$pure" |
| 90 |
" $bvec lessThan($svec,$svec);$pure $bvec lessThanEqual($vec,$vec);$pure $bvec" |
| 91 |
" lessThanEqual($hvec,$hvec);$pure $bvec lessThanEqual($ivec,$ivec);$pure $bvec" |
| 92 |
" lessThanEqual($svec,$svec);$pure $bvec greaterThan($vec,$vec);$pure $bvec greaterThan" |
| 93 |
"($hvec,$hvec);$pure $bvec greaterThan($ivec,$ivec);$pure $bvec greaterThan(" |
| 94 |
"$svec,$svec);$pure $bvec greaterThanEqual($vec,$vec);$pure $bvec greaterThanEqual" |
| 95 |
"($hvec,$hvec);$pure $bvec greaterThanEqual($ivec,$ivec);$pure $bvec greaterThanEqual" |
| 96 |
"($svec,$svec);$pure $bvec equal($vec,$vec);$pure $bvec equal($hvec,$hvec);$pure" |
| 97 |
" $bvec equal($ivec,$ivec);$pure $bvec equal($svec,$svec);$pure $bvec equal(" |
| 98 |
"$bvec,$bvec);$pure $bvec notEqual($vec,$vec);$pure $bvec notEqual($hvec,$hvec" |
| 99 |
");$pure $bvec notEqual($ivec,$ivec);$pure $bvec notEqual($svec,$svec);$pure" |
| 100 |
" $bvec notEqual($bvec,$bvec);$es3 $pure $bvec lessThan($usvec,$usvec);$es3 $pure" |
| 101 |
" $bvec lessThan($uvec,$uvec);$es3 $pure $bvec lessThanEqual($uvec,$uvec);$es3" |
| 102 |
" $pure $bvec lessThanEqual($usvec,$usvec);$es3 $pure $bvec greaterThan($uvec" |
| 103 |
",$uvec);$es3 $pure $bvec greaterThan($usvec,$usvec);$es3 $pure $bvec greaterThanEqual" |
| 104 |
"($uvec,$uvec);$es3 $pure $bvec greaterThanEqual($usvec,$usvec);$es3 $pure $bvec" |
| 105 |
" equal($uvec,$uvec);$es3 $pure $bvec equal($usvec,$usvec);$es3 $pure $bvec notEqual" |
| 106 |
"($uvec,$uvec);$es3 $pure $bvec notEqual($usvec,$usvec);$pure bool any($bvec" |
| 107 |
");$pure bool all($bvec);$pure $bvec not($bvec);$es3 $pure $genType dFdx($genType" |
| 108 |
");$es3 $pure $genType dFdy($genType);$es3 $pure $genHType dFdx($genHType);$es3" |
| 109 |
" $pure $genHType dFdy($genHType);$es3 $pure $genType fwidth($genType);$es3 $pure" |
| 110 |
" $genHType fwidth($genHType);$pure half4 unpremul(half4 a){return half4(a.xyz" |
| 111 |
"/max(a.w,.0001),a.w);}$pure float4 unpremul(float4 a){return float4(a.xyz/max" |
| 112 |
"(a.w,.0001),a.w);}$pure half4 $unpremul_polar(half4 a){return half4(a.x,a.yz" |
| 113 |
"/max(a.w,.0001),a.w);}$pure half4 $rgb_to_hsl(half3 b,half d){half4 e=b.y<b" |
| 114 |
".z?half4(b.zy,-1.,.6666667):half4(b.yz,0.,-.333333343);half4 f=b.x<e.x?half4" |
| 115 |
"(e.x,b.x,e.yw):half4(b.x,e.x,e.yz);half h=f.x;half i=h-min(f.y,f.z);half j=" |
| 116 |
"h-i*.5;half k=abs(f.w+(f.y-f.z)/(i*6.+.0001));half l=i/((d+.0001)-abs(j*2.-" |
| 117 |
"d));half m=j/(d+.0001);return half4(k,l,m,d);}$pure half3 $hsl_to_rgb(half3" |
| 118 |
" a){half b=(1.-abs(2.*a.z-1.))*a.y;half3 c=a.xxx+half3(0.,.6666667,.333333343" |
| 119 |
");half3 d=saturate(abs(fract(c)*6.-3.)-1.);return(d-.5)*b+a.z;}$pure half4 $hsl_to_rgb" |
| 120 |
"(half3 b,half c){return saturate(half4($hsl_to_rgb(b)*c,c));}$pure half3 $css_lab_to_xyz" |
| 121 |
"(half3 a){half3 d;d.y=(a.x+16.)*.00862069;d.x=a.y*.002+d.y;d.z=d.y-a.z*.005" |
| 122 |
";half3 g=pow(d,half3(3.));half3 h=half3(g.x>.008856452?g.x:(116.*d.x-16.)*.00110705639" |
| 123 |
",a.x>8.000001?g.y:a.x*.00110705639,g.z>.008856452?g.z:(116.*d.z-16.)*.00110705639" |
| 124 |
");return h*half3(.9642956,1.,.825104535);}$pure half3 $a(half3 a){return half3" |
| 125 |
"(a.z,a.y*cos(radians(a.x)),a.y*sin(radians(a.x)));}$pure half3 $css_hcl_to_xyz" |
| 126 |
"(half3 a){return $css_lab_to_xyz($a(a));}$pure half3 $css_oklab_to_linear_srgb" |
| 127 |
"(half3 a){half b=(a.x+.396337777*a.y)+.215803757*a.z;half c=(a.x-.105561346" |
| 128 |
"*a.y)-.06385417*a.z;half d=(a.x-.08948418*a.y)-1.29148555*a.z;half e=(b*b)*" |
| 129 |
"b;half f=(c*c)*c;half g=(d*d)*d;return half3((4.0767417*e-3.3077116*f)+.230969936" |
| 130 |
"*g,(-1.268438*e+2.60975742*f)-.341319382*g,(-.00419608643*e-.7034186*f)+1.70761466" |
| 131 |
"*g);}$pure half3 $css_okhcl_to_linear_srgb(half3 a){return $css_oklab_to_linear_srgb" |
| 132 |
"($a(a));}$pure half3 $css_oklab_gamut_map_to_linear_srgb(half3 a){const half2" |
| 133 |
" r=half2(-.014804,-.162608);const half2 s=half2(-.276786,.004193);half2 z=a" |
| 134 |
".yz;half A;half2 B;half2 C;if(dot(z,half2(.409702,-.912219))<0.)if(dot(z,half2" |
| 135 |
"(.460276,.887776))<0.)if(dot(z,half2(-.171122,.98525))<0.){A=.102047;B=r;C=" |
| 136 |
"s;}else{A=.092029;B=half2(-.038533,-.00165);C=half2(-.232572,-.094331);}else" |
| 137 |
" if(dot(z,half2(.947925,.318495))<0.){A=.081709;B=half2(-.034601,-.002215);" |
| 138 |
"C=half2(.012185,.338031);}else{A=.091132;B=half2(.07037,.034139);C=half2(.01817" |
| 139 |
",.37855);}else if(dot(z,half2(-.9068,.421562))<0.)if(dot(z,half2(-.397919,-" |
| 140 |
".917421))<0.){A=.113902;B=half2(.090836,.036251);C=half2(.226781,.018764);}" |
| 141 |
"else{A=.161739;B=half2(-.008202,-.264819);C=half2(.187156,-.284304);}else{A" |
| 142 |
"=.102047;B=r;C=s;}half D=1.;half E=dot(B,z);if(E>0.){half F=1.-a.x;half G=A" |
| 143 |
"*F;if(G<E)D=min(D,G/E);}half F=dot(C,z);if(F>0.){half G=a.x;half H=A*G;if(H" |
| 144 |
"<F)D=min(D,H/F);}a.yz*=D;return $css_oklab_to_linear_srgb(a);}$pure half3 $css_okhcl_gamut_map_to_linear_srgb" |
| 145 |
"(half3 a){return $css_oklab_gamut_map_to_linear_srgb($a(a));}$pure half3 $css_hsl_to_srgb" |
| 146 |
"(half3 b){b.x=mod(b.x,360.);if(b.x<0.)b.x+=360.;b.yz*=.01;half3 c=mod(half3" |
| 147 |
"(0.,8.,4.)+b.x*.0333333351,12.);half d=b.y*min(b.z,1.-b.z);return b.z-d*clamp" |
| 148 |
"(min(c-3.,9.-c),-1.,1.);}$pure half3 $css_hwb_to_srgb(half3 a){half3 b;a.yz" |
| 149 |
"*=.01;if(a.y+a.z>=1.)b=(a.y/(a.y+a.z)).xxx;else{b=$css_hsl_to_srgb(half3(a." |
| 150 |
"x,100.,50.));b*=(1.-a.y)-a.z;b+=a.y;}return b;}$pure half4 $interpolated_to_rgb_unpremul" |
| 151 |
"(half4 a,int b,int c){if(bool(c))switch(b){case 2:;case 3:;case 4:a=unpremul" |
| 152 |
"(a);break;case 5:;case 6:;case 7:;case 9:;case 10:a=$unpremul_polar(a);break" |
| 153 |
";}switch(b){case 2:a.xyz=$css_lab_to_xyz(a.xyz);break;case 3:a.xyz=$css_oklab_to_linear_srgb" |
| 154 |
"(a.xyz);break;case 4:a.xyz=$css_oklab_gamut_map_to_linear_srgb(a.xyz);break" |
| 155 |
";case 5:a.xyz=$css_hcl_to_xyz(a.xyz);break;case 6:a.xyz=$css_okhcl_to_linear_srgb" |
| 156 |
"(a.xyz);break;case 7:a.xyz=$css_okhcl_gamut_map_to_linear_srgb(a.xyz);break" |
| 157 |
";case 9:a.xyz=$css_hsl_to_srgb(a.xyz);break;case 10:a.xyz=$css_hwb_to_srgb(" |
| 158 |
"a.xyz);break;}return a;}"; |