skia2/tests/sksl/blend/golden/BlendOverlap.glsl
John Stiles a9be76de8b Reduce the number of inliner temporaries by swizzling.
Ideally the inliner would be smart enough to avoid creating a temporary
at all just for a swizzle, but a good first step is to create fewer of
them.

Change-Id: Icd6f86c294237488f7923dc787bb64a5f99bd0ac
Bug: skia:10737
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/318213
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-09-22 15:43:19 +00:00

35 lines
1.2 KiB
GLSL

#version 400
uniform vec4 src, dst;
float _blend_overlay_component(vec2 s, vec2 d) {
return 2.0 * d.x <= d.y ? (2.0 * s.x) * d.x : s.y * d.y - (2.0 * (d.y - d.x)) * (s.y - s.x);
}
vec4 blend_overlay(vec4 src, vec4 dst) {
float _0_blend_overlay_component;
vec2 _1_s = src.xw;
vec2 _2_d = dst.xw;
{
_0_blend_overlay_component = 2.0 * _2_d.x <= _2_d.y ? (2.0 * _1_s.x) * _2_d.x : _1_s.y * _2_d.y - (2.0 * (_2_d.y - _2_d.x)) * (_1_s.y - _1_s.x);
}
float _3_blend_overlay_component;
vec2 _4_s = src.yw;
vec2 _5_d = dst.yw;
{
_3_blend_overlay_component = 2.0 * _5_d.x <= _5_d.y ? (2.0 * _4_s.x) * _5_d.x : _4_s.y * _5_d.y - (2.0 * (_5_d.y - _5_d.x)) * (_4_s.y - _4_s.x);
}
float _6_blend_overlay_component;
vec2 _7_s = src.zw;
vec2 _8_d = dst.zw;
{
_6_blend_overlay_component = 2.0 * _8_d.x <= _8_d.y ? (2.0 * _7_s.x) * _8_d.x : _7_s.y * _8_d.y - (2.0 * (_8_d.y - _8_d.x)) * (_7_s.y - _7_s.x);
}
vec4 result = vec4(_0_blend_overlay_component, _3_blend_overlay_component, _6_blend_overlay_component, src.w + (1.0 - src.w) * dst.w);
result.xyz += dst.xyz * (1.0 - src.w) + src.xyz * (1.0 - dst.w);
return result;
}
vec4 main() {
return blend_overlay(src, dst);
}