skia2/tests/sksl/blend/BlendHardLightStandaloneSettings.glsl
John Stiles dc28d75792 Collapse overlay/hard-light blend functions into one.
Hard-light is just overlay with the parameters reversed.

Change-Id: I6cf5963b1252cba3a7b71a56f4094a070188f8b2
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/527503
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2022-04-05 20:21:47 +00:00

16 lines
618 B
GLSL

out vec4 sk_FragColor;
uniform vec4 src;
uniform vec4 dst;
float blend_overlay_component_Qhh2h2(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_h4h4h4(vec4 src, vec4 dst) {
vec4 result = vec4(blend_overlay_component_Qhh2h2(src.xw, dst.xw), blend_overlay_component_Qhh2h2(src.yw, dst.yw), blend_overlay_component_Qhh2h2(src.zw, dst.zw), src.w + (1.0 - src.w) * dst.w);
result.xyz += dst.xyz * (1.0 - src.w) + src.xyz * (1.0 - dst.w);
return result;
}
void main() {
sk_FragColor = blend_overlay_h4h4h4(dst, src);
}