Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -252,15 +252,18 @@ jobs:
with:
node-version: 24
cache: npm
- run: sudo apt-get update && sudo apt-get install -y --no-install-recommends libjavascriptcoregtk-4.1-dev pkg-config libssl-dev
- run: sudo apt-get update && sudo apt-get install -y --no-install-recommends libjavascriptcoregtk-4.1-dev pkg-config libssl-dev libwayland-dev
- run: npm ci
- uses: ./.github/actions/cargo-cache
with:
workspaces: |
runtime
webgpu
webgpu/wallpaper
- run: cd runtime && cargo test --release --locked
- run: cd webgpu && cargo test --release --locked
# The Omarchy wallpaper host (webgpu/wallpaper, its own workspace; Wayland, so Linux only): it compiles.
- run: cd webgpu/wallpaper && cargo check --locked
- run: node tools/build.ts --renderer webgpu
- run: node tools/check-webgpu-gate.ts --render

Expand Down
21 changes: 18 additions & 3 deletions webgpu/src/gpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,27 @@ pub struct Gpu {
}

/// Options for [`crate::init`].
#[derive(Clone, Debug, Default)]
#[derive(Clone, Debug)]
pub struct GpuOptions {
/// Extra wgpu features the host's own renderers need (requested only if the adapter has them).
pub extra_features: wgpu::Features,
/// `wgpu::InstanceFlags` debug/validation (default: off; `THREERT_WGPU_DEBUG=1` turns it on).
pub debug: bool,
/// Adapter power preference (`HighPerformance` by default; `LowPower` for ambient/wallpaper hosts).
pub power_preference: wgpu::PowerPreference,
/// Memory allocation hint (`Performance` by default; `MemoryUsage` for low-footprint hosts).
pub memory_hints: wgpu::MemoryHints,
}

impl Default for GpuOptions {
fn default() -> Self {
Self {
extra_features: wgpu::Features::empty(),
debug: false,
power_preference: wgpu::PowerPreference::HighPerformance,
memory_hints: wgpu::MemoryHints::Performance,
}
}
}

static GPU: OnceLock<Gpu> = OnceLock::new();
Expand All @@ -39,7 +54,7 @@ pub fn init(opts: &GpuOptions) -> Result<&'static Gpu, String> {
..Default::default()
});
let adapter = pollster::block_on(instance.request_adapter(&wgpu::RequestAdapterOptions {
power_preference: wgpu::PowerPreference::HighPerformance,
power_preference: opts.power_preference,
force_fallback_adapter: false,
compatible_surface: None,
}))
Expand All @@ -57,7 +72,7 @@ pub fn init(opts: &GpuOptions) -> Result<&'static Gpu, String> {
label: Some("threert-webgpu"),
required_features: want,
required_limits: adapter.limits(),
memory_hints: wgpu::MemoryHints::Performance,
memory_hints: opts.memory_hints.clone(),
trace: wgpu::Trace::Off,
}))
.map_err(|e| format!("request_device: {e}"))?;
Expand Down
2 changes: 2 additions & 0 deletions webgpu/wallpaper/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/target
/demo/assets/
Loading
Loading