yum-mirror/slang

Making it easier to work with shaders

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

Yong HeMore control flow simplifications. (#2673)bd6306cda

master
3.3 KiB169 linesraw
1#version 450
2#extension GL_EXT_mesh_shader : require
3layout(row_major) uniform;
4layout(row_major) buffer;
5struct Texes_0
6{
7    vec2 tex1_0;
8    vec4 tex2_0;
9};
10
11struct Vertex_0
12{
13    vec4 pos_0;
14    vec3 col_0;
15    Texes_0 ts_0;
16};
17
18void just_two_0(out Vertex_0 v_0, out Vertex_0 w_0)
19{
20    const vec4 _S1 = vec4(0.0);
21    const vec3 _S2 = vec3(1.0);
22    Texes_0 _S3 = { vec2(0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0) };
23    v_0.pos_0 = _S1;
24    v_0.col_0 = _S2;
25    v_0.ts_0 = _S3;
26    w_0.pos_0 = _S1;
27    w_0.col_0 = _S2;
28    w_0.ts_0 = _S3;
29    return;
30}
31
32void just_one_0(out Vertex_0 v_1)
33{
34    const vec3 _S4 = vec3(1.0);
35    Texes_0 _S5 = { vec2(0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0) };
36    v_1.pos_0 = vec4(0.0);
37    v_1.col_0 = _S4;
38    v_1.ts_0 = _S5;
39    return;
40}
41
42void part_of_one_0(out vec4 p_0)
43{
44    p_0 = vec4(1.0, 2.0, 3.0, 4.0);
45    return;
46}
47
48void write_struct_0(out Texes_0 t_0)
49{
50    t_0.tex1_0 = vec2(0.0);
51    t_0.tex2_0 = vec4(1.0);
52    return;
53}
54
55layout(location = 0)
56out vec3  _S6[3];
57
58layout(location = 1)
59out vec2  _S7[3];
60
61layout(location = 2)
62out vec4  _S8[3];
63
64out gl_MeshPerVertexEXT
65{
66    vec4 gl_Position;
67} gl_MeshVerticesEXT[3];
68
69out uvec3  gl_PrimitiveTriangleIndicesEXT[1];
70void everything_0()
71{
72    vec3 _S9 = vec3(1.0);
73    vec2 _S10 = vec2(0.0, 0.0);
74    vec4 _S11 = vec4(0.0, 0.0, 0.0, 0.0);
75    gl_MeshVerticesEXT[0U].gl_Position = vec4(0.0);
76    _S6[0U] = _S9;
77    _S7[0U] = _S10;
78    _S8[0U] = _S11;
79    return;
80}
81
82void a_0()
83{
84    everything_0();
85    return;
86}
87
88void b_0()
89{
90    Vertex_0 _S12;
91    Vertex_0 _S13;
92    just_two_0(_S13, _S12);
93    Vertex_0 _S14 = _S13;
94    gl_MeshVerticesEXT[0U].gl_Position = _S13.pos_0;
95    _S6[0U] = _S14.col_0;
96    _S7[0U] = _S14.ts_0.tex1_0;
97    _S8[0U] = _S14.ts_0.tex2_0;
98    Vertex_0 _S15 = _S12;
99    gl_MeshVerticesEXT[0U].gl_Position = _S12.pos_0;
100    _S6[0U] = _S15.col_0;
101    _S7[0U] = _S15.ts_0.tex1_0;
102    _S8[0U] = _S15.ts_0.tex2_0;
103    return;
104}
105
106void c_0(uint _S16)
107{
108    Vertex_0 _S17;
109    just_one_0(_S17);
110    Vertex_0 _S18 = _S17;
111    gl_MeshVerticesEXT[_S16].gl_Position = _S17.pos_0;
112    _S6[_S16] = _S18.col_0;
113    _S7[_S16] = _S18.ts_0.tex1_0;
114    _S8[_S16] = _S18.ts_0.tex2_0;
115    return;
116}
117
118void d_0(uint _S19)
119{
120    Vertex_0 _S20;
121    Vertex_0 _S21;
122    just_two_0(_S21, _S20);
123    Vertex_0 _S22 = _S21;
124    gl_MeshVerticesEXT[_S19].gl_Position = _S21.pos_0;
125    _S6[_S19] = _S22.col_0;
126    _S7[_S19] = _S22.ts_0.tex1_0;
127    _S8[_S19] = _S22.ts_0.tex2_0;
128    Vertex_0 _S23 = _S20;
129    gl_MeshVerticesEXT[0U].gl_Position = _S20.pos_0;
130    _S6[0U] = _S23.col_0;
131    _S7[0U] = _S23.ts_0.tex1_0;
132    _S8[0U] = _S23.ts_0.tex2_0;
133    return;
134}
135
136void e_0(uint _S24)
137{
138    part_of_one_0(gl_MeshVerticesEXT[_S24].gl_Position);
139    Texes_0 _S25;
140    write_struct_0(_S25);
141    Texes_0 _S26 = _S25;
142    _S7[_S24] = _S25.tex1_0;
143    _S8[_S24] = _S26.tex2_0;
144    part_of_one_0(_S8[_S24]);
145    return;
146}
147
148layout(local_size_x = 3, local_size_y = 1, local_size_z = 1) in;
149layout(max_vertices = 3) out;
150layout(max_primitives = 1) out;
151layout(triangles) out;
152void main()
153{
154    SetMeshOutputsEXT(3U, 1U);
155    if(gl_LocalInvocationIndex < 3U)
156    {
157        a_0();
158        b_0();
159        c_0(gl_LocalInvocationIndex);
160        d_0(gl_LocalInvocationIndex);
161        e_0(gl_LocalInvocationIndex);
162    }
163    if(gl_LocalInvocationIndex < 1U)
164    {
165        gl_PrimitiveTriangleIndicesEXT[gl_LocalInvocationIndex] = uvec3(0U, 1U, 2U);
166    }
167    return;
168}
169