summaryrefslogtreecommitdiffstats
path: root/tests/playground/comp_buffer.comp
blob: 4a7e0ce5e08509ebc15f9173b01be4d5eea825f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#version 440

layout (local_size_x = 256) in;

struct Stuff {
    vec2 a;
    vec2 b;
};

layout(std140, binding = 0) buffer StuffSsbo
{
    vec4 whatever;
    Stuff stuff[];
} buf;

void main()
{
    uint index = gl_GlobalInvocationID.x;
    vec2 a = buf.stuff[index].a;
    vec2 b = buf.stuff[index].b;

    a.x += 1.0;
    buf.stuff[index].a = a;
    b.y += 1.0;
    buf.stuff[index].b = b;
}