diff --git a/data/shaders/tessellation/pntriangles.tesc b/data/shaders/tessellation/pntriangles.tesc index 50ff307..56f8d1c 100644 --- a/data/shaders/tessellation/pntriangles.tesc +++ b/data/shaders/tessellation/pntriangles.tesc @@ -33,6 +33,8 @@ layout(location = 0) out vec3 outNormal[3]; layout(location = 3) out vec2 outUV[3]; layout(location = 6) out PnPatch outPatch[3]; +layout(location = 16) patch out float outTessLevels[3]; + float wij(int i, int j) { return dot(gl_in[j].gl_Position.xyz - gl_in[i].gl_Position.xyz, inNormal[i]); @@ -81,6 +83,12 @@ void main() outPatch[gl_InvocationID].n101 = N2+N0-vij(2,0)*(P0-P2); // set tess levels - gl_TessLevelOuter[gl_InvocationID] = ubo.tessLevel; - gl_TessLevelInner[0] = ubo.tessLevel; -} \ No newline at end of file + outTessLevels[gl_InvocationID] = ubo.tessLevel; + barrier(); + if (gl_InvocationID == 0) { + gl_TessLevelOuter[0] = outTessLevels[0]; + gl_TessLevelOuter[1] = outTessLevels[1]; + gl_TessLevelOuter[2] = outTessLevels[2]; + gl_TessLevelInner[0] = ubo.tessLevel; + } +} diff --git a/data/shaders/tessellation/pntriangles.tesc.spv b/data/shaders/tessellation/pntriangles.tesc.spv index d7c90ed..23e4117 100644 Binary files a/data/shaders/tessellation/pntriangles.tesc.spv and b/data/shaders/tessellation/pntriangles.tesc.spv differ