skia2/tests/sksl/blend/golden/BlendHardLight.glsl
Brian Osman 2e25ff436a Directly compute call counts, rather than mutating state
This causes a ~4% regression on sksl_large, but some of that
can be bought back in two ways:

1) Removing (now unnecessary) cloning of program elements
2) Hoisting the new analysis passes, with (nontrivial)
   logic to update/maintain the call counts as we edit IR.

Also, this fixes bugs where we were emitting functions that
had "calls" from no-longer called functions.

Bug: skia:10776
Change-Id: I4f8c29957be2e4233a883c9a1125f363b82ee40c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/327198
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
2020-10-19 16:08:39 +00:00

36 lines
1.2 KiB
GLSL

#version 400
out vec4 sk_FragColor;
in vec4 src;
in vec4 dst;
void main() {
vec4 _0_blend_hard_light;
{
vec4 _4_blend_overlay;
{
float _6_blend_overlay_component;
{
_6_blend_overlay_component = 2.0 * src.x <= src.w ? (2.0 * dst.x) * src.x : dst.w * src.w - (2.0 * (src.w - src.x)) * (dst.w - dst.x);
}
float _7_blend_overlay_component;
{
_7_blend_overlay_component = 2.0 * src.y <= src.w ? (2.0 * dst.y) * src.y : dst.w * src.w - (2.0 * (src.w - src.y)) * (dst.w - dst.y);
}
float _8_blend_overlay_component;
{
_8_blend_overlay_component = 2.0 * src.z <= src.w ? (2.0 * dst.z) * src.z : dst.w * src.w - (2.0 * (src.w - src.z)) * (dst.w - dst.z);
}
vec4 _5_result = vec4(_6_blend_overlay_component, _7_blend_overlay_component, _8_blend_overlay_component, dst.w + (1.0 - dst.w) * src.w);
_5_result.xyz += src.xyz * (1.0 - dst.w) + dst.xyz * (1.0 - src.w);
_4_blend_overlay = _5_result;
}
_0_blend_hard_light = _4_blend_overlay;
}
sk_FragColor = _0_blend_hard_light;
}