| 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 $genType" |
| " modf($genType x,out $genType i);$es3 $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);}$pure" |
| " half4 premul(half4 color){return half4(color.xyz*color.w,color.w);}$pure float4" |
| " premul(float4 color){return float4(color.xyz*color.w,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 e=.008856452" |
| ";half3 f;f.y=(lab.x+16.)*.00862069;f.x=lab.y*.002+f.y;f.z=f.y-lab.z*.005;half3" |
| " f_cubed=pow(f,half3(3.));half3 xyz=half3(f_cubed.x>e?f_cubed.x:(116.*f.x-16." |
| ")*.00110705639,lab.x>8.000001?f_cubed.y:lab.x*.00110705639,f_cubed.z>e?f_cubed" |
| ".z:(116.*f.z-16.)*.00110705639);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_oklab_gamut_map_to_linear_srgb" |
| "(half3 oklab){const half2 normal_R=half2(.409702,-.912219);const half2 normal_M" |
| "=half2(-.397919,-.917421);const half2 normal_B=half2(-.9068,.421562);const half2" |
| " normal_C=half2(-.171122,.98525);const half2 normal_G=half2(.460276,.887776" |
| ");const half2 normal_Y=half2(.947925,.318495);const half c0_YR=.091132;const" |
| " half2 cW_YR=half2(.07037,.034139);const half2 cK_YR=half2(.01817,.37855);const" |
| " half c0_RM=.113902;const half2 cW_RM=half2(.090836,.036251);const half2 cK_RM" |
| "=half2(.226781,.018764);const half c0_MB=.161739;const half2 cW_MB=half2(-.008202" |
| ",-.264819);const half2 cK_MB=half2(.187156,-.284304);const half c0_BC=.102047" |
| ";const half2 cW_BC=half2(-.014804,-.162608);const half2 cK_BC=half2(-.276786" |
| ",.004193);const half c0_CG=.092029;const half2 cW_CG=half2(-.038533,-.00165" |
| ");const half2 cK_CG=half2(-.232572,-.094331);const half c0_GY=.081709;const" |
| " half2 cW_GY=half2(-.034601,-.002215);const half2 cK_GY=half2(.012185,.338031" |
| ");half2 ab=oklab.yz;half c0;half2 cW;half2 cK;if(dot(ab,normal_R)<0.)if(dot" |
| "(ab,normal_G)<0.)if(dot(ab,normal_C)<0.){c0=c0_BC;cW=cW_BC;cK=cK_BC;}else{c0" |
| "=c0_CG;cW=cW_CG;cK=cK_CG;}else if(dot(ab,normal_Y)<0.){c0=c0_GY;cW=cW_GY;cK" |
| "=cK_GY;}else{c0=c0_YR;cW=cW_YR;cK=cK_YR;}else if(dot(ab,normal_B)<0.)if(dot" |
| "(ab,normal_M)<0.){c0=c0_RM;cW=cW_RM;cK=cK_RM;}else{c0=c0_MB;cW=cW_MB;cK=cK_MB" |
| ";}else{c0=c0_BC;cW=cW_BC;cK=cK_BC;}half alpha=1.;half w_denom=dot(cW,ab);if" |
| "(w_denom>0.){half one_minus_L=1.-oklab.x;half w_num=c0*one_minus_L;if(w_num" |
| "<w_denom)alpha=min(alpha,w_num/w_denom);}half k_denom=dot(cK,ab);if(k_denom" |
| ">0.){half L=oklab.x;half k_num=c0*L;if(k_num<k_denom)alpha=min(alpha,k_num/" |
| "k_denom);}oklab.yz*=alpha;return $css_oklab_to_linear_srgb(oklab);}$export $pure" |
| " half3 $css_okhcl_gamut_map_to_linear_srgb(half3 okhcl){return $css_oklab_gamut_map_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*=.01;half3 k=mod(half3(0." |
| ",8.,4.)+hsl.x*.0333333351,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){half3 rgb;hwb.yz*=.01;if(hwb.y+hwb.z>=1.)rgb=(hwb.y/(hwb.y+hwb.z)).xxx" |
| ";else{rgb=$css_hsl_to_srgb(half3(hwb.x,100.,50.));rgb*=(1.-hwb.y)-hwb.z;rgb" |
| "+=hwb.y;}return rgb;}$export $pure half4 $interpolated_to_rgb_unpremul(half4" |
| " color,int colorSpace,int doUnpremul){if(bool(doUnpremul))switch(colorSpace" |
| "){case 2:;case 3:;case 4:color=unpremul(color);break;case 5:;case 6:;case 7" |
| ":;case 9:;case 10:color=$unpremul_polar(color);break;}switch(colorSpace){case" |
| " 2:color.xyz=$css_lab_to_xyz(color.xyz);break;case 3:color.xyz=$css_oklab_to_linear_srgb" |
| "(color.xyz);break;case 4:color.xyz=$css_oklab_gamut_map_to_linear_srgb(color" |
| ".xyz);break;case 5:color.xyz=$css_hcl_to_xyz(color.xyz);break;case 6:color." |
| "xyz=$css_okhcl_to_linear_srgb(color.xyz);break;case 7:color.xyz=$css_okhcl_gamut_map_to_linear_srgb" |
| "(color.xyz);break;case 9:color.xyz=$css_hsl_to_srgb(color.xyz);break;case 10" |
| ":color.xyz=$css_hwb_to_srgb(color.xyz);break;}return color;}"; |