skia2/tests/sksl/blend/golden/BlendHardLight.glsl
John Stiles f201af8b00 Allow more types of expressions to be directly inlined.
The following types of expression are hoisted directly into the
inlined code:

- Struct field access: `myStruct.myField`
- Swizzles: `myVector.xzy`
- Simple array indexes: `myArray[0]`

This significantly reduces the number of temporary variables generated
by the inliner.

Change-Id: Ifed226ecc87b096ec1e38752c0c38ae32bd31578
Bug: skia:10737, skia:10786
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/319919
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
2020-09-30 00:36:40 +00:00

35 lines
1.2 KiB
GLSL

#version 400
out vec4 sk_FragColor;
in vec4 src, dst;
void main() {
vec4 _0_blend_hard_light;
{
vec4 _3_blend_overlay;
{
float _5_blend_overlay_component;
{
_5_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 _6_blend_overlay_component;
{
_6_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 _7_blend_overlay_component;
{
_7_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 _4_result = vec4(_5_blend_overlay_component, _6_blend_overlay_component, _7_blend_overlay_component, dst.w + (1.0 - dst.w) * src.w);
_4_result.xyz += src.xyz * (1.0 - dst.w) + dst.xyz * (1.0 - src.w);
_3_blend_overlay = _4_result;
}
_0_blend_hard_light = _3_blend_overlay;
}
sk_FragColor = _0_blend_hard_light;
}