2018-01-23 20:15:09 +00:00
|
|
|
#include <metal_stdlib>
|
|
|
|
#include <simd/simd.h>
|
|
|
|
|
|
|
|
using namespace metal;
|
|
|
|
|
2018-06-12 15:41:35 +00:00
|
|
|
struct main0_out
|
2018-01-23 20:15:09 +00:00
|
|
|
{
|
2018-06-12 15:41:35 +00:00
|
|
|
float4 result [[color(0)]];
|
2018-01-23 20:15:09 +00:00
|
|
|
};
|
|
|
|
|
2018-06-12 15:41:35 +00:00
|
|
|
struct main0_in
|
2018-01-23 20:15:09 +00:00
|
|
|
{
|
2018-06-12 15:41:35 +00:00
|
|
|
float4 accum [[user(locn0)]];
|
2018-01-23 20:15:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
fragment main0_out main0(main0_in in [[stage_in]])
|
|
|
|
{
|
|
|
|
main0_out out = {};
|
|
|
|
out.result = float4(0.0);
|
|
|
|
uint j;
|
|
|
|
for (int i = 0; i < 4; i += int(j))
|
|
|
|
{
|
|
|
|
if (in.accum.y > 10.0)
|
|
|
|
{
|
|
|
|
j = 40u;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
j = 30u;
|
|
|
|
}
|
|
|
|
out.result += in.accum;
|
|
|
|
}
|
|
|
|
return out;
|
|
|
|
}
|
|
|
|
|