yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
4c4826d47
master
1#version 450 2#extension GL_EXT_mesh_shader : require 3layout (row_major )uniform ; 4layout (row_major )buffer ; 5const vec2 positions_0 [3 ]= {vec2 (0.0 ,-0.5 ),vec2 (0.5 ,0.5 ),vec2 (-0.5 ,0.5 ) }; 6const vec3 colors_0 [3 ]= {vec3 (1.0 ,1.0 ,0.0 ),vec3 (0.0 ,1.0 ,1.0 ),vec3 (1.0 ,0.0 ,1.0 ) }; 7layout (location = 0 ) 8out vec3 _S1 [3 ]; 9 10 11out gl_MeshPerVertexEXT 12{ 13vec4 gl_Position ; 14}gl_MeshVerticesEXT [3 ]; 15 16out uvec3 gl_PrimitiveTriangleIndicesEXT [1 ]; 17 18layout (local_size_x = 3 ,local_size_y = 1 ,local_size_z = 1 )in ; 19layout (max_vertices = 3 )out ; 20layout (max_primitives = 1 )out ; 21layout (triangles )out ; 22void main () 23{ 24 25SetMeshOutputsEXT (3U ,1U ); 26if (gl_LocalInvocationIndex < 3U ) 27 { 28gl_MeshVerticesEXT [gl_LocalInvocationIndex ].gl_Position = vec4 (positions_0 [gl_LocalInvocationIndex ],0.0 ,1.0 ); 29_S1 [gl_LocalInvocationIndex ]= colors_0 [gl_LocalInvocationIndex ]; 30 } 31else 32 { 33 } 34 35if (gl_LocalInvocationIndex < 1U ) 36 { 37gl_PrimitiveTriangleIndicesEXT [gl_LocalInvocationIndex ]= uvec3 (0U ,1U ,2U ); 38 } 39else 40 { 41 } 42 43return ; 44}