#!/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; @group(1) @binding(1) var s: sampler; @fragment fn fs_main(@location(0) uv: vec2) -> @location(0) vec4 { 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