xref: /aosp_15_r20/external/skia/src/sksl/generated/sksl_shared.unoptimized.sksl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1static constexpr char SKSL_MINIFIED_sksl_shared[] =
2"$pure $genType radians($genType degrees);$pure $genHType radians($genHType degrees"
3");$pure $genType degrees($genType radians);$pure $genHType degrees($genHType"
4" radians);$pure $genType sin($genType angle);$pure $genHType sin($genHType angle"
5");$pure $genType cos($genType angle);$pure $genHType cos($genHType angle);$pure"
6" $genType tan($genType angle);$pure $genHType tan($genHType angle);$pure $genType"
7" asin($genType x);$pure $genHType asin($genHType x);$pure $genType acos($genType"
8" x);$pure $genHType acos($genHType x);$pure $genType atan($genType y,$genType"
9" x);$pure $genHType atan($genHType y,$genHType x);$pure $genType atan($genType"
10" y_over_x);$pure $genHType atan($genHType y_over_x);$es3 $pure $genType sinh"
11"($genType x);$es3 $pure $genHType sinh($genHType x);$es3 $pure $genType cosh"
12"($genType x);$es3 $pure $genHType cosh($genHType x);$es3 $pure $genType tanh"
13"($genType x);$es3 $pure $genHType tanh($genHType x);$es3 $pure $genType asinh"
14"($genType x);$es3 $pure $genHType asinh($genHType x);$es3 $pure $genType acosh"
15"($genType x);$es3 $pure $genHType acosh($genHType x);$es3 $pure $genType atanh"
16"($genType x);$es3 $pure $genHType atanh($genHType x);$pure $genType pow($genType"
17" x,$genType y);$pure $genHType pow($genHType x,$genHType y);$pure $genType exp"
18"($genType x);$pure $genHType exp($genHType x);$pure $genType log($genType x"
19");$pure $genHType log($genHType x);$pure $genType exp2($genType x);$pure $genHType"
20" exp2($genHType x);$pure $genType log2($genType x);$pure $genHType log2($genHType"
21" x);$pure $genType sqrt($genType x);$pure $genHType sqrt($genHType x);$pure"
22" $genType inversesqrt($genType x);$pure $genHType inversesqrt($genHType x);"
23"$pure $genType abs($genType x);$pure $genHType abs($genHType x);$pure $genType"
24" sign($genType x);$pure $genHType sign($genHType x);$pure $genType floor($genType"
25" x);$pure $genHType floor($genHType x);$pure $genType ceil($genType x);$pure"
26" $genHType ceil($genHType x);$pure $genType fract($genType x);$pure $genHType"
27" fract($genHType x);$pure $genType mod($genType x,float y);$pure $genType mod"
28"($genType x,$genType y);$pure $genHType mod($genHType x,half y);$pure $genHType"
29" mod($genHType x,$genHType y);$pure $genType min($genType x,$genType y);$pure"
30" $genType min($genType x,float y);$pure $genHType min($genHType x,$genHType"
31" y);$pure $genHType min($genHType x,half y);$pure $genType max($genType x,$genType"
32" y);$pure $genType max($genType x,float y);$pure $genHType max($genHType x,"
33"$genHType y);$pure $genHType max($genHType x,half y);$pure $genType clamp($genType"
34" x,$genType minVal,$genType maxVal);$pure $genType clamp($genType x,float minVal"
35",float maxVal);$pure $genHType clamp($genHType x,$genHType minVal,$genHType"
36" maxVal);$pure $genHType clamp($genHType x,half minVal,half maxVal);$pure $genType"
37" saturate($genType x);$pure $genHType saturate($genHType x);$pure $genType mix"
38"($genType x,$genType y,$genType a);$pure $genType mix($genType x,$genType y"
39",float a);$pure $genHType mix($genHType x,$genHType y,$genHType a);$pure $genHType"
40" mix($genHType x,$genHType y,half a);$pure $genType step($genType edge,$genType"
41" x);$pure $genType step(float edge,$genType x);$pure $genHType step($genHType"
42" edge,$genHType x);$pure $genHType step(half edge,$genHType x);$pure $genType"
43" smoothstep($genType edge0,$genType edge1,$genType x);$pure $genType smoothstep"
44"(float edge0,float edge1,$genType x);$pure $genHType smoothstep($genHType edge0"
45",$genHType edge1,$genHType x);$pure $genHType smoothstep(half edge0,half edge1"
46",$genHType x);$es3 $pure $genIType abs($genIType x);$es3 $pure $genIType sign"
47"($genIType x);$es3 $pure $genIType floatBitsToInt($genType value);$es3 $pure"
48" $genUType floatBitsToUint($genType value);$es3 $pure $genType intBitsToFloat"
49"($genIType value);$es3 $pure $genType uintBitsToFloat($genUType value);$es3"
50" $pure $genType trunc($genType x);$es3 $pure $genHType trunc($genHType x);$es3"
51" $pure $genType round($genType x);$es3 $pure $genHType round($genHType x);$es3"
52" $pure $genType roundEven($genType x);$es3 $pure $genHType roundEven($genHType"
53" x);$es3 $pure $genIType min($genIType x,$genIType y);$es3 $pure $genIType min"
54"($genIType x,int y);$es3 $pure $genUType min($genUType x,$genUType y);$es3 $pure"
55" $genUType min($genUType x,uint y);$es3 $pure $genIType max($genIType x,$genIType"
56" y);$es3 $pure $genIType max($genIType x,int y);$es3 $pure $genUType max($genUType"
57" x,$genUType y);$es3 $pure $genUType max($genUType x,uint y);$es3 $pure $genIType"
58" clamp($genIType x,$genIType minVal,$genIType maxVal);$es3 $pure $genIType clamp"
59"($genIType x,int minVal,int maxVal);$es3 $pure $genUType clamp($genUType x,"
60"$genUType minVal,$genUType maxVal);$es3 $pure $genUType clamp($genUType x,uint"
61" minVal,uint maxVal);$es3 $pure $genType mix($genType x,$genType y,$genBType"
62" a);$es3 $pure $genHType mix($genHType x,$genHType y,$genBType a);$es3 $pure"
63" $genBType isnan($genType x);$es3 $pure $genBType isnan($genHType x);$es3 $pure"
64" $genBType isinf($genType x);$es3 $pure $genBType isinf($genHType x);$es3 $genType"
65" modf($genType x,out $genType i);$es3 $genHType modf($genHType x,out $genHType"
66" i);$es3 $pure uint packUnorm2x16(float2 v);$es3 $pure float2 unpackUnorm2x16"
67"(uint p);$pure float length($genType x);$pure half length($genHType x);$pure"
68" float distance($genType p0,$genType p1);$pure half distance($genHType p0,$genHType"
69" p1);$pure float dot($genType x,$genType y);$pure half dot($genHType x,$genHType"
70" y);$pure float3 cross(float3 x,float3 y);$pure half3 cross(half3 x,half3 y"
71");$pure $genType normalize($genType x);$pure $genHType normalize($genHType x"
72");$pure $genType faceforward($genType N,$genType I,$genType Nref);$pure $genHType"
73" faceforward($genHType N,$genHType I,$genHType Nref);$pure $genType reflect"
74"($genType I,$genType N);$pure $genHType reflect($genHType I,$genHType N);$pure"
75" $genType refract($genType I,$genType N,float eta);$pure $genHType refract("
76"$genHType I,$genHType N,half eta);$pure $squareMat matrixCompMult($squareMat"
77" x,$squareMat y);$pure $squareHMat matrixCompMult($squareHMat x,$squareHMat"
78" y);$es3 $pure $mat matrixCompMult($mat x,$mat y);$es3 $pure $hmat matrixCompMult"
79"($hmat x,$hmat y);$pure $squareMat inverse($squareMat m);$pure $squareHMat inverse"
80"($squareHMat m);$es3 $pure float determinant($squareMat m);$es3 $pure half determinant"
81"($squareHMat m);$es3 $pure $squareMat transpose($squareMat m);$es3 $pure $squareHMat"
82" transpose($squareHMat m);$es3 $pure float2x3 transpose(float3x2 m);$es3 $pure"
83" half2x3 transpose(half3x2 m);$es3 $pure float2x4 transpose(float4x2 m);$es3"
84" $pure half2x4 transpose(half4x2 m);$es3 $pure float3x2 transpose(float2x3 m"
85");$es3 $pure half3x2 transpose(half2x3 m);$es3 $pure float3x4 transpose(float4x3"
86" m);$es3 $pure half3x4 transpose(half4x3 m);$es3 $pure float4x2 transpose(float2x4"
87" m);$es3 $pure half4x2 transpose(half2x4 m);$es3 $pure float4x3 transpose(float3x4"
88" m);$es3 $pure half4x3 transpose(half3x4 m);$es3 $pure $squareMat outerProduct"
89"($vec c,$vec r);$es3 $pure $squareHMat outerProduct($hvec c,$hvec r);$es3 $pure"
90" float2x3 outerProduct(float3 c,float2 r);$es3 $pure half2x3 outerProduct(half3"
91" c,half2 r);$es3 $pure float3x2 outerProduct(float2 c,float3 r);$es3 $pure half3x2"
92" outerProduct(half2 c,half3 r);$es3 $pure float2x4 outerProduct(float4 c,float2"
93" r);$es3 $pure half2x4 outerProduct(half4 c,half2 r);$es3 $pure float4x2 outerProduct"
94"(float2 c,float4 r);$es3 $pure half4x2 outerProduct(half2 c,half4 r);$es3 $pure"
95" float3x4 outerProduct(float4 c,float3 r);$es3 $pure half3x4 outerProduct(half4"
96" c,half3 r);$es3 $pure float4x3 outerProduct(float3 c,float4 r);$es3 $pure half4x3"
97" outerProduct(half3 c,half4 r);$pure $bvec lessThan($vec x,$vec y);$pure $bvec"
98" lessThan($hvec x,$hvec y);$pure $bvec lessThan($ivec x,$ivec y);$pure $bvec"
99" lessThan($svec x,$svec y);$pure $bvec lessThanEqual($vec x,$vec y);$pure $bvec"
100" lessThanEqual($hvec x,$hvec y);$pure $bvec lessThanEqual($ivec x,$ivec y);"
101"$pure $bvec lessThanEqual($svec x,$svec y);$pure $bvec greaterThan($vec x,$vec"
102" y);$pure $bvec greaterThan($hvec x,$hvec y);$pure $bvec greaterThan($ivec x"
103",$ivec y);$pure $bvec greaterThan($svec x,$svec y);$pure $bvec greaterThanEqual"
104"($vec x,$vec y);$pure $bvec greaterThanEqual($hvec x,$hvec y);$pure $bvec greaterThanEqual"
105"($ivec x,$ivec y);$pure $bvec greaterThanEqual($svec x,$svec y);$pure $bvec"
106" equal($vec x,$vec y);$pure $bvec equal($hvec x,$hvec y);$pure $bvec equal("
107"$ivec x,$ivec y);$pure $bvec equal($svec x,$svec y);$pure $bvec equal($bvec"
108" x,$bvec y);$pure $bvec notEqual($vec x,$vec y);$pure $bvec notEqual($hvec x"
109",$hvec y);$pure $bvec notEqual($ivec x,$ivec y);$pure $bvec notEqual($svec x"
110",$svec y);$pure $bvec notEqual($bvec x,$bvec y);$es3 $pure $bvec lessThan($usvec"
111" x,$usvec y);$es3 $pure $bvec lessThan($uvec x,$uvec y);$es3 $pure $bvec lessThanEqual"
112"($uvec x,$uvec y);$es3 $pure $bvec lessThanEqual($usvec x,$usvec y);$es3 $pure"
113" $bvec greaterThan($uvec x,$uvec y);$es3 $pure $bvec greaterThan($usvec x,$usvec"
114" y);$es3 $pure $bvec greaterThanEqual($uvec x,$uvec y);$es3 $pure $bvec greaterThanEqual"
115"($usvec x,$usvec y);$es3 $pure $bvec equal($uvec x,$uvec y);$es3 $pure $bvec"
116" equal($usvec x,$usvec y);$es3 $pure $bvec notEqual($uvec x,$uvec y);$es3 $pure"
117" $bvec notEqual($usvec x,$usvec y);$pure bool any($bvec x);$pure bool all($bvec"
118" x);$pure $bvec not($bvec x);$es3 $pure $genType dFdx($genType p);$es3 $pure"
119" $genType dFdy($genType p);$es3 $pure $genHType dFdx($genHType p);$es3 $pure"
120" $genHType dFdy($genHType p);$es3 $pure $genType fwidth($genType p);$es3 $pure"
121" $genHType fwidth($genHType p);$pure half4 unpremul(half4 color){return half4"
122"(color.xyz/max(color.w,.0001),color.w);}$pure float4 unpremul(float4 color)"
123"{return float4(color.xyz/max(color.w,.0001),color.w);}$export $pure half4 $unpremul_polar"
124"(half4 color){return half4(color.x,color.yz/max(color.w,.0001),color.w);}$export"
125" $pure half4 $rgb_to_hsl(half3 c,half a){half4 p=c.y<c.z?half4(c.zy,-1.,.6666667"
126"):half4(c.yz,0.,-.333333343);half4 q=c.x<p.x?half4(p.x,c.x,p.yw):half4(c.x,"
127"p.x,p.yz);const half kEps=.0001;half pmV=q.x;half pmC=pmV-min(q.y,q.z);half"
128" pmL=pmV-pmC*.5;half H=abs(q.w+(q.y-q.z)/(pmC*6.+kEps));half S=pmC/((a+kEps"
129")-abs(pmL*2.-a));half L=pmL/(a+kEps);return half4(H,S,L,a);}$export $pure half3"
130" $hsl_to_rgb(half3 hsl){half C=(1.-abs(2.*hsl.z-1.))*hsl.y;half3 p=hsl.xxx+"
131"half3(0.,.6666667,.333333343);half3 q=saturate(abs(fract(p)*6.-3.)-1.);return"
132"(q-.5)*C+hsl.z;}$export $pure half4 $hsl_to_rgb(half3 hsl,half a){return saturate"
133"(half4($hsl_to_rgb(hsl)*a,a));}$export $pure half3 $css_lab_to_xyz(half3 lab"
134"){const half e=.008856452;half3 f;f.y=(lab.x+16.)*.00862069;f.x=lab.y*.002+"
135"f.y;f.z=f.y-lab.z*.005;half3 f_cubed=pow(f,half3(3.));half3 xyz=half3(f_cubed"
136".x>e?f_cubed.x:(116.*f.x-16.)*.00110705639,lab.x>8.000001?f_cubed.y:lab.x*.00110705639"
137",f_cubed.z>e?f_cubed.z:(116.*f.z-16.)*.00110705639);const half3 D50=half3(.9642956"
138",1.,.825104535);return xyz*D50;}$pure half3 $css_hcl_to_lab(half3 hcl){return"
139" half3(hcl.z,hcl.y*cos(radians(hcl.x)),hcl.y*sin(radians(hcl.x)));}$export $pure"
140" half3 $css_hcl_to_xyz(half3 hcl){return $css_lab_to_xyz($css_hcl_to_lab(hcl"
141"));}$export $pure half3 $css_oklab_to_linear_srgb(half3 oklab){half l_=(oklab"
142".x+.396337777*oklab.y)+.215803757*oklab.z;half m_=(oklab.x-.105561346*oklab"
143".y)-.06385417*oklab.z;half s_=(oklab.x-.08948418*oklab.y)-1.29148555*oklab."
144"z;half l=(l_*l_)*l_;half m=(m_*m_)*m_;half s=(s_*s_)*s_;return half3((4.0767417"
145"*l-3.3077116*m)+.230969936*s,(-1.268438*l+2.60975742*m)-.341319382*s,(-.00419608643"
146"*l-.7034186*m)+1.70761466*s);}$export $pure half3 $css_okhcl_to_linear_srgb"
147"(half3 okhcl){return $css_oklab_to_linear_srgb($css_hcl_to_lab(okhcl));}$export"
148" $pure half3 $css_oklab_gamut_map_to_linear_srgb(half3 oklab){const half2 normal_R"
149"=half2(.409702,-.912219);const half2 normal_M=half2(-.397919,-.917421);const"
150" half2 normal_B=half2(-.9068,.421562);const half2 normal_C=half2(-.171122,.98525"
151");const half2 normal_G=half2(.460276,.887776);const half2 normal_Y=half2(.947925"
152",.318495);const half c0_YR=.091132;const half2 cW_YR=half2(.07037,.034139);"
153"const half2 cK_YR=half2(.01817,.37855);const half c0_RM=.113902;const half2"
154" cW_RM=half2(.090836,.036251);const half2 cK_RM=half2(.226781,.018764);const"
155" half c0_MB=.161739;const half2 cW_MB=half2(-.008202,-.264819);const half2 cK_MB"
156"=half2(.187156,-.284304);const half c0_BC=.102047;const half2 cW_BC=half2(-"
157".014804,-.162608);const half2 cK_BC=half2(-.276786,.004193);const half c0_CG"
158"=.092029;const half2 cW_CG=half2(-.038533,-.00165);const half2 cK_CG=half2("
159"-.232572,-.094331);const half c0_GY=.081709;const half2 cW_GY=half2(-.034601"
160",-.002215);const half2 cK_GY=half2(.012185,.338031);half2 ab=oklab.yz;half c0"
161";half2 cW;half2 cK;if(dot(ab,normal_R)<0.)if(dot(ab,normal_G)<0.)if(dot(ab,"
162"normal_C)<0.){c0=c0_BC;cW=cW_BC;cK=cK_BC;}else{c0=c0_CG;cW=cW_CG;cK=cK_CG;}"
163"else if(dot(ab,normal_Y)<0.){c0=c0_GY;cW=cW_GY;cK=cK_GY;}else{c0=c0_YR;cW=cW_YR"
164";cK=cK_YR;}else if(dot(ab,normal_B)<0.)if(dot(ab,normal_M)<0.){c0=c0_RM;cW="
165"cW_RM;cK=cK_RM;}else{c0=c0_MB;cW=cW_MB;cK=cK_MB;}else{c0=c0_BC;cW=cW_BC;cK="
166"cK_BC;}half alpha=1.;half w_denom=dot(cW,ab);if(w_denom>0.){half one_minus_L"
167"=1.-oklab.x;half w_num=c0*one_minus_L;if(w_num<w_denom)alpha=min(alpha,w_num"
168"/w_denom);}half k_denom=dot(cK,ab);if(k_denom>0.){half L=oklab.x;half k_num"
169"=c0*L;if(k_num<k_denom)alpha=min(alpha,k_num/k_denom);}oklab.yz*=alpha;return"
170" $css_oklab_to_linear_srgb(oklab);}$export $pure half3 $css_okhcl_gamut_map_to_linear_srgb"
171"(half3 okhcl){return $css_oklab_gamut_map_to_linear_srgb($css_hcl_to_lab(okhcl"
172"));}$export $pure half3 $css_hsl_to_srgb(half3 hsl){hsl.x=mod(hsl.x,360.);if"
173"(hsl.x<0.)hsl.x+=360.;hsl.yz*=.01;half3 k=mod(half3(0.,8.,4.)+hsl.x*.0333333351"
174",12.);half a=hsl.y*min(hsl.z,1.-hsl.z);return hsl.z-a*clamp(min(k-3.,9.-k),"
175"-1.,1.);}$export $pure half3 $css_hwb_to_srgb(half3 hwb){half3 rgb;hwb.yz*="
176".01;if(hwb.y+hwb.z>=1.)rgb=(hwb.y/(hwb.y+hwb.z)).xxx;else{rgb=$css_hsl_to_srgb"
177"(half3(hwb.x,100.,50.));rgb*=(1.-hwb.y)-hwb.z;rgb+=hwb.y;}return rgb;}$export"
178" $pure half4 $interpolated_to_rgb_unpremul(half4 color,int colorSpace,int doUnpremul"
179"){if(bool(doUnpremul))switch(colorSpace){case 2:;case 3:;case 4:color=unpremul"
180"(color);break;case 5:;case 6:;case 7:;case 9:;case 10:color=$unpremul_polar"
181"(color);break;}switch(colorSpace){case 2:color.xyz=$css_lab_to_xyz(color.xyz"
182");break;case 3:color.xyz=$css_oklab_to_linear_srgb(color.xyz);break;case 4:"
183"color.xyz=$css_oklab_gamut_map_to_linear_srgb(color.xyz);break;case 5:color"
184".xyz=$css_hcl_to_xyz(color.xyz);break;case 6:color.xyz=$css_okhcl_to_linear_srgb"
185"(color.xyz);break;case 7:color.xyz=$css_okhcl_gamut_map_to_linear_srgb(color"
186".xyz);break;case 9:color.xyz=$css_hsl_to_srgb(color.xyz);break;case 10:color"
187".xyz=$css_hwb_to_srgb(color.xyz);break;}return color;}";
188