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 float3x3 testMatrix3x3; 11}; 12struct Inputs { 13}; 14struct Outputs { 15 half4 sk_FragColor [[color(0)]]; 16}; 17float3x3 GetTestMatrix_f33(Uniforms _uniforms) { 18 return _uniforms.testMatrix3x3; 19} 20fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { 21 Outputs _out; 22 (void)_out; 23 float expected = 0.0; 24 for (int i = 0;i < 3; ++i) { 25 for (int j = 0;j < 3; ++j) { 26 expected += 1.0; 27 if (GetTestMatrix_f33(_uniforms)[i][j] != expected) { 28 _out.sk_FragColor = _uniforms.colorRed; 29 return _out; 30 } 31 } 32 } 33 _out.sk_FragColor = _uniforms.colorGreen; 34 return _out; 35} 36