xref: /aosp_15_r20/external/skia/tests/sksl/shared/StaticSwitchWithConditionalBreakInsideBlock.metal (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1#include <metal_stdlib>
2#include <simd/simd.h>
3#ifdef __clang__
4#pragma clang diagnostic ignored "-Wall"
5#endif
6using namespace metal;
7struct Uniforms {
8    float unknownInput;
9};
10struct Inputs {
11};
12struct Outputs {
13    half4 sk_FragColor [[color(0)]];
14};
15fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
16    Outputs _out;
17    (void)_out;
18    half value = 0.0h;
19    switch (0) {
20        case 0:
21            value = 0.0h;
22            if (_uniforms.unknownInput == 2.0) {
23                _out.sk_FragColor = half4(value);
24                break;
25            }
26        case 1:
27            value = 1.0h;
28    }
29    return _out;
30}
31