2020-09-21 21:01:22 +00:00
|
|
|
#version 400
|
2020-09-25 17:35:58 +00:00
|
|
|
out vec4 sk_FragColor;
|
2020-11-23 19:48:06 +00:00
|
|
|
vec3 _blend_set_color_saturation_helper(vec3 minMidMax, float sat) {
|
|
|
|
return minMidMax.x < minMidMax.z ? vec3(0.0, (sat * (minMidMax.y - minMidMax.x)) / (minMidMax.z - minMidMax.x), sat) : vec3(0.0);
|
|
|
|
}
|
2020-10-06 18:43:32 +00:00
|
|
|
in vec4 src;
|
|
|
|
in vec4 dst;
|
2020-10-15 14:32:04 +00:00
|
|
|
void main() {
|
|
|
|
vec4 _0_blend_saturation;
|
2020-12-15 22:50:21 +00:00
|
|
|
float _1_alpha;
|
|
|
|
vec3 _2_sda;
|
|
|
|
vec3 _3_dsa;
|
|
|
|
_1_alpha = dst.w * src.w;
|
|
|
|
_2_sda = src.xyz * dst.w;
|
|
|
|
_3_dsa = dst.xyz * src.w;
|
2020-12-15 20:21:03 +00:00
|
|
|
vec3 _4_blend_set_color_saturation;
|
|
|
|
float _5_13_blend_color_saturation;
|
2020-12-15 22:50:21 +00:00
|
|
|
float _6_sat;
|
2020-12-15 20:21:03 +00:00
|
|
|
_5_13_blend_color_saturation = max(max(_2_sda.x, _2_sda.y), _2_sda.z) - min(min(_2_sda.x, _2_sda.y), _2_sda.z);
|
2020-09-21 21:01:22 +00:00
|
|
|
|
2020-12-15 22:50:21 +00:00
|
|
|
_6_sat = _5_13_blend_color_saturation;
|
2020-12-15 20:21:03 +00:00
|
|
|
|
|
|
|
if (_3_dsa.x <= _3_dsa.y) {
|
|
|
|
if (_3_dsa.y <= _3_dsa.z) {
|
|
|
|
_4_blend_set_color_saturation = _blend_set_color_saturation_helper(_3_dsa, _6_sat);
|
|
|
|
} else if (_3_dsa.x <= _3_dsa.z) {
|
|
|
|
_4_blend_set_color_saturation = _blend_set_color_saturation_helper(_3_dsa.xzy, _6_sat).xzy;
|
|
|
|
} else {
|
|
|
|
_4_blend_set_color_saturation = _blend_set_color_saturation_helper(_3_dsa.zxy, _6_sat).yzx;
|
2020-10-15 14:32:04 +00:00
|
|
|
}
|
2020-12-15 20:21:03 +00:00
|
|
|
} else if (_3_dsa.x <= _3_dsa.z) {
|
|
|
|
_4_blend_set_color_saturation = _blend_set_color_saturation_helper(_3_dsa.yxz, _6_sat).yxz;
|
|
|
|
} else if (_3_dsa.y <= _3_dsa.z) {
|
|
|
|
_4_blend_set_color_saturation = _blend_set_color_saturation_helper(_3_dsa.yzx, _6_sat).zxy;
|
|
|
|
} else {
|
|
|
|
_4_blend_set_color_saturation = _blend_set_color_saturation_helper(_3_dsa.zyx, _6_sat).zyx;
|
|
|
|
}
|
2020-09-21 21:01:22 +00:00
|
|
|
|
2020-12-15 20:21:03 +00:00
|
|
|
vec3 _7_blend_set_color_luminance;
|
|
|
|
float _8_11_blend_color_luminance;
|
2020-12-15 22:50:21 +00:00
|
|
|
float _9_lum;
|
|
|
|
float _10_12_blend_color_luminance;
|
|
|
|
vec3 _11_result;
|
|
|
|
float _12_minComp;
|
|
|
|
float _13_maxComp;
|
2020-12-15 20:21:03 +00:00
|
|
|
_8_11_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), _3_dsa);
|
2020-10-12 15:21:35 +00:00
|
|
|
|
2020-12-15 22:50:21 +00:00
|
|
|
_9_lum = _8_11_blend_color_luminance;
|
2020-12-15 20:21:03 +00:00
|
|
|
|
|
|
|
_10_12_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), _4_blend_set_color_saturation);
|
2020-09-21 21:01:22 +00:00
|
|
|
|
2020-12-15 22:50:21 +00:00
|
|
|
_11_result = (_9_lum - _10_12_blend_color_luminance) + _4_blend_set_color_saturation;
|
2020-09-21 21:01:22 +00:00
|
|
|
|
2020-12-15 22:50:21 +00:00
|
|
|
_12_minComp = min(min(_11_result.x, _11_result.y), _11_result.z);
|
|
|
|
_13_maxComp = max(max(_11_result.x, _11_result.y), _11_result.z);
|
2020-12-15 20:21:03 +00:00
|
|
|
if (_12_minComp < 0.0 && _9_lum != _12_minComp) {
|
|
|
|
_11_result = _9_lum + ((_11_result - _9_lum) * _9_lum) / (_9_lum - _12_minComp);
|
2020-09-21 21:01:22 +00:00
|
|
|
}
|
2020-12-15 20:21:03 +00:00
|
|
|
_7_blend_set_color_luminance = _13_maxComp > _1_alpha && _13_maxComp != _9_lum ? _9_lum + ((_11_result - _9_lum) * (_1_alpha - _9_lum)) / (_13_maxComp - _9_lum) : _11_result;
|
|
|
|
|
|
|
|
_0_blend_saturation = vec4((((_7_blend_set_color_luminance + dst.xyz) - _3_dsa) + src.xyz) - _2_sda, (src.w + dst.w) - _1_alpha);
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-13 15:19:41 +00:00
|
|
|
sk_FragColor = _0_blend_saturation;
|
2020-09-28 17:13:40 +00:00
|
|
|
|
2020-09-21 21:01:22 +00:00
|
|
|
}
|