Debian Codegraph @

third_party/spirv-cross/reference/shaders-msl/frag/control-dependent-in-branch.desktop.frag

raw
1 #include <metal_stdlib>
2 #include <simd/simd.h>
3
4 using namespace metal;
5
6 struct main0_out
7 {
8 float4 FragColor [[color(0)]];
9 };
10
11 struct main0_in
12 {
13 float4 vInput [[user(locn0)]];
14 };
15
16 fragment main0_out main0(main0_in in [[stage_in]], texture2d<float> uSampler [[texture(0)]], sampler uSamplerSmplr [[sampler(0)]])
17 {
18 main0_out out = {};
19 out.FragColor = in.vInput;
20 float4 t = uSampler.sample(uSamplerSmplr, in.vInput.xy);
21 float4 d0 = dfdx(in.vInput);
22 float4 d1 = dfdy(in.vInput);
23 float4 d2 = fwidth(in.vInput);
24 float4 d3 = dfdx(in.vInput);
25 float4 d4 = dfdy(in.vInput);
26 float4 d5 = fwidth(in.vInput);
27 float4 d6 = dfdx(in.vInput);
28 float4 d7 = dfdy(in.vInput);
29 float4 d8 = fwidth(in.vInput);
30 if (in.vInput.y > 10.0)
31 {
32 out.FragColor += t;
33 out.FragColor += d0;
34 out.FragColor += d1;
35 out.FragColor += d2;
36 out.FragColor += d3;
37 out.FragColor += d4;
38 out.FragColor += d5;
39 out.FragColor += d6;
40 out.FragColor += d7;
41 out.FragColor += d8;
42 }
43 return out;
44 }
45