• 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(125u, 80u, 80u, 225u);
20    uint4 expectedB = uint4(125u, 100u, 75u, 225u);
21    _out.sk_FragColor = ((((((((((((((max(uintValues.x, 80u) == expectedA.x && all(max(uintValues.xy, 80u) == expectedA.xy)) && all(max(uintValues.xyz, 80u) == expectedA.xyz)) && all(max(uintValues, 80u) == expectedA)) && 125u == expectedA.x) && all(uint2(125u, 80u) == expectedA.xy)) && all(uint3(125u, 80u, 80u) == expectedA.xyz)) && all(uint4(125u, 80u, 80u, 225u) == expectedA)) && max(uintValues.x, uintGreen.x) == expectedB.x) && all(max(uintValues.xy, uintGreen.xy) == expectedB.xy)) && all(max(uintValues.xyz, uintGreen.xyz) == expectedB.xyz)) && all(max(uintValues, uintGreen) == expectedB)) && 125u == expectedB.x) && all(uint2(125u, 100u) == expectedB.xy)) && all(uint3(125u, 100u, 75u) == expectedB.xyz)) && all(uint4(125u, 100u, 75u, 225u) == expectedB) ? _uniforms.colorGreen : _uniforms.colorRed;
22    return _out;
23}
24