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