• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#include <metal_stdlib>
2#include <simd/simd.h>
3using namespace metal;
4struct Uniforms {
5    half4 testInputs;
6    half4 colorGreen;
7    half4 colorRed;
8};
9struct Inputs {
10};
11struct Outputs {
12    half4 sk_FragColor [[color(0)]];
13};
14fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
15    Outputs _out;
16    (void)_out;
17    uint4 uintValues = uint4(abs(_uniforms.testInputs) * 100.0h);
18    uint4 uintGreen = uint4(_uniforms.colorGreen * 100.0h);
19    uint4 expectedA = uint4(50u, 0u, 50u, 50u);
20    uint4 expectedB = uint4(0u, 0u, 0u, 100u);
21    _out.sk_FragColor = ((((((((((((((min(uintValues.x, 50u) == expectedA.x && all(min(uintValues.xy, 50u) == expectedA.xy)) && all(min(uintValues.xyz, 50u) == expectedA.xyz)) && all(min(uintValues, 50u) == expectedA)) && 50u == expectedA.x) && all(uint2(50u, 0u) == expectedA.xy)) && all(uint3(50u, 0u, 50u) == expectedA.xyz)) && all(uint4(50u, 0u, 50u, 50u) == expectedA)) && min(uintValues.x, uintGreen.x) == expectedB.x) && all(min(uintValues.xy, uintGreen.xy) == expectedB.xy)) && all(min(uintValues.xyz, uintGreen.xyz) == expectedB.xyz)) && all(min(uintValues, uintGreen) == expectedB)) && 0u == expectedB.x) && all(uint2(0u) == expectedB.xy)) && all(uint3(0u) == expectedB.xyz)) && all(uint4(0u, 0u, 0u, 100u) == expectedB) ? _uniforms.colorGreen : _uniforms.colorRed;
22    return _out;
23}
24