Debian Codegraph @

third_party/spirv-cross/reference/opt/shaders-msl/vert/interface-block-block-composites.vert

raw
1 #pragma clang diagnostic ignored "-Wmissing-prototypes"
2 #pragma clang diagnostic ignored "-Wmissing-braces"
3
4 #include <metal_stdlib>
5 #include <simd/simd.h>
6
7 using namespace metal;
8
9 template<typename T, size_t Num>
10 struct spvUnsafeArray
11 {
12 T elements[Num ? Num : 1];
13
14 thread T& operator [] (size_t pos) thread
15 {
16 return elements[pos];
17 }
18 constexpr const thread T& operator [] (size_t pos) const thread
19 {
20 return elements[pos];
21 }
22
23 device T& operator [] (size_t pos) device
24 {
25 return elements[pos];
26 }
27 constexpr const device T& operator [] (size_t pos) const device
28 {
29 return elements[pos];
30 }
31
32 constexpr const constant T& operator [] (size_t pos) const constant
33 {
34 return elements[pos];
35 }
36
37 threadgroup T& operator [] (size_t pos) threadgroup
38 {
39 return elements[pos];
40 }
41 constexpr const threadgroup T& operator [] (size_t pos) const threadgroup
42 {
43 return elements[pos];
44 }
45 };
46
47 struct Vert
48 {
49 spvUnsafeArray<float, 3> arr;
50 float3x3 wMatrix;
51 float4 wTmp;
52 };
53
54 struct main0_out
55 {
56 float3 vMatrix_0 [[user(locn0)]];
57 float3 vMatrix_1 [[user(locn1)]];
58 float3 vMatrix_2 [[user(locn2)]];
59 float Vert_arr_0 [[user(locn4)]];
60 float Vert_arr_1 [[user(locn5)]];
61 float Vert_arr_2 [[user(locn6)]];
62 float3 Vert_wMatrix_0 [[user(locn7)]];
63 float3 Vert_wMatrix_1 [[user(locn8)]];
64 float3 Vert_wMatrix_2 [[user(locn9)]];
65 float4 Vert_wTmp [[user(locn10)]];
66 float4 gl_Position [[position]];
67 };
68
69 struct main0_in
70 {
71 float3 Matrix_0 [[attribute(0)]];
72 float3 Matrix_1 [[attribute(1)]];
73 float3 Matrix_2 [[attribute(2)]];
74 float4 Pos [[attribute(4)]];
75 };
76
77 vertex main0_out main0(main0_in in [[stage_in]])
78 {
79 main0_out out = {};
80 float3x3 vMatrix = {};
81 Vert _20 = {};
82 float3x3 Matrix = {};
83 Matrix[0] = in.Matrix_0;
84 Matrix[1] = in.Matrix_1;
85 Matrix[2] = in.Matrix_2;
86 vMatrix = Matrix;
87 _20.wMatrix = Matrix;
88 _20.arr[0] = 1.0;
89 _20.arr[1] = 2.0;
90 _20.arr[2] = 3.0;
91 _20.wTmp = in.Pos;
92 out.gl_Position = in.Pos;
93 out.vMatrix_0 = vMatrix[0];
94 out.vMatrix_1 = vMatrix[1];
95 out.vMatrix_2 = vMatrix[2];
96 out.Vert_arr_0 = _20.arr[0];
97 out.Vert_arr_1 = _20.arr[1];
98 out.Vert_arr_2 = _20.arr[2];
99 out.Vert_wMatrix_0 = _20.wMatrix[0];
100 out.Vert_wMatrix_1 = _20.wMatrix[1];
101 out.Vert_wMatrix_2 = _20.wMatrix[2];
102 out.Vert_wTmp = _20.wTmp;
103 return out;
104 }
105