• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#version 460
2
3layout (location = 0) out vec4 io;
4
5// default uniforms will be gathered into a uniform block
6// final global block will merge uniforms from all linked files
7uniform vec4 a;     // declared in both stages
8uniform vec2 b2;    // declaration order swapped in other stage
9uniform vec2 b1;
10uniform vec4 c2;    // not delcared in other file
11uniform vec4 d;
12
13uniform vec4 s[4];
14
15layout (binding = 0) uniform atomic_uint counter3;
16layout (binding = 0) uniform atomic_uint counter2;
17
18vec4 foo() {
19    uint j = atomicCounterIncrement(counter2) + atomicCounterDecrement(counter3);
20    vec4 v = a + vec4(b1.x, b1.y, b2.x, b2.y) + c2 + d;
21
22    return float(j) * v;
23}
24
25void main() {
26
27    vec4 v = foo();
28    v = v + s[gl_VertexID - gl_VertexIndex];
29    v.x = v.x - float(gl_InstanceID - gl_InstanceIndex);
30    io = v;
31}
32