2021-03-16 14:40:11 +00:00
|
|
|
#include <metal_stdlib>
|
|
|
|
#include <simd/simd.h>
|
|
|
|
using namespace metal;
|
2021-02-04 19:50:03 +00:00
|
|
|
struct Uniforms {
|
2021-10-30 02:34:51 +00:00
|
|
|
half4 colorGreen;
|
|
|
|
half4 colorRed;
|
2021-02-04 19:50:03 +00:00
|
|
|
};
|
2020-09-26 04:18:55 +00:00
|
|
|
struct Inputs {
|
|
|
|
};
|
|
|
|
struct Outputs {
|
2021-10-30 02:34:51 +00:00
|
|
|
half4 sk_FragColor [[color(0)]];
|
2020-09-26 04:18:55 +00:00
|
|
|
};
|
2021-10-30 02:34:51 +00:00
|
|
|
half2 tricky_h2hhh2h(half x, half y, thread half2& color, half z);
|
|
|
|
half2 _skOutParamHelper0_tricky_h2hhh2h(half _var0, half _var1, thread half4& color, half _var3) {
|
|
|
|
half2 _var2 = color.xz;
|
|
|
|
half2 _skResult = tricky_h2hhh2h(_var0, _var1, _var2, _var3);
|
2021-02-11 22:50:09 +00:00
|
|
|
color.xz = _var2;
|
|
|
|
return _skResult;
|
|
|
|
}
|
2021-10-30 02:34:51 +00:00
|
|
|
void func_vh4(thread half4& color);
|
|
|
|
void _skOutParamHelper1_func_vh4(thread half4& result) {
|
|
|
|
half4 _var0 = result;
|
2021-03-22 15:57:41 +00:00
|
|
|
func_vh4(_var0);
|
2021-02-11 22:50:09 +00:00
|
|
|
result = _var0;
|
|
|
|
}
|
2021-10-30 02:34:51 +00:00
|
|
|
half2 tricky_h2hhh2h(half x, half y, thread half2& color, half z) {
|
2021-02-19 19:09:38 +00:00
|
|
|
color = color.yx;
|
2021-10-30 02:34:51 +00:00
|
|
|
return half2(x + y, z);
|
2021-02-11 22:50:09 +00:00
|
|
|
}
|
2021-10-30 02:34:51 +00:00
|
|
|
void func_vh4(thread half4& color) {
|
|
|
|
half2 t = _skOutParamHelper0_tricky_h2hhh2h(1.0h, 2.0h, color, 5.0h);
|
2021-02-11 22:50:09 +00:00
|
|
|
color.yw = t;
|
|
|
|
}
|
2021-02-04 19:50:03 +00:00
|
|
|
fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
2021-01-19 18:07:55 +00:00
|
|
|
Outputs _out;
|
2021-01-22 03:24:28 +00:00
|
|
|
(void)_out;
|
2021-10-30 02:34:51 +00:00
|
|
|
half4 result = half4(0.0h, 1.0h, 2.0h, 3.0h);
|
2021-03-22 15:57:41 +00:00
|
|
|
_skOutParamHelper1_func_vh4(result);
|
2021-10-30 02:34:51 +00:00
|
|
|
_out.sk_FragColor = all(result == half4(2.0h, 3.0h, 0.0h, 5.0h)) ? _uniforms.colorGreen : _uniforms.colorRed;
|
2021-01-19 18:07:55 +00:00
|
|
|
return _out;
|
2020-09-26 04:18:55 +00:00
|
|
|
}
|