Debian Codegraph @

third_party/spirv-cross/reference/shaders-msl/tesc/struct-output.multi-patch.tesc

raw
1 #include <metal_stdlib>
2 #include <simd/simd.h>
3
4 using namespace metal;
5
6 struct te_data
7 {
8 float a;
9 float b;
10 uint c;
11 };
12
13 struct main0_out
14 {
15 float in_te_attr;
16 te_data in_te_data0;
17 te_data in_te_data1;
18 };
19
20 struct main0_in
21 {
22 float3 in_tc_attr;
23 ushort2 m_107;
24 };
25
26 kernel void main0(uint3 gl_GlobalInvocationID [[thread_position_in_grid]], device main0_out* spvOut [[buffer(28)]], constant uint* spvIndirectParams [[buffer(29)]], device MTLQuadTessellationFactorsHalf* spvTessLevel [[buffer(26)]], device main0_in* spvIn [[buffer(22)]])
27 {
28 device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 3];
29 device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 3, spvIndirectParams[1] - 1) * spvIndirectParams[0]];
30 uint gl_InvocationID = gl_GlobalInvocationID.x % 3;
31 uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 3, spvIndirectParams[1]);
32 te_data d = te_data{ float(gl_InvocationID), float(gl_InvocationID + 1), uint(gl_InvocationID) };
33 gl_out[gl_InvocationID].in_te_data0 = d;
34 threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup);
35 te_data e = gl_out[(gl_InvocationID + 1) % 3].in_te_data0;
36 gl_out[gl_InvocationID].in_te_data1 = te_data{ d.a + e.a, d.b + e.b, d.c + e.c };
37 gl_out[gl_InvocationID].in_te_attr = gl_in[gl_InvocationID].in_tc_attr.x;
38 spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(1.0);
39 spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(1.0);
40 spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(1.0);
41 spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(1.0);
42 spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(1.0);
43 spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(1.0);
44 }
45