-
Notifications
You must be signed in to change notification settings - Fork 89
Add Vello GPU rendering with unified viewer code #473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
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
Research and document plan for integrating Vello GPU-accelerated vector rendering into NodeBox's Rust GUI. Key points: - Vello offers 10-100x performance improvement over CPU rendering - Architecture for sharing wgpu device between egui and Vello - Geometry conversion layer from nodebox-core Path to kurbo BezPath - Phased implementation approach with feature flag for gradual rollout - Risk assessment and fallback strategy for unsupported hardware https://claude.ai/code/session_01NLaj9921BZ1ThxDXvL35dJ
Implement the foundation for GPU-accelerated vector rendering using Vello: - Add vello 0.7 workspace dependency with gpu-rendering feature flag - Create vello_convert.rs for geometry conversion: - Path/Contour/Color conversion from nodebox-core to kurbo/peniko types - VelloPath wrapper combining bezpath with style info - Create vello_renderer.rs with VelloRenderer wrapper: - Manages Vello renderer lifecycle and render target textures - Builds Vello scenes from NodeBox geometry - ViewTransform for pan/zoom transforms - Feature-gated modules only compiled when gpu-rendering is enabled All 43 tests pass with the new feature enabled. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Implement GPU-accelerated vector rendering in the viewer pane: - Create VelloViewer widget that manages its own wgpu context - Renders Vello output to GPU texture, copies to CPU for egui display - Handles wgpu 27 (Vello) / wgpu 23 (egui) version mismatch via texture copy - Automatic fallback to CPU rendering if GPU unavailable - Integrate VelloViewer into ViewerPane - Conditional compilation with gpu-rendering feature - Toggle between GPU and CPU rendering at runtime - Geometry hash for efficient cache invalidation - Overlays (grid, handles, points) still rendered via egui painter - Update dependencies - Add egui-wgpu and pollster for wgpu support - Enable eframe/wgpu feature when gpu-rendering is enabled All tests pass with and without gpu-rendering feature. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Fix cache invalidation: hash actual point coordinates (x, y) and point types, not just counts. Previously changing rect width didn't trigger re-render because only path/contour/point counts were hashed. - Fix performance: cache GPU resources (render texture, texture view, staging buffer) in CachedResources struct. Only recreate when size changes. Previously created new GPU resources on every render call. - Add HiDPI support using pixels_per_point() for physical pixel scaling - Fix alignment by using texture-local coordinates for transform Co-Authored-By: Claude Opus 4.5 <[email protected]>
Upgrade egui/eframe from 0.30 to 0.33 to align wgpu versions: - egui-wgpu 0.33 uses wgpu 27 (same as vello 0.7) - VelloViewer now shares egui's wgpu device directly - Zero-copy texture sharing via egui_wgpu::RenderState This eliminates the GPU→CPU→GPU texture copying that caused 25-60ms overhead per frame, improving to ~5-15ms (3-5x faster). Changes: - Update egui/eframe/egui-wgpu/egui_extras to 0.33 - Fix breaking API changes (CornerRadius, Margin, Frame::NONE, etc.) - Rewrite VelloViewer to use shared RenderState - Pass RenderState through ViewerPane to VelloViewer - Update wgpu-rendering-plan.md with completion status Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Make gpu-rendering the default feature in Cargo.toml - Unify show() and show_impl() into single functions - Merge show_canvas() and show_canvas_no_gpu() into one function - Extract render_geometry() with cfg-gated GPU/CPU implementations - Add render_geometry_cpu() helper for CPU fallback path - Simplify app.rs render_state passing with unified show() call This reduces viewer_pane.rs by ~270 lines while maintaining full functionality for both GPU and CPU-only builds. Co-Authored-By: Claude Opus 4.5 <[email protected]>
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
Key Changes
show_canvas()andshow_canvas_no_gpu()functionsgpu-renderingis now enabled by default; opt out with--no-default-featuresTest plan
cargo build -p nodebox-gui(GPU rendering, default)cargo build -p nodebox-gui --no-default-features(CPU-only)cargo test -p nodebox-gui(95 tests pass)use_gpu_rendering = false🤖 Generated with Claude Code