From bc0c29ead3f1b0687de3bf255abd10e1741add21 Mon Sep 17 00:00:00 2001 From: John Stiles Date: Mon, 28 Sep 2020 13:13:40 -0400 Subject: [PATCH] Fix call counts for intrinsic functions. This allows dead-stripping to properly optimize away unreferenced clones of intrinsic functions, and allows the inliner to detect intrinsic functions that are only called once (which can generally always be inlined without penalty). Change-Id: I0cf034d880ae5d52f4cc0f93de6e2c7aad34e975 Bug: skia:10776 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/320258 Commit-Queue: John Stiles Commit-Queue: Brian Osman Auto-Submit: John Stiles Reviewed-by: Brian Osman --- src/sksl/SkSLCompiler.cpp | 18 ++ tests/sksl/blend/golden/BlendClear.glsl | 3 - tests/sksl/blend/golden/BlendClear.metal | 3 - .../golden/BlendClearStandaloneSettings.glsl | 3 - tests/sksl/blend/golden/BlendColor.glsl | 53 +++-- tests/sksl/blend/golden/BlendColor.metal | 53 +++-- tests/sksl/blend/golden/BlendColorBurn.glsl | 6 - tests/sksl/blend/golden/BlendColorBurn.metal | 6 - .../BlendColorBurnStandaloneSettings.glsl | 6 - tests/sksl/blend/golden/BlendColorDodge.glsl | 6 - tests/sksl/blend/golden/BlendColorDodge.metal | 6 - .../BlendColorDodgeStandaloneSettings.glsl | 6 - .../golden/BlendColorStandaloneSettings.glsl | 53 +++-- tests/sksl/blend/golden/BlendDarken.glsl | 13 -- tests/sksl/blend/golden/BlendDarken.metal | 13 -- .../golden/BlendDarkenStandaloneSettings.glsl | 13 -- tests/sksl/blend/golden/BlendDifference.glsl | 3 - tests/sksl/blend/golden/BlendDifference.metal | 3 - .../BlendDifferenceStandaloneSettings.glsl | 3 - tests/sksl/blend/golden/BlendDst.glsl | 3 - tests/sksl/blend/golden/BlendDst.metal | 3 - tests/sksl/blend/golden/BlendDstAtop.glsl | 3 - tests/sksl/blend/golden/BlendDstAtop.metal | 3 - .../BlendDstAtopStandaloneSettings.glsl | 3 - tests/sksl/blend/golden/BlendDstIn.glsl | 11 - tests/sksl/blend/golden/BlendDstIn.metal | 11 - .../golden/BlendDstInStandaloneSettings.glsl | 11 - tests/sksl/blend/golden/BlendDstOut.glsl | 3 - tests/sksl/blend/golden/BlendDstOut.metal | 3 - .../golden/BlendDstOutStandaloneSettings.glsl | 3 - tests/sksl/blend/golden/BlendDstOver.glsl | 3 - tests/sksl/blend/golden/BlendDstOver.metal | 3 - .../BlendDstOverStandaloneSettings.glsl | 3 - .../golden/BlendDstStandaloneSettings.glsl | 3 - tests/sksl/blend/golden/BlendExclusion.glsl | 3 - tests/sksl/blend/golden/BlendExclusion.metal | 3 - .../BlendExclusionStandaloneSettings.glsl | 3 - tests/sksl/blend/golden/BlendHardLight.glsl | 62 +++--- tests/sksl/blend/golden/BlendHardLight.metal | 62 +++--- .../BlendHardLightStandaloneSettings.glsl | 62 +++--- tests/sksl/blend/golden/BlendHue.glsl | 188 +++++++++--------- tests/sksl/blend/golden/BlendHue.metal | 188 +++++++++--------- .../golden/BlendHueStandaloneSettings.glsl | 188 +++++++++--------- tests/sksl/blend/golden/BlendLighten.glsl | 13 -- tests/sksl/blend/golden/BlendLighten.metal | 13 -- .../BlendLightenStandaloneSettings.glsl | 13 -- tests/sksl/blend/golden/BlendLuminosity.glsl | 53 +++-- tests/sksl/blend/golden/BlendLuminosity.metal | 53 +++-- .../BlendLuminosityStandaloneSettings.glsl | 53 +++-- tests/sksl/blend/golden/BlendModulate.glsl | 3 - tests/sksl/blend/golden/BlendModulate.metal | 3 - .../BlendModulateStandaloneSettings.glsl | 3 - tests/sksl/blend/golden/BlendMultiply.glsl | 3 - tests/sksl/blend/golden/BlendMultiply.metal | 3 - .../BlendMultiplyStandaloneSettings.glsl | 3 - tests/sksl/blend/golden/BlendOverlap.glsl | 59 +++--- tests/sksl/blend/golden/BlendOverlap.metal | 59 +++--- .../BlendOverlapStandaloneSettings.glsl | 59 +++--- tests/sksl/blend/golden/BlendPlus.glsl | 3 - tests/sksl/blend/golden/BlendPlus.metal | 3 - .../golden/BlendPlusStandaloneSettings.glsl | 3 - tests/sksl/blend/golden/BlendSaturation.glsl | 188 +++++++++--------- tests/sksl/blend/golden/BlendSaturation.metal | 188 +++++++++--------- .../BlendSaturationStandaloneSettings.glsl | 188 +++++++++--------- tests/sksl/blend/golden/BlendScreen.glsl | 3 - tests/sksl/blend/golden/BlendScreen.metal | 3 - .../golden/BlendScreenStandaloneSettings.glsl | 3 - tests/sksl/blend/golden/BlendSoftLight.glsl | 6 - tests/sksl/blend/golden/BlendSoftLight.metal | 6 - .../BlendSoftLightStandaloneSettings.glsl | 6 - tests/sksl/blend/golden/BlendSrc.glsl | 3 - tests/sksl/blend/golden/BlendSrc.metal | 3 - tests/sksl/blend/golden/BlendSrcAtop.glsl | 3 - tests/sksl/blend/golden/BlendSrcAtop.metal | 3 - .../BlendSrcAtopStandaloneSettings.glsl | 3 - tests/sksl/blend/golden/BlendSrcIn.glsl | 3 - tests/sksl/blend/golden/BlendSrcIn.metal | 3 - .../golden/BlendSrcInStandaloneSettings.glsl | 3 - tests/sksl/blend/golden/BlendSrcOut.glsl | 3 - tests/sksl/blend/golden/BlendSrcOut.metal | 3 - .../golden/BlendSrcOutStandaloneSettings.glsl | 3 - tests/sksl/blend/golden/BlendSrcOver.glsl | 3 - tests/sksl/blend/golden/BlendSrcOver.metal | 3 - .../BlendSrcOverStandaloneSettings.glsl | 3 - .../golden/BlendSrcStandaloneSettings.glsl | 3 - tests/sksl/blend/golden/BlendXor.glsl | 3 - tests/sksl/blend/golden/BlendXor.metal | 3 - .../golden/BlendXorStandaloneSettings.glsl | 3 - 88 files changed, 888 insertions(+), 1257 deletions(-) diff --git a/src/sksl/SkSLCompiler.cpp b/src/sksl/SkSLCompiler.cpp index 44ca9049ca..147a81393a 100644 --- a/src/sksl/SkSLCompiler.cpp +++ b/src/sksl/SkSLCompiler.cpp @@ -96,6 +96,15 @@ static void grab_intrinsics(std::vector>* src, } } +static void reset_call_counts(std::vector>* src) { + for (std::unique_ptr& element : *src) { + if (element->is()) { + const FunctionDeclaration& fnDecl = element->as().fDeclaration; + fnDecl.fCallCount = 0; + } + } +} + Compiler::Compiler(Flags flags) : fGPUIntrinsics(std::make_unique(/*parent=*/nullptr)) , fInterpreterIntrinsics(std::make_unique(/*parent=*/nullptr)) @@ -266,6 +275,15 @@ Compiler::Compiler(Flags flags) fFragmentInclude = rehydrator.elements(); } #endif + // Call counts are used to track dead-stripping and inlinability within the program being + // currently compiled, and always should start at zero for a new program. Zero out any call + // counts that were registered during the assembly of the intrinsics/include data. (If we + // actually use calls from inside the intrinsics, we will clone them into the program and they + // will get new call counts.) + reset_call_counts(&gpuIntrinsics); + reset_call_counts(&fVertexInclude); + reset_call_counts(&fFragmentInclude); + grab_intrinsics(&gpuIntrinsics, fGPUIntrinsics.get()); SkASSERT(gpuIntrinsics.empty()); } diff --git a/tests/sksl/blend/golden/BlendClear.glsl b/tests/sksl/blend/golden/BlendClear.glsl index 21300305ec..1e3089d9de 100644 --- a/tests/sksl/blend/golden/BlendClear.glsl +++ b/tests/sksl/blend/golden/BlendClear.glsl @@ -1,9 +1,6 @@ #version 400 out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_clear(vec4 src, vec4 dst) { - return vec4(0.0); -} void main() { sk_FragColor = vec4(0.0); diff --git a/tests/sksl/blend/golden/BlendClear.metal b/tests/sksl/blend/golden/BlendClear.metal index bf759686d2..abeef500e4 100644 --- a/tests/sksl/blend/golden/BlendClear.metal +++ b/tests/sksl/blend/golden/BlendClear.metal @@ -8,9 +8,6 @@ struct Outputs { float4 sk_FragColor [[color(0)]]; }; -float4 blend_clear(float4 src, float4 dst) { - return float4(0.0); -} fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { Outputs _outputStruct; thread Outputs* _out = &_outputStruct; diff --git a/tests/sksl/blend/golden/BlendClearStandaloneSettings.glsl b/tests/sksl/blend/golden/BlendClearStandaloneSettings.glsl index 4b9703852a..20b76f0c1f 100644 --- a/tests/sksl/blend/golden/BlendClearStandaloneSettings.glsl +++ b/tests/sksl/blend/golden/BlendClearStandaloneSettings.glsl @@ -1,9 +1,6 @@ out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_clear(vec4 src, vec4 dst) { - return vec4(0.0); -} void main() { sk_FragColor = vec4(0.0); diff --git a/tests/sksl/blend/golden/BlendColor.glsl b/tests/sksl/blend/golden/BlendColor.glsl index 0a8abb9217..937ced0f50 100644 --- a/tests/sksl/blend/golden/BlendColor.glsl +++ b/tests/sksl/blend/golden/BlendColor.glsl @@ -1,42 +1,35 @@ #version 400 out vec4 sk_FragColor; in vec4 src, dst; -float _blend_color_luminance(vec3 color) { - return dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), color); -} -vec3 _blend_set_color_luminance(vec3 hueSatColor, float alpha, vec3 lumColor) { - float _4_blend_color_luminance; - { - _4_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), lumColor); - } - float lum = _4_blend_color_luminance; - - float _5_blend_color_luminance; - { - _5_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), hueSatColor); - } - vec3 result = (lum - _5_blend_color_luminance) + hueSatColor; - - float minComp = min(min(result.x, result.y), result.z); - float maxComp = max(max(result.x, result.y), result.z); - if (minComp < 0.0 && lum != minComp) { - result = lum + ((result - lum) * lum) / (lum - minComp); - } - return maxComp > alpha && maxComp != lum ? lum + ((result - lum) * (alpha - lum)) / (maxComp - lum) : result; -} -vec4 blend_color(vec4 src, vec4 dst) { - float alpha = dst.w * src.w; - vec3 sda = src.xyz * dst.w; - vec3 dsa = dst.xyz * src.w; - return vec4((((_blend_set_color_luminance(sda, alpha, dsa) + dst.xyz) - dsa) + src.xyz) - sda, (src.w + dst.w) - alpha); -} void main() { vec4 _0_blend_color; { float _1_alpha = dst.w * src.w; vec3 _2_sda = src.xyz * dst.w; vec3 _3_dsa = dst.xyz * src.w; - _0_blend_color = vec4((((_blend_set_color_luminance(_2_sda, _1_alpha, _3_dsa) + dst.xyz) - _3_dsa) + src.xyz) - _2_sda, (src.w + dst.w) - _1_alpha); + vec3 _6_blend_set_color_luminance; + { + float _11_blend_color_luminance; + { + _11_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), _3_dsa); + } + float _7_lum = _11_blend_color_luminance; + + float _12_blend_color_luminance; + { + _12_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), _2_sda); + } + vec3 _8_result = (_7_lum - _12_blend_color_luminance) + _2_sda; + + float _9_minComp = min(min(_8_result.x, _8_result.y), _8_result.z); + float _10_maxComp = max(max(_8_result.x, _8_result.y), _8_result.z); + if (_9_minComp < 0.0 && _7_lum != _9_minComp) { + _8_result = _7_lum + ((_8_result - _7_lum) * _7_lum) / (_7_lum - _9_minComp); + } + _6_blend_set_color_luminance = _10_maxComp > _1_alpha && _10_maxComp != _7_lum ? _7_lum + ((_8_result - _7_lum) * (_1_alpha - _7_lum)) / (_10_maxComp - _7_lum) : _8_result; + } + _0_blend_color = vec4((((_6_blend_set_color_luminance + dst.xyz) - _3_dsa) + src.xyz) - _2_sda, (src.w + dst.w) - _1_alpha); + } sk_FragColor = _0_blend_color; diff --git a/tests/sksl/blend/golden/BlendColor.metal b/tests/sksl/blend/golden/BlendColor.metal index ae52139fe3..aa2824bd4d 100644 --- a/tests/sksl/blend/golden/BlendColor.metal +++ b/tests/sksl/blend/golden/BlendColor.metal @@ -8,35 +8,6 @@ struct Outputs { float4 sk_FragColor [[color(0)]]; }; -float _blend_color_luminance(float3 color) { - return dot(float3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), color); -} -float3 _blend_set_color_luminance(float3 hueSatColor, float alpha, float3 lumColor) { - float _4_blend_color_luminance; - { - _4_blend_color_luminance = dot(float3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), lumColor); - } - float lum = _4_blend_color_luminance; - - float _5_blend_color_luminance; - { - _5_blend_color_luminance = dot(float3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), hueSatColor); - } - float3 result = (lum - _5_blend_color_luminance) + hueSatColor; - - float minComp = min(min(result.x, result.y), result.z); - float maxComp = max(max(result.x, result.y), result.z); - if (minComp < 0.0 && lum != minComp) { - result = lum + ((result - lum) * lum) / (lum - minComp); - } - return maxComp > alpha && maxComp != lum ? lum + ((result - lum) * (alpha - lum)) / (maxComp - lum) : result; -} -float4 blend_color(float4 src, float4 dst) { - float alpha = dst.w * src.w; - float3 sda = src.xyz * dst.w; - float3 dsa = dst.xyz * src.w; - return float4((((_blend_set_color_luminance(sda, alpha, dsa) + dst.xyz) - dsa) + src.xyz) - sda, (src.w + dst.w) - alpha); -} fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { Outputs _outputStruct; thread Outputs* _out = &_outputStruct; @@ -45,7 +16,29 @@ fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front float _1_alpha = _in.dst.w * _in.src.w; float3 _2_sda = _in.src.xyz * _in.dst.w; float3 _3_dsa = _in.dst.xyz * _in.src.w; - _0_blend_color = float4((((_blend_set_color_luminance(_2_sda, _1_alpha, _3_dsa) + _in.dst.xyz) - _3_dsa) + _in.src.xyz) - _2_sda, (_in.src.w + _in.dst.w) - _1_alpha); + float3 _6_blend_set_color_luminance; + { + float _11_blend_color_luminance; + { + _11_blend_color_luminance = dot(float3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), _3_dsa); + } + float _7_lum = _11_blend_color_luminance; + + float _12_blend_color_luminance; + { + _12_blend_color_luminance = dot(float3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), _2_sda); + } + float3 _8_result = (_7_lum - _12_blend_color_luminance) + _2_sda; + + float _9_minComp = min(min(_8_result.x, _8_result.y), _8_result.z); + float _10_maxComp = max(max(_8_result.x, _8_result.y), _8_result.z); + if (_9_minComp < 0.0 && _7_lum != _9_minComp) { + _8_result = _7_lum + ((_8_result - _7_lum) * _7_lum) / (_7_lum - _9_minComp); + } + _6_blend_set_color_luminance = _10_maxComp > _1_alpha && _10_maxComp != _7_lum ? _7_lum + ((_8_result - _7_lum) * (_1_alpha - _7_lum)) / (_10_maxComp - _7_lum) : _8_result; + } + _0_blend_color = float4((((_6_blend_set_color_luminance + _in.dst.xyz) - _3_dsa) + _in.src.xyz) - _2_sda, (_in.src.w + _in.dst.w) - _1_alpha); + } _out->sk_FragColor = _0_blend_color; diff --git a/tests/sksl/blend/golden/BlendColorBurn.glsl b/tests/sksl/blend/golden/BlendColorBurn.glsl index 2bca526579..f69cb5d2a6 100644 --- a/tests/sksl/blend/golden/BlendColorBurn.glsl +++ b/tests/sksl/blend/golden/BlendColorBurn.glsl @@ -1,9 +1,6 @@ #version 400 out vec4 sk_FragColor; in vec4 src, dst; -float _guarded_divide(float n, float d) { - return n / d; -} float _color_burn_component(vec2 s, vec2 d) { if (d.y == d.x) { return (s.y * d.y + s.x * (1.0 - d.y)) + d.x * (1.0 - s.y); @@ -21,9 +18,6 @@ float _color_burn_component(vec2 s, vec2 d) { return (delta * s.y + s.x * (1.0 - d.y)) + d.x * (1.0 - s.y); } } -vec4 blend_color_burn(vec4 src, vec4 dst) { - return vec4(_color_burn_component(src.xw, dst.xw), _color_burn_component(src.yw, dst.yw), _color_burn_component(src.zw, dst.zw), src.w + (1.0 - src.w) * dst.w); -} void main() { vec4 _0_blend_color_burn; { diff --git a/tests/sksl/blend/golden/BlendColorBurn.metal b/tests/sksl/blend/golden/BlendColorBurn.metal index a6c6d8d7fe..efcd37786c 100644 --- a/tests/sksl/blend/golden/BlendColorBurn.metal +++ b/tests/sksl/blend/golden/BlendColorBurn.metal @@ -8,9 +8,6 @@ struct Outputs { float4 sk_FragColor [[color(0)]]; }; -float _guarded_divide(float n, float d) { - return n / d; -} float _color_burn_component(float2 s, float2 d) { if (d.y == d.x) { return (s.y * d.y + s.x * (1.0 - d.y)) + d.x * (1.0 - s.y); @@ -28,9 +25,6 @@ float _color_burn_component(float2 s, float2 d) { return (delta * s.y + s.x * (1.0 - d.y)) + d.x * (1.0 - s.y); } } -float4 blend_color_burn(float4 src, float4 dst) { - return float4(_color_burn_component(src.xw, dst.xw), _color_burn_component(src.yw, dst.yw), _color_burn_component(src.zw, dst.zw), src.w + (1.0 - src.w) * dst.w); -} fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { Outputs _outputStruct; thread Outputs* _out = &_outputStruct; diff --git a/tests/sksl/blend/golden/BlendColorBurnStandaloneSettings.glsl b/tests/sksl/blend/golden/BlendColorBurnStandaloneSettings.glsl index 251052a72c..359c23afcf 100644 --- a/tests/sksl/blend/golden/BlendColorBurnStandaloneSettings.glsl +++ b/tests/sksl/blend/golden/BlendColorBurnStandaloneSettings.glsl @@ -1,9 +1,6 @@ out vec4 sk_FragColor; in vec4 src, dst; -float _guarded_divide(float n, float d) { - return n / d; -} float _color_burn_component(vec2 s, vec2 d) { if (d.y == d.x) { return (s.y * d.y + s.x * (1.0 - d.y)) + d.x * (1.0 - s.y); @@ -21,9 +18,6 @@ float _color_burn_component(vec2 s, vec2 d) { return (delta * s.y + s.x * (1.0 - d.y)) + d.x * (1.0 - s.y); } } -vec4 blend_color_burn(vec4 src, vec4 dst) { - return vec4(_color_burn_component(src.xw, dst.xw), _color_burn_component(src.yw, dst.yw), _color_burn_component(src.zw, dst.zw), src.w + (1.0 - src.w) * dst.w); -} void main() { vec4 _0_blend_color_burn; { diff --git a/tests/sksl/blend/golden/BlendColorDodge.glsl b/tests/sksl/blend/golden/BlendColorDodge.glsl index ce45c927ed..7cc9f789a0 100644 --- a/tests/sksl/blend/golden/BlendColorDodge.glsl +++ b/tests/sksl/blend/golden/BlendColorDodge.glsl @@ -1,9 +1,6 @@ #version 400 out vec4 sk_FragColor; in vec4 src, dst; -float _guarded_divide(float n, float d) { - return n / d; -} float _color_dodge_component(vec2 s, vec2 d) { if (d.x == 0.0) { return s.x * (1.0 - d.y); @@ -23,9 +20,6 @@ float _color_dodge_component(vec2 s, vec2 d) { } } } -vec4 blend_color_dodge(vec4 src, vec4 dst) { - return vec4(_color_dodge_component(src.xw, dst.xw), _color_dodge_component(src.yw, dst.yw), _color_dodge_component(src.zw, dst.zw), src.w + (1.0 - src.w) * dst.w); -} void main() { vec4 _0_blend_color_dodge; { diff --git a/tests/sksl/blend/golden/BlendColorDodge.metal b/tests/sksl/blend/golden/BlendColorDodge.metal index bd4893680d..ec4e8c59cb 100644 --- a/tests/sksl/blend/golden/BlendColorDodge.metal +++ b/tests/sksl/blend/golden/BlendColorDodge.metal @@ -8,9 +8,6 @@ struct Outputs { float4 sk_FragColor [[color(0)]]; }; -float _guarded_divide(float n, float d) { - return n / d; -} float _color_dodge_component(float2 s, float2 d) { if (d.x == 0.0) { return s.x * (1.0 - d.y); @@ -30,9 +27,6 @@ float _color_dodge_component(float2 s, float2 d) { } } } -float4 blend_color_dodge(float4 src, float4 dst) { - return float4(_color_dodge_component(src.xw, dst.xw), _color_dodge_component(src.yw, dst.yw), _color_dodge_component(src.zw, dst.zw), src.w + (1.0 - src.w) * dst.w); -} fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { Outputs _outputStruct; thread Outputs* _out = &_outputStruct; diff --git a/tests/sksl/blend/golden/BlendColorDodgeStandaloneSettings.glsl b/tests/sksl/blend/golden/BlendColorDodgeStandaloneSettings.glsl index dcde287393..9a4e348098 100644 --- a/tests/sksl/blend/golden/BlendColorDodgeStandaloneSettings.glsl +++ b/tests/sksl/blend/golden/BlendColorDodgeStandaloneSettings.glsl @@ -1,9 +1,6 @@ out vec4 sk_FragColor; in vec4 src, dst; -float _guarded_divide(float n, float d) { - return n / d; -} float _color_dodge_component(vec2 s, vec2 d) { if (d.x == 0.0) { return s.x * (1.0 - d.y); @@ -23,9 +20,6 @@ float _color_dodge_component(vec2 s, vec2 d) { } } } -vec4 blend_color_dodge(vec4 src, vec4 dst) { - return vec4(_color_dodge_component(src.xw, dst.xw), _color_dodge_component(src.yw, dst.yw), _color_dodge_component(src.zw, dst.zw), src.w + (1.0 - src.w) * dst.w); -} void main() { vec4 _0_blend_color_dodge; { diff --git a/tests/sksl/blend/golden/BlendColorStandaloneSettings.glsl b/tests/sksl/blend/golden/BlendColorStandaloneSettings.glsl index cd3eef4d64..4d30986773 100644 --- a/tests/sksl/blend/golden/BlendColorStandaloneSettings.glsl +++ b/tests/sksl/blend/golden/BlendColorStandaloneSettings.glsl @@ -1,42 +1,35 @@ out vec4 sk_FragColor; in vec4 src, dst; -float _blend_color_luminance(vec3 color) { - return dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), color); -} -vec3 _blend_set_color_luminance(vec3 hueSatColor, float alpha, vec3 lumColor) { - float _4_blend_color_luminance; - { - _4_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), lumColor); - } - float lum = _4_blend_color_luminance; - - float _5_blend_color_luminance; - { - _5_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), hueSatColor); - } - vec3 result = (lum - _5_blend_color_luminance) + hueSatColor; - - float minComp = min(min(result.x, result.y), result.z); - float maxComp = max(max(result.x, result.y), result.z); - if (minComp < 0.0 && lum != minComp) { - result = lum + ((result - lum) * lum) / (lum - minComp); - } - return maxComp > alpha && maxComp != lum ? lum + ((result - lum) * (alpha - lum)) / (maxComp - lum) : result; -} -vec4 blend_color(vec4 src, vec4 dst) { - float alpha = dst.w * src.w; - vec3 sda = src.xyz * dst.w; - vec3 dsa = dst.xyz * src.w; - return vec4((((_blend_set_color_luminance(sda, alpha, dsa) + dst.xyz) - dsa) + src.xyz) - sda, (src.w + dst.w) - alpha); -} void main() { vec4 _0_blend_color; { float _1_alpha = dst.w * src.w; vec3 _2_sda = src.xyz * dst.w; vec3 _3_dsa = dst.xyz * src.w; - _0_blend_color = vec4((((_blend_set_color_luminance(_2_sda, _1_alpha, _3_dsa) + dst.xyz) - _3_dsa) + src.xyz) - _2_sda, (src.w + dst.w) - _1_alpha); + vec3 _6_blend_set_color_luminance; + { + float _11_blend_color_luminance; + { + _11_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), _3_dsa); + } + float _7_lum = _11_blend_color_luminance; + + float _12_blend_color_luminance; + { + _12_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), _2_sda); + } + vec3 _8_result = (_7_lum - _12_blend_color_luminance) + _2_sda; + + float _9_minComp = min(min(_8_result.x, _8_result.y), _8_result.z); + float _10_maxComp = max(max(_8_result.x, _8_result.y), _8_result.z); + if (_9_minComp < 0.0 && _7_lum != _9_minComp) { + _8_result = _7_lum + ((_8_result - _7_lum) * _7_lum) / (_7_lum - _9_minComp); + } + _6_blend_set_color_luminance = _10_maxComp > _1_alpha && _10_maxComp != _7_lum ? _7_lum + ((_8_result - _7_lum) * (_1_alpha - _7_lum)) / (_10_maxComp - _7_lum) : _8_result; + } + _0_blend_color = vec4((((_6_blend_set_color_luminance + dst.xyz) - _3_dsa) + src.xyz) - _2_sda, (src.w + dst.w) - _1_alpha); + } sk_FragColor = _0_blend_color; diff --git a/tests/sksl/blend/golden/BlendDarken.glsl b/tests/sksl/blend/golden/BlendDarken.glsl index 69afdbdb3a..7ca1eb9287 100644 --- a/tests/sksl/blend/golden/BlendDarken.glsl +++ b/tests/sksl/blend/golden/BlendDarken.glsl @@ -1,19 +1,6 @@ #version 400 out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_src_over(vec4 src, vec4 dst) { - return src + (1.0 - src.w) * dst; -} -vec4 blend_darken(vec4 src, vec4 dst) { - vec4 _2_blend_src_over; - { - _2_blend_src_over = src + (1.0 - src.w) * dst; - } - vec4 result = _2_blend_src_over; - - result.xyz = min(result.xyz, (1.0 - dst.w) * src.xyz + dst.xyz); - return result; -} void main() { vec4 _0_blend_darken; { diff --git a/tests/sksl/blend/golden/BlendDarken.metal b/tests/sksl/blend/golden/BlendDarken.metal index 9c69c79126..fa5031be15 100644 --- a/tests/sksl/blend/golden/BlendDarken.metal +++ b/tests/sksl/blend/golden/BlendDarken.metal @@ -8,19 +8,6 @@ struct Outputs { float4 sk_FragColor [[color(0)]]; }; -float4 blend_src_over(float4 src, float4 dst) { - return src + (1.0 - src.w) * dst; -} -float4 blend_darken(float4 src, float4 dst) { - float4 _2_blend_src_over; - { - _2_blend_src_over = src + (1.0 - src.w) * dst; - } - float4 result = _2_blend_src_over; - - result.xyz = min(result.xyz, (1.0 - dst.w) * src.xyz + dst.xyz); - return result; -} fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { Outputs _outputStruct; thread Outputs* _out = &_outputStruct; diff --git a/tests/sksl/blend/golden/BlendDarkenStandaloneSettings.glsl b/tests/sksl/blend/golden/BlendDarkenStandaloneSettings.glsl index 4c4ff9001d..83bc9f780d 100644 --- a/tests/sksl/blend/golden/BlendDarkenStandaloneSettings.glsl +++ b/tests/sksl/blend/golden/BlendDarkenStandaloneSettings.glsl @@ -1,19 +1,6 @@ out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_src_over(vec4 src, vec4 dst) { - return src + (1.0 - src.w) * dst; -} -vec4 blend_darken(vec4 src, vec4 dst) { - vec4 _2_blend_src_over; - { - _2_blend_src_over = src + (1.0 - src.w) * dst; - } - vec4 result = _2_blend_src_over; - - result.xyz = min(result.xyz, (1.0 - dst.w) * src.xyz + dst.xyz); - return result; -} void main() { vec4 _0_blend_darken; { diff --git a/tests/sksl/blend/golden/BlendDifference.glsl b/tests/sksl/blend/golden/BlendDifference.glsl index f1c8e85d4a..89a4e8353b 100644 --- a/tests/sksl/blend/golden/BlendDifference.glsl +++ b/tests/sksl/blend/golden/BlendDifference.glsl @@ -1,9 +1,6 @@ #version 400 out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_difference(vec4 src, vec4 dst) { - return vec4((src.xyz + dst.xyz) - 2.0 * min(src.xyz * dst.w, dst.xyz * src.w), src.w + (1.0 - src.w) * dst.w); -} void main() { vec4 _0_blend_difference; { diff --git a/tests/sksl/blend/golden/BlendDifference.metal b/tests/sksl/blend/golden/BlendDifference.metal index a11dd6c7bd..f2dbaecece 100644 --- a/tests/sksl/blend/golden/BlendDifference.metal +++ b/tests/sksl/blend/golden/BlendDifference.metal @@ -8,9 +8,6 @@ struct Outputs { float4 sk_FragColor [[color(0)]]; }; -float4 blend_difference(float4 src, float4 dst) { - return float4((src.xyz + dst.xyz) - 2.0 * min(src.xyz * dst.w, dst.xyz * src.w), src.w + (1.0 - src.w) * dst.w); -} fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { Outputs _outputStruct; thread Outputs* _out = &_outputStruct; diff --git a/tests/sksl/blend/golden/BlendDifferenceStandaloneSettings.glsl b/tests/sksl/blend/golden/BlendDifferenceStandaloneSettings.glsl index 7ec4550e0d..3caa5c9d33 100644 --- a/tests/sksl/blend/golden/BlendDifferenceStandaloneSettings.glsl +++ b/tests/sksl/blend/golden/BlendDifferenceStandaloneSettings.glsl @@ -1,9 +1,6 @@ out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_difference(vec4 src, vec4 dst) { - return vec4((src.xyz + dst.xyz) - 2.0 * min(src.xyz * dst.w, dst.xyz * src.w), src.w + (1.0 - src.w) * dst.w); -} void main() { vec4 _0_blend_difference; { diff --git a/tests/sksl/blend/golden/BlendDst.glsl b/tests/sksl/blend/golden/BlendDst.glsl index 008a1d90bc..fe08420927 100644 --- a/tests/sksl/blend/golden/BlendDst.glsl +++ b/tests/sksl/blend/golden/BlendDst.glsl @@ -1,9 +1,6 @@ #version 400 out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_dst(vec4 src, vec4 dst) { - return dst; -} void main() { vec4 _0_blend_dst; { diff --git a/tests/sksl/blend/golden/BlendDst.metal b/tests/sksl/blend/golden/BlendDst.metal index e4d5e93ccd..99498a3b5b 100644 --- a/tests/sksl/blend/golden/BlendDst.metal +++ b/tests/sksl/blend/golden/BlendDst.metal @@ -8,9 +8,6 @@ struct Outputs { float4 sk_FragColor [[color(0)]]; }; -float4 blend_dst(float4 src, float4 dst) { - return dst; -} fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { Outputs _outputStruct; thread Outputs* _out = &_outputStruct; diff --git a/tests/sksl/blend/golden/BlendDstAtop.glsl b/tests/sksl/blend/golden/BlendDstAtop.glsl index 8dbbb84d9d..eca22ae0ab 100644 --- a/tests/sksl/blend/golden/BlendDstAtop.glsl +++ b/tests/sksl/blend/golden/BlendDstAtop.glsl @@ -1,9 +1,6 @@ #version 400 out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_src_atop(vec4 src, vec4 dst) { - return dst.w * src + (1.0 - src.w) * dst; -} void main() { vec4 _0_blend_src_atop; { diff --git a/tests/sksl/blend/golden/BlendDstAtop.metal b/tests/sksl/blend/golden/BlendDstAtop.metal index a1d43ca408..c9c3854264 100644 --- a/tests/sksl/blend/golden/BlendDstAtop.metal +++ b/tests/sksl/blend/golden/BlendDstAtop.metal @@ -8,9 +8,6 @@ struct Outputs { float4 sk_FragColor [[color(0)]]; }; -float4 blend_src_atop(float4 src, float4 dst) { - return dst.w * src + (1.0 - src.w) * dst; -} fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { Outputs _outputStruct; thread Outputs* _out = &_outputStruct; diff --git a/tests/sksl/blend/golden/BlendDstAtopStandaloneSettings.glsl b/tests/sksl/blend/golden/BlendDstAtopStandaloneSettings.glsl index b9687932a7..3b141d46ea 100644 --- a/tests/sksl/blend/golden/BlendDstAtopStandaloneSettings.glsl +++ b/tests/sksl/blend/golden/BlendDstAtopStandaloneSettings.glsl @@ -1,9 +1,6 @@ out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_src_atop(vec4 src, vec4 dst) { - return dst.w * src + (1.0 - src.w) * dst; -} void main() { vec4 _0_blend_src_atop; { diff --git a/tests/sksl/blend/golden/BlendDstIn.glsl b/tests/sksl/blend/golden/BlendDstIn.glsl index 9e52c3781f..c9f93b8758 100644 --- a/tests/sksl/blend/golden/BlendDstIn.glsl +++ b/tests/sksl/blend/golden/BlendDstIn.glsl @@ -1,17 +1,6 @@ #version 400 out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_src_in(vec4 src, vec4 dst) { - return src * dst.w; -} -vec4 blend_dst_in(vec4 src, vec4 dst) { - vec4 _1_blend_src_in; - { - _1_blend_src_in = dst * src.w; - } - return _1_blend_src_in; - -} void main() { vec4 _0_blend_dst_in; { diff --git a/tests/sksl/blend/golden/BlendDstIn.metal b/tests/sksl/blend/golden/BlendDstIn.metal index 1466fbc61a..132ba4beda 100644 --- a/tests/sksl/blend/golden/BlendDstIn.metal +++ b/tests/sksl/blend/golden/BlendDstIn.metal @@ -8,17 +8,6 @@ struct Outputs { float4 sk_FragColor [[color(0)]]; }; -float4 blend_src_in(float4 src, float4 dst) { - return src * dst.w; -} -float4 blend_dst_in(float4 src, float4 dst) { - float4 _1_blend_src_in; - { - _1_blend_src_in = dst * src.w; - } - return _1_blend_src_in; - -} fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { Outputs _outputStruct; thread Outputs* _out = &_outputStruct; diff --git a/tests/sksl/blend/golden/BlendDstInStandaloneSettings.glsl b/tests/sksl/blend/golden/BlendDstInStandaloneSettings.glsl index f9ca3a80bb..2c907b2670 100644 --- a/tests/sksl/blend/golden/BlendDstInStandaloneSettings.glsl +++ b/tests/sksl/blend/golden/BlendDstInStandaloneSettings.glsl @@ -1,17 +1,6 @@ out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_src_in(vec4 src, vec4 dst) { - return src * dst.w; -} -vec4 blend_dst_in(vec4 src, vec4 dst) { - vec4 _1_blend_src_in; - { - _1_blend_src_in = dst * src.w; - } - return _1_blend_src_in; - -} void main() { vec4 _0_blend_dst_in; { diff --git a/tests/sksl/blend/golden/BlendDstOut.glsl b/tests/sksl/blend/golden/BlendDstOut.glsl index f89539183f..0ceb1cedfa 100644 --- a/tests/sksl/blend/golden/BlendDstOut.glsl +++ b/tests/sksl/blend/golden/BlendDstOut.glsl @@ -1,9 +1,6 @@ #version 400 out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_dst_out(vec4 src, vec4 dst) { - return (1.0 - src.w) * dst; -} void main() { vec4 _0_blend_dst_out; { diff --git a/tests/sksl/blend/golden/BlendDstOut.metal b/tests/sksl/blend/golden/BlendDstOut.metal index b53f7fe0d0..fa60a39c91 100644 --- a/tests/sksl/blend/golden/BlendDstOut.metal +++ b/tests/sksl/blend/golden/BlendDstOut.metal @@ -8,9 +8,6 @@ struct Outputs { float4 sk_FragColor [[color(0)]]; }; -float4 blend_dst_out(float4 src, float4 dst) { - return (1.0 - src.w) * dst; -} fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { Outputs _outputStruct; thread Outputs* _out = &_outputStruct; diff --git a/tests/sksl/blend/golden/BlendDstOutStandaloneSettings.glsl b/tests/sksl/blend/golden/BlendDstOutStandaloneSettings.glsl index a1ab25dbac..b86600eec9 100644 --- a/tests/sksl/blend/golden/BlendDstOutStandaloneSettings.glsl +++ b/tests/sksl/blend/golden/BlendDstOutStandaloneSettings.glsl @@ -1,9 +1,6 @@ out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_dst_out(vec4 src, vec4 dst) { - return (1.0 - src.w) * dst; -} void main() { vec4 _0_blend_dst_out; { diff --git a/tests/sksl/blend/golden/BlendDstOver.glsl b/tests/sksl/blend/golden/BlendDstOver.glsl index c2a54c053f..65e8346c3e 100644 --- a/tests/sksl/blend/golden/BlendDstOver.glsl +++ b/tests/sksl/blend/golden/BlendDstOver.glsl @@ -1,9 +1,6 @@ #version 400 out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_dst_over(vec4 src, vec4 dst) { - return (1.0 - dst.w) * src + dst; -} void main() { vec4 _0_blend_dst_over; { diff --git a/tests/sksl/blend/golden/BlendDstOver.metal b/tests/sksl/blend/golden/BlendDstOver.metal index 566fac1447..7fd095d676 100644 --- a/tests/sksl/blend/golden/BlendDstOver.metal +++ b/tests/sksl/blend/golden/BlendDstOver.metal @@ -8,9 +8,6 @@ struct Outputs { float4 sk_FragColor [[color(0)]]; }; -float4 blend_dst_over(float4 src, float4 dst) { - return (1.0 - dst.w) * src + dst; -} fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { Outputs _outputStruct; thread Outputs* _out = &_outputStruct; diff --git a/tests/sksl/blend/golden/BlendDstOverStandaloneSettings.glsl b/tests/sksl/blend/golden/BlendDstOverStandaloneSettings.glsl index 6c3ec37d41..bb554b6420 100644 --- a/tests/sksl/blend/golden/BlendDstOverStandaloneSettings.glsl +++ b/tests/sksl/blend/golden/BlendDstOverStandaloneSettings.glsl @@ -1,9 +1,6 @@ out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_dst_over(vec4 src, vec4 dst) { - return (1.0 - dst.w) * src + dst; -} void main() { vec4 _0_blend_dst_over; { diff --git a/tests/sksl/blend/golden/BlendDstStandaloneSettings.glsl b/tests/sksl/blend/golden/BlendDstStandaloneSettings.glsl index 1ef3eb3130..fb3cd54f09 100644 --- a/tests/sksl/blend/golden/BlendDstStandaloneSettings.glsl +++ b/tests/sksl/blend/golden/BlendDstStandaloneSettings.glsl @@ -1,9 +1,6 @@ out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_dst(vec4 src, vec4 dst) { - return dst; -} void main() { vec4 _0_blend_dst; { diff --git a/tests/sksl/blend/golden/BlendExclusion.glsl b/tests/sksl/blend/golden/BlendExclusion.glsl index 602762d536..ac17b03a68 100644 --- a/tests/sksl/blend/golden/BlendExclusion.glsl +++ b/tests/sksl/blend/golden/BlendExclusion.glsl @@ -1,9 +1,6 @@ #version 400 out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_exclusion(vec4 src, vec4 dst) { - return vec4((dst.xyz + src.xyz) - (2.0 * dst.xyz) * src.xyz, src.w + (1.0 - src.w) * dst.w); -} void main() { vec4 _0_blend_exclusion; { diff --git a/tests/sksl/blend/golden/BlendExclusion.metal b/tests/sksl/blend/golden/BlendExclusion.metal index b1f2683a71..0d35292b4b 100644 --- a/tests/sksl/blend/golden/BlendExclusion.metal +++ b/tests/sksl/blend/golden/BlendExclusion.metal @@ -8,9 +8,6 @@ struct Outputs { float4 sk_FragColor [[color(0)]]; }; -float4 blend_exclusion(float4 src, float4 dst) { - return float4((dst.xyz + src.xyz) - (2.0 * dst.xyz) * src.xyz, src.w + (1.0 - src.w) * dst.w); -} fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { Outputs _outputStruct; thread Outputs* _out = &_outputStruct; diff --git a/tests/sksl/blend/golden/BlendExclusionStandaloneSettings.glsl b/tests/sksl/blend/golden/BlendExclusionStandaloneSettings.glsl index bfc74c8978..45c99474dc 100644 --- a/tests/sksl/blend/golden/BlendExclusionStandaloneSettings.glsl +++ b/tests/sksl/blend/golden/BlendExclusionStandaloneSettings.glsl @@ -1,9 +1,6 @@ out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_exclusion(vec4 src, vec4 dst) { - return vec4((dst.xyz + src.xyz) - (2.0 * dst.xyz) * src.xyz, src.w + (1.0 - src.w) * dst.w); -} void main() { vec4 _0_blend_exclusion; { diff --git a/tests/sksl/blend/golden/BlendHardLight.glsl b/tests/sksl/blend/golden/BlendHardLight.glsl index 779f9afd71..5d142a5df8 100644 --- a/tests/sksl/blend/golden/BlendHardLight.glsl +++ b/tests/sksl/blend/golden/BlendHardLight.glsl @@ -1,42 +1,38 @@ #version 400 out vec4 sk_FragColor; in vec4 src, dst; -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); -} -vec4 blend_overlay(vec4 src, vec4 dst) { - float _1_blend_overlay_component; - vec2 _2_s = src.xw; - vec2 _3_d = dst.xw; - { - _1_blend_overlay_component = 2.0 * _3_d.x <= _3_d.y ? (2.0 * _2_s.x) * _3_d.x : _2_s.y * _3_d.y - (2.0 * (_3_d.y - _3_d.x)) * (_2_s.y - _2_s.x); - } - float _4_blend_overlay_component; - vec2 _5_s = src.yw; - vec2 _6_d = dst.yw; - { - _4_blend_overlay_component = 2.0 * _6_d.x <= _6_d.y ? (2.0 * _5_s.x) * _6_d.x : _5_s.y * _6_d.y - (2.0 * (_6_d.y - _6_d.x)) * (_5_s.y - _5_s.x); - } - float _7_blend_overlay_component; - vec2 _8_s = src.zw; - vec2 _9_d = dst.zw; - { - _7_blend_overlay_component = 2.0 * _9_d.x <= _9_d.y ? (2.0 * _8_s.x) * _9_d.x : _8_s.y * _9_d.y - (2.0 * (_9_d.y - _9_d.x)) * (_8_s.y - _8_s.x); - } - vec4 result = vec4(_1_blend_overlay_component, _4_blend_overlay_component, _7_blend_overlay_component, src.w + (1.0 - src.w) * dst.w); - - - - result.xyz += dst.xyz * (1.0 - src.w) + src.xyz * (1.0 - dst.w); - return result; -} -vec4 blend_hard_light(vec4 src, vec4 dst) { - return blend_overlay(dst, src); -} void main() { vec4 _0_blend_hard_light; { - _0_blend_hard_light = blend_overlay(dst, src); + vec4 _7_blend_overlay; + { + float _9_blend_overlay_component; + vec2 _10_s = dst.xw; + vec2 _11_d = src.xw; + { + _9_blend_overlay_component = 2.0 * _11_d.x <= _11_d.y ? (2.0 * _10_s.x) * _11_d.x : _10_s.y * _11_d.y - (2.0 * (_11_d.y - _11_d.x)) * (_10_s.y - _10_s.x); + } + float _12_blend_overlay_component; + vec2 _13_s = dst.yw; + vec2 _14_d = src.yw; + { + _12_blend_overlay_component = 2.0 * _14_d.x <= _14_d.y ? (2.0 * _13_s.x) * _14_d.x : _13_s.y * _14_d.y - (2.0 * (_14_d.y - _14_d.x)) * (_13_s.y - _13_s.x); + } + float _15_blend_overlay_component; + vec2 _16_s = dst.zw; + vec2 _17_d = src.zw; + { + _15_blend_overlay_component = 2.0 * _17_d.x <= _17_d.y ? (2.0 * _16_s.x) * _17_d.x : _16_s.y * _17_d.y - (2.0 * (_17_d.y - _17_d.x)) * (_16_s.y - _16_s.x); + } + vec4 _8_result = vec4(_9_blend_overlay_component, _12_blend_overlay_component, _15_blend_overlay_component, dst.w + (1.0 - dst.w) * src.w); + + + + _8_result.xyz += src.xyz * (1.0 - dst.w) + dst.xyz * (1.0 - src.w); + _7_blend_overlay = _8_result; + } + _0_blend_hard_light = _7_blend_overlay; + } sk_FragColor = _0_blend_hard_light; diff --git a/tests/sksl/blend/golden/BlendHardLight.metal b/tests/sksl/blend/golden/BlendHardLight.metal index 7fcce70769..821745d624 100644 --- a/tests/sksl/blend/golden/BlendHardLight.metal +++ b/tests/sksl/blend/golden/BlendHardLight.metal @@ -8,44 +8,40 @@ struct Outputs { float4 sk_FragColor [[color(0)]]; }; -float _blend_overlay_component(float2 s, float2 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); -} -float4 blend_overlay(float4 src, float4 dst) { - float _1_blend_overlay_component; - float2 _2_s = src.xw; - float2 _3_d = dst.xw; - { - _1_blend_overlay_component = 2.0 * _3_d.x <= _3_d.y ? (2.0 * _2_s.x) * _3_d.x : _2_s.y * _3_d.y - (2.0 * (_3_d.y - _3_d.x)) * (_2_s.y - _2_s.x); - } - float _4_blend_overlay_component; - float2 _5_s = src.yw; - float2 _6_d = dst.yw; - { - _4_blend_overlay_component = 2.0 * _6_d.x <= _6_d.y ? (2.0 * _5_s.x) * _6_d.x : _5_s.y * _6_d.y - (2.0 * (_6_d.y - _6_d.x)) * (_5_s.y - _5_s.x); - } - float _7_blend_overlay_component; - float2 _8_s = src.zw; - float2 _9_d = dst.zw; - { - _7_blend_overlay_component = 2.0 * _9_d.x <= _9_d.y ? (2.0 * _8_s.x) * _9_d.x : _8_s.y * _9_d.y - (2.0 * (_9_d.y - _9_d.x)) * (_8_s.y - _8_s.x); - } - float4 result = float4(_1_blend_overlay_component, _4_blend_overlay_component, _7_blend_overlay_component, src.w + (1.0 - src.w) * dst.w); - - - - result.xyz = result.xyz + dst.xyz * (1.0 - src.w) + src.xyz * (1.0 - dst.w); - return result; -} -float4 blend_hard_light(float4 src, float4 dst) { - return blend_overlay(dst, src); -} fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { Outputs _outputStruct; thread Outputs* _out = &_outputStruct; float4 _0_blend_hard_light; { - _0_blend_hard_light = blend_overlay(_in.dst, _in.src); + float4 _7_blend_overlay; + { + float _9_blend_overlay_component; + float2 _10_s = _in.dst.xw; + float2 _11_d = _in.src.xw; + { + _9_blend_overlay_component = 2.0 * _11_d.x <= _11_d.y ? (2.0 * _10_s.x) * _11_d.x : _10_s.y * _11_d.y - (2.0 * (_11_d.y - _11_d.x)) * (_10_s.y - _10_s.x); + } + float _12_blend_overlay_component; + float2 _13_s = _in.dst.yw; + float2 _14_d = _in.src.yw; + { + _12_blend_overlay_component = 2.0 * _14_d.x <= _14_d.y ? (2.0 * _13_s.x) * _14_d.x : _13_s.y * _14_d.y - (2.0 * (_14_d.y - _14_d.x)) * (_13_s.y - _13_s.x); + } + float _15_blend_overlay_component; + float2 _16_s = _in.dst.zw; + float2 _17_d = _in.src.zw; + { + _15_blend_overlay_component = 2.0 * _17_d.x <= _17_d.y ? (2.0 * _16_s.x) * _17_d.x : _16_s.y * _17_d.y - (2.0 * (_17_d.y - _17_d.x)) * (_16_s.y - _16_s.x); + } + float4 _8_result = float4(_9_blend_overlay_component, _12_blend_overlay_component, _15_blend_overlay_component, _in.dst.w + (1.0 - _in.dst.w) * _in.src.w); + + + + _8_result.xyz = _8_result.xyz + _in.src.xyz * (1.0 - _in.dst.w) + _in.dst.xyz * (1.0 - _in.src.w); + _7_blend_overlay = _8_result; + } + _0_blend_hard_light = _7_blend_overlay; + } _out->sk_FragColor = _0_blend_hard_light; diff --git a/tests/sksl/blend/golden/BlendHardLightStandaloneSettings.glsl b/tests/sksl/blend/golden/BlendHardLightStandaloneSettings.glsl index 3dee5dca1e..0e25176f14 100644 --- a/tests/sksl/blend/golden/BlendHardLightStandaloneSettings.glsl +++ b/tests/sksl/blend/golden/BlendHardLightStandaloneSettings.glsl @@ -1,42 +1,38 @@ out vec4 sk_FragColor; in vec4 src, dst; -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); -} -vec4 blend_overlay(vec4 src, vec4 dst) { - float _1_blend_overlay_component; - vec2 _2_s = src.xw; - vec2 _3_d = dst.xw; - { - _1_blend_overlay_component = 2.0 * _3_d.x <= _3_d.y ? (2.0 * _2_s.x) * _3_d.x : _2_s.y * _3_d.y - (2.0 * (_3_d.y - _3_d.x)) * (_2_s.y - _2_s.x); - } - float _4_blend_overlay_component; - vec2 _5_s = src.yw; - vec2 _6_d = dst.yw; - { - _4_blend_overlay_component = 2.0 * _6_d.x <= _6_d.y ? (2.0 * _5_s.x) * _6_d.x : _5_s.y * _6_d.y - (2.0 * (_6_d.y - _6_d.x)) * (_5_s.y - _5_s.x); - } - float _7_blend_overlay_component; - vec2 _8_s = src.zw; - vec2 _9_d = dst.zw; - { - _7_blend_overlay_component = 2.0 * _9_d.x <= _9_d.y ? (2.0 * _8_s.x) * _9_d.x : _8_s.y * _9_d.y - (2.0 * (_9_d.y - _9_d.x)) * (_8_s.y - _8_s.x); - } - vec4 result = vec4(_1_blend_overlay_component, _4_blend_overlay_component, _7_blend_overlay_component, src.w + (1.0 - src.w) * dst.w); - - - - result.xyz += dst.xyz * (1.0 - src.w) + src.xyz * (1.0 - dst.w); - return result; -} -vec4 blend_hard_light(vec4 src, vec4 dst) { - return blend_overlay(dst, src); -} void main() { vec4 _0_blend_hard_light; { - _0_blend_hard_light = blend_overlay(dst, src); + vec4 _7_blend_overlay; + { + float _9_blend_overlay_component; + vec2 _10_s = dst.xw; + vec2 _11_d = src.xw; + { + _9_blend_overlay_component = 2.0 * _11_d.x <= _11_d.y ? (2.0 * _10_s.x) * _11_d.x : _10_s.y * _11_d.y - (2.0 * (_11_d.y - _11_d.x)) * (_10_s.y - _10_s.x); + } + float _12_blend_overlay_component; + vec2 _13_s = dst.yw; + vec2 _14_d = src.yw; + { + _12_blend_overlay_component = 2.0 * _14_d.x <= _14_d.y ? (2.0 * _13_s.x) * _14_d.x : _13_s.y * _14_d.y - (2.0 * (_14_d.y - _14_d.x)) * (_13_s.y - _13_s.x); + } + float _15_blend_overlay_component; + vec2 _16_s = dst.zw; + vec2 _17_d = src.zw; + { + _15_blend_overlay_component = 2.0 * _17_d.x <= _17_d.y ? (2.0 * _16_s.x) * _17_d.x : _16_s.y * _17_d.y - (2.0 * (_17_d.y - _17_d.x)) * (_16_s.y - _16_s.x); + } + vec4 _8_result = vec4(_9_blend_overlay_component, _12_blend_overlay_component, _15_blend_overlay_component, dst.w + (1.0 - dst.w) * src.w); + + + + _8_result.xyz += src.xyz * (1.0 - dst.w) + dst.xyz * (1.0 - src.w); + _7_blend_overlay = _8_result; + } + _0_blend_hard_light = _7_blend_overlay; + } sk_FragColor = _0_blend_hard_light; diff --git a/tests/sksl/blend/golden/BlendHue.glsl b/tests/sksl/blend/golden/BlendHue.glsl index c7328600aa..56f7870e35 100644 --- a/tests/sksl/blend/golden/BlendHue.glsl +++ b/tests/sksl/blend/golden/BlendHue.glsl @@ -1,100 +1,98 @@ #version 400 out vec4 sk_FragColor; in vec4 src, dst; -float _blend_color_luminance(vec3 color) { - return dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), color); -} -vec3 _blend_set_color_luminance(vec3 hueSatColor, float alpha, vec3 lumColor) { - float _0_blend_color_luminance; - { - _0_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), lumColor); - } - float lum = _0_blend_color_luminance; - - float _1_blend_color_luminance; - { - _1_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), hueSatColor); - } - vec3 result = (lum - _1_blend_color_luminance) + hueSatColor; - - float minComp = min(min(result.x, result.y), result.z); - float maxComp = max(max(result.x, result.y), result.z); - if (minComp < 0.0 && lum != minComp) { - result = lum + ((result - lum) * lum) / (lum - minComp); - } - return maxComp > alpha && maxComp != lum ? lum + ((result - lum) * (alpha - lum)) / (maxComp - lum) : result; -} -float _blend_color_saturation(vec3 color) { - return max(max(color.x, color.y), color.z) - min(min(color.x, color.y), color.z); -} -vec3 _blend_set_color_saturation_helper(vec3 minMidMax, float sat) { - return minMidMax.x < minMidMax.z ? vec3(0.0, (sat * (minMidMax.y - minMidMax.x)) / (minMidMax.z - minMidMax.x), sat) : vec3(0.0); -} -vec3 _blend_set_color_saturation(vec3 hueLumColor, vec3 satColor) { - float _2_blend_color_saturation; - { - _2_blend_color_saturation = max(max(satColor.x, satColor.y), satColor.z) - min(min(satColor.x, satColor.y), satColor.z); - } - float sat = _2_blend_color_saturation; - - if (hueLumColor.x <= hueLumColor.y) { - if (hueLumColor.y <= hueLumColor.z) { - vec3 _3_blend_set_color_saturation_helper; - { - _3_blend_set_color_saturation_helper = hueLumColor.x < hueLumColor.z ? vec3(0.0, (sat * (hueLumColor.y - hueLumColor.x)) / (hueLumColor.z - hueLumColor.x), sat) : vec3(0.0); - } - hueLumColor.xyz = _3_blend_set_color_saturation_helper; - - } else if (hueLumColor.x <= hueLumColor.z) { - vec3 _4_blend_set_color_saturation_helper; - vec3 _5_minMidMax = hueLumColor.xzy; - { - _4_blend_set_color_saturation_helper = _5_minMidMax.x < _5_minMidMax.z ? vec3(0.0, (sat * (_5_minMidMax.y - _5_minMidMax.x)) / (_5_minMidMax.z - _5_minMidMax.x), sat) : vec3(0.0); - } - hueLumColor.xzy = _4_blend_set_color_saturation_helper; - - } else { - vec3 _6_blend_set_color_saturation_helper; - vec3 _7_minMidMax = hueLumColor.zxy; - { - _6_blend_set_color_saturation_helper = _7_minMidMax.x < _7_minMidMax.z ? vec3(0.0, (sat * (_7_minMidMax.y - _7_minMidMax.x)) / (_7_minMidMax.z - _7_minMidMax.x), sat) : vec3(0.0); - } - hueLumColor.zxy = _6_blend_set_color_saturation_helper; - - } - } else if (hueLumColor.x <= hueLumColor.z) { - vec3 _8_blend_set_color_saturation_helper; - vec3 _9_minMidMax = hueLumColor.yxz; - { - _8_blend_set_color_saturation_helper = _9_minMidMax.x < _9_minMidMax.z ? vec3(0.0, (sat * (_9_minMidMax.y - _9_minMidMax.x)) / (_9_minMidMax.z - _9_minMidMax.x), sat) : vec3(0.0); - } - hueLumColor.yxz = _8_blend_set_color_saturation_helper; - - } else if (hueLumColor.y <= hueLumColor.z) { - vec3 _10_blend_set_color_saturation_helper; - vec3 _11_minMidMax = hueLumColor.yzx; - { - _10_blend_set_color_saturation_helper = _11_minMidMax.x < _11_minMidMax.z ? vec3(0.0, (sat * (_11_minMidMax.y - _11_minMidMax.x)) / (_11_minMidMax.z - _11_minMidMax.x), sat) : vec3(0.0); - } - hueLumColor.yzx = _10_blend_set_color_saturation_helper; - - } else { - vec3 _12_blend_set_color_saturation_helper; - vec3 _13_minMidMax = hueLumColor.zyx; - { - _12_blend_set_color_saturation_helper = _13_minMidMax.x < _13_minMidMax.z ? vec3(0.0, (sat * (_13_minMidMax.y - _13_minMidMax.x)) / (_13_minMidMax.z - _13_minMidMax.x), sat) : vec3(0.0); - } - hueLumColor.zyx = _12_blend_set_color_saturation_helper; - - } - return hueLumColor; -} -vec4 blend_hue(vec4 src, vec4 dst) { - float alpha = dst.w * src.w; - vec3 sda = src.xyz * dst.w; - vec3 dsa = dst.xyz * src.w; - return vec4((((_blend_set_color_luminance(_blend_set_color_saturation(sda, dsa), alpha, dsa) + dst.xyz) - dsa) + src.xyz) - sda, (src.w + dst.w) - alpha); -} void main() { - sk_FragColor = blend_hue(src, dst); + vec4 _17_blend_hue; + { + float _18_alpha = dst.w * src.w; + vec3 _19_sda = src.xyz * dst.w; + vec3 _20_dsa = dst.xyz * src.w; + vec3 _21_blend_set_color_saturation; + vec3 _22_hueLumColor = _19_sda; + { + float _24_blend_color_saturation; + { + _24_blend_color_saturation = max(max(_20_dsa.x, _20_dsa.y), _20_dsa.z) - min(min(_20_dsa.x, _20_dsa.y), _20_dsa.z); + } + float _23_sat = _24_blend_color_saturation; + + if (_22_hueLumColor.x <= _22_hueLumColor.y) { + if (_22_hueLumColor.y <= _22_hueLumColor.z) { + vec3 _25_blend_set_color_saturation_helper; + { + _25_blend_set_color_saturation_helper = _22_hueLumColor.x < _22_hueLumColor.z ? vec3(0.0, (_23_sat * (_22_hueLumColor.y - _22_hueLumColor.x)) / (_22_hueLumColor.z - _22_hueLumColor.x), _23_sat) : vec3(0.0); + } + _22_hueLumColor.xyz = _25_blend_set_color_saturation_helper; + + } else if (_22_hueLumColor.x <= _22_hueLumColor.z) { + vec3 _26_blend_set_color_saturation_helper; + vec3 _27_minMidMax = _22_hueLumColor.xzy; + { + _26_blend_set_color_saturation_helper = _27_minMidMax.x < _27_minMidMax.z ? vec3(0.0, (_23_sat * (_27_minMidMax.y - _27_minMidMax.x)) / (_27_minMidMax.z - _27_minMidMax.x), _23_sat) : vec3(0.0); + } + _22_hueLumColor.xzy = _26_blend_set_color_saturation_helper; + + } else { + vec3 _28_blend_set_color_saturation_helper; + vec3 _29_minMidMax = _22_hueLumColor.zxy; + { + _28_blend_set_color_saturation_helper = _29_minMidMax.x < _29_minMidMax.z ? vec3(0.0, (_23_sat * (_29_minMidMax.y - _29_minMidMax.x)) / (_29_minMidMax.z - _29_minMidMax.x), _23_sat) : vec3(0.0); + } + _22_hueLumColor.zxy = _28_blend_set_color_saturation_helper; + + } + } else if (_22_hueLumColor.x <= _22_hueLumColor.z) { + vec3 _30_blend_set_color_saturation_helper; + vec3 _31_minMidMax = _22_hueLumColor.yxz; + { + _30_blend_set_color_saturation_helper = _31_minMidMax.x < _31_minMidMax.z ? vec3(0.0, (_23_sat * (_31_minMidMax.y - _31_minMidMax.x)) / (_31_minMidMax.z - _31_minMidMax.x), _23_sat) : vec3(0.0); + } + _22_hueLumColor.yxz = _30_blend_set_color_saturation_helper; + + } else if (_22_hueLumColor.y <= _22_hueLumColor.z) { + vec3 _32_blend_set_color_saturation_helper; + vec3 _33_minMidMax = _22_hueLumColor.yzx; + { + _32_blend_set_color_saturation_helper = _33_minMidMax.x < _33_minMidMax.z ? vec3(0.0, (_23_sat * (_33_minMidMax.y - _33_minMidMax.x)) / (_33_minMidMax.z - _33_minMidMax.x), _23_sat) : vec3(0.0); + } + _22_hueLumColor.yzx = _32_blend_set_color_saturation_helper; + + } else { + vec3 _34_blend_set_color_saturation_helper; + vec3 _35_minMidMax = _22_hueLumColor.zyx; + { + _34_blend_set_color_saturation_helper = _35_minMidMax.x < _35_minMidMax.z ? vec3(0.0, (_23_sat * (_35_minMidMax.y - _35_minMidMax.x)) / (_35_minMidMax.z - _35_minMidMax.x), _23_sat) : vec3(0.0); + } + _22_hueLumColor.zyx = _34_blend_set_color_saturation_helper; + + } + _21_blend_set_color_saturation = _22_hueLumColor; + } + vec3 _36_blend_set_color_luminance; + { + float _41_blend_color_luminance; + { + _41_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), _20_dsa); + } + float _37_lum = _41_blend_color_luminance; + + float _42_blend_color_luminance; + { + _42_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), _21_blend_set_color_saturation); + } + vec3 _38_result = (_37_lum - _42_blend_color_luminance) + _21_blend_set_color_saturation; + + float _39_minComp = min(min(_38_result.x, _38_result.y), _38_result.z); + float _40_maxComp = max(max(_38_result.x, _38_result.y), _38_result.z); + if (_39_minComp < 0.0 && _37_lum != _39_minComp) { + _38_result = _37_lum + ((_38_result - _37_lum) * _37_lum) / (_37_lum - _39_minComp); + } + _36_blend_set_color_luminance = _40_maxComp > _18_alpha && _40_maxComp != _37_lum ? _37_lum + ((_38_result - _37_lum) * (_18_alpha - _37_lum)) / (_40_maxComp - _37_lum) : _38_result; + } + _17_blend_hue = vec4((((_36_blend_set_color_luminance + dst.xyz) - _20_dsa) + src.xyz) - _19_sda, (src.w + dst.w) - _18_alpha); + + + } + sk_FragColor = _17_blend_hue; + } diff --git a/tests/sksl/blend/golden/BlendHue.metal b/tests/sksl/blend/golden/BlendHue.metal index fd6b63b3e8..e560fc1015 100644 --- a/tests/sksl/blend/golden/BlendHue.metal +++ b/tests/sksl/blend/golden/BlendHue.metal @@ -8,103 +8,101 @@ struct Outputs { float4 sk_FragColor [[color(0)]]; }; -float _blend_color_luminance(float3 color) { - return dot(float3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), color); -} -float3 _blend_set_color_luminance(float3 hueSatColor, float alpha, float3 lumColor) { - float _0_blend_color_luminance; - { - _0_blend_color_luminance = dot(float3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), lumColor); - } - float lum = _0_blend_color_luminance; - - float _1_blend_color_luminance; - { - _1_blend_color_luminance = dot(float3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), hueSatColor); - } - float3 result = (lum - _1_blend_color_luminance) + hueSatColor; - - float minComp = min(min(result.x, result.y), result.z); - float maxComp = max(max(result.x, result.y), result.z); - if (minComp < 0.0 && lum != minComp) { - result = lum + ((result - lum) * lum) / (lum - minComp); - } - return maxComp > alpha && maxComp != lum ? lum + ((result - lum) * (alpha - lum)) / (maxComp - lum) : result; -} -float _blend_color_saturation(float3 color) { - return max(max(color.x, color.y), color.z) - min(min(color.x, color.y), color.z); -} -float3 _blend_set_color_saturation_helper(float3 minMidMax, float sat) { - return minMidMax.x < minMidMax.z ? float3(0.0, (sat * (minMidMax.y - minMidMax.x)) / (minMidMax.z - minMidMax.x), sat) : float3(0.0); -} -float3 _blend_set_color_saturation(float3 hueLumColor, float3 satColor) { - float _2_blend_color_saturation; - { - _2_blend_color_saturation = max(max(satColor.x, satColor.y), satColor.z) - min(min(satColor.x, satColor.y), satColor.z); - } - float sat = _2_blend_color_saturation; - - if (hueLumColor.x <= hueLumColor.y) { - if (hueLumColor.y <= hueLumColor.z) { - float3 _3_blend_set_color_saturation_helper; - { - _3_blend_set_color_saturation_helper = hueLumColor.x < hueLumColor.z ? float3(0.0, (sat * (hueLumColor.y - hueLumColor.x)) / (hueLumColor.z - hueLumColor.x), sat) : float3(0.0); - } - hueLumColor.xyz = _3_blend_set_color_saturation_helper; - - } else if (hueLumColor.x <= hueLumColor.z) { - float3 _4_blend_set_color_saturation_helper; - float3 _5_minMidMax = hueLumColor.xzy; - { - _4_blend_set_color_saturation_helper = _5_minMidMax.x < _5_minMidMax.z ? float3(0.0, (sat * (_5_minMidMax.y - _5_minMidMax.x)) / (_5_minMidMax.z - _5_minMidMax.x), sat) : float3(0.0); - } - hueLumColor.xzy = _4_blend_set_color_saturation_helper; - - } else { - float3 _6_blend_set_color_saturation_helper; - float3 _7_minMidMax = hueLumColor.zxy; - { - _6_blend_set_color_saturation_helper = _7_minMidMax.x < _7_minMidMax.z ? float3(0.0, (sat * (_7_minMidMax.y - _7_minMidMax.x)) / (_7_minMidMax.z - _7_minMidMax.x), sat) : float3(0.0); - } - hueLumColor.zxy = _6_blend_set_color_saturation_helper; - - } - } else if (hueLumColor.x <= hueLumColor.z) { - float3 _8_blend_set_color_saturation_helper; - float3 _9_minMidMax = hueLumColor.yxz; - { - _8_blend_set_color_saturation_helper = _9_minMidMax.x < _9_minMidMax.z ? float3(0.0, (sat * (_9_minMidMax.y - _9_minMidMax.x)) / (_9_minMidMax.z - _9_minMidMax.x), sat) : float3(0.0); - } - hueLumColor.yxz = _8_blend_set_color_saturation_helper; - - } else if (hueLumColor.y <= hueLumColor.z) { - float3 _10_blend_set_color_saturation_helper; - float3 _11_minMidMax = hueLumColor.yzx; - { - _10_blend_set_color_saturation_helper = _11_minMidMax.x < _11_minMidMax.z ? float3(0.0, (sat * (_11_minMidMax.y - _11_minMidMax.x)) / (_11_minMidMax.z - _11_minMidMax.x), sat) : float3(0.0); - } - hueLumColor.yzx = _10_blend_set_color_saturation_helper; - - } else { - float3 _12_blend_set_color_saturation_helper; - float3 _13_minMidMax = hueLumColor.zyx; - { - _12_blend_set_color_saturation_helper = _13_minMidMax.x < _13_minMidMax.z ? float3(0.0, (sat * (_13_minMidMax.y - _13_minMidMax.x)) / (_13_minMidMax.z - _13_minMidMax.x), sat) : float3(0.0); - } - hueLumColor.zyx = _12_blend_set_color_saturation_helper; - - } - return hueLumColor; -} -float4 blend_hue(float4 src, float4 dst) { - float alpha = dst.w * src.w; - float3 sda = src.xyz * dst.w; - float3 dsa = dst.xyz * src.w; - return float4((((_blend_set_color_luminance(_blend_set_color_saturation(sda, dsa), alpha, dsa) + dst.xyz) - dsa) + src.xyz) - sda, (src.w + dst.w) - alpha); -} fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { Outputs _outputStruct; thread Outputs* _out = &_outputStruct; - _out->sk_FragColor = blend_hue(_in.src, _in.dst); + float4 _17_blend_hue; + { + float _18_alpha = _in.dst.w * _in.src.w; + float3 _19_sda = _in.src.xyz * _in.dst.w; + float3 _20_dsa = _in.dst.xyz * _in.src.w; + float3 _21_blend_set_color_saturation; + float3 _22_hueLumColor = _19_sda; + { + float _24_blend_color_saturation; + { + _24_blend_color_saturation = max(max(_20_dsa.x, _20_dsa.y), _20_dsa.z) - min(min(_20_dsa.x, _20_dsa.y), _20_dsa.z); + } + float _23_sat = _24_blend_color_saturation; + + if (_22_hueLumColor.x <= _22_hueLumColor.y) { + if (_22_hueLumColor.y <= _22_hueLumColor.z) { + float3 _25_blend_set_color_saturation_helper; + { + _25_blend_set_color_saturation_helper = _22_hueLumColor.x < _22_hueLumColor.z ? float3(0.0, (_23_sat * (_22_hueLumColor.y - _22_hueLumColor.x)) / (_22_hueLumColor.z - _22_hueLumColor.x), _23_sat) : float3(0.0); + } + _22_hueLumColor.xyz = _25_blend_set_color_saturation_helper; + + } else if (_22_hueLumColor.x <= _22_hueLumColor.z) { + float3 _26_blend_set_color_saturation_helper; + float3 _27_minMidMax = _22_hueLumColor.xzy; + { + _26_blend_set_color_saturation_helper = _27_minMidMax.x < _27_minMidMax.z ? float3(0.0, (_23_sat * (_27_minMidMax.y - _27_minMidMax.x)) / (_27_minMidMax.z - _27_minMidMax.x), _23_sat) : float3(0.0); + } + _22_hueLumColor.xzy = _26_blend_set_color_saturation_helper; + + } else { + float3 _28_blend_set_color_saturation_helper; + float3 _29_minMidMax = _22_hueLumColor.zxy; + { + _28_blend_set_color_saturation_helper = _29_minMidMax.x < _29_minMidMax.z ? float3(0.0, (_23_sat * (_29_minMidMax.y - _29_minMidMax.x)) / (_29_minMidMax.z - _29_minMidMax.x), _23_sat) : float3(0.0); + } + _22_hueLumColor.zxy = _28_blend_set_color_saturation_helper; + + } + } else if (_22_hueLumColor.x <= _22_hueLumColor.z) { + float3 _30_blend_set_color_saturation_helper; + float3 _31_minMidMax = _22_hueLumColor.yxz; + { + _30_blend_set_color_saturation_helper = _31_minMidMax.x < _31_minMidMax.z ? float3(0.0, (_23_sat * (_31_minMidMax.y - _31_minMidMax.x)) / (_31_minMidMax.z - _31_minMidMax.x), _23_sat) : float3(0.0); + } + _22_hueLumColor.yxz = _30_blend_set_color_saturation_helper; + + } else if (_22_hueLumColor.y <= _22_hueLumColor.z) { + float3 _32_blend_set_color_saturation_helper; + float3 _33_minMidMax = _22_hueLumColor.yzx; + { + _32_blend_set_color_saturation_helper = _33_minMidMax.x < _33_minMidMax.z ? float3(0.0, (_23_sat * (_33_minMidMax.y - _33_minMidMax.x)) / (_33_minMidMax.z - _33_minMidMax.x), _23_sat) : float3(0.0); + } + _22_hueLumColor.yzx = _32_blend_set_color_saturation_helper; + + } else { + float3 _34_blend_set_color_saturation_helper; + float3 _35_minMidMax = _22_hueLumColor.zyx; + { + _34_blend_set_color_saturation_helper = _35_minMidMax.x < _35_minMidMax.z ? float3(0.0, (_23_sat * (_35_minMidMax.y - _35_minMidMax.x)) / (_35_minMidMax.z - _35_minMidMax.x), _23_sat) : float3(0.0); + } + _22_hueLumColor.zyx = _34_blend_set_color_saturation_helper; + + } + _21_blend_set_color_saturation = _22_hueLumColor; + } + float3 _36_blend_set_color_luminance; + { + float _41_blend_color_luminance; + { + _41_blend_color_luminance = dot(float3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), _20_dsa); + } + float _37_lum = _41_blend_color_luminance; + + float _42_blend_color_luminance; + { + _42_blend_color_luminance = dot(float3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), _21_blend_set_color_saturation); + } + float3 _38_result = (_37_lum - _42_blend_color_luminance) + _21_blend_set_color_saturation; + + float _39_minComp = min(min(_38_result.x, _38_result.y), _38_result.z); + float _40_maxComp = max(max(_38_result.x, _38_result.y), _38_result.z); + if (_39_minComp < 0.0 && _37_lum != _39_minComp) { + _38_result = _37_lum + ((_38_result - _37_lum) * _37_lum) / (_37_lum - _39_minComp); + } + _36_blend_set_color_luminance = _40_maxComp > _18_alpha && _40_maxComp != _37_lum ? _37_lum + ((_38_result - _37_lum) * (_18_alpha - _37_lum)) / (_40_maxComp - _37_lum) : _38_result; + } + _17_blend_hue = float4((((_36_blend_set_color_luminance + _in.dst.xyz) - _20_dsa) + _in.src.xyz) - _19_sda, (_in.src.w + _in.dst.w) - _18_alpha); + + + } + _out->sk_FragColor = _17_blend_hue; + return *_out; } diff --git a/tests/sksl/blend/golden/BlendHueStandaloneSettings.glsl b/tests/sksl/blend/golden/BlendHueStandaloneSettings.glsl index 718ced9a7b..c792d393c1 100644 --- a/tests/sksl/blend/golden/BlendHueStandaloneSettings.glsl +++ b/tests/sksl/blend/golden/BlendHueStandaloneSettings.glsl @@ -1,100 +1,98 @@ out vec4 sk_FragColor; in vec4 src, dst; -float _blend_color_luminance(vec3 color) { - return dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), color); -} -vec3 _blend_set_color_luminance(vec3 hueSatColor, float alpha, vec3 lumColor) { - float _0_blend_color_luminance; - { - _0_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), lumColor); - } - float lum = _0_blend_color_luminance; - - float _1_blend_color_luminance; - { - _1_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), hueSatColor); - } - vec3 result = (lum - _1_blend_color_luminance) + hueSatColor; - - float minComp = min(min(result.x, result.y), result.z); - float maxComp = max(max(result.x, result.y), result.z); - if (minComp < 0.0 && lum != minComp) { - result = lum + ((result - lum) * lum) / (lum - minComp); - } - return maxComp > alpha && maxComp != lum ? lum + ((result - lum) * (alpha - lum)) / (maxComp - lum) : result; -} -float _blend_color_saturation(vec3 color) { - return max(max(color.x, color.y), color.z) - min(min(color.x, color.y), color.z); -} -vec3 _blend_set_color_saturation_helper(vec3 minMidMax, float sat) { - return minMidMax.x < minMidMax.z ? vec3(0.0, (sat * (minMidMax.y - minMidMax.x)) / (minMidMax.z - minMidMax.x), sat) : vec3(0.0); -} -vec3 _blend_set_color_saturation(vec3 hueLumColor, vec3 satColor) { - float _2_blend_color_saturation; - { - _2_blend_color_saturation = max(max(satColor.x, satColor.y), satColor.z) - min(min(satColor.x, satColor.y), satColor.z); - } - float sat = _2_blend_color_saturation; - - if (hueLumColor.x <= hueLumColor.y) { - if (hueLumColor.y <= hueLumColor.z) { - vec3 _3_blend_set_color_saturation_helper; - { - _3_blend_set_color_saturation_helper = hueLumColor.x < hueLumColor.z ? vec3(0.0, (sat * (hueLumColor.y - hueLumColor.x)) / (hueLumColor.z - hueLumColor.x), sat) : vec3(0.0); - } - hueLumColor.xyz = _3_blend_set_color_saturation_helper; - - } else if (hueLumColor.x <= hueLumColor.z) { - vec3 _4_blend_set_color_saturation_helper; - vec3 _5_minMidMax = hueLumColor.xzy; - { - _4_blend_set_color_saturation_helper = _5_minMidMax.x < _5_minMidMax.z ? vec3(0.0, (sat * (_5_minMidMax.y - _5_minMidMax.x)) / (_5_minMidMax.z - _5_minMidMax.x), sat) : vec3(0.0); - } - hueLumColor.xzy = _4_blend_set_color_saturation_helper; - - } else { - vec3 _6_blend_set_color_saturation_helper; - vec3 _7_minMidMax = hueLumColor.zxy; - { - _6_blend_set_color_saturation_helper = _7_minMidMax.x < _7_minMidMax.z ? vec3(0.0, (sat * (_7_minMidMax.y - _7_minMidMax.x)) / (_7_minMidMax.z - _7_minMidMax.x), sat) : vec3(0.0); - } - hueLumColor.zxy = _6_blend_set_color_saturation_helper; - - } - } else if (hueLumColor.x <= hueLumColor.z) { - vec3 _8_blend_set_color_saturation_helper; - vec3 _9_minMidMax = hueLumColor.yxz; - { - _8_blend_set_color_saturation_helper = _9_minMidMax.x < _9_minMidMax.z ? vec3(0.0, (sat * (_9_minMidMax.y - _9_minMidMax.x)) / (_9_minMidMax.z - _9_minMidMax.x), sat) : vec3(0.0); - } - hueLumColor.yxz = _8_blend_set_color_saturation_helper; - - } else if (hueLumColor.y <= hueLumColor.z) { - vec3 _10_blend_set_color_saturation_helper; - vec3 _11_minMidMax = hueLumColor.yzx; - { - _10_blend_set_color_saturation_helper = _11_minMidMax.x < _11_minMidMax.z ? vec3(0.0, (sat * (_11_minMidMax.y - _11_minMidMax.x)) / (_11_minMidMax.z - _11_minMidMax.x), sat) : vec3(0.0); - } - hueLumColor.yzx = _10_blend_set_color_saturation_helper; - - } else { - vec3 _12_blend_set_color_saturation_helper; - vec3 _13_minMidMax = hueLumColor.zyx; - { - _12_blend_set_color_saturation_helper = _13_minMidMax.x < _13_minMidMax.z ? vec3(0.0, (sat * (_13_minMidMax.y - _13_minMidMax.x)) / (_13_minMidMax.z - _13_minMidMax.x), sat) : vec3(0.0); - } - hueLumColor.zyx = _12_blend_set_color_saturation_helper; - - } - return hueLumColor; -} -vec4 blend_hue(vec4 src, vec4 dst) { - float alpha = dst.w * src.w; - vec3 sda = src.xyz * dst.w; - vec3 dsa = dst.xyz * src.w; - return vec4((((_blend_set_color_luminance(_blend_set_color_saturation(sda, dsa), alpha, dsa) + dst.xyz) - dsa) + src.xyz) - sda, (src.w + dst.w) - alpha); -} void main() { - sk_FragColor = blend_hue(src, dst); + vec4 _17_blend_hue; + { + float _18_alpha = dst.w * src.w; + vec3 _19_sda = src.xyz * dst.w; + vec3 _20_dsa = dst.xyz * src.w; + vec3 _21_blend_set_color_saturation; + vec3 _22_hueLumColor = _19_sda; + { + float _24_blend_color_saturation; + { + _24_blend_color_saturation = max(max(_20_dsa.x, _20_dsa.y), _20_dsa.z) - min(min(_20_dsa.x, _20_dsa.y), _20_dsa.z); + } + float _23_sat = _24_blend_color_saturation; + + if (_22_hueLumColor.x <= _22_hueLumColor.y) { + if (_22_hueLumColor.y <= _22_hueLumColor.z) { + vec3 _25_blend_set_color_saturation_helper; + { + _25_blend_set_color_saturation_helper = _22_hueLumColor.x < _22_hueLumColor.z ? vec3(0.0, (_23_sat * (_22_hueLumColor.y - _22_hueLumColor.x)) / (_22_hueLumColor.z - _22_hueLumColor.x), _23_sat) : vec3(0.0); + } + _22_hueLumColor.xyz = _25_blend_set_color_saturation_helper; + + } else if (_22_hueLumColor.x <= _22_hueLumColor.z) { + vec3 _26_blend_set_color_saturation_helper; + vec3 _27_minMidMax = _22_hueLumColor.xzy; + { + _26_blend_set_color_saturation_helper = _27_minMidMax.x < _27_minMidMax.z ? vec3(0.0, (_23_sat * (_27_minMidMax.y - _27_minMidMax.x)) / (_27_minMidMax.z - _27_minMidMax.x), _23_sat) : vec3(0.0); + } + _22_hueLumColor.xzy = _26_blend_set_color_saturation_helper; + + } else { + vec3 _28_blend_set_color_saturation_helper; + vec3 _29_minMidMax = _22_hueLumColor.zxy; + { + _28_blend_set_color_saturation_helper = _29_minMidMax.x < _29_minMidMax.z ? vec3(0.0, (_23_sat * (_29_minMidMax.y - _29_minMidMax.x)) / (_29_minMidMax.z - _29_minMidMax.x), _23_sat) : vec3(0.0); + } + _22_hueLumColor.zxy = _28_blend_set_color_saturation_helper; + + } + } else if (_22_hueLumColor.x <= _22_hueLumColor.z) { + vec3 _30_blend_set_color_saturation_helper; + vec3 _31_minMidMax = _22_hueLumColor.yxz; + { + _30_blend_set_color_saturation_helper = _31_minMidMax.x < _31_minMidMax.z ? vec3(0.0, (_23_sat * (_31_minMidMax.y - _31_minMidMax.x)) / (_31_minMidMax.z - _31_minMidMax.x), _23_sat) : vec3(0.0); + } + _22_hueLumColor.yxz = _30_blend_set_color_saturation_helper; + + } else if (_22_hueLumColor.y <= _22_hueLumColor.z) { + vec3 _32_blend_set_color_saturation_helper; + vec3 _33_minMidMax = _22_hueLumColor.yzx; + { + _32_blend_set_color_saturation_helper = _33_minMidMax.x < _33_minMidMax.z ? vec3(0.0, (_23_sat * (_33_minMidMax.y - _33_minMidMax.x)) / (_33_minMidMax.z - _33_minMidMax.x), _23_sat) : vec3(0.0); + } + _22_hueLumColor.yzx = _32_blend_set_color_saturation_helper; + + } else { + vec3 _34_blend_set_color_saturation_helper; + vec3 _35_minMidMax = _22_hueLumColor.zyx; + { + _34_blend_set_color_saturation_helper = _35_minMidMax.x < _35_minMidMax.z ? vec3(0.0, (_23_sat * (_35_minMidMax.y - _35_minMidMax.x)) / (_35_minMidMax.z - _35_minMidMax.x), _23_sat) : vec3(0.0); + } + _22_hueLumColor.zyx = _34_blend_set_color_saturation_helper; + + } + _21_blend_set_color_saturation = _22_hueLumColor; + } + vec3 _36_blend_set_color_luminance; + { + float _41_blend_color_luminance; + { + _41_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), _20_dsa); + } + float _37_lum = _41_blend_color_luminance; + + float _42_blend_color_luminance; + { + _42_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), _21_blend_set_color_saturation); + } + vec3 _38_result = (_37_lum - _42_blend_color_luminance) + _21_blend_set_color_saturation; + + float _39_minComp = min(min(_38_result.x, _38_result.y), _38_result.z); + float _40_maxComp = max(max(_38_result.x, _38_result.y), _38_result.z); + if (_39_minComp < 0.0 && _37_lum != _39_minComp) { + _38_result = _37_lum + ((_38_result - _37_lum) * _37_lum) / (_37_lum - _39_minComp); + } + _36_blend_set_color_luminance = _40_maxComp > _18_alpha && _40_maxComp != _37_lum ? _37_lum + ((_38_result - _37_lum) * (_18_alpha - _37_lum)) / (_40_maxComp - _37_lum) : _38_result; + } + _17_blend_hue = vec4((((_36_blend_set_color_luminance + dst.xyz) - _20_dsa) + src.xyz) - _19_sda, (src.w + dst.w) - _18_alpha); + + + } + sk_FragColor = _17_blend_hue; + } diff --git a/tests/sksl/blend/golden/BlendLighten.glsl b/tests/sksl/blend/golden/BlendLighten.glsl index de387e3b25..bdc8bf707b 100644 --- a/tests/sksl/blend/golden/BlendLighten.glsl +++ b/tests/sksl/blend/golden/BlendLighten.glsl @@ -1,19 +1,6 @@ #version 400 out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_src_over(vec4 src, vec4 dst) { - return src + (1.0 - src.w) * dst; -} -vec4 blend_lighten(vec4 src, vec4 dst) { - vec4 _2_blend_src_over; - { - _2_blend_src_over = src + (1.0 - src.w) * dst; - } - vec4 result = _2_blend_src_over; - - result.xyz = max(result.xyz, (1.0 - dst.w) * src.xyz + dst.xyz); - return result; -} void main() { vec4 _0_blend_lighten; { diff --git a/tests/sksl/blend/golden/BlendLighten.metal b/tests/sksl/blend/golden/BlendLighten.metal index 3ff75bc3a2..f4ae9271e6 100644 --- a/tests/sksl/blend/golden/BlendLighten.metal +++ b/tests/sksl/blend/golden/BlendLighten.metal @@ -8,19 +8,6 @@ struct Outputs { float4 sk_FragColor [[color(0)]]; }; -float4 blend_src_over(float4 src, float4 dst) { - return src + (1.0 - src.w) * dst; -} -float4 blend_lighten(float4 src, float4 dst) { - float4 _2_blend_src_over; - { - _2_blend_src_over = src + (1.0 - src.w) * dst; - } - float4 result = _2_blend_src_over; - - result.xyz = max(result.xyz, (1.0 - dst.w) * src.xyz + dst.xyz); - return result; -} fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { Outputs _outputStruct; thread Outputs* _out = &_outputStruct; diff --git a/tests/sksl/blend/golden/BlendLightenStandaloneSettings.glsl b/tests/sksl/blend/golden/BlendLightenStandaloneSettings.glsl index cdf673b2e5..0e5c0f363b 100644 --- a/tests/sksl/blend/golden/BlendLightenStandaloneSettings.glsl +++ b/tests/sksl/blend/golden/BlendLightenStandaloneSettings.glsl @@ -1,19 +1,6 @@ out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_src_over(vec4 src, vec4 dst) { - return src + (1.0 - src.w) * dst; -} -vec4 blend_lighten(vec4 src, vec4 dst) { - vec4 _2_blend_src_over; - { - _2_blend_src_over = src + (1.0 - src.w) * dst; - } - vec4 result = _2_blend_src_over; - - result.xyz = max(result.xyz, (1.0 - dst.w) * src.xyz + dst.xyz); - return result; -} void main() { vec4 _0_blend_lighten; { diff --git a/tests/sksl/blend/golden/BlendLuminosity.glsl b/tests/sksl/blend/golden/BlendLuminosity.glsl index 5131c15a5f..f820a28d62 100644 --- a/tests/sksl/blend/golden/BlendLuminosity.glsl +++ b/tests/sksl/blend/golden/BlendLuminosity.glsl @@ -1,42 +1,35 @@ #version 400 out vec4 sk_FragColor; in vec4 src, dst; -float _blend_color_luminance(vec3 color) { - return dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), color); -} -vec3 _blend_set_color_luminance(vec3 hueSatColor, float alpha, vec3 lumColor) { - float _4_blend_color_luminance; - { - _4_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), lumColor); - } - float lum = _4_blend_color_luminance; - - float _5_blend_color_luminance; - { - _5_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), hueSatColor); - } - vec3 result = (lum - _5_blend_color_luminance) + hueSatColor; - - float minComp = min(min(result.x, result.y), result.z); - float maxComp = max(max(result.x, result.y), result.z); - if (minComp < 0.0 && lum != minComp) { - result = lum + ((result - lum) * lum) / (lum - minComp); - } - return maxComp > alpha && maxComp != lum ? lum + ((result - lum) * (alpha - lum)) / (maxComp - lum) : result; -} -vec4 blend_luminosity(vec4 src, vec4 dst) { - float alpha = dst.w * src.w; - vec3 sda = src.xyz * dst.w; - vec3 dsa = dst.xyz * src.w; - return vec4((((_blend_set_color_luminance(dsa, alpha, sda) + dst.xyz) - dsa) + src.xyz) - sda, (src.w + dst.w) - alpha); -} void main() { vec4 _0_blend_luminosity; { float _1_alpha = dst.w * src.w; vec3 _2_sda = src.xyz * dst.w; vec3 _3_dsa = dst.xyz * src.w; - _0_blend_luminosity = vec4((((_blend_set_color_luminance(_3_dsa, _1_alpha, _2_sda) + dst.xyz) - _3_dsa) + src.xyz) - _2_sda, (src.w + dst.w) - _1_alpha); + vec3 _6_blend_set_color_luminance; + { + float _11_blend_color_luminance; + { + _11_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), _2_sda); + } + float _7_lum = _11_blend_color_luminance; + + float _12_blend_color_luminance; + { + _12_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), _3_dsa); + } + vec3 _8_result = (_7_lum - _12_blend_color_luminance) + _3_dsa; + + float _9_minComp = min(min(_8_result.x, _8_result.y), _8_result.z); + float _10_maxComp = max(max(_8_result.x, _8_result.y), _8_result.z); + if (_9_minComp < 0.0 && _7_lum != _9_minComp) { + _8_result = _7_lum + ((_8_result - _7_lum) * _7_lum) / (_7_lum - _9_minComp); + } + _6_blend_set_color_luminance = _10_maxComp > _1_alpha && _10_maxComp != _7_lum ? _7_lum + ((_8_result - _7_lum) * (_1_alpha - _7_lum)) / (_10_maxComp - _7_lum) : _8_result; + } + _0_blend_luminosity = vec4((((_6_blend_set_color_luminance + dst.xyz) - _3_dsa) + src.xyz) - _2_sda, (src.w + dst.w) - _1_alpha); + } sk_FragColor = _0_blend_luminosity; diff --git a/tests/sksl/blend/golden/BlendLuminosity.metal b/tests/sksl/blend/golden/BlendLuminosity.metal index edc9ae8d6b..aa5d90327c 100644 --- a/tests/sksl/blend/golden/BlendLuminosity.metal +++ b/tests/sksl/blend/golden/BlendLuminosity.metal @@ -8,35 +8,6 @@ struct Outputs { float4 sk_FragColor [[color(0)]]; }; -float _blend_color_luminance(float3 color) { - return dot(float3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), color); -} -float3 _blend_set_color_luminance(float3 hueSatColor, float alpha, float3 lumColor) { - float _4_blend_color_luminance; - { - _4_blend_color_luminance = dot(float3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), lumColor); - } - float lum = _4_blend_color_luminance; - - float _5_blend_color_luminance; - { - _5_blend_color_luminance = dot(float3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), hueSatColor); - } - float3 result = (lum - _5_blend_color_luminance) + hueSatColor; - - float minComp = min(min(result.x, result.y), result.z); - float maxComp = max(max(result.x, result.y), result.z); - if (minComp < 0.0 && lum != minComp) { - result = lum + ((result - lum) * lum) / (lum - minComp); - } - return maxComp > alpha && maxComp != lum ? lum + ((result - lum) * (alpha - lum)) / (maxComp - lum) : result; -} -float4 blend_luminosity(float4 src, float4 dst) { - float alpha = dst.w * src.w; - float3 sda = src.xyz * dst.w; - float3 dsa = dst.xyz * src.w; - return float4((((_blend_set_color_luminance(dsa, alpha, sda) + dst.xyz) - dsa) + src.xyz) - sda, (src.w + dst.w) - alpha); -} fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { Outputs _outputStruct; thread Outputs* _out = &_outputStruct; @@ -45,7 +16,29 @@ fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front float _1_alpha = _in.dst.w * _in.src.w; float3 _2_sda = _in.src.xyz * _in.dst.w; float3 _3_dsa = _in.dst.xyz * _in.src.w; - _0_blend_luminosity = float4((((_blend_set_color_luminance(_3_dsa, _1_alpha, _2_sda) + _in.dst.xyz) - _3_dsa) + _in.src.xyz) - _2_sda, (_in.src.w + _in.dst.w) - _1_alpha); + float3 _6_blend_set_color_luminance; + { + float _11_blend_color_luminance; + { + _11_blend_color_luminance = dot(float3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), _2_sda); + } + float _7_lum = _11_blend_color_luminance; + + float _12_blend_color_luminance; + { + _12_blend_color_luminance = dot(float3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), _3_dsa); + } + float3 _8_result = (_7_lum - _12_blend_color_luminance) + _3_dsa; + + float _9_minComp = min(min(_8_result.x, _8_result.y), _8_result.z); + float _10_maxComp = max(max(_8_result.x, _8_result.y), _8_result.z); + if (_9_minComp < 0.0 && _7_lum != _9_minComp) { + _8_result = _7_lum + ((_8_result - _7_lum) * _7_lum) / (_7_lum - _9_minComp); + } + _6_blend_set_color_luminance = _10_maxComp > _1_alpha && _10_maxComp != _7_lum ? _7_lum + ((_8_result - _7_lum) * (_1_alpha - _7_lum)) / (_10_maxComp - _7_lum) : _8_result; + } + _0_blend_luminosity = float4((((_6_blend_set_color_luminance + _in.dst.xyz) - _3_dsa) + _in.src.xyz) - _2_sda, (_in.src.w + _in.dst.w) - _1_alpha); + } _out->sk_FragColor = _0_blend_luminosity; diff --git a/tests/sksl/blend/golden/BlendLuminosityStandaloneSettings.glsl b/tests/sksl/blend/golden/BlendLuminosityStandaloneSettings.glsl index d32473f5fe..943d3a72a6 100644 --- a/tests/sksl/blend/golden/BlendLuminosityStandaloneSettings.glsl +++ b/tests/sksl/blend/golden/BlendLuminosityStandaloneSettings.glsl @@ -1,42 +1,35 @@ out vec4 sk_FragColor; in vec4 src, dst; -float _blend_color_luminance(vec3 color) { - return dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), color); -} -vec3 _blend_set_color_luminance(vec3 hueSatColor, float alpha, vec3 lumColor) { - float _4_blend_color_luminance; - { - _4_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), lumColor); - } - float lum = _4_blend_color_luminance; - - float _5_blend_color_luminance; - { - _5_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), hueSatColor); - } - vec3 result = (lum - _5_blend_color_luminance) + hueSatColor; - - float minComp = min(min(result.x, result.y), result.z); - float maxComp = max(max(result.x, result.y), result.z); - if (minComp < 0.0 && lum != minComp) { - result = lum + ((result - lum) * lum) / (lum - minComp); - } - return maxComp > alpha && maxComp != lum ? lum + ((result - lum) * (alpha - lum)) / (maxComp - lum) : result; -} -vec4 blend_luminosity(vec4 src, vec4 dst) { - float alpha = dst.w * src.w; - vec3 sda = src.xyz * dst.w; - vec3 dsa = dst.xyz * src.w; - return vec4((((_blend_set_color_luminance(dsa, alpha, sda) + dst.xyz) - dsa) + src.xyz) - sda, (src.w + dst.w) - alpha); -} void main() { vec4 _0_blend_luminosity; { float _1_alpha = dst.w * src.w; vec3 _2_sda = src.xyz * dst.w; vec3 _3_dsa = dst.xyz * src.w; - _0_blend_luminosity = vec4((((_blend_set_color_luminance(_3_dsa, _1_alpha, _2_sda) + dst.xyz) - _3_dsa) + src.xyz) - _2_sda, (src.w + dst.w) - _1_alpha); + vec3 _6_blend_set_color_luminance; + { + float _11_blend_color_luminance; + { + _11_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), _2_sda); + } + float _7_lum = _11_blend_color_luminance; + + float _12_blend_color_luminance; + { + _12_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), _3_dsa); + } + vec3 _8_result = (_7_lum - _12_blend_color_luminance) + _3_dsa; + + float _9_minComp = min(min(_8_result.x, _8_result.y), _8_result.z); + float _10_maxComp = max(max(_8_result.x, _8_result.y), _8_result.z); + if (_9_minComp < 0.0 && _7_lum != _9_minComp) { + _8_result = _7_lum + ((_8_result - _7_lum) * _7_lum) / (_7_lum - _9_minComp); + } + _6_blend_set_color_luminance = _10_maxComp > _1_alpha && _10_maxComp != _7_lum ? _7_lum + ((_8_result - _7_lum) * (_1_alpha - _7_lum)) / (_10_maxComp - _7_lum) : _8_result; + } + _0_blend_luminosity = vec4((((_6_blend_set_color_luminance + dst.xyz) - _3_dsa) + src.xyz) - _2_sda, (src.w + dst.w) - _1_alpha); + } sk_FragColor = _0_blend_luminosity; diff --git a/tests/sksl/blend/golden/BlendModulate.glsl b/tests/sksl/blend/golden/BlendModulate.glsl index 0b5254a29b..54ed5443a4 100644 --- a/tests/sksl/blend/golden/BlendModulate.glsl +++ b/tests/sksl/blend/golden/BlendModulate.glsl @@ -1,9 +1,6 @@ #version 400 out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_modulate(vec4 src, vec4 dst) { - return src * dst; -} void main() { vec4 _0_blend_modulate; { diff --git a/tests/sksl/blend/golden/BlendModulate.metal b/tests/sksl/blend/golden/BlendModulate.metal index d36a5b2355..ae5f7c60f6 100644 --- a/tests/sksl/blend/golden/BlendModulate.metal +++ b/tests/sksl/blend/golden/BlendModulate.metal @@ -8,9 +8,6 @@ struct Outputs { float4 sk_FragColor [[color(0)]]; }; -float4 blend_modulate(float4 src, float4 dst) { - return src * dst; -} fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { Outputs _outputStruct; thread Outputs* _out = &_outputStruct; diff --git a/tests/sksl/blend/golden/BlendModulateStandaloneSettings.glsl b/tests/sksl/blend/golden/BlendModulateStandaloneSettings.glsl index 867d0a053b..8f1db211d4 100644 --- a/tests/sksl/blend/golden/BlendModulateStandaloneSettings.glsl +++ b/tests/sksl/blend/golden/BlendModulateStandaloneSettings.glsl @@ -1,9 +1,6 @@ out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_modulate(vec4 src, vec4 dst) { - return src * dst; -} void main() { vec4 _0_blend_modulate; { diff --git a/tests/sksl/blend/golden/BlendMultiply.glsl b/tests/sksl/blend/golden/BlendMultiply.glsl index 67575810dc..15e8d5d4a4 100644 --- a/tests/sksl/blend/golden/BlendMultiply.glsl +++ b/tests/sksl/blend/golden/BlendMultiply.glsl @@ -1,9 +1,6 @@ #version 400 out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_multiply(vec4 src, vec4 dst) { - return vec4(((1.0 - src.w) * dst.xyz + (1.0 - dst.w) * src.xyz) + src.xyz * dst.xyz, src.w + (1.0 - src.w) * dst.w); -} void main() { vec4 _0_blend_multiply; { diff --git a/tests/sksl/blend/golden/BlendMultiply.metal b/tests/sksl/blend/golden/BlendMultiply.metal index 65b5c74099..7892069a7e 100644 --- a/tests/sksl/blend/golden/BlendMultiply.metal +++ b/tests/sksl/blend/golden/BlendMultiply.metal @@ -8,9 +8,6 @@ struct Outputs { float4 sk_FragColor [[color(0)]]; }; -float4 blend_multiply(float4 src, float4 dst) { - return float4(((1.0 - src.w) * dst.xyz + (1.0 - dst.w) * src.xyz) + src.xyz * dst.xyz, src.w + (1.0 - src.w) * dst.w); -} fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { Outputs _outputStruct; thread Outputs* _out = &_outputStruct; diff --git a/tests/sksl/blend/golden/BlendMultiplyStandaloneSettings.glsl b/tests/sksl/blend/golden/BlendMultiplyStandaloneSettings.glsl index f212214622..c750c792be 100644 --- a/tests/sksl/blend/golden/BlendMultiplyStandaloneSettings.glsl +++ b/tests/sksl/blend/golden/BlendMultiplyStandaloneSettings.glsl @@ -1,9 +1,6 @@ out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_multiply(vec4 src, vec4 dst) { - return vec4(((1.0 - src.w) * dst.xyz + (1.0 - dst.w) * src.xyz) + src.xyz * dst.xyz, src.w + (1.0 - src.w) * dst.w); -} void main() { vec4 _0_blend_multiply; { diff --git a/tests/sksl/blend/golden/BlendOverlap.glsl b/tests/sksl/blend/golden/BlendOverlap.glsl index 4513be8f33..8248462a98 100644 --- a/tests/sksl/blend/golden/BlendOverlap.glsl +++ b/tests/sksl/blend/golden/BlendOverlap.glsl @@ -1,35 +1,34 @@ #version 400 out vec4 sk_FragColor; in vec4 src, dst; -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); -} -vec4 blend_overlay(vec4 src, vec4 dst) { - float _0_blend_overlay_component; - vec2 _1_s = src.xw; - vec2 _2_d = dst.xw; - { - _0_blend_overlay_component = 2.0 * _2_d.x <= _2_d.y ? (2.0 * _1_s.x) * _2_d.x : _1_s.y * _2_d.y - (2.0 * (_2_d.y - _2_d.x)) * (_1_s.y - _1_s.x); - } - float _3_blend_overlay_component; - vec2 _4_s = src.yw; - vec2 _5_d = dst.yw; - { - _3_blend_overlay_component = 2.0 * _5_d.x <= _5_d.y ? (2.0 * _4_s.x) * _5_d.x : _4_s.y * _5_d.y - (2.0 * (_5_d.y - _5_d.x)) * (_4_s.y - _4_s.x); - } - float _6_blend_overlay_component; - vec2 _7_s = src.zw; - vec2 _8_d = dst.zw; - { - _6_blend_overlay_component = 2.0 * _8_d.x <= _8_d.y ? (2.0 * _7_s.x) * _8_d.x : _7_s.y * _8_d.y - (2.0 * (_8_d.y - _8_d.x)) * (_7_s.y - _7_s.x); - } - vec4 result = vec4(_0_blend_overlay_component, _3_blend_overlay_component, _6_blend_overlay_component, src.w + (1.0 - src.w) * dst.w); - - - - result.xyz += dst.xyz * (1.0 - src.w) + src.xyz * (1.0 - dst.w); - return result; -} void main() { - sk_FragColor = blend_overlay(src, dst); + vec4 _3_blend_overlay; + { + float _5_blend_overlay_component; + vec2 _6_s = src.xw; + vec2 _7_d = dst.xw; + { + _5_blend_overlay_component = 2.0 * _7_d.x <= _7_d.y ? (2.0 * _6_s.x) * _7_d.x : _6_s.y * _7_d.y - (2.0 * (_7_d.y - _7_d.x)) * (_6_s.y - _6_s.x); + } + float _8_blend_overlay_component; + vec2 _9_s = src.yw; + vec2 _10_d = dst.yw; + { + _8_blend_overlay_component = 2.0 * _10_d.x <= _10_d.y ? (2.0 * _9_s.x) * _10_d.x : _9_s.y * _10_d.y - (2.0 * (_10_d.y - _10_d.x)) * (_9_s.y - _9_s.x); + } + float _11_blend_overlay_component; + vec2 _12_s = src.zw; + vec2 _13_d = dst.zw; + { + _11_blend_overlay_component = 2.0 * _13_d.x <= _13_d.y ? (2.0 * _12_s.x) * _13_d.x : _12_s.y * _13_d.y - (2.0 * (_13_d.y - _13_d.x)) * (_12_s.y - _12_s.x); + } + vec4 _4_result = vec4(_5_blend_overlay_component, _8_blend_overlay_component, _11_blend_overlay_component, src.w + (1.0 - src.w) * dst.w); + + + + _4_result.xyz += dst.xyz * (1.0 - src.w) + src.xyz * (1.0 - dst.w); + _3_blend_overlay = _4_result; + } + sk_FragColor = _3_blend_overlay; + } diff --git a/tests/sksl/blend/golden/BlendOverlap.metal b/tests/sksl/blend/golden/BlendOverlap.metal index 83327dbcd4..3b4ec69151 100644 --- a/tests/sksl/blend/golden/BlendOverlap.metal +++ b/tests/sksl/blend/golden/BlendOverlap.metal @@ -8,38 +8,37 @@ struct Outputs { float4 sk_FragColor [[color(0)]]; }; -float _blend_overlay_component(float2 s, float2 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); -} -float4 blend_overlay(float4 src, float4 dst) { - float _0_blend_overlay_component; - float2 _1_s = src.xw; - float2 _2_d = dst.xw; - { - _0_blend_overlay_component = 2.0 * _2_d.x <= _2_d.y ? (2.0 * _1_s.x) * _2_d.x : _1_s.y * _2_d.y - (2.0 * (_2_d.y - _2_d.x)) * (_1_s.y - _1_s.x); - } - float _3_blend_overlay_component; - float2 _4_s = src.yw; - float2 _5_d = dst.yw; - { - _3_blend_overlay_component = 2.0 * _5_d.x <= _5_d.y ? (2.0 * _4_s.x) * _5_d.x : _4_s.y * _5_d.y - (2.0 * (_5_d.y - _5_d.x)) * (_4_s.y - _4_s.x); - } - float _6_blend_overlay_component; - float2 _7_s = src.zw; - float2 _8_d = dst.zw; - { - _6_blend_overlay_component = 2.0 * _8_d.x <= _8_d.y ? (2.0 * _7_s.x) * _8_d.x : _7_s.y * _8_d.y - (2.0 * (_8_d.y - _8_d.x)) * (_7_s.y - _7_s.x); - } - float4 result = float4(_0_blend_overlay_component, _3_blend_overlay_component, _6_blend_overlay_component, src.w + (1.0 - src.w) * dst.w); - - - - result.xyz = result.xyz + dst.xyz * (1.0 - src.w) + src.xyz * (1.0 - dst.w); - return result; -} fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { Outputs _outputStruct; thread Outputs* _out = &_outputStruct; - _out->sk_FragColor = blend_overlay(_in.src, _in.dst); + float4 _3_blend_overlay; + { + float _5_blend_overlay_component; + float2 _6_s = _in.src.xw; + float2 _7_d = _in.dst.xw; + { + _5_blend_overlay_component = 2.0 * _7_d.x <= _7_d.y ? (2.0 * _6_s.x) * _7_d.x : _6_s.y * _7_d.y - (2.0 * (_7_d.y - _7_d.x)) * (_6_s.y - _6_s.x); + } + float _8_blend_overlay_component; + float2 _9_s = _in.src.yw; + float2 _10_d = _in.dst.yw; + { + _8_blend_overlay_component = 2.0 * _10_d.x <= _10_d.y ? (2.0 * _9_s.x) * _10_d.x : _9_s.y * _10_d.y - (2.0 * (_10_d.y - _10_d.x)) * (_9_s.y - _9_s.x); + } + float _11_blend_overlay_component; + float2 _12_s = _in.src.zw; + float2 _13_d = _in.dst.zw; + { + _11_blend_overlay_component = 2.0 * _13_d.x <= _13_d.y ? (2.0 * _12_s.x) * _13_d.x : _12_s.y * _13_d.y - (2.0 * (_13_d.y - _13_d.x)) * (_12_s.y - _12_s.x); + } + float4 _4_result = float4(_5_blend_overlay_component, _8_blend_overlay_component, _11_blend_overlay_component, _in.src.w + (1.0 - _in.src.w) * _in.dst.w); + + + + _4_result.xyz = _4_result.xyz + _in.dst.xyz * (1.0 - _in.src.w) + _in.src.xyz * (1.0 - _in.dst.w); + _3_blend_overlay = _4_result; + } + _out->sk_FragColor = _3_blend_overlay; + return *_out; } diff --git a/tests/sksl/blend/golden/BlendOverlapStandaloneSettings.glsl b/tests/sksl/blend/golden/BlendOverlapStandaloneSettings.glsl index ef1b15da17..8d50305f69 100644 --- a/tests/sksl/blend/golden/BlendOverlapStandaloneSettings.glsl +++ b/tests/sksl/blend/golden/BlendOverlapStandaloneSettings.glsl @@ -1,35 +1,34 @@ out vec4 sk_FragColor; in vec4 src, dst; -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); -} -vec4 blend_overlay(vec4 src, vec4 dst) { - float _0_blend_overlay_component; - vec2 _1_s = src.xw; - vec2 _2_d = dst.xw; - { - _0_blend_overlay_component = 2.0 * _2_d.x <= _2_d.y ? (2.0 * _1_s.x) * _2_d.x : _1_s.y * _2_d.y - (2.0 * (_2_d.y - _2_d.x)) * (_1_s.y - _1_s.x); - } - float _3_blend_overlay_component; - vec2 _4_s = src.yw; - vec2 _5_d = dst.yw; - { - _3_blend_overlay_component = 2.0 * _5_d.x <= _5_d.y ? (2.0 * _4_s.x) * _5_d.x : _4_s.y * _5_d.y - (2.0 * (_5_d.y - _5_d.x)) * (_4_s.y - _4_s.x); - } - float _6_blend_overlay_component; - vec2 _7_s = src.zw; - vec2 _8_d = dst.zw; - { - _6_blend_overlay_component = 2.0 * _8_d.x <= _8_d.y ? (2.0 * _7_s.x) * _8_d.x : _7_s.y * _8_d.y - (2.0 * (_8_d.y - _8_d.x)) * (_7_s.y - _7_s.x); - } - vec4 result = vec4(_0_blend_overlay_component, _3_blend_overlay_component, _6_blend_overlay_component, src.w + (1.0 - src.w) * dst.w); - - - - result.xyz += dst.xyz * (1.0 - src.w) + src.xyz * (1.0 - dst.w); - return result; -} void main() { - sk_FragColor = blend_overlay(src, dst); + vec4 _3_blend_overlay; + { + float _5_blend_overlay_component; + vec2 _6_s = src.xw; + vec2 _7_d = dst.xw; + { + _5_blend_overlay_component = 2.0 * _7_d.x <= _7_d.y ? (2.0 * _6_s.x) * _7_d.x : _6_s.y * _7_d.y - (2.0 * (_7_d.y - _7_d.x)) * (_6_s.y - _6_s.x); + } + float _8_blend_overlay_component; + vec2 _9_s = src.yw; + vec2 _10_d = dst.yw; + { + _8_blend_overlay_component = 2.0 * _10_d.x <= _10_d.y ? (2.0 * _9_s.x) * _10_d.x : _9_s.y * _10_d.y - (2.0 * (_10_d.y - _10_d.x)) * (_9_s.y - _9_s.x); + } + float _11_blend_overlay_component; + vec2 _12_s = src.zw; + vec2 _13_d = dst.zw; + { + _11_blend_overlay_component = 2.0 * _13_d.x <= _13_d.y ? (2.0 * _12_s.x) * _13_d.x : _12_s.y * _13_d.y - (2.0 * (_13_d.y - _13_d.x)) * (_12_s.y - _12_s.x); + } + vec4 _4_result = vec4(_5_blend_overlay_component, _8_blend_overlay_component, _11_blend_overlay_component, src.w + (1.0 - src.w) * dst.w); + + + + _4_result.xyz += dst.xyz * (1.0 - src.w) + src.xyz * (1.0 - dst.w); + _3_blend_overlay = _4_result; + } + sk_FragColor = _3_blend_overlay; + } diff --git a/tests/sksl/blend/golden/BlendPlus.glsl b/tests/sksl/blend/golden/BlendPlus.glsl index aae0626ce0..046c7f4c96 100644 --- a/tests/sksl/blend/golden/BlendPlus.glsl +++ b/tests/sksl/blend/golden/BlendPlus.glsl @@ -1,9 +1,6 @@ #version 400 out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_plus(vec4 src, vec4 dst) { - return min(src + dst, 1.0); -} void main() { vec4 _0_blend_plus; { diff --git a/tests/sksl/blend/golden/BlendPlus.metal b/tests/sksl/blend/golden/BlendPlus.metal index e50c55525b..2669da925d 100644 --- a/tests/sksl/blend/golden/BlendPlus.metal +++ b/tests/sksl/blend/golden/BlendPlus.metal @@ -8,9 +8,6 @@ struct Outputs { float4 sk_FragColor [[color(0)]]; }; -float4 blend_plus(float4 src, float4 dst) { - return min(src + dst, 1.0); -} fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { Outputs _outputStruct; thread Outputs* _out = &_outputStruct; diff --git a/tests/sksl/blend/golden/BlendPlusStandaloneSettings.glsl b/tests/sksl/blend/golden/BlendPlusStandaloneSettings.glsl index 43459cefed..548c351505 100644 --- a/tests/sksl/blend/golden/BlendPlusStandaloneSettings.glsl +++ b/tests/sksl/blend/golden/BlendPlusStandaloneSettings.glsl @@ -1,9 +1,6 @@ out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_plus(vec4 src, vec4 dst) { - return min(src + dst, 1.0); -} void main() { vec4 _0_blend_plus; { diff --git a/tests/sksl/blend/golden/BlendSaturation.glsl b/tests/sksl/blend/golden/BlendSaturation.glsl index 4dcd4dde94..ff06be5319 100644 --- a/tests/sksl/blend/golden/BlendSaturation.glsl +++ b/tests/sksl/blend/golden/BlendSaturation.glsl @@ -1,100 +1,98 @@ #version 400 out vec4 sk_FragColor; in vec4 src, dst; -float _blend_color_luminance(vec3 color) { - return dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), color); -} -vec3 _blend_set_color_luminance(vec3 hueSatColor, float alpha, vec3 lumColor) { - float _0_blend_color_luminance; - { - _0_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), lumColor); - } - float lum = _0_blend_color_luminance; - - float _1_blend_color_luminance; - { - _1_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), hueSatColor); - } - vec3 result = (lum - _1_blend_color_luminance) + hueSatColor; - - float minComp = min(min(result.x, result.y), result.z); - float maxComp = max(max(result.x, result.y), result.z); - if (minComp < 0.0 && lum != minComp) { - result = lum + ((result - lum) * lum) / (lum - minComp); - } - return maxComp > alpha && maxComp != lum ? lum + ((result - lum) * (alpha - lum)) / (maxComp - lum) : result; -} -float _blend_color_saturation(vec3 color) { - return max(max(color.x, color.y), color.z) - min(min(color.x, color.y), color.z); -} -vec3 _blend_set_color_saturation_helper(vec3 minMidMax, float sat) { - return minMidMax.x < minMidMax.z ? vec3(0.0, (sat * (minMidMax.y - minMidMax.x)) / (minMidMax.z - minMidMax.x), sat) : vec3(0.0); -} -vec3 _blend_set_color_saturation(vec3 hueLumColor, vec3 satColor) { - float _2_blend_color_saturation; - { - _2_blend_color_saturation = max(max(satColor.x, satColor.y), satColor.z) - min(min(satColor.x, satColor.y), satColor.z); - } - float sat = _2_blend_color_saturation; - - if (hueLumColor.x <= hueLumColor.y) { - if (hueLumColor.y <= hueLumColor.z) { - vec3 _3_blend_set_color_saturation_helper; - { - _3_blend_set_color_saturation_helper = hueLumColor.x < hueLumColor.z ? vec3(0.0, (sat * (hueLumColor.y - hueLumColor.x)) / (hueLumColor.z - hueLumColor.x), sat) : vec3(0.0); - } - hueLumColor.xyz = _3_blend_set_color_saturation_helper; - - } else if (hueLumColor.x <= hueLumColor.z) { - vec3 _4_blend_set_color_saturation_helper; - vec3 _5_minMidMax = hueLumColor.xzy; - { - _4_blend_set_color_saturation_helper = _5_minMidMax.x < _5_minMidMax.z ? vec3(0.0, (sat * (_5_minMidMax.y - _5_minMidMax.x)) / (_5_minMidMax.z - _5_minMidMax.x), sat) : vec3(0.0); - } - hueLumColor.xzy = _4_blend_set_color_saturation_helper; - - } else { - vec3 _6_blend_set_color_saturation_helper; - vec3 _7_minMidMax = hueLumColor.zxy; - { - _6_blend_set_color_saturation_helper = _7_minMidMax.x < _7_minMidMax.z ? vec3(0.0, (sat * (_7_minMidMax.y - _7_minMidMax.x)) / (_7_minMidMax.z - _7_minMidMax.x), sat) : vec3(0.0); - } - hueLumColor.zxy = _6_blend_set_color_saturation_helper; - - } - } else if (hueLumColor.x <= hueLumColor.z) { - vec3 _8_blend_set_color_saturation_helper; - vec3 _9_minMidMax = hueLumColor.yxz; - { - _8_blend_set_color_saturation_helper = _9_minMidMax.x < _9_minMidMax.z ? vec3(0.0, (sat * (_9_minMidMax.y - _9_minMidMax.x)) / (_9_minMidMax.z - _9_minMidMax.x), sat) : vec3(0.0); - } - hueLumColor.yxz = _8_blend_set_color_saturation_helper; - - } else if (hueLumColor.y <= hueLumColor.z) { - vec3 _10_blend_set_color_saturation_helper; - vec3 _11_minMidMax = hueLumColor.yzx; - { - _10_blend_set_color_saturation_helper = _11_minMidMax.x < _11_minMidMax.z ? vec3(0.0, (sat * (_11_minMidMax.y - _11_minMidMax.x)) / (_11_minMidMax.z - _11_minMidMax.x), sat) : vec3(0.0); - } - hueLumColor.yzx = _10_blend_set_color_saturation_helper; - - } else { - vec3 _12_blend_set_color_saturation_helper; - vec3 _13_minMidMax = hueLumColor.zyx; - { - _12_blend_set_color_saturation_helper = _13_minMidMax.x < _13_minMidMax.z ? vec3(0.0, (sat * (_13_minMidMax.y - _13_minMidMax.x)) / (_13_minMidMax.z - _13_minMidMax.x), sat) : vec3(0.0); - } - hueLumColor.zyx = _12_blend_set_color_saturation_helper; - - } - return hueLumColor; -} -vec4 blend_saturation(vec4 src, vec4 dst) { - float alpha = dst.w * src.w; - vec3 sda = src.xyz * dst.w; - vec3 dsa = dst.xyz * src.w; - return vec4((((_blend_set_color_luminance(_blend_set_color_saturation(dsa, sda), alpha, dsa) + dst.xyz) - dsa) + src.xyz) - sda, (src.w + dst.w) - alpha); -} void main() { - sk_FragColor = blend_saturation(src, dst); + vec4 _17_blend_saturation; + { + float _18_alpha = dst.w * src.w; + vec3 _19_sda = src.xyz * dst.w; + vec3 _20_dsa = dst.xyz * src.w; + vec3 _21_blend_set_color_saturation; + vec3 _22_hueLumColor = _20_dsa; + { + float _24_blend_color_saturation; + { + _24_blend_color_saturation = max(max(_19_sda.x, _19_sda.y), _19_sda.z) - min(min(_19_sda.x, _19_sda.y), _19_sda.z); + } + float _23_sat = _24_blend_color_saturation; + + if (_22_hueLumColor.x <= _22_hueLumColor.y) { + if (_22_hueLumColor.y <= _22_hueLumColor.z) { + vec3 _25_blend_set_color_saturation_helper; + { + _25_blend_set_color_saturation_helper = _22_hueLumColor.x < _22_hueLumColor.z ? vec3(0.0, (_23_sat * (_22_hueLumColor.y - _22_hueLumColor.x)) / (_22_hueLumColor.z - _22_hueLumColor.x), _23_sat) : vec3(0.0); + } + _22_hueLumColor.xyz = _25_blend_set_color_saturation_helper; + + } else if (_22_hueLumColor.x <= _22_hueLumColor.z) { + vec3 _26_blend_set_color_saturation_helper; + vec3 _27_minMidMax = _22_hueLumColor.xzy; + { + _26_blend_set_color_saturation_helper = _27_minMidMax.x < _27_minMidMax.z ? vec3(0.0, (_23_sat * (_27_minMidMax.y - _27_minMidMax.x)) / (_27_minMidMax.z - _27_minMidMax.x), _23_sat) : vec3(0.0); + } + _22_hueLumColor.xzy = _26_blend_set_color_saturation_helper; + + } else { + vec3 _28_blend_set_color_saturation_helper; + vec3 _29_minMidMax = _22_hueLumColor.zxy; + { + _28_blend_set_color_saturation_helper = _29_minMidMax.x < _29_minMidMax.z ? vec3(0.0, (_23_sat * (_29_minMidMax.y - _29_minMidMax.x)) / (_29_minMidMax.z - _29_minMidMax.x), _23_sat) : vec3(0.0); + } + _22_hueLumColor.zxy = _28_blend_set_color_saturation_helper; + + } + } else if (_22_hueLumColor.x <= _22_hueLumColor.z) { + vec3 _30_blend_set_color_saturation_helper; + vec3 _31_minMidMax = _22_hueLumColor.yxz; + { + _30_blend_set_color_saturation_helper = _31_minMidMax.x < _31_minMidMax.z ? vec3(0.0, (_23_sat * (_31_minMidMax.y - _31_minMidMax.x)) / (_31_minMidMax.z - _31_minMidMax.x), _23_sat) : vec3(0.0); + } + _22_hueLumColor.yxz = _30_blend_set_color_saturation_helper; + + } else if (_22_hueLumColor.y <= _22_hueLumColor.z) { + vec3 _32_blend_set_color_saturation_helper; + vec3 _33_minMidMax = _22_hueLumColor.yzx; + { + _32_blend_set_color_saturation_helper = _33_minMidMax.x < _33_minMidMax.z ? vec3(0.0, (_23_sat * (_33_minMidMax.y - _33_minMidMax.x)) / (_33_minMidMax.z - _33_minMidMax.x), _23_sat) : vec3(0.0); + } + _22_hueLumColor.yzx = _32_blend_set_color_saturation_helper; + + } else { + vec3 _34_blend_set_color_saturation_helper; + vec3 _35_minMidMax = _22_hueLumColor.zyx; + { + _34_blend_set_color_saturation_helper = _35_minMidMax.x < _35_minMidMax.z ? vec3(0.0, (_23_sat * (_35_minMidMax.y - _35_minMidMax.x)) / (_35_minMidMax.z - _35_minMidMax.x), _23_sat) : vec3(0.0); + } + _22_hueLumColor.zyx = _34_blend_set_color_saturation_helper; + + } + _21_blend_set_color_saturation = _22_hueLumColor; + } + vec3 _36_blend_set_color_luminance; + { + float _41_blend_color_luminance; + { + _41_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), _20_dsa); + } + float _37_lum = _41_blend_color_luminance; + + float _42_blend_color_luminance; + { + _42_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), _21_blend_set_color_saturation); + } + vec3 _38_result = (_37_lum - _42_blend_color_luminance) + _21_blend_set_color_saturation; + + float _39_minComp = min(min(_38_result.x, _38_result.y), _38_result.z); + float _40_maxComp = max(max(_38_result.x, _38_result.y), _38_result.z); + if (_39_minComp < 0.0 && _37_lum != _39_minComp) { + _38_result = _37_lum + ((_38_result - _37_lum) * _37_lum) / (_37_lum - _39_minComp); + } + _36_blend_set_color_luminance = _40_maxComp > _18_alpha && _40_maxComp != _37_lum ? _37_lum + ((_38_result - _37_lum) * (_18_alpha - _37_lum)) / (_40_maxComp - _37_lum) : _38_result; + } + _17_blend_saturation = vec4((((_36_blend_set_color_luminance + dst.xyz) - _20_dsa) + src.xyz) - _19_sda, (src.w + dst.w) - _18_alpha); + + + } + sk_FragColor = _17_blend_saturation; + } diff --git a/tests/sksl/blend/golden/BlendSaturation.metal b/tests/sksl/blend/golden/BlendSaturation.metal index 6f0facd8af..29e1a0b105 100644 --- a/tests/sksl/blend/golden/BlendSaturation.metal +++ b/tests/sksl/blend/golden/BlendSaturation.metal @@ -8,103 +8,101 @@ struct Outputs { float4 sk_FragColor [[color(0)]]; }; -float _blend_color_luminance(float3 color) { - return dot(float3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), color); -} -float3 _blend_set_color_luminance(float3 hueSatColor, float alpha, float3 lumColor) { - float _0_blend_color_luminance; - { - _0_blend_color_luminance = dot(float3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), lumColor); - } - float lum = _0_blend_color_luminance; - - float _1_blend_color_luminance; - { - _1_blend_color_luminance = dot(float3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), hueSatColor); - } - float3 result = (lum - _1_blend_color_luminance) + hueSatColor; - - float minComp = min(min(result.x, result.y), result.z); - float maxComp = max(max(result.x, result.y), result.z); - if (minComp < 0.0 && lum != minComp) { - result = lum + ((result - lum) * lum) / (lum - minComp); - } - return maxComp > alpha && maxComp != lum ? lum + ((result - lum) * (alpha - lum)) / (maxComp - lum) : result; -} -float _blend_color_saturation(float3 color) { - return max(max(color.x, color.y), color.z) - min(min(color.x, color.y), color.z); -} -float3 _blend_set_color_saturation_helper(float3 minMidMax, float sat) { - return minMidMax.x < minMidMax.z ? float3(0.0, (sat * (minMidMax.y - minMidMax.x)) / (minMidMax.z - minMidMax.x), sat) : float3(0.0); -} -float3 _blend_set_color_saturation(float3 hueLumColor, float3 satColor) { - float _2_blend_color_saturation; - { - _2_blend_color_saturation = max(max(satColor.x, satColor.y), satColor.z) - min(min(satColor.x, satColor.y), satColor.z); - } - float sat = _2_blend_color_saturation; - - if (hueLumColor.x <= hueLumColor.y) { - if (hueLumColor.y <= hueLumColor.z) { - float3 _3_blend_set_color_saturation_helper; - { - _3_blend_set_color_saturation_helper = hueLumColor.x < hueLumColor.z ? float3(0.0, (sat * (hueLumColor.y - hueLumColor.x)) / (hueLumColor.z - hueLumColor.x), sat) : float3(0.0); - } - hueLumColor.xyz = _3_blend_set_color_saturation_helper; - - } else if (hueLumColor.x <= hueLumColor.z) { - float3 _4_blend_set_color_saturation_helper; - float3 _5_minMidMax = hueLumColor.xzy; - { - _4_blend_set_color_saturation_helper = _5_minMidMax.x < _5_minMidMax.z ? float3(0.0, (sat * (_5_minMidMax.y - _5_minMidMax.x)) / (_5_minMidMax.z - _5_minMidMax.x), sat) : float3(0.0); - } - hueLumColor.xzy = _4_blend_set_color_saturation_helper; - - } else { - float3 _6_blend_set_color_saturation_helper; - float3 _7_minMidMax = hueLumColor.zxy; - { - _6_blend_set_color_saturation_helper = _7_minMidMax.x < _7_minMidMax.z ? float3(0.0, (sat * (_7_minMidMax.y - _7_minMidMax.x)) / (_7_minMidMax.z - _7_minMidMax.x), sat) : float3(0.0); - } - hueLumColor.zxy = _6_blend_set_color_saturation_helper; - - } - } else if (hueLumColor.x <= hueLumColor.z) { - float3 _8_blend_set_color_saturation_helper; - float3 _9_minMidMax = hueLumColor.yxz; - { - _8_blend_set_color_saturation_helper = _9_minMidMax.x < _9_minMidMax.z ? float3(0.0, (sat * (_9_minMidMax.y - _9_minMidMax.x)) / (_9_minMidMax.z - _9_minMidMax.x), sat) : float3(0.0); - } - hueLumColor.yxz = _8_blend_set_color_saturation_helper; - - } else if (hueLumColor.y <= hueLumColor.z) { - float3 _10_blend_set_color_saturation_helper; - float3 _11_minMidMax = hueLumColor.yzx; - { - _10_blend_set_color_saturation_helper = _11_minMidMax.x < _11_minMidMax.z ? float3(0.0, (sat * (_11_minMidMax.y - _11_minMidMax.x)) / (_11_minMidMax.z - _11_minMidMax.x), sat) : float3(0.0); - } - hueLumColor.yzx = _10_blend_set_color_saturation_helper; - - } else { - float3 _12_blend_set_color_saturation_helper; - float3 _13_minMidMax = hueLumColor.zyx; - { - _12_blend_set_color_saturation_helper = _13_minMidMax.x < _13_minMidMax.z ? float3(0.0, (sat * (_13_minMidMax.y - _13_minMidMax.x)) / (_13_minMidMax.z - _13_minMidMax.x), sat) : float3(0.0); - } - hueLumColor.zyx = _12_blend_set_color_saturation_helper; - - } - return hueLumColor; -} -float4 blend_saturation(float4 src, float4 dst) { - float alpha = dst.w * src.w; - float3 sda = src.xyz * dst.w; - float3 dsa = dst.xyz * src.w; - return float4((((_blend_set_color_luminance(_blend_set_color_saturation(dsa, sda), alpha, dsa) + dst.xyz) - dsa) + src.xyz) - sda, (src.w + dst.w) - alpha); -} fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { Outputs _outputStruct; thread Outputs* _out = &_outputStruct; - _out->sk_FragColor = blend_saturation(_in.src, _in.dst); + float4 _17_blend_saturation; + { + float _18_alpha = _in.dst.w * _in.src.w; + float3 _19_sda = _in.src.xyz * _in.dst.w; + float3 _20_dsa = _in.dst.xyz * _in.src.w; + float3 _21_blend_set_color_saturation; + float3 _22_hueLumColor = _20_dsa; + { + float _24_blend_color_saturation; + { + _24_blend_color_saturation = max(max(_19_sda.x, _19_sda.y), _19_sda.z) - min(min(_19_sda.x, _19_sda.y), _19_sda.z); + } + float _23_sat = _24_blend_color_saturation; + + if (_22_hueLumColor.x <= _22_hueLumColor.y) { + if (_22_hueLumColor.y <= _22_hueLumColor.z) { + float3 _25_blend_set_color_saturation_helper; + { + _25_blend_set_color_saturation_helper = _22_hueLumColor.x < _22_hueLumColor.z ? float3(0.0, (_23_sat * (_22_hueLumColor.y - _22_hueLumColor.x)) / (_22_hueLumColor.z - _22_hueLumColor.x), _23_sat) : float3(0.0); + } + _22_hueLumColor.xyz = _25_blend_set_color_saturation_helper; + + } else if (_22_hueLumColor.x <= _22_hueLumColor.z) { + float3 _26_blend_set_color_saturation_helper; + float3 _27_minMidMax = _22_hueLumColor.xzy; + { + _26_blend_set_color_saturation_helper = _27_minMidMax.x < _27_minMidMax.z ? float3(0.0, (_23_sat * (_27_minMidMax.y - _27_minMidMax.x)) / (_27_minMidMax.z - _27_minMidMax.x), _23_sat) : float3(0.0); + } + _22_hueLumColor.xzy = _26_blend_set_color_saturation_helper; + + } else { + float3 _28_blend_set_color_saturation_helper; + float3 _29_minMidMax = _22_hueLumColor.zxy; + { + _28_blend_set_color_saturation_helper = _29_minMidMax.x < _29_minMidMax.z ? float3(0.0, (_23_sat * (_29_minMidMax.y - _29_minMidMax.x)) / (_29_minMidMax.z - _29_minMidMax.x), _23_sat) : float3(0.0); + } + _22_hueLumColor.zxy = _28_blend_set_color_saturation_helper; + + } + } else if (_22_hueLumColor.x <= _22_hueLumColor.z) { + float3 _30_blend_set_color_saturation_helper; + float3 _31_minMidMax = _22_hueLumColor.yxz; + { + _30_blend_set_color_saturation_helper = _31_minMidMax.x < _31_minMidMax.z ? float3(0.0, (_23_sat * (_31_minMidMax.y - _31_minMidMax.x)) / (_31_minMidMax.z - _31_minMidMax.x), _23_sat) : float3(0.0); + } + _22_hueLumColor.yxz = _30_blend_set_color_saturation_helper; + + } else if (_22_hueLumColor.y <= _22_hueLumColor.z) { + float3 _32_blend_set_color_saturation_helper; + float3 _33_minMidMax = _22_hueLumColor.yzx; + { + _32_blend_set_color_saturation_helper = _33_minMidMax.x < _33_minMidMax.z ? float3(0.0, (_23_sat * (_33_minMidMax.y - _33_minMidMax.x)) / (_33_minMidMax.z - _33_minMidMax.x), _23_sat) : float3(0.0); + } + _22_hueLumColor.yzx = _32_blend_set_color_saturation_helper; + + } else { + float3 _34_blend_set_color_saturation_helper; + float3 _35_minMidMax = _22_hueLumColor.zyx; + { + _34_blend_set_color_saturation_helper = _35_minMidMax.x < _35_minMidMax.z ? float3(0.0, (_23_sat * (_35_minMidMax.y - _35_minMidMax.x)) / (_35_minMidMax.z - _35_minMidMax.x), _23_sat) : float3(0.0); + } + _22_hueLumColor.zyx = _34_blend_set_color_saturation_helper; + + } + _21_blend_set_color_saturation = _22_hueLumColor; + } + float3 _36_blend_set_color_luminance; + { + float _41_blend_color_luminance; + { + _41_blend_color_luminance = dot(float3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), _20_dsa); + } + float _37_lum = _41_blend_color_luminance; + + float _42_blend_color_luminance; + { + _42_blend_color_luminance = dot(float3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), _21_blend_set_color_saturation); + } + float3 _38_result = (_37_lum - _42_blend_color_luminance) + _21_blend_set_color_saturation; + + float _39_minComp = min(min(_38_result.x, _38_result.y), _38_result.z); + float _40_maxComp = max(max(_38_result.x, _38_result.y), _38_result.z); + if (_39_minComp < 0.0 && _37_lum != _39_minComp) { + _38_result = _37_lum + ((_38_result - _37_lum) * _37_lum) / (_37_lum - _39_minComp); + } + _36_blend_set_color_luminance = _40_maxComp > _18_alpha && _40_maxComp != _37_lum ? _37_lum + ((_38_result - _37_lum) * (_18_alpha - _37_lum)) / (_40_maxComp - _37_lum) : _38_result; + } + _17_blend_saturation = float4((((_36_blend_set_color_luminance + _in.dst.xyz) - _20_dsa) + _in.src.xyz) - _19_sda, (_in.src.w + _in.dst.w) - _18_alpha); + + + } + _out->sk_FragColor = _17_blend_saturation; + return *_out; } diff --git a/tests/sksl/blend/golden/BlendSaturationStandaloneSettings.glsl b/tests/sksl/blend/golden/BlendSaturationStandaloneSettings.glsl index 6606b8daba..584d291133 100644 --- a/tests/sksl/blend/golden/BlendSaturationStandaloneSettings.glsl +++ b/tests/sksl/blend/golden/BlendSaturationStandaloneSettings.glsl @@ -1,100 +1,98 @@ out vec4 sk_FragColor; in vec4 src, dst; -float _blend_color_luminance(vec3 color) { - return dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), color); -} -vec3 _blend_set_color_luminance(vec3 hueSatColor, float alpha, vec3 lumColor) { - float _0_blend_color_luminance; - { - _0_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), lumColor); - } - float lum = _0_blend_color_luminance; - - float _1_blend_color_luminance; - { - _1_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), hueSatColor); - } - vec3 result = (lum - _1_blend_color_luminance) + hueSatColor; - - float minComp = min(min(result.x, result.y), result.z); - float maxComp = max(max(result.x, result.y), result.z); - if (minComp < 0.0 && lum != minComp) { - result = lum + ((result - lum) * lum) / (lum - minComp); - } - return maxComp > alpha && maxComp != lum ? lum + ((result - lum) * (alpha - lum)) / (maxComp - lum) : result; -} -float _blend_color_saturation(vec3 color) { - return max(max(color.x, color.y), color.z) - min(min(color.x, color.y), color.z); -} -vec3 _blend_set_color_saturation_helper(vec3 minMidMax, float sat) { - return minMidMax.x < minMidMax.z ? vec3(0.0, (sat * (minMidMax.y - minMidMax.x)) / (minMidMax.z - minMidMax.x), sat) : vec3(0.0); -} -vec3 _blend_set_color_saturation(vec3 hueLumColor, vec3 satColor) { - float _2_blend_color_saturation; - { - _2_blend_color_saturation = max(max(satColor.x, satColor.y), satColor.z) - min(min(satColor.x, satColor.y), satColor.z); - } - float sat = _2_blend_color_saturation; - - if (hueLumColor.x <= hueLumColor.y) { - if (hueLumColor.y <= hueLumColor.z) { - vec3 _3_blend_set_color_saturation_helper; - { - _3_blend_set_color_saturation_helper = hueLumColor.x < hueLumColor.z ? vec3(0.0, (sat * (hueLumColor.y - hueLumColor.x)) / (hueLumColor.z - hueLumColor.x), sat) : vec3(0.0); - } - hueLumColor.xyz = _3_blend_set_color_saturation_helper; - - } else if (hueLumColor.x <= hueLumColor.z) { - vec3 _4_blend_set_color_saturation_helper; - vec3 _5_minMidMax = hueLumColor.xzy; - { - _4_blend_set_color_saturation_helper = _5_minMidMax.x < _5_minMidMax.z ? vec3(0.0, (sat * (_5_minMidMax.y - _5_minMidMax.x)) / (_5_minMidMax.z - _5_minMidMax.x), sat) : vec3(0.0); - } - hueLumColor.xzy = _4_blend_set_color_saturation_helper; - - } else { - vec3 _6_blend_set_color_saturation_helper; - vec3 _7_minMidMax = hueLumColor.zxy; - { - _6_blend_set_color_saturation_helper = _7_minMidMax.x < _7_minMidMax.z ? vec3(0.0, (sat * (_7_minMidMax.y - _7_minMidMax.x)) / (_7_minMidMax.z - _7_minMidMax.x), sat) : vec3(0.0); - } - hueLumColor.zxy = _6_blend_set_color_saturation_helper; - - } - } else if (hueLumColor.x <= hueLumColor.z) { - vec3 _8_blend_set_color_saturation_helper; - vec3 _9_minMidMax = hueLumColor.yxz; - { - _8_blend_set_color_saturation_helper = _9_minMidMax.x < _9_minMidMax.z ? vec3(0.0, (sat * (_9_minMidMax.y - _9_minMidMax.x)) / (_9_minMidMax.z - _9_minMidMax.x), sat) : vec3(0.0); - } - hueLumColor.yxz = _8_blend_set_color_saturation_helper; - - } else if (hueLumColor.y <= hueLumColor.z) { - vec3 _10_blend_set_color_saturation_helper; - vec3 _11_minMidMax = hueLumColor.yzx; - { - _10_blend_set_color_saturation_helper = _11_minMidMax.x < _11_minMidMax.z ? vec3(0.0, (sat * (_11_minMidMax.y - _11_minMidMax.x)) / (_11_minMidMax.z - _11_minMidMax.x), sat) : vec3(0.0); - } - hueLumColor.yzx = _10_blend_set_color_saturation_helper; - - } else { - vec3 _12_blend_set_color_saturation_helper; - vec3 _13_minMidMax = hueLumColor.zyx; - { - _12_blend_set_color_saturation_helper = _13_minMidMax.x < _13_minMidMax.z ? vec3(0.0, (sat * (_13_minMidMax.y - _13_minMidMax.x)) / (_13_minMidMax.z - _13_minMidMax.x), sat) : vec3(0.0); - } - hueLumColor.zyx = _12_blend_set_color_saturation_helper; - - } - return hueLumColor; -} -vec4 blend_saturation(vec4 src, vec4 dst) { - float alpha = dst.w * src.w; - vec3 sda = src.xyz * dst.w; - vec3 dsa = dst.xyz * src.w; - return vec4((((_blend_set_color_luminance(_blend_set_color_saturation(dsa, sda), alpha, dsa) + dst.xyz) - dsa) + src.xyz) - sda, (src.w + dst.w) - alpha); -} void main() { - sk_FragColor = blend_saturation(src, dst); + vec4 _17_blend_saturation; + { + float _18_alpha = dst.w * src.w; + vec3 _19_sda = src.xyz * dst.w; + vec3 _20_dsa = dst.xyz * src.w; + vec3 _21_blend_set_color_saturation; + vec3 _22_hueLumColor = _20_dsa; + { + float _24_blend_color_saturation; + { + _24_blend_color_saturation = max(max(_19_sda.x, _19_sda.y), _19_sda.z) - min(min(_19_sda.x, _19_sda.y), _19_sda.z); + } + float _23_sat = _24_blend_color_saturation; + + if (_22_hueLumColor.x <= _22_hueLumColor.y) { + if (_22_hueLumColor.y <= _22_hueLumColor.z) { + vec3 _25_blend_set_color_saturation_helper; + { + _25_blend_set_color_saturation_helper = _22_hueLumColor.x < _22_hueLumColor.z ? vec3(0.0, (_23_sat * (_22_hueLumColor.y - _22_hueLumColor.x)) / (_22_hueLumColor.z - _22_hueLumColor.x), _23_sat) : vec3(0.0); + } + _22_hueLumColor.xyz = _25_blend_set_color_saturation_helper; + + } else if (_22_hueLumColor.x <= _22_hueLumColor.z) { + vec3 _26_blend_set_color_saturation_helper; + vec3 _27_minMidMax = _22_hueLumColor.xzy; + { + _26_blend_set_color_saturation_helper = _27_minMidMax.x < _27_minMidMax.z ? vec3(0.0, (_23_sat * (_27_minMidMax.y - _27_minMidMax.x)) / (_27_minMidMax.z - _27_minMidMax.x), _23_sat) : vec3(0.0); + } + _22_hueLumColor.xzy = _26_blend_set_color_saturation_helper; + + } else { + vec3 _28_blend_set_color_saturation_helper; + vec3 _29_minMidMax = _22_hueLumColor.zxy; + { + _28_blend_set_color_saturation_helper = _29_minMidMax.x < _29_minMidMax.z ? vec3(0.0, (_23_sat * (_29_minMidMax.y - _29_minMidMax.x)) / (_29_minMidMax.z - _29_minMidMax.x), _23_sat) : vec3(0.0); + } + _22_hueLumColor.zxy = _28_blend_set_color_saturation_helper; + + } + } else if (_22_hueLumColor.x <= _22_hueLumColor.z) { + vec3 _30_blend_set_color_saturation_helper; + vec3 _31_minMidMax = _22_hueLumColor.yxz; + { + _30_blend_set_color_saturation_helper = _31_minMidMax.x < _31_minMidMax.z ? vec3(0.0, (_23_sat * (_31_minMidMax.y - _31_minMidMax.x)) / (_31_minMidMax.z - _31_minMidMax.x), _23_sat) : vec3(0.0); + } + _22_hueLumColor.yxz = _30_blend_set_color_saturation_helper; + + } else if (_22_hueLumColor.y <= _22_hueLumColor.z) { + vec3 _32_blend_set_color_saturation_helper; + vec3 _33_minMidMax = _22_hueLumColor.yzx; + { + _32_blend_set_color_saturation_helper = _33_minMidMax.x < _33_minMidMax.z ? vec3(0.0, (_23_sat * (_33_minMidMax.y - _33_minMidMax.x)) / (_33_minMidMax.z - _33_minMidMax.x), _23_sat) : vec3(0.0); + } + _22_hueLumColor.yzx = _32_blend_set_color_saturation_helper; + + } else { + vec3 _34_blend_set_color_saturation_helper; + vec3 _35_minMidMax = _22_hueLumColor.zyx; + { + _34_blend_set_color_saturation_helper = _35_minMidMax.x < _35_minMidMax.z ? vec3(0.0, (_23_sat * (_35_minMidMax.y - _35_minMidMax.x)) / (_35_minMidMax.z - _35_minMidMax.x), _23_sat) : vec3(0.0); + } + _22_hueLumColor.zyx = _34_blend_set_color_saturation_helper; + + } + _21_blend_set_color_saturation = _22_hueLumColor; + } + vec3 _36_blend_set_color_luminance; + { + float _41_blend_color_luminance; + { + _41_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), _20_dsa); + } + float _37_lum = _41_blend_color_luminance; + + float _42_blend_color_luminance; + { + _42_blend_color_luminance = dot(vec3(0.30000001192092896, 0.5899999737739563, 0.10999999940395355), _21_blend_set_color_saturation); + } + vec3 _38_result = (_37_lum - _42_blend_color_luminance) + _21_blend_set_color_saturation; + + float _39_minComp = min(min(_38_result.x, _38_result.y), _38_result.z); + float _40_maxComp = max(max(_38_result.x, _38_result.y), _38_result.z); + if (_39_minComp < 0.0 && _37_lum != _39_minComp) { + _38_result = _37_lum + ((_38_result - _37_lum) * _37_lum) / (_37_lum - _39_minComp); + } + _36_blend_set_color_luminance = _40_maxComp > _18_alpha && _40_maxComp != _37_lum ? _37_lum + ((_38_result - _37_lum) * (_18_alpha - _37_lum)) / (_40_maxComp - _37_lum) : _38_result; + } + _17_blend_saturation = vec4((((_36_blend_set_color_luminance + dst.xyz) - _20_dsa) + src.xyz) - _19_sda, (src.w + dst.w) - _18_alpha); + + + } + sk_FragColor = _17_blend_saturation; + } diff --git a/tests/sksl/blend/golden/BlendScreen.glsl b/tests/sksl/blend/golden/BlendScreen.glsl index fe30678890..ad2f0728fb 100644 --- a/tests/sksl/blend/golden/BlendScreen.glsl +++ b/tests/sksl/blend/golden/BlendScreen.glsl @@ -1,9 +1,6 @@ #version 400 out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_screen(vec4 src, vec4 dst) { - return src + (1.0 - src) * dst; -} void main() { vec4 _0_blend_screen; { diff --git a/tests/sksl/blend/golden/BlendScreen.metal b/tests/sksl/blend/golden/BlendScreen.metal index ac232a49eb..da9831c82d 100644 --- a/tests/sksl/blend/golden/BlendScreen.metal +++ b/tests/sksl/blend/golden/BlendScreen.metal @@ -8,9 +8,6 @@ struct Outputs { float4 sk_FragColor [[color(0)]]; }; -float4 blend_screen(float4 src, float4 dst) { - return src + (1.0 - src) * dst; -} fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { Outputs _outputStruct; thread Outputs* _out = &_outputStruct; diff --git a/tests/sksl/blend/golden/BlendScreenStandaloneSettings.glsl b/tests/sksl/blend/golden/BlendScreenStandaloneSettings.glsl index 4f0270d854..b2c0ea0d85 100644 --- a/tests/sksl/blend/golden/BlendScreenStandaloneSettings.glsl +++ b/tests/sksl/blend/golden/BlendScreenStandaloneSettings.glsl @@ -1,9 +1,6 @@ out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_screen(vec4 src, vec4 dst) { - return src + (1.0 - src) * dst; -} void main() { vec4 _0_blend_screen; { diff --git a/tests/sksl/blend/golden/BlendSoftLight.glsl b/tests/sksl/blend/golden/BlendSoftLight.glsl index ddc901de4b..e6de093e32 100644 --- a/tests/sksl/blend/golden/BlendSoftLight.glsl +++ b/tests/sksl/blend/golden/BlendSoftLight.glsl @@ -1,9 +1,6 @@ #version 400 out vec4 sk_FragColor; in vec4 src, dst; -float _guarded_divide(float n, float d) { - return n / d; -} float _soft_light_component(vec2 s, vec2 d) { if (2.0 * s.x <= s.y) { float _1_guarded_divide; @@ -30,9 +27,6 @@ float _soft_light_component(vec2 s, vec2 d) { return ((d.x * ((s.y - 2.0 * s.x) + 1.0) + s.x) - sqrt(d.y * d.x) * (s.y - 2.0 * s.x)) - d.y * s.x; } } -vec4 blend_soft_light(vec4 src, vec4 dst) { - return dst.w == 0.0 ? src : vec4(_soft_light_component(src.xw, dst.xw), _soft_light_component(src.yw, dst.yw), _soft_light_component(src.zw, dst.zw), src.w + (1.0 - src.w) * dst.w); -} void main() { vec4 _0_blend_soft_light; { diff --git a/tests/sksl/blend/golden/BlendSoftLight.metal b/tests/sksl/blend/golden/BlendSoftLight.metal index 2c5e50d30b..12ad4176af 100644 --- a/tests/sksl/blend/golden/BlendSoftLight.metal +++ b/tests/sksl/blend/golden/BlendSoftLight.metal @@ -8,9 +8,6 @@ struct Outputs { float4 sk_FragColor [[color(0)]]; }; -float _guarded_divide(float n, float d) { - return n / d; -} float _soft_light_component(float2 s, float2 d) { if (2.0 * s.x <= s.y) { float _1_guarded_divide; @@ -37,9 +34,6 @@ float _soft_light_component(float2 s, float2 d) { return ((d.x * ((s.y - 2.0 * s.x) + 1.0) + s.x) - sqrt(d.y * d.x) * (s.y - 2.0 * s.x)) - d.y * s.x; } } -float4 blend_soft_light(float4 src, float4 dst) { - return dst.w == 0.0 ? src : float4(_soft_light_component(src.xw, dst.xw), _soft_light_component(src.yw, dst.yw), _soft_light_component(src.zw, dst.zw), src.w + (1.0 - src.w) * dst.w); -} fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { Outputs _outputStruct; thread Outputs* _out = &_outputStruct; diff --git a/tests/sksl/blend/golden/BlendSoftLightStandaloneSettings.glsl b/tests/sksl/blend/golden/BlendSoftLightStandaloneSettings.glsl index 03a9dfc071..1c41de771d 100644 --- a/tests/sksl/blend/golden/BlendSoftLightStandaloneSettings.glsl +++ b/tests/sksl/blend/golden/BlendSoftLightStandaloneSettings.glsl @@ -1,9 +1,6 @@ out vec4 sk_FragColor; in vec4 src, dst; -float _guarded_divide(float n, float d) { - return n / d; -} float _soft_light_component(vec2 s, vec2 d) { if (2.0 * s.x <= s.y) { float _1_guarded_divide; @@ -30,9 +27,6 @@ float _soft_light_component(vec2 s, vec2 d) { return ((d.x * ((s.y - 2.0 * s.x) + 1.0) + s.x) - sqrt(d.y * d.x) * (s.y - 2.0 * s.x)) - d.y * s.x; } } -vec4 blend_soft_light(vec4 src, vec4 dst) { - return dst.w == 0.0 ? src : vec4(_soft_light_component(src.xw, dst.xw), _soft_light_component(src.yw, dst.yw), _soft_light_component(src.zw, dst.zw), src.w + (1.0 - src.w) * dst.w); -} void main() { vec4 _0_blend_soft_light; { diff --git a/tests/sksl/blend/golden/BlendSrc.glsl b/tests/sksl/blend/golden/BlendSrc.glsl index b3fa07a773..c878f75596 100644 --- a/tests/sksl/blend/golden/BlendSrc.glsl +++ b/tests/sksl/blend/golden/BlendSrc.glsl @@ -1,9 +1,6 @@ #version 400 out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_src(vec4 src, vec4 dst) { - return src; -} void main() { vec4 _0_blend_src; { diff --git a/tests/sksl/blend/golden/BlendSrc.metal b/tests/sksl/blend/golden/BlendSrc.metal index 2271f9e5a1..421917f00e 100644 --- a/tests/sksl/blend/golden/BlendSrc.metal +++ b/tests/sksl/blend/golden/BlendSrc.metal @@ -8,9 +8,6 @@ struct Outputs { float4 sk_FragColor [[color(0)]]; }; -float4 blend_src(float4 src, float4 dst) { - return src; -} fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { Outputs _outputStruct; thread Outputs* _out = &_outputStruct; diff --git a/tests/sksl/blend/golden/BlendSrcAtop.glsl b/tests/sksl/blend/golden/BlendSrcAtop.glsl index 8dbbb84d9d..eca22ae0ab 100644 --- a/tests/sksl/blend/golden/BlendSrcAtop.glsl +++ b/tests/sksl/blend/golden/BlendSrcAtop.glsl @@ -1,9 +1,6 @@ #version 400 out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_src_atop(vec4 src, vec4 dst) { - return dst.w * src + (1.0 - src.w) * dst; -} void main() { vec4 _0_blend_src_atop; { diff --git a/tests/sksl/blend/golden/BlendSrcAtop.metal b/tests/sksl/blend/golden/BlendSrcAtop.metal index a1d43ca408..c9c3854264 100644 --- a/tests/sksl/blend/golden/BlendSrcAtop.metal +++ b/tests/sksl/blend/golden/BlendSrcAtop.metal @@ -8,9 +8,6 @@ struct Outputs { float4 sk_FragColor [[color(0)]]; }; -float4 blend_src_atop(float4 src, float4 dst) { - return dst.w * src + (1.0 - src.w) * dst; -} fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { Outputs _outputStruct; thread Outputs* _out = &_outputStruct; diff --git a/tests/sksl/blend/golden/BlendSrcAtopStandaloneSettings.glsl b/tests/sksl/blend/golden/BlendSrcAtopStandaloneSettings.glsl index b9687932a7..3b141d46ea 100644 --- a/tests/sksl/blend/golden/BlendSrcAtopStandaloneSettings.glsl +++ b/tests/sksl/blend/golden/BlendSrcAtopStandaloneSettings.glsl @@ -1,9 +1,6 @@ out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_src_atop(vec4 src, vec4 dst) { - return dst.w * src + (1.0 - src.w) * dst; -} void main() { vec4 _0_blend_src_atop; { diff --git a/tests/sksl/blend/golden/BlendSrcIn.glsl b/tests/sksl/blend/golden/BlendSrcIn.glsl index 4957ab14e7..53aee0eb59 100644 --- a/tests/sksl/blend/golden/BlendSrcIn.glsl +++ b/tests/sksl/blend/golden/BlendSrcIn.glsl @@ -1,9 +1,6 @@ #version 400 out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_src_in(vec4 src, vec4 dst) { - return src * dst.w; -} void main() { vec4 _0_blend_src_in; { diff --git a/tests/sksl/blend/golden/BlendSrcIn.metal b/tests/sksl/blend/golden/BlendSrcIn.metal index 88687c79b3..86bff61a13 100644 --- a/tests/sksl/blend/golden/BlendSrcIn.metal +++ b/tests/sksl/blend/golden/BlendSrcIn.metal @@ -8,9 +8,6 @@ struct Outputs { float4 sk_FragColor [[color(0)]]; }; -float4 blend_src_in(float4 src, float4 dst) { - return src * dst.w; -} fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { Outputs _outputStruct; thread Outputs* _out = &_outputStruct; diff --git a/tests/sksl/blend/golden/BlendSrcInStandaloneSettings.glsl b/tests/sksl/blend/golden/BlendSrcInStandaloneSettings.glsl index 0dd9cf0c1b..200f81b31e 100644 --- a/tests/sksl/blend/golden/BlendSrcInStandaloneSettings.glsl +++ b/tests/sksl/blend/golden/BlendSrcInStandaloneSettings.glsl @@ -1,9 +1,6 @@ out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_src_in(vec4 src, vec4 dst) { - return src * dst.w; -} void main() { vec4 _0_blend_src_in; { diff --git a/tests/sksl/blend/golden/BlendSrcOut.glsl b/tests/sksl/blend/golden/BlendSrcOut.glsl index 7b94f0ba1d..a6bc0ad465 100644 --- a/tests/sksl/blend/golden/BlendSrcOut.glsl +++ b/tests/sksl/blend/golden/BlendSrcOut.glsl @@ -1,9 +1,6 @@ #version 400 out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_src_out(vec4 src, vec4 dst) { - return (1.0 - dst.w) * src; -} void main() { vec4 _0_blend_src_out; { diff --git a/tests/sksl/blend/golden/BlendSrcOut.metal b/tests/sksl/blend/golden/BlendSrcOut.metal index dbaffe81cd..f7e1647015 100644 --- a/tests/sksl/blend/golden/BlendSrcOut.metal +++ b/tests/sksl/blend/golden/BlendSrcOut.metal @@ -8,9 +8,6 @@ struct Outputs { float4 sk_FragColor [[color(0)]]; }; -float4 blend_src_out(float4 src, float4 dst) { - return (1.0 - dst.w) * src; -} fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { Outputs _outputStruct; thread Outputs* _out = &_outputStruct; diff --git a/tests/sksl/blend/golden/BlendSrcOutStandaloneSettings.glsl b/tests/sksl/blend/golden/BlendSrcOutStandaloneSettings.glsl index 72df90163b..a3c859a417 100644 --- a/tests/sksl/blend/golden/BlendSrcOutStandaloneSettings.glsl +++ b/tests/sksl/blend/golden/BlendSrcOutStandaloneSettings.glsl @@ -1,9 +1,6 @@ out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_src_out(vec4 src, vec4 dst) { - return (1.0 - dst.w) * src; -} void main() { vec4 _0_blend_src_out; { diff --git a/tests/sksl/blend/golden/BlendSrcOver.glsl b/tests/sksl/blend/golden/BlendSrcOver.glsl index 52b2292d79..f20940860d 100644 --- a/tests/sksl/blend/golden/BlendSrcOver.glsl +++ b/tests/sksl/blend/golden/BlendSrcOver.glsl @@ -1,9 +1,6 @@ #version 400 out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_src_over(vec4 src, vec4 dst) { - return src + (1.0 - src.w) * dst; -} void main() { vec4 _0_blend_src_over; { diff --git a/tests/sksl/blend/golden/BlendSrcOver.metal b/tests/sksl/blend/golden/BlendSrcOver.metal index 78be7f7c37..0319a28681 100644 --- a/tests/sksl/blend/golden/BlendSrcOver.metal +++ b/tests/sksl/blend/golden/BlendSrcOver.metal @@ -8,9 +8,6 @@ struct Outputs { float4 sk_FragColor [[color(0)]]; }; -float4 blend_src_over(float4 src, float4 dst) { - return src + (1.0 - src.w) * dst; -} fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { Outputs _outputStruct; thread Outputs* _out = &_outputStruct; diff --git a/tests/sksl/blend/golden/BlendSrcOverStandaloneSettings.glsl b/tests/sksl/blend/golden/BlendSrcOverStandaloneSettings.glsl index 79cb0e69ac..4686f360f5 100644 --- a/tests/sksl/blend/golden/BlendSrcOverStandaloneSettings.glsl +++ b/tests/sksl/blend/golden/BlendSrcOverStandaloneSettings.glsl @@ -1,9 +1,6 @@ out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_src_over(vec4 src, vec4 dst) { - return src + (1.0 - src.w) * dst; -} void main() { vec4 _0_blend_src_over; { diff --git a/tests/sksl/blend/golden/BlendSrcStandaloneSettings.glsl b/tests/sksl/blend/golden/BlendSrcStandaloneSettings.glsl index 320b841e58..00cb5b2d28 100644 --- a/tests/sksl/blend/golden/BlendSrcStandaloneSettings.glsl +++ b/tests/sksl/blend/golden/BlendSrcStandaloneSettings.glsl @@ -1,9 +1,6 @@ out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_src(vec4 src, vec4 dst) { - return src; -} void main() { vec4 _0_blend_src; { diff --git a/tests/sksl/blend/golden/BlendXor.glsl b/tests/sksl/blend/golden/BlendXor.glsl index c88da3d7ec..47b6342d95 100644 --- a/tests/sksl/blend/golden/BlendXor.glsl +++ b/tests/sksl/blend/golden/BlendXor.glsl @@ -1,9 +1,6 @@ #version 400 out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_xor(vec4 src, vec4 dst) { - return (1.0 - dst.w) * src + (1.0 - src.w) * dst; -} void main() { vec4 _0_blend_xor; { diff --git a/tests/sksl/blend/golden/BlendXor.metal b/tests/sksl/blend/golden/BlendXor.metal index fb838cbf0d..0937120c91 100644 --- a/tests/sksl/blend/golden/BlendXor.metal +++ b/tests/sksl/blend/golden/BlendXor.metal @@ -8,9 +8,6 @@ struct Outputs { float4 sk_FragColor [[color(0)]]; }; -float4 blend_xor(float4 src, float4 dst) { - return (1.0 - dst.w) * src + (1.0 - src.w) * dst; -} fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { Outputs _outputStruct; thread Outputs* _out = &_outputStruct; diff --git a/tests/sksl/blend/golden/BlendXorStandaloneSettings.glsl b/tests/sksl/blend/golden/BlendXorStandaloneSettings.glsl index c8f85d8e30..e0a413035d 100644 --- a/tests/sksl/blend/golden/BlendXorStandaloneSettings.glsl +++ b/tests/sksl/blend/golden/BlendXorStandaloneSettings.glsl @@ -1,9 +1,6 @@ out vec4 sk_FragColor; in vec4 src, dst; -vec4 blend_xor(vec4 src, vec4 dst) { - return (1.0 - dst.w) * src + (1.0 - src.w) * dst; -} void main() { vec4 _0_blend_xor; {