• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#include <metal_stdlib>
2#include <simd/simd.h>
3using namespace metal;
4struct Uniforms {
5    half4 colorGreen;
6    half4 colorRed;
7};
8struct Inputs {
9};
10struct Outputs {
11    half4 sk_FragColor [[color(0)]];
12};
13bool test_ivec_b() {
14    int one = 1;
15    const int two = 2;
16    bool ok = true;
17    ok = ok && all(-int2(-one, one + one) == -int2(one - two, 2));
18    return ok;
19}
20bool test_mat_b() {
21    bool ok = true;
22    return ok;
23}
24fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
25    Outputs _out;
26    (void)_out;
27    const float _0_one = 1.0;
28    float _1_two = 2.0;
29    bool _4_ok = true;
30    _4_ok = _4_ok && all(-half4(half(_1_two)) == half4(half(-_1_two), half3(half(-_1_two))));
31    _4_ok = _4_ok && all(half2(1.0h, -2.0h) == -half2(half(_0_one - _1_two), half(_1_two)));
32    _out.sk_FragColor = (_4_ok && test_ivec_b()) && test_mat_b() ? _uniforms.colorGreen : _uniforms.colorRed;
33    return _out;
34}
35