2021-03-16 14:40:11 +00:00
|
|
|
#include <metal_stdlib>
|
|
|
|
#include <simd/simd.h>
|
|
|
|
using namespace metal;
|
2021-03-15 18:58:57 +00:00
|
|
|
struct Uniforms {
|
2021-08-20 14:10:02 +00:00
|
|
|
float testInput;
|
|
|
|
float2x2 testMatrix2x2;
|
2021-10-29 19:37:50 +00:00
|
|
|
half4 colorGreen;
|
|
|
|
half4 colorRed;
|
2020-12-09 23:00:47 +00:00
|
|
|
};
|
2021-03-15 18:58:57 +00:00
|
|
|
struct Inputs {
|
|
|
|
};
|
2020-12-09 23:00:47 +00:00
|
|
|
struct Outputs {
|
2021-10-29 19:37:50 +00:00
|
|
|
half4 sk_FragColor [[color(0)]];
|
2020-12-09 23:00:47 +00:00
|
|
|
};
|
2021-08-20 14:10:02 +00:00
|
|
|
|
|
|
|
float4 float4_from_float2x2(float2x2 x) {
|
|
|
|
return float4(x[0].xy, x[1].xy);
|
|
|
|
}
|
2021-03-15 18:58:57 +00:00
|
|
|
fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
2021-01-19 18:07:55 +00:00
|
|
|
Outputs _out;
|
2021-01-22 03:24:28 +00:00
|
|
|
(void)_out;
|
2021-09-30 16:00:09 +00:00
|
|
|
float4 inputVal = float4_from_float2x2(_uniforms.testMatrix2x2) * float4(1.0, 1.0, -1.0, -1.0);
|
2021-08-20 14:10:02 +00:00
|
|
|
uint4 expectedB = uint4(1065353216u, 1073741824u, 3225419776u, 3229614080u);
|
2021-09-30 16:00:09 +00:00
|
|
|
_out.sk_FragColor = ((inputVal.x == as_type<float>(expectedB.x) && all(inputVal.xy == as_type<float2>(expectedB.xy))) && all(inputVal.xyz == as_type<float3>(expectedB.xyz))) && all(inputVal == as_type<float4>(expectedB)) ? _uniforms.colorGreen : _uniforms.colorRed;
|
2021-01-19 18:07:55 +00:00
|
|
|
return _out;
|
2020-12-09 23:00:47 +00:00
|
|
|
}
|