yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Yong He[SPIRV] Support `globallycoherent` and `[vk::index()]`. (#3488)e7b6de334

master
1.1 KiB43 linesraw
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  verts_color_0[3];
9
10
11out gl_MeshPerVertexEXT
12{
13    vec4 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
25    SetMeshOutputsEXT(3U, 1U);
26    if(gl_LocalInvocationIndex < 3U)
27    {
28        gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_Position = vec4(positions_0[gl_LocalInvocationIndex], 0.0, 1.0);
29        verts_color_0[gl_LocalInvocationIndex] = colors_0[gl_LocalInvocationIndex];
30    }
31    else
32    {
33    }
34    if(gl_LocalInvocationIndex < 1U)
35    {
36        gl_PrimitiveTriangleIndicesEXT[gl_LocalInvocationIndex] = uvec3(0U, 1U, 2U);
37    }
38    else
39    {
40    }
41
42    return;
43}