Skip to content

Commit 33a82de

Browse files
authored
Add vello_hybrid backend (#278)
* Add vello_hybrid backend Signed-off-by: Nico Burns <[email protected]> * Enable vello_hybrid for mini-dxn and todomvc Signed-off-by: Nico Burns <[email protected]> * Readme: Change default renderer back to vello classic Signed-off-by: Nico Burns <[email protected]> --------- Signed-off-by: Nico Burns <[email protected]>
1 parent 717fc88 commit 33a82de

File tree

9 files changed

+77
-16
lines changed

9 files changed

+77
-16
lines changed

Cargo.lock

Lines changed: 58 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,10 @@ taffy = { version = "0.9", default-features = false, features = ["std", "flexbox
7474
# AnyRender
7575
anyrender = { version = "0.6" }
7676
anyrender_vello = { version = "0.6" }
77-
anyrender_vello_cpu = { version = "0.7" }
77+
anyrender_vello_cpu = { version = "0.8" }
78+
anyrender_vello_hybrid = { version = "0.1" }
7879
anyrender_svg = { version = "0.6" }
79-
wgpu_context = { version = "0.1" }
80+
wgpu_context = { version = "0.1.1" }
8081

8182
# Linebender + Fontations + WGPU + SVG
8283
color = "0.3"
@@ -183,6 +184,7 @@ publish = false
183184
anyrender = { workspace = true }
184185
anyrender_vello = { workspace = true }
185186
anyrender_vello_cpu = { workspace = true, features = ["multithreading"] }
187+
anyrender_vello_hybrid = { workspace = true }
186188
blitz-dom = { workspace = true, features = ["default"] }
187189
blitz-html = { workspace = true }
188190
blitz-traits = { workspace = true }

apps/readme/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ publish = false
99
[features]
1010
default = ["gpu", "comrak"]
1111
gpu = ["dep:anyrender_vello"]
12+
hybrid = ["dep:anyrender_vello_hybrid"]
1213
cpu = ["cpu-pixels"]
1314
cpu-pixels = ["cpu-base", "anyrender_vello_cpu/pixels_window_renderer"]
1415
cpu-softbuffer = ["cpu-base", "anyrender_vello_cpu/softbuffer_window_renderer"]
1516
cpu-base = ["dep:anyrender_vello_cpu"]
1617
avif = ["dep:image", "image?/avif-native"]
1718
comrak = ["dep:comrak"]
1819
pulldown_cmark = ["dep:pulldown-cmark"]
19-
log_frame_times = ["anyrender_vello_cpu?/log_frame_times", "anyrender_vello?/log_frame_times"]
20+
log_frame_times = ["anyrender_vello_cpu?/log_frame_times", "anyrender_vello_hybrid?/log_frame_times", "anyrender_vello?/log_frame_times"]
2021
log_phase_times = ["blitz-dom/log_phase_times"]
2122
incremental = ["blitz-dom/incremental"]
2223

@@ -29,6 +30,7 @@ blitz-net = { workspace = true, features = ["cookies", "debug_log"] }
2930
blitz-shell = { workspace = true, features = ["tracing", "default"] }
3031
anyrender_vello = { workspace = true, optional = true }
3132
anyrender_vello_cpu = { workspace = true, features = ["multithreading"], optional = true }
33+
anyrender_vello_hybrid = { workspace = true, optional = true }
3234

3335
tokio = { workspace = true, features = ["rt", "rt-multi-thread"] }
3436
reqwest = { workspace = true }

apps/readme/src/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ mod markdown {
1919
use anyrender_vello::VelloWindowRenderer as WindowRenderer;
2020
#[cfg(feature = "cpu-base")]
2121
use anyrender_vello_cpu::VelloCpuWindowRenderer as WindowRenderer;
22+
#[cfg(feature = "hybrid")]
23+
use anyrender_vello_hybrid::VelloHybridWindowRenderer as WindowRenderer;
2224

2325
use blitz_dom::DocumentConfig;
2426
use blitz_dom::net::Resource;

examples/todomvc/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ publish = false
88
[features]
99
default = ["gpu"]
1010
gpu = ["mini-dxn/gpu"]
11+
hybrid = ["mini-dxn/hybrid"]
1112
cpu = ["cpu-pixels"]
1213
cpu-pixels = ["mini-dxn/cpu-pixels"]
1314
cpu-softbuffer = ["mini-dxn/cpu-softbuffer"]

justfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ incr *ARGS:
2525
cpu *ARGS:
2626
cargo run --release --package readme --no-default-features --features cpu,comrak,incremental,log_frame_times,log_phase_times {{ARGS}}
2727

28+
hybrid *ARGS:
29+
cargo run --release --package readme --no-default-features --features hybrid,comrak,incremental,log_frame_times,log_phase_times {{ARGS}}
30+
2831
bump *ARGS:
2932
cargo run --release --package bump {{ARGS}}
3033

packages/mini-dxn/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ tracing = ["dep:tracing", "blitz-shell/tracing", "blitz-dom/tracing"]
2525
incremental = ["blitz-dom/incremental"]
2626
hot-reload = ["dep:dioxus-cli-config", "dep:dioxus-devtools"]
2727
gpu = ["dep:anyrender_vello", "dep:wgpu"]
28+
hybrid = ["dep:anyrender_vello_hybrid"]
2829
cpu = ["cpu-pixels"]
2930
cpu-pixels = ["cpu-base", "anyrender_vello_cpu/pixels_window_renderer"]
3031
cpu-softbuffer = ["cpu-base", "anyrender_vello_cpu/softbuffer_window_renderer"]
@@ -36,6 +37,7 @@ log_phase_times = ["blitz-dom/log_phase_times"]
3637
# Blitz dependencies
3738
anyrender = { workspace = true }
3839
anyrender_vello = { workspace = true, optional = true }
40+
anyrender_vello_hybrid = { workspace = true, optional = true }
3941
anyrender_vello_cpu = { workspace = true, features = ["multithreading"], optional = true }
4042
blitz-paint = { workspace = true }
4143
blitz-dom = { workspace = true, features = ["parallel-construct"] }

packages/mini-dxn/src/dioxus_renderer.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ pub use anyrender_vello::{
1313
#[cfg(feature = "cpu-base")]
1414
use anyrender_vello_cpu::VelloCpuWindowRenderer as InnerRenderer;
1515

16+
#[cfg(feature = "hybrid")]
17+
use anyrender_vello_hybrid::VelloHybridWindowRenderer as InnerRenderer;
18+
1619
#[cfg(feature = "gpu")]
1720
pub fn use_wgpu<T: CustomPaintSource>(create_source: impl FnOnce() -> T) -> u64 {
1821
use dioxus_core::{consume_context, use_hook_with_cleanup};

packages/mini-dxn/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ pub fn launch_cfg(
100100
// Create the renderer
101101
#[cfg(feature = "gpu")]
102102
let renderer = DxnWindowRenderer::with_features_and_limits(features, limits);
103-
#[cfg(feature = "cpu-base")]
103+
#[cfg(any(feature = "cpu-base", feature = "hybrid"))]
104104
let renderer = DxnWindowRenderer::new();
105105

106106
// Spin up the virtualdom

0 commit comments

Comments
 (0)