skia2/tests/sksl/blend/BlendDarkenStandaloneSettings.glsl
John Stiles 72d4c6b574 Collapse darken/lighten blend functions into one.
We use multiplication by 1 or -1 to branchlessly choose one of `min` and
`max` in the same function.

Change-Id: I44cf747feeae75a9c3e00f36e112e0a429871e86
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/527596
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:27:09 +00:00

11 lines
231 B
GLSL

out vec4 sk_FragColor;
uniform vec4 src;
uniform vec4 dst;
void main() {
vec4 _0_a = src + (1.0 - src.w) * dst;
vec3 _1_b = (1.0 - dst.w) * src.xyz + dst.xyz;
_0_a.xyz = min(_0_a.xyz, _1_b);
sk_FragColor = _0_a;
}