yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
e7b6de334
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 ) }; 7out uvec3 gl_PrimitiveTriangleIndicesEXT [1 ]; 8 9layout (location = 0 ) 10out vec3 verts_color_0 [3 ]; 11 12out gl_MeshPerVertexEXT 13{ 14vec4 gl_Position ; 15}gl_MeshVerticesEXT [3 ]; 16 17perprimitiveEXT layout (location = 1 ) 18out vec3 primitives_triangleNormal_0 [1 ]; 19 20perprimitiveEXT out gl_MeshPerPrimitiveEXT 21{ 22int gl_PrimitiveID ; 23bool gl_CullPrimitiveEXT ; 24}gl_MeshPrimitivesEXT [1 ]; 25 26layout (local_size_x = 3 ,local_size_y = 1 ,local_size_z = 1 )in ; 27layout (max_vertices = 3 )out ; 28layout (max_primitives = 1 )out ; 29layout (triangles )out ; 30void main () 31{ 32 33SetMeshOutputsEXT (3U ,1U ); 34if (gl_LocalInvocationIndex < 3U ) 35 { 36gl_MeshVerticesEXT [gl_LocalInvocationIndex ].gl_Position = vec4 (positions_0 [gl_LocalInvocationIndex ],0.0 ,1.0 ); 37verts_color_0 [gl_LocalInvocationIndex ]= colors_0 [gl_LocalInvocationIndex ]; 38 } 39else 40 { 41 } 42 43if (gl_LocalInvocationIndex < 1U ) 44 { 45gl_PrimitiveTriangleIndicesEXT [gl_LocalInvocationIndex ]= uvec3 (0U ,1U ,2U ); 46primitives_triangleNormal_0 [gl_LocalInvocationIndex ]= vec3 (0.0 ,0.0 ,1.0 ); 47gl_MeshPrimitivesEXT [gl_LocalInvocationIndex ].gl_PrimitiveID = int (gl_LocalInvocationIndex ); 48gl_MeshPrimitivesEXT [gl_LocalInvocationIndex ].gl_CullPrimitiveEXT = false; 49 } 50else 51 { 52 } 53 54return ; 55}