blob: f94187884bc5732f2eafe03bfbe8d2930c9654a9 (
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
45
46
47
48
49
50
51
|
#!/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 tsv-video-stream --name "$TSV_SRC" -- \
-f lavfi -i "testsrc=size=1920x1080:rate=60"
spawn wgsl-render --continuous
sleep 2
SHADER='
@group(1) @binding(0) var video: texture_2d<f32>;
@group(1) @binding(1) var s: sampler;
@fragment
fn fs_main(@location(0) uv: vec2<f32>) -> @location(0) vec4<f32> {
return textureSample(video, s, uv).rrra;
}
'
oscsend "$HOST" "$PORT" /texture/tex1 s "$TSV_SRC"
oscsend "$HOST" "$PORT" /sampler/samp1 ss nearest clamp
oscsend "$HOST" "$PORT" /module/package::main s "$SHADER"
oscsend "$HOST" "$PORT" /entrypoint s package::main
oscsend "$HOST" "$PORT" /binding/package::main/video s /texture/tex1
oscsend "$HOST" "$PORT" /binding/package::main/s s /sampler/samp1
cargo run --bin tsv-view
|