#version 450 #extension GL_EXT_mesh_shader : require layout(local_size_x = 2, local_size_y = 3, local_size_z = 4) in; layout(triangles, max_vertices = 24, max_primitives = 22) out; out gl_MeshPerVertexEXT { vec4 gl_Position; float gl_PointSize; float gl_ClipDistance[1]; float gl_CullDistance[2]; } gl_MeshVerticesEXT[]; layout(location = 0) out vec4 vOut[]; layout(location = 2) out BlockOut { vec4 a; vec4 b; } outputs[]; shared float shared_float[16]; struct TaskPayload { float a; float b; int c; }; layout(constant_id = 0) const int spec_const_index = 1; taskPayloadSharedEXT TaskPayload payload; void main() { SetMeshOutputsEXT(24, 22); gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_Position = vec4(gl_GlobalInvocationID, 1.0); gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_Position.y = float(gl_WorkGroupID); gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_Position.xzw = vec3(gl_GlobalInvocationID); gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_Position[gl_LocalInvocationIndex % 4] = float(gl_GlobalInvocationID.z); gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_Position[spec_const_index] = float(gl_GlobalInvocationID.z); gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_ClipDistance[0] = 4.0; gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_CullDistance[0] = 3.0; gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_CullDistance[1] = 5.0; barrier(); if (gl_LocalInvocationIndex < 22) { gl_PrimitiveTriangleIndicesEXT[gl_LocalInvocationIndex] = uvec3(0, 1, 2) + gl_LocalInvocationIndex; } }