yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
9ec6b9168
master
1#version 450 2#extension GL_EXT_mesh_shader : require 3layout (row_major )uniform ; 4layout (row_major )buffer ; 5 6out gl_MeshPerVertexEXT 7{ 8vec4 gl_Position ; 9}gl_MeshVerticesEXT [3 ]; 10 11const 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 ) }; 12const vec2 positions_0 [3 ]= {vec2 (0.0 ,-0.5 ),vec2 (0.5 ,0.5 ),vec2 (-0.5 ,0.5 ) }; 13 14struct Vertex_0 15{ 16vec4 pos_0 ; 17vec3 color_0 ; 18}; 19 20Vertex_0 Vertex_x24init_0 (vec4 pos_1 ,vec3 color_1 ) 21{ 22Vertex_0 _S1 ; 23 24_S1 .pos_0 = pos_1 ; 25_S1 .color_0 = color_1 ; 26return _S1 ; 27} 28 29layout (location = 0 ) 30out vec3 verts_color_0 [3 ]; 31out uvec3 gl_PrimitiveTriangleIndicesEXT [1 ]; 32void foo_0 (uint _S2 ) 33{ 34if (_S2 < 3U ) 35 { 36Vertex_0 _S3 = Vertex_x24init_0 (vec4 (positions_0 [_S2 ],0.0 ,1.0 ),colors_0 [_S2 ]); 37gl_MeshVerticesEXT [_S2 ].gl_Position = _S3 .pos_0 ; 38verts_color_0 [_S2 ]= _S3 .color_0 ; 39 } 40return ; 41} 42 43layout (local_size_x = 3 ,local_size_y = 1 ,local_size_z = 1 )in ; 44layout (max_vertices = 3 )out ; 45layout (max_primitives = 1 )out ; 46layout (triangles )out ; 47void main () 48{ 49SetMeshOutputsEXT (3U ,1U ); 50foo_0 (gl_LocalInvocationIndex ); 51if (gl_LocalInvocationIndex < 1U ) 52 { 53gl_PrimitiveTriangleIndicesEXT [gl_LocalInvocationIndex ]= uvec3 (0U ,1U ,2U ); 54 } 55return ; 56}