WIP: WASM/WebGPU support for running vibe in the browser - #5
Draft
marksverdhei wants to merge 17 commits into
Draft
WIP: WASM/WebGPU support for running vibe in the browser#5marksverdhei wants to merge 17 commits into
marksverdhei wants to merge 17 commits into
Conversation
Re-implements both features on top of upstream's refactored codebase (no more ResourceManager, new Component trait, texture support): - BPM detector: spectral flux + autocorrelation with median smoothing, exposed as iBPM uniform (binding 4), writes /tmp/vibe-bpm for waybar - Color palette: 4 configurable colors from ~/.config/vibe/colors.toml, exposed as iColors uniform (binding 5), live-reloads via mtime check Texture bindings bumped to 6/7 to accommodate new uniforms. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Some AMD GPUs expose Rgba16Unorm first which isn't renderable. Prefer known-good 8-bit formats with fallback chain. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…capture On PipeWire/ALSA, build_input_stream on an output device doesn't do loopback capture. Switch to using the default input device with supported_input_configs so PipeWire can route a monitor source for capturing system audio output. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Start normalize_factor at 0.1 instead of 1.0 so newly loaded shaders fade in from dim rather than flashing bright and slowly settling. Use a faster ramp-up rate (3% vs 0.2% per frame) while below 0.5 to reach equilibrium in ~1-2 seconds. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Covers uniforms, audio-reactive techniques, color vibrancy, texture sampling, and best practices for FragmentCanvas shaders. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add iMouseClick (vec4f, binding 8) and iLocalTime (binding 9) uniforms. Implements GPU pixel readback via post_render hook, nearest-neighbor texture sampling, and external tool integration (/tmp/vibe-click). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
18 WGSL fragment shaders for the FragmentCanvas component: aurora, cluster, deep_sea, event_horizon, grass, liquid, mandelbrot_light, monolith, nebula, plasma, pokemon_grass, pokemon_grass_3d, singularity, solar_system, starfield, tesseract, vortex, waveform Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add comprehensive changelog to README documenting all fork features (18 shaders, BPM detection, click-to-interact, color palette, fixes). Add utility scripts from ~/.config/vibe to utils/: - cycle-shader.sh: cycle shaders per output/window - vibe-key-cycle.sh: Hyprland keybinding shader cycling - randomize-colors.sh: randomize color palette - pokemon-click-cry.py: click-triggered Pokemon cry daemon - pokemon-cries-daemon.sh: ambient random cries - cluster-status-feeder.sh: K8s metrics → shader constants Include Pokemon grass shader spec doc. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add shared compositor abstraction (utils/lib/compositor.sh) that auto-detects Hyprland, Sway, and KDE Plasma for focused-window queries. Keybinding scripts now work on any supported compositor instead of only Hyprland. - vibe-key-cycle.sh: use compositor.sh instead of hyprctl directly - randomize-colors.sh: use compositor.sh with graceful fallback - cluster-status-feeder.sh: externalize node config to TOML file - Add cluster-nodes.toml.example for user configuration - Add utils/README.md with setup docs for all compositors Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Only update last_mtime after successfully parsing the species file. Previously, a partial/incomplete read would update the mtime tracker and never retry, silently dropping the click event. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add ht-fork changelog to README documenting all fork features, fixes, and docs. Add portable utility scripts (shader cycling, color randomization, Pokemon cry daemons, K8s cluster status feeder) with shared compositor abstraction supporting Hyprland, Sway, and KDE Plasma. Include Pokemon grass shader spec and utils README. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Dedicated changelog for all fork-specific features, fixes, and CI changes with commit links. Linked from README. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Introduce platform abstractions across vibe-audio, vibe-renderer, and a new vibe-web crate to enable compilation to wasm32 targets using WebGPU. - Add cfg(target_arch = "wasm32") gates throughout for cpal, pollster, xdg, fs - Replace cpal::SampleRate with a platform-agnostic type alias on WASM - Make Renderer::new async-capable with new_async for WASM - Add web-sys/wasm-bindgen/js-sys workspace dependencies - Add vibe-web crate as the browser entry point - Add WebAudioFetcher for browser audio capture - Move vulkan backend feature to native-only (vibe crate) - Skip error scope blocking and file I/O on WASM targets Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add default-members to workspace Cargo.toml so native builds skip vibe-web - Fix import path for WASM pkg (./pkg/ not ../pkg/) - Add Web Audio API integration (getUserMedia → AnalyserNode → frequency data) - DPI-aware canvas sizing with devicePixelRatio - Graceful audio fallback with click-to-retry - Normalize mouse coordinates using clientWidth/clientHeight Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cfg(target_arch = "wasm32")gates acrossvibe-audioandvibe-rendererto compile without native-only deps (cpal, pollster, xdg, filesystem I/O)vibe-webcrate — a standalone browser entry point using wasm-bindgen, with its own WebGPU render pipeline, uniform management, and shader hot-swap via JSWebAudioFetcherinvibe-audiofor pulling audio from the Web Audio API'sAnalyserNodeRendererinitialization async-capable (new_asyncon WASM,newstays blocking on native)vulkanbackend feature out of workspace default into the nativevibecrate onlyCurrent issues
vibe-webduplicates the render pipeline — it has its own standalone WebGPU setup rather than reusingvibe-renderer. The uniform layout (preamble, bind group) is duplicated and will drift from the native version. Ideallyvibe-webshould be a thin shell that drivesvibe-renderercomponents.WebAudioFetcheris not wired intovibe-web— the fetcher exists invibe-audiobutvibe-web/src/lib.rsdoesn't use it; frequency data is currently pushed from JS viaset_frequencies(). Need to decide: keep JS-driven approach, or integrate the Rust-side fetcher.freqsstorage buffer on web — the nativeFragmentCanvasuses a storage buffer for frequency data, but WebGPU uniform buffers have a 64KB limit. The web version packs freqs intoarray<vec4f, 64>(256 floats) as a workaround. Shaders that usevar<storage>won't work unmodified.arrayLength(&freqs)which aren't available in the web uniform-only layout. Shaders need porting or a compatibility layer.BpmDetectorisn't integrated in the web path.push_error_scope+pop(with blocking) is skipped on WASM. Shader compilation errors in the browser will be silent or only show inon_uncaptured_error.vibe-web/build.shis a manual script callingwasm-pack. No CI integration yet.cargo test/cargo buildpaths.Test plan
cargo build(native) still workscargo test(native) still passeswasm-pack buildinvibe-web/produces working pkgset_shader()hot-swaps a custom WGSL fragmentset_frequencies()drives audio reactivity from JS AnalyserNode data🤖 Generated with Claude Code