xref: /aosp_15_r20/external/skia/tests/sksl/shared/SwizzleBoolConstants.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    half4 colorGreen;
9    half4 colorRed;
10};
11struct Inputs {
12};
13struct Outputs {
14    half4 sk_FragColor [[color(0)]];
15};
16fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
17    Outputs _out;
18    (void)_out;
19    bool4 v = bool4(bool(_uniforms.colorGreen.y));
20    bool4 result = bool4(v.x, true, true, true);
21    result = bool4(v.xy, false, true);
22    result = bool4(v.x, true, true, false);
23    result = bool4(false, v.y, true, true);
24    result = bool4(v.xyz, true);
25    result = bool4(v.xy, true, true);
26    result = bool4(v.x, false, v.z, true);
27    result = bool4(v.x, true, false, false);
28    result = bool4(true, v.yz, false);
29    result = bool4(false, v.y, true, false);
30    result = bool4(true, true, v.z, false);
31    result = v;
32    result = bool4(v.xyz, true);
33    result = bool4(v.xy, false, v.w);
34    result = bool4(v.xy, true, false);
35    result = bool4(v.x, true, v.zw);
36    result = bool4(v.x, false, v.z, true);
37    result = bool4(v.x, true, true, v.w);
38    result = bool4(v.x, true, false, true);
39    result = bool4(true, v.yzw);
40    result = bool4(false, v.yz, true);
41    result = bool4(false, v.y, true, v.w);
42    result = bool4(true, v.y, true, true);
43    result = bool4(false, false, v.zw);
44    result = bool4(false, false, v.z, true);
45    result = bool4(false, true, true, v.w);
46    _out.sk_FragColor = any(result) ? _uniforms.colorGreen : _uniforms.colorRed;
47    return _out;
48}
49