Debian Codegraph @

third_party/spirv-cross/reference/shaders-msl/tese/set-from-function.tese

raw
1 #pragma clang diagnostic ignored "-Wmissing-prototypes"
2
3 #include <metal_stdlib>
4 #include <simd/simd.h>
5
6 using namespace metal;
7
8 struct Block
9 {
10 float4 a;
11 float4 b;
12 };
13
14 struct Foo
15 {
16 float4 a;
17 float4 b;
18 };
19
20 struct main0_out
21 {
22 float4 gl_Position [[position]];
23 };
24
25 struct main0_in
26 {
27 float4 vColor [[attribute(0)]];
28 float4 Block_a [[attribute(2)]];
29 float4 Block_b [[attribute(3)]];
30 };
31
32 struct main0_patchIn
33 {
34 float4 vColors [[attribute(1)]];
35 float4 Foo_a [[attribute(4)]];
36 float4 Foo_b [[attribute(5)]];
37 patch_control_point<main0_in> gl_in;
38 };
39
40 static inline __attribute__((always_inline))
41 void set_from_function(thread float4& gl_Position, thread patch_control_point<main0_in>& gl_in, thread float4& vColors, thread Foo& vFoo)
42 {
43 gl_Position = gl_in[0].Block_a;
44 gl_Position += gl_in[0].Block_b;
45 gl_Position += gl_in[1].Block_a;
46 gl_Position += gl_in[1].Block_b;
47 gl_Position += gl_in[0].vColor;
48 gl_Position += gl_in[1].vColor;
49 gl_Position += vColors;
50 gl_Position += vFoo.a;
51 gl_Position += vFoo.b;
52 }
53
54 [[ patch(quad, 0) ]] vertex main0_out main0(main0_patchIn patchIn [[stage_in]])
55 {
56 main0_out out = {};
57 Foo vFoo = {};
58 vFoo.a = patchIn.Foo_a;
59 vFoo.b = patchIn.Foo_b;
60 set_from_function(out.gl_Position, patchIn.gl_in, patchIn.vColors, vFoo);
61 return out;
62 }
63