xref: /aosp_15_r20/external/skia/src/sksl/generated/sksl_gpu.unoptimized.sksl (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1*c8dee2aaSAndroid Build Coastguard Workerstatic constexpr char SKSL_MINIFIED_sksl_gpu[] =
2*c8dee2aaSAndroid Build Coastguard Worker"$pure $genIType mix($genIType x,$genIType y,$genBType a);$pure $genBType mix"
3*c8dee2aaSAndroid Build Coastguard Worker"($genBType x,$genBType y,$genBType a);$pure $genType fma($genType a,$genType"
4*c8dee2aaSAndroid Build Coastguard Worker" b,$genType c);$pure $genHType fma($genHType a,$genHType b,$genHType c);$genType"
5*c8dee2aaSAndroid Build Coastguard Worker" frexp($genType x,out $genIType exp);$genHType frexp($genHType x,out $genIType"
6*c8dee2aaSAndroid Build Coastguard Worker" exp);$pure $genType ldexp($genType x,$genIType exp);$pure $genHType ldexp("
7*c8dee2aaSAndroid Build Coastguard Worker"$genHType x,$genIType exp);$pure uint packSnorm2x16(float2 v);$pure uint packUnorm4x8"
8*c8dee2aaSAndroid Build Coastguard Worker"(float4 v);$pure uint packSnorm4x8(float4 v);$pure float2 unpackSnorm2x16(uint"
9*c8dee2aaSAndroid Build Coastguard Worker" p);$pure float4 unpackUnorm4x8(uint p);$pure float4 unpackSnorm4x8(uint p)"
10*c8dee2aaSAndroid Build Coastguard Worker";$pure uint packHalf2x16(float2 v);$pure float2 unpackHalf2x16(uint v);$pure"
11*c8dee2aaSAndroid Build Coastguard Worker" $genIType bitCount($genIType value);$pure $genIType bitCount($genUType value"
12*c8dee2aaSAndroid Build Coastguard Worker");$pure $genIType findLSB($genIType value);$pure $genIType findLSB($genUType"
13*c8dee2aaSAndroid Build Coastguard Worker" value);$pure $genIType findMSB($genIType value);$pure $genIType findMSB($genUType"
14*c8dee2aaSAndroid Build Coastguard Worker" value);$pure half4 sample(sampler2D s,float2 P);$pure half4 sample(sampler2D"
15*c8dee2aaSAndroid Build Coastguard Worker" s,float3 P);$pure half4 sample(sampler2D s,float3 P,float bias);$pure half4"
16*c8dee2aaSAndroid Build Coastguard Worker" sample(samplerExternalOES s,float2 P);$pure half4 sample(samplerExternalOES"
17*c8dee2aaSAndroid Build Coastguard Worker" s,float2 P,float bias);$pure half4 sample(sampler2DRect s,float2 P);$pure half4"
18*c8dee2aaSAndroid Build Coastguard Worker" sample(sampler2DRect s,float3 P);$pure half4 sampleLod(sampler2D s,float2 P"
19*c8dee2aaSAndroid Build Coastguard Worker",float lod);$pure half4 sampleLod(sampler2D s,float3 P,float lod);$pure half4"
20*c8dee2aaSAndroid Build Coastguard Worker" sampleGrad(sampler2D s,float2,float2 dPdx,float2 dPdy);$pure half4 subpassLoad"
21*c8dee2aaSAndroid Build Coastguard Worker"(subpassInput subpass);$pure half4 subpassLoad(subpassInputMS subpass,int sample"
22*c8dee2aaSAndroid Build Coastguard Worker");$pure uint atomicLoad(atomicUint a);void atomicStore(atomicUint a,uint value"
23*c8dee2aaSAndroid Build Coastguard Worker");uint atomicAdd(atomicUint a,uint value);$pure half4 blend_clear(half4 src"
24*c8dee2aaSAndroid Build Coastguard Worker",half4 dst){return half4(0.);}$pure half4 blend_src(half4 src,half4 dst){return"
25*c8dee2aaSAndroid Build Coastguard Worker" src;}$pure half4 blend_dst(half4 src,half4 dst){return dst;}$pure half4 blend_src_over"
26*c8dee2aaSAndroid Build Coastguard Worker"(half4 src,half4 dst){return src+(1.-src.w)*dst;}$pure half4 blend_dst_over"
27*c8dee2aaSAndroid Build Coastguard Worker"(half4 src,half4 dst){return(1.-dst.w)*src+dst;}$pure half4 blend_src_in(half4"
28*c8dee2aaSAndroid Build Coastguard Worker" src,half4 dst){return src*dst.w;}$pure half4 blend_dst_in(half4 src,half4 dst"
29*c8dee2aaSAndroid Build Coastguard Worker"){return dst*src.w;}$pure half4 blend_src_out(half4 src,half4 dst){return(1."
30*c8dee2aaSAndroid Build Coastguard Worker"-dst.w)*src;}$pure half4 blend_dst_out(half4 src,half4 dst){return(1.-src.w"
31*c8dee2aaSAndroid Build Coastguard Worker")*dst;}$pure half4 blend_src_atop(half4 src,half4 dst){return dst.w*src+(1."
32*c8dee2aaSAndroid Build Coastguard Worker"-src.w)*dst;}$pure half4 blend_dst_atop(half4 src,half4 dst){return(1.-dst."
33*c8dee2aaSAndroid Build Coastguard Worker"w)*src+src.w*dst;}$pure half4 blend_xor(half4 src,half4 dst){return(1.-dst."
34*c8dee2aaSAndroid Build Coastguard Worker"w)*src+(1.-src.w)*dst;}$pure half4 blend_porter_duff(half4 blendOp,half4 src"
35*c8dee2aaSAndroid Build Coastguard Worker",half4 dst){half2 coeff=blendOp.xy+blendOp.zw*half2(dst.w,src.w);return src"
36*c8dee2aaSAndroid Build Coastguard Worker"*coeff.x+dst*coeff.y;}$pure half4 blend_plus(half4 src,half4 dst){return min"
37*c8dee2aaSAndroid Build Coastguard Worker"(src+dst,1.);}$pure half4 blend_modulate(half4 src,half4 dst){return src*dst"
38*c8dee2aaSAndroid Build Coastguard Worker";}$pure half4 blend_screen(half4 src,half4 dst){return src+(1.-src)*dst;}$pure"
39*c8dee2aaSAndroid Build Coastguard Worker" half $blend_overlay_component(half2 s,half2 d){return 2.*d.x<=d.y?(2.*s.x)"
40*c8dee2aaSAndroid Build Coastguard Worker"*d.x:s.y*d.y-(2.*(d.y-d.x))*(s.y-s.x);}$pure half4 blend_overlay(half4 src,"
41*c8dee2aaSAndroid Build Coastguard Worker"half4 dst){half4 result=half4($blend_overlay_component(src.xw,dst.xw),$blend_overlay_component"
42*c8dee2aaSAndroid Build Coastguard Worker"(src.yw,dst.yw),$blend_overlay_component(src.zw,dst.zw),src.w+(1.-src.w)*dst"
43*c8dee2aaSAndroid Build Coastguard Worker".w);result.xyz+=dst.xyz*(1.-src.w)+src.xyz*(1.-dst.w);return result;}$pure half4"
44*c8dee2aaSAndroid Build Coastguard Worker" blend_overlay(half flip,half4 a,half4 b){return blend_overlay(bool(flip)?b"
45*c8dee2aaSAndroid Build Coastguard Worker":a,bool(flip)?a:b);}$pure half4 blend_lighten(half4 src,half4 dst){half4 result"
46*c8dee2aaSAndroid Build Coastguard Worker"=blend_src_over(src,dst);result.xyz=max(result.xyz,(1.-dst.w)*src.xyz+dst.xyz"
47*c8dee2aaSAndroid Build Coastguard Worker");return result;}$pure half4 blend_darken(half mode,half4 src,half4 dst){half4"
48*c8dee2aaSAndroid Build Coastguard Worker" a=blend_src_over(src,dst);half3 b=(1.-dst.w)*src.xyz+dst.xyz;a.xyz=mode*min"
49*c8dee2aaSAndroid Build Coastguard Worker"(a.xyz*mode,b*mode);return a;}$pure half4 blend_darken(half4 src,half4 dst)"
50*c8dee2aaSAndroid Build Coastguard Worker"{return blend_darken(1.,src,dst);}const half $kMinNormalHalf=6.10351562e-05"
51*c8dee2aaSAndroid Build Coastguard Worker";const half $kGuardedDivideEpsilon=half(sk_Caps.mustGuardDivisionEvenAfterExplicitZeroCheck"
52*c8dee2aaSAndroid Build Coastguard Worker"?1e-08:0.);$pure inline half $guarded_divide(half n,half d){return n/(d+$kGuardedDivideEpsilon"
53*c8dee2aaSAndroid Build Coastguard Worker");}$pure inline half3 $guarded_divide(half3 n,half d){return n/(d+$kGuardedDivideEpsilon"
54*c8dee2aaSAndroid Build Coastguard Worker");}$pure half $color_dodge_component(half2 s,half2 d){half dxScale=half(d.x"
55*c8dee2aaSAndroid Build Coastguard Worker"==0.?0:1);half delta=dxScale*min(d.y,abs(s.y-s.x)>=$kMinNormalHalf?$guarded_divide"
56*c8dee2aaSAndroid Build Coastguard Worker"(d.x*s.y,s.y-s.x):d.y);return(delta*s.y+s.x*(1.-d.y))+d.x*(1.-s.y);}$pure half4"
57*c8dee2aaSAndroid Build Coastguard Worker" blend_color_dodge(half4 src,half4 dst){return half4($color_dodge_component"
58*c8dee2aaSAndroid Build Coastguard Worker"(src.xw,dst.xw),$color_dodge_component(src.yw,dst.yw),$color_dodge_component"
59*c8dee2aaSAndroid Build Coastguard Worker"(src.zw,dst.zw),src.w+(1.-src.w)*dst.w);}$pure half $color_burn_component(half2"
60*c8dee2aaSAndroid Build Coastguard Worker" s,half2 d){half dyTerm=d.y==d.x?d.y:0.;half delta=abs(s.x)>=$kMinNormalHalf"
61*c8dee2aaSAndroid Build Coastguard Worker"?d.y-min(d.y,$guarded_divide((d.y-d.x)*s.y,s.x)):dyTerm;return(delta*s.y+s."
62*c8dee2aaSAndroid Build Coastguard Worker"x*(1.-d.y))+d.x*(1.-s.y);}$pure half4 blend_color_burn(half4 src,half4 dst)"
63*c8dee2aaSAndroid Build Coastguard Worker"{return half4($color_burn_component(src.xw,dst.xw),$color_burn_component(src"
64*c8dee2aaSAndroid Build Coastguard Worker".yw,dst.yw),$color_burn_component(src.zw,dst.zw),src.w+(1.-src.w)*dst.w);}$pure"
65*c8dee2aaSAndroid Build Coastguard Worker" half4 blend_hard_light(half4 src,half4 dst){return blend_overlay(dst,src);"
66*c8dee2aaSAndroid Build Coastguard Worker"}$pure half $soft_light_component(half2 s,half2 d){if(2.*s.x<=s.y)return($guarded_divide"
67*c8dee2aaSAndroid Build Coastguard Worker"((d.x*d.x)*(s.y-2.*s.x),d.y)+(1.-d.y)*s.x)+d.x*((-s.y+2.*s.x)+1.);else if(4."
68*c8dee2aaSAndroid Build Coastguard Worker"*d.x<=d.y){half DSqd=d.x*d.x;half DCub=DSqd*d.x;half DaSqd=d.y*d.y;half DaCub"
69*c8dee2aaSAndroid Build Coastguard Worker"=DaSqd*d.y;return $guarded_divide(((DaSqd*(s.x-d.x*((3.*s.y-6.*s.x)-1.))+(("
70*c8dee2aaSAndroid Build Coastguard Worker"12.*d.y)*DSqd)*(s.y-2.*s.x))-(16.*DCub)*(s.y-2.*s.x))-DaCub*s.x,DaSqd);}else"
71*c8dee2aaSAndroid Build Coastguard Worker" return((d.x*((s.y-2.*s.x)+1.)+s.x)-sqrt(d.y*d.x)*(s.y-2.*s.x))-d.y*s.x;}$pure"
72*c8dee2aaSAndroid Build Coastguard Worker" half4 blend_soft_light(half4 src,half4 dst){return dst.w==0.?src:half4($soft_light_component"
73*c8dee2aaSAndroid Build Coastguard Worker"(src.xw,dst.xw),$soft_light_component(src.yw,dst.yw),$soft_light_component("
74*c8dee2aaSAndroid Build Coastguard Worker"src.zw,dst.zw),src.w+(1.-src.w)*dst.w);}$pure half4 blend_difference(half4 src"
75*c8dee2aaSAndroid Build Coastguard Worker",half4 dst){return half4((src.xyz+dst.xyz)-2.*min(src.xyz*dst.w,dst.xyz*src"
76*c8dee2aaSAndroid Build Coastguard Worker".w),src.w+(1.-src.w)*dst.w);}$pure half4 blend_exclusion(half4 src,half4 dst"
77*c8dee2aaSAndroid Build Coastguard Worker"){return half4((dst.xyz+src.xyz)-(2.*dst.xyz)*src.xyz,src.w+(1.-src.w)*dst."
78*c8dee2aaSAndroid Build Coastguard Worker"w);}$pure half4 blend_multiply(half4 src,half4 dst){return half4(((1.-src.w"
79*c8dee2aaSAndroid Build Coastguard Worker")*dst.xyz+(1.-dst.w)*src.xyz)+src.xyz*dst.xyz,src.w+(1.-src.w)*dst.w);}$pure"
80*c8dee2aaSAndroid Build Coastguard Worker" half $blend_color_luminance(half3 color){return dot(half3(.3,.59,.11),color"
81*c8dee2aaSAndroid Build Coastguard Worker");}$pure half3 $blend_set_color_luminance(half3 hueSatColor,half alpha,half3"
82*c8dee2aaSAndroid Build Coastguard Worker" lumColor){half lum=$blend_color_luminance(lumColor);half3 result=(lum-$blend_color_luminance"
83*c8dee2aaSAndroid Build Coastguard Worker"(hueSatColor))+hueSatColor;half minComp=min(min(result.x,result.y),result.z"
84*c8dee2aaSAndroid Build Coastguard Worker");half maxComp=max(max(result.x,result.y),result.z);if(minComp<0.&&lum!=minComp"
85*c8dee2aaSAndroid Build Coastguard Worker")result=lum+(result-lum)*$guarded_divide(lum,(lum-minComp)+$kMinNormalHalf)"
86*c8dee2aaSAndroid Build Coastguard Worker";if(maxComp>alpha&&maxComp!=lum)result=lum+$guarded_divide((result-lum)*(alpha"
87*c8dee2aaSAndroid Build Coastguard Worker"-lum),(maxComp-lum)+$kMinNormalHalf);return result;}$pure half $blend_color_saturation"
88*c8dee2aaSAndroid Build Coastguard Worker"(half3 color){return max(max(color.x,color.y),color.z)-min(min(color.x,color"
89*c8dee2aaSAndroid Build Coastguard Worker".y),color.z);}$pure half3 $blend_set_color_saturation(half3 color,half3 satColor"
90*c8dee2aaSAndroid Build Coastguard Worker"){half mn=min(min(color.x,color.y),color.z);half mx=max(max(color.x,color.y"
91*c8dee2aaSAndroid Build Coastguard Worker"),color.z);return mx>mn?((color-mn)*$blend_color_saturation(satColor))/(mx-"
92*c8dee2aaSAndroid Build Coastguard Worker"mn):half3(0.);}$pure half4 blend_hslc(half2 flipSat,half4 src,half4 dst){half"
93*c8dee2aaSAndroid Build Coastguard Worker" alpha=dst.w*src.w;half3 sda=src.xyz*dst.w;half3 dsa=dst.xyz*src.w;half3 l="
94*c8dee2aaSAndroid Build Coastguard Worker"bool(flipSat.x)?dsa:sda;half3 r=bool(flipSat.x)?sda:dsa;if(bool(flipSat.y))"
95*c8dee2aaSAndroid Build Coastguard Worker"{l=$blend_set_color_saturation(l,r);r=dsa;}return half4(((($blend_set_color_luminance"
96*c8dee2aaSAndroid Build Coastguard Worker"(l,alpha,r)+dst.xyz)-dsa)+src.xyz)-sda,(src.w+dst.w)-alpha);}$pure half4 blend_hue"
97*c8dee2aaSAndroid Build Coastguard Worker"(half4 src,half4 dst){return blend_hslc(half2(0.,1.),src,dst);}$pure half4 blend_saturation"
98*c8dee2aaSAndroid Build Coastguard Worker"(half4 src,half4 dst){return blend_hslc(half2(1.),src,dst);}$pure half4 blend_color"
99*c8dee2aaSAndroid Build Coastguard Worker"(half4 src,half4 dst){return blend_hslc(half2(0.),src,dst);}$pure half4 blend_luminosity"
100*c8dee2aaSAndroid Build Coastguard Worker"(half4 src,half4 dst){return blend_hslc(half2(1.,0.),src,dst);}$pure float2"
101*c8dee2aaSAndroid Build Coastguard Worker" proj(float3 p){return p.xy/p.z;}$pure float cross_length_2d(float2 a,float2"
102*c8dee2aaSAndroid Build Coastguard Worker" b){return determinant(float2x2(a,b));}$pure half cross_length_2d(half2 a,half2"
103*c8dee2aaSAndroid Build Coastguard Worker" b){return determinant(half2x2(a,b));}$pure float2 perp(float2 v){return float2"
104*c8dee2aaSAndroid Build Coastguard Worker"(-v.y,v.x);}$pure half2 perp(half2 v){return half2(-v.y,v.x);}$pure float coverage_bias"
105*c8dee2aaSAndroid Build Coastguard Worker"(float scale){return 1.-.5*scale;}";
106