summaryrefslogtreecommitdiffstats
path: root/test.sh
blob: 15bcc7f597c163ddb0d4cea2afc974a157752ab0 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
set -euo pipefail

HOST=localhost
PORT=9000
TSV_SRC=test-vid

# ensure relatively predictable timing for spawn()
cargo build

PIDS=()
cleanup() {
    for pid in "${PIDS[@]}"; do
        kill "$pid" 2>/dev/null || true
    done
    wait 2>/dev/null
}
trap cleanup EXIT

spawn() {
    BIN="$1"
    shift
    cargo run --bin "$BIN" -- "$@" &
    PIDS+=($!)
}

spawn wgsl-render

sleep 2


SHADER='
@group(1) @binding(0) var<uniform> color: vec3f;

@fragment
fn fs_main(@location(0) uv: vec2<f32>) -> @location(0) vec4<f32> {
    return vec4f(color, 1);
}
'
oscsend "$HOST" "$PORT" /module/package::main s "$SHADER"
oscsend "$HOST" "$PORT" /entrypoint s package::main
oscsend "$HOST" "$PORT" /uniform/package::main/color fff 1 0 0

cargo run --bin tsv-view