| 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_119; |
| 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 |
float _15 = float(gl_InvocationID); |
| 33 |
int _18 = gl_InvocationID + 1; |
| 34 |
float _19 = float(_18); |
| 35 |
uint _21 = uint(gl_InvocationID); |
| 36 |
gl_out[gl_InvocationID].in_te_data0 = te_data{ _15, _19, _21 }; |
| 37 |
threadgroup_barrier(mem_flags::mem_device | mem_flags::mem_threadgroup); |
| 38 |
int _38 = _18 % 3; |
| 39 |
gl_out[gl_InvocationID].in_te_data1 = te_data{ _15 + gl_out[_38].in_te_data0.a, _19 + gl_out[_38].in_te_data0.b, _21 + gl_out[_38].in_te_data0.c }; |
| 40 |
gl_out[gl_InvocationID].in_te_attr = gl_in[gl_InvocationID].in_tc_attr.x; |
| 41 |
spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(1.0); |
| 42 |
spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(1.0); |
| 43 |
spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(1.0); |
| 44 |
spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(1.0); |
| 45 |
spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(1.0); |
| 46 |
spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(1.0); |
| 47 |
} |
| 48 |
|