summaryrefslogtreecommitdiff
path: root/examples/spheres/shaders/rechord.comp
blob: 61191202f0e1e89feab4b206127182505ad485cc (plain) (blame)
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
27
#version 450
#extension GL_GOOGLE_include_directive : require
// The look-ahead's chords again, for another scale setting: one thread per
// snapshot, the first `count` of them.
layout(local_size_x = 64) in;

#include "LookParams.glsl"
#include "voices.glsl"

layout(set = 0, binding = 0) readonly buffer Snapshots { vec4 snapshots[]; };
layout(set = 1, binding = 0) buffer Chords { uint chords[]; };

void main() {
    uint at = gl_GlobalInvocationID.x;
    if (at >= u.count) return;
    vec2 p[3];
    vec2 v[3];
    for (int i = 0; i < 3; i++) {
        vec4 b = snapshots[3u * at + uint(i)];
        p[i] = b.xy;
        v[i] = b.zw;
    }
    vec4 sung[3];
    vec4 coupled[3];
    sing(p, v, Mapping(u.base, u.speed_ref, u.depth_scale, u.couple_scale, u.quantize), sung, coupled);
    chords[at] = chordOf(sung) | voicing(sung, coupled);
}