Debian Codegraph @

third_party/spirv-cross/reference/shaders-msl/comp/torture-loop.comp

raw
1 #include <metal_stdlib>
2 #include <simd/simd.h>
3
4 using namespace metal;
5
6 struct SSBO
7 {
8 float4x4 mvp;
9 float4 in_data[1];
10 };
11
12 struct SSBO2
13 {
14 float4 out_data[1];
15 };
16
17 constant uint3 gl_WorkGroupSize [[maybe_unused]] = uint3(1u);
18
19 kernel void main0(const device SSBO& _24 [[buffer(0)]], device SSBO2& _89 [[buffer(1)]], uint3 gl_GlobalInvocationID [[thread_position_in_grid]])
20 {
21 uint ident = gl_GlobalInvocationID.x;
22 float4 idat = _24.in_data[ident];
23 int k = 0;
24 for (;;)
25 {
26 int _39 = k;
27 int _40 = _39 + 1;
28 k = _40;
29 if (_40 < 10)
30 {
31 idat *= 2.0;
32 k++;
33 continue;
34 }
35 else
36 {
37 break;
38 }
39 }
40 for (uint i = 0u; i < 16u; i++, k++)
41 {
42 for (uint j = 0u; j < 30u; j++)
43 {
44 idat = _24.mvp * idat;
45 }
46 }
47 do
48 {
49 k++;
50 } while (k > 10);
51 _89.out_data[ident] = idat;
52 }
53