SPIRV-Cross/reference/shaders-no-opt/mesh/invariant-position-mesh.spv14.nocompat.vk.mesh.vk
Hans-Kristian Arntzen 79d63934a6 GLSL: Emit inline invariant position for mesh shaders.
Work around missing feature from GLSL. Normally we can emit a global
invariant gl_Position; and call it a day, but it does not work for mesh
shaders it seems. Declaring invariance inside an explicit IO block works
fine on the other hand ...
2023-08-17 12:45:54 +02:00

20 lines
523 B
Plaintext

#version 450
#extension GL_EXT_mesh_shader : require
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
layout(max_vertices = 3, max_primitives = 1, triangles) out;
out gl_MeshPerVertexEXT
{
invariant vec4 gl_Position;
} gl_MeshVerticesEXT[];
void main()
{
SetMeshOutputsEXT(3u, 1u);
gl_MeshVerticesEXT[0].gl_Position = vec4(1.0);
gl_MeshVerticesEXT[1].gl_Position = vec4(1.0);
gl_MeshVerticesEXT[2].gl_Position = vec4(1.0);
gl_PrimitiveTriangleIndicesEXT[0] = uvec3(0u, 1u, 2u);
}