#version 460 #extension GL_ARB_separate_shader_objects : enable #extension GL_NV_mesh_shader : require layout(local_size_x=32) in; layout(triangles) out; layout(max_vertices=64, max_primitives=126) out; layout( push_constant ) uniform constants{ mat4 mvp; }; layout(location = 0) out vec3 vertexColors[]; void main() { if(gl_LocalInvocationID.x == 0) { gl_PrimitiveCountNV = 1; gl_PrimitiveIndicesNV[0] = 0; gl_PrimitiveIndicesNV[1] = 1; gl_PrimitiveIndicesNV[2] = 2; gl_MeshVerticesNV[0].gl_Position = mvp * vec4(-0.5, 0.5, 0.5, 1); gl_MeshVerticesNV[1].gl_Position = mvp * vec4( 0.5, 0.5, 0.5, 1); gl_MeshVerticesNV[2].gl_Position = mvp * vec4( 0 , -0.5, 0.5, 1); vertexColors[0] = vec3(1, 0, 0); vertexColors[1] = vec3(0, 1, 0); vertexColors[2] = vec3(0, 0, 1); } }