skia2/tests/sksl/blend/golden/BlendLightenStandaloneSettings.glsl
John Stiles 345d72124d Eliminate inliner temporary variables for functions with a single exit.
When we determine that a function only contains a single return
statement, there is no need to create a temporary variable and store the
result expression into a variable. Instead, we can directly replace the
function-call expression with the return-statement's expression.

This dramatically simplifies the final optimized output from chains of
very simple inlined functions, which is a very common pattern for trees
of Skia fragment processors.

Change-Id: I6789064a321daf43db2e1cef4915f25ed74d6131
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344665
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-12-16 17:26:06 +00:00

14 lines
237 B
GLSL

out vec4 sk_FragColor;
in vec4 src;
in vec4 dst;
void main() {
vec4 _1_result;
_1_result = src + (1.0 - src.w) * dst;
_1_result.xyz = max(_1_result.xyz, (1.0 - dst.w) * src.xyz + dst.xyz);
sk_FragColor = _1_result;
}