skia2/tests/sksl/blend/golden/BlendSaturation.glsl

68 lines
2.7 KiB
Plaintext
Raw Normal View History

#version 400
out vec4 sk_FragColor;
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);
}
in vec4 src;
in vec4 dst;
void main() {
vec4 _0_blend_saturation;
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;
vec3 _4_blend_set_color_saturation;
float _5_13_blend_color_saturation;
float _6_sat;
_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);
_6_sat = _5_13_blend_color_saturation;
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;
}
} 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;
}
vec3 _7_blend_set_color_luminance;
float _8_11_blend_color_luminance;
float _9_lum;
float _10_12_blend_color_luminance;
vec3 _11_result;
float _12_minComp;
float _13_maxComp;
_8_11_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), _3_dsa);
_9_lum = _8_11_blend_color_luminance;
_10_12_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), _4_blend_set_color_saturation);
_11_result = (_9_lum - _10_12_blend_color_luminance) + _4_blend_set_color_saturation;
_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);
if (_12_minComp < 0.0 && _9_lum != _12_minComp) {
_11_result = _9_lum + ((_11_result - _9_lum) * _9_lum) / (_9_lum - _12_minComp);
}
_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);
Revert "Reland "Remove inliner from IR generation stage."" This reverts commit e497a080651c05678cf4760fa6e4daa53a10355b. Reason for revert: Pinpoint disagrees Original change's description: > Reland "Remove inliner from IR generation stage." > > This reverts commit 941fc7174fc20e8a8b707f1b636c85bbf2e1294f. > > Reason for revert: performance now seems to be roughly equal or better > (~1%) over several trials. > Nanobench: http://screen/A8e8sojaXBgbMgF > > Original change's description: > > Revert "Remove inliner from IR generation stage." > > > > This reverts commit 21d7778cb5c13e729b513eaa22dbf53f58a877c8. > > > > Reason for revert: Pinpoint absolutely hates this change > > > > Original change's description: > > > Remove inliner from IR generation stage. > > > > > > There is no need to inline code during IR generation, as the optimizer > > > can now handle this. > > > > > > Change-Id: If272bfb98e945a75ec91fb4aa026e5631ac51b5b > > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/315971 > > > Commit-Queue: John Stiles <johnstiles@google.com> > > > Commit-Queue: Brian Osman <brianosman@google.com> > > > Reviewed-by: Brian Osman <brianosman@google.com> > > > Auto-Submit: John Stiles <johnstiles@google.com> > > > > TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com > > > > Change-Id: I62c235415bcdc92a088e2a7f9c3d7dbf7e1bf669 > > No-Presubmit: true > > No-Tree-Checks: true > > No-Try: true > > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/317976 > > Reviewed-by: John Stiles <johnstiles@google.com> > > Commit-Queue: John Stiles <johnstiles@google.com> > > TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com > > Change-Id: I6189806c678283188f4b67ee61e5886f88c2d6fc > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/324891 > Reviewed-by: John Stiles <johnstiles@google.com> > Reviewed-by: Ethan Nicholas <ethannicholas@google.com> > Commit-Queue: Ethan Nicholas <ethannicholas@google.com> > Auto-Submit: John Stiles <johnstiles@google.com> TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com Change-Id: I79149467565f22f53b8c28868dd53b80f3421137 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/c/skia/+/325626 Reviewed-by: John Stiles <johnstiles@google.com> Commit-Queue: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com>
2020-10-13 15:19:41 +00:00
sk_FragColor = _0_blend_saturation;
}