e8e4aca955
By itself, this is uninteresting and even perhaps slightly counterproductive (as it separates vardecl from its initializer, increasing LOC). However, this enables a followup CL (http://review.skia.org/344665) which allows single-return functions to be inlined without the creation of a temporary variable at all. This applies to the majority of fragment processors in a typical Ganesh hierarchy. This change will greatly reduce the number of inliner-created temporary copies when compiling a typical tree of FPs. Change-Id: I03423a13cf35050637dabace4a32973a08a4ed0a Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344764 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: John Stiles <johnstiles@google.com>
22 lines
664 B
GLSL
22 lines
664 B
GLSL
|
|
out vec4 sk_FragColor;
|
|
float _blend_overlay_component(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);
|
|
}
|
|
in vec4 src;
|
|
in vec4 dst;
|
|
void main() {
|
|
vec4 _0_blend_hard_light;
|
|
vec4 _1_blend_overlay;
|
|
vec4 _2_result;
|
|
_2_result = vec4(_blend_overlay_component(dst.xw, src.xw), _blend_overlay_component(dst.yw, src.yw), _blend_overlay_component(dst.zw, src.zw), dst.w + (1.0 - dst.w) * src.w);
|
|
_2_result.xyz += src.xyz * (1.0 - dst.w) + dst.xyz * (1.0 - src.w);
|
|
_1_blend_overlay = _2_result;
|
|
|
|
_0_blend_hard_light = _1_blend_overlay;
|
|
|
|
|
|
sk_FragColor = _0_blend_hard_light;
|
|
|
|
}
|