1 2out vec4 sk_FragColor; 3uniform vec4 color; 4vec4 blend_src_in_h4h4h4(vec4 src, vec4 dst) { 5 return src * dst.w; 6} 7vec4 blend_dst_in_h4h4h4(vec4 src, vec4 dst) { 8 return dst * src.w; 9} 10vec3 _blend_set_color_luminance_h3h3hh3(vec3 hueSatColor, float alpha, vec3 lumColor) { 11 float lum = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), lumColor); 12 vec3 result = (lum - dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), hueSatColor)) + hueSatColor; 13 float minComp = min(min(result.x, result.y), result.z); 14 float maxComp = max(max(result.x, result.y), result.z); 15 if (minComp < 0.0 && lum != minComp) { 16 result = lum + (result - lum) * (lum / (lum - minComp)); 17 } 18 if (maxComp > alpha && maxComp != lum) { 19 return lum + ((result - lum) * (alpha - lum)) / (maxComp - lum); 20 } else { 21 return result; 22 } 23} 24vec3 _blend_set_color_saturation_helper_h3h3h(vec3 minMidMax, float sat) { 25 if (minMidMax.x < minMidMax.z) { 26 return vec3(0.0, (sat * (minMidMax.y - minMidMax.x)) / (minMidMax.z - minMidMax.x), sat); 27 } else { 28 return vec3(0.0); 29 } 30} 31vec3 _blend_set_color_saturation_h3h3h3(vec3 hueLumColor, vec3 satColor) { 32 float sat = max(max(satColor.x, satColor.y), satColor.z) - min(min(satColor.x, satColor.y), satColor.z); 33 if (hueLumColor.x <= hueLumColor.y) { 34 if (hueLumColor.y <= hueLumColor.z) { 35 return _blend_set_color_saturation_helper_h3h3h(hueLumColor, sat); 36 } else if (hueLumColor.x <= hueLumColor.z) { 37 return _blend_set_color_saturation_helper_h3h3h(hueLumColor.xzy, sat).xzy; 38 } else { 39 return _blend_set_color_saturation_helper_h3h3h(hueLumColor.zxy, sat).yzx; 40 } 41 } else if (hueLumColor.x <= hueLumColor.z) { 42 return _blend_set_color_saturation_helper_h3h3h(hueLumColor.yxz, sat).yxz; 43 } else if (hueLumColor.y <= hueLumColor.z) { 44 return _blend_set_color_saturation_helper_h3h3h(hueLumColor.yzx, sat).zxy; 45 } else { 46 return _blend_set_color_saturation_helper_h3h3h(hueLumColor.zyx, sat).zyx; 47 } 48} 49vec4 blend_hue_h4h4h4(vec4 src, vec4 dst) { 50 float alpha = dst.w * src.w; 51 vec3 sda = src.xyz * dst.w; 52 vec3 dsa = dst.xyz * src.w; 53 return vec4((((_blend_set_color_luminance_h3h3hh3(_blend_set_color_saturation_h3h3h3(sda, dsa), alpha, dsa) + dst.xyz) - dsa) + src.xyz) - sda, (src.w + dst.w) - alpha); 54} 55float singleuse_h() { 56 return 1.25; 57} 58float add_hhh(float a, float b) { 59 float c = a + b; 60 return c; 61} 62float mul_hhh(float a, float b) { 63 return a * b; 64} 65float fma_hhhh(float a, float b, float c) { 66 return add_hhh(mul_hhh(a, b), c); 67} 68void main() { 69 sk_FragColor = vec4(fma_hhhh(color.x, color.y, color.z)); 70 sk_FragColor *= singleuse_h(); 71 sk_FragColor *= blend_src_in_h4h4h4(color.xxyy, color.zzww); 72 sk_FragColor *= blend_dst_in_h4h4h4(color.xxyy, color.zzww); 73 sk_FragColor *= blend_hue_h4h4h4(color, color.wwww); 74 sk_FragColor *= blend_hue_h4h4h4(color, color.wzyx); 75} 76