| 1 |
#include <metal_stdlib> |
| 2 |
#include <simd/simd.h> |
| 3 |
|
| 4 |
using namespace metal; |
| 5 |
|
| 6 |
struct main0_out |
| 7 |
{ |
| 8 |
float4 gl_Position; |
| 9 |
}; |
| 10 |
|
| 11 |
struct main0_in |
| 12 |
{ |
| 13 |
uint3 m_82; |
| 14 |
ushort2 m_86; |
| 15 |
float4 gl_Position; |
| 16 |
}; |
| 17 |
|
| 18 |
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)]]) |
| 19 |
{ |
| 20 |
device main0_out* gl_out = &spvOut[gl_GlobalInvocationID.x - gl_GlobalInvocationID.x % 4]; |
| 21 |
device main0_in* gl_in = &spvIn[min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1] - 1) * spvIndirectParams[0]]; |
| 22 |
uint gl_InvocationID = gl_GlobalInvocationID.x % 4; |
| 23 |
uint gl_PrimitiveID = min(gl_GlobalInvocationID.x / 4, spvIndirectParams[1]); |
| 24 |
if (gl_InvocationID == 0) |
| 25 |
{ |
| 26 |
spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0] = half(2.0); |
| 27 |
spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1] = half(3.0); |
| 28 |
spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2] = half(4.0); |
| 29 |
spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3] = half(5.0); |
| 30 |
spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(mix(float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0]), float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3]), 0.5)); |
| 31 |
spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(mix(float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2]), float(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1]), 0.5)); |
| 32 |
} |
| 33 |
gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; |
| 34 |
} |
| 35 |
|