From 3a8e2348a5d18262a714ccfbcba115176848475c Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Wed, 24 Jan 2024 09:43:40 +0100 Subject: [PATCH] `egui-wgpu`: turn off the default features of `wgpu` (#3875) This makes all `wgpu` features opt-in for `egui-wgpu` users. For `eframe`, I opted to enable some `wgpu` features so users can still use `eframe` without having to also opt-in to extra ewgpu features (eframe is batteries-included). --- Cargo.lock | 20 -------------------- Cargo.toml | 2 +- crates/eframe/Cargo.toml | 7 ++++++- crates/egui-wgpu/Cargo.toml | 2 +- 4 files changed, 8 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0c85eaa68a9..f88634fd456 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1076,17 +1076,6 @@ dependencies = [ "env_logger", ] -[[package]] -name = "d3d12" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e3d747f100290a1ca24b752186f61f6637e1deffe3bf6320de6fcb29510a307" -dependencies = [ - "bitflags 2.4.0", - "libloading 0.8.0", - "winapi", -] - [[package]] name = "data-url" version = "0.3.1" @@ -2997,12 +2986,6 @@ dependencies = [ "getrandom", ] -[[package]] -name = "range-alloc" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8a99fddc9f0ba0a85884b8d14e3592853e787d581ca1816c91349b10e4eeab" - [[package]] name = "raw-window-handle" version = "0.5.2" @@ -4277,12 +4260,10 @@ dependencies = [ "android_system_properties", "arrayvec", "ash", - "bit-set", "bitflags 2.4.0", "block", "cfg_aliases", "core-graphics-types", - "d3d12", "glow", "glutin_wgl_sys", "gpu-alloc", @@ -4300,7 +4281,6 @@ dependencies = [ "once_cell", "parking_lot", "profiling", - "range-alloc", "raw-window-handle 0.6.0", "renderdoc-sys", "rustc-hash", diff --git a/Cargo.toml b/Cargo.toml index 67f0806ed81..993751bffdd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -53,7 +53,7 @@ glow = "0.13" puffin = "0.18" raw-window-handle = "0.6.0" thiserror = "1.0.37" -wgpu = { version = "0.19.1", features = [ +wgpu = { version = "0.19.1", default-features = false, features = [ # Make the renderer `Sync` even on wasm32, because it makes the code simpler: "fragile-send-sync-non-atomic-wasm", ] } diff --git a/crates/eframe/Cargo.toml b/crates/eframe/Cargo.toml index c3158ee4e10..6b2a6f32bb6 100644 --- a/crates/eframe/Cargo.toml +++ b/crates/eframe/Cargo.toml @@ -168,7 +168,12 @@ pollster = { version = "0.3", optional = true } # needed for wgpu glutin = { version = "0.31", optional = true } glutin-winit = { version = "0.4", optional = true } puffin = { workspace = true, optional = true } -wgpu = { workspace = true, optional = true } +wgpu = { workspace = true, optional = true, features = [ + # Let's enable some backends so that users can use `eframe` out-of-the-box + # without having to explicitly opt-in to backends + "metal", + "webgpu", +] } # mac: [target.'cfg(any(target_os = "macos"))'.dependencies] diff --git a/crates/egui-wgpu/Cargo.toml b/crates/egui-wgpu/Cargo.toml index 5b86dc09127..c598669eb2a 100644 --- a/crates/egui-wgpu/Cargo.toml +++ b/crates/egui-wgpu/Cargo.toml @@ -45,7 +45,7 @@ bytemuck = "1.7" log = { version = "0.4", features = ["std"] } thiserror.workspace = true type-map = "0.5.0" -wgpu.workspace = true +wgpu = { workspace = true, features = ["wgsl"] } #! ### Optional dependencies ## Enable this when generating docs.