From 84e559813a0c935bb64346e3f1b356ec3c67b512 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ram=C3=B3n=20Jim=C3=A9nez?= Date: Fri, 21 Nov 2025 02:02:40 +0100 Subject: [PATCH] Add `wgpu-bare` feature flag to disable default `wgpu` features Co-authored-by: dtzxporter Co-authored-by: Stefan Tammer --- Cargo.toml | 12 +++++++----- renderer/Cargo.toml | 3 ++- wgpu/Cargo.toml | 1 + widget/Cargo.toml | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7d2d6f3f..5701effd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,9 +23,11 @@ maintenance = { status = "actively-developed" } [features] default = ["wgpu", "tiny-skia", "crisp", "web-colors", "thread-pool", "linux-theme-detection"] -# Enables the `wgpu` GPU-accelerated renderer backend -wgpu = ["iced_renderer/wgpu", "iced_widget/wgpu"] -# Enables the `tiny-skia` software renderer backend +# Enables the `wgpu` GPU-accelerated renderer with all its default features (Vulkan, Metal, DX12, OpenGL, and WebGPU) +wgpu = ["wgpu-bare", "iced_renderer/wgpu"] +# Enables the `wgpu` GPU-accelerated renderer with the minimum required features (no backends!) +wgpu-bare = ["iced_renderer/wgpu-bare", "iced_widget/wgpu"] +# Enables the `tiny-skia` software renderer tiny-skia = ["iced_renderer/tiny-skia"] # Enables the `image` widget image = ["image-without-codecs", "image/default"] @@ -175,7 +177,7 @@ iced_selector = { version = "0.14.0-dev", path = "selector" } iced_test = { version = "0.14.0-dev", path = "test" } iced_tester = { version = "0.14.0-dev", path = "tester" } iced_tiny_skia = { version = "0.14.0-dev", path = "tiny_skia" } -iced_wgpu = { version = "0.14.0-dev", path = "wgpu" } +iced_wgpu = { version = "0.14.0-dev", path = "wgpu", default-features = false } iced_widget = { version = "0.14.0-dev", path = "widget" } iced_winit = { version = "0.14.0-dev", path = "winit" } @@ -227,7 +229,7 @@ wasm-bindgen-futures = "0.4" wasmtimer = "0.4.1" web-sys = "0.3.69" web-time = "1.1" -wgpu = "27.0" +wgpu = { version = "27.0", default-features = false, features = ["std", "wgsl"] } window_clipboard = "0.4.1" winit = { git = "https://github.com/iced-rs/winit.git", rev = "05b8ff17a06562f0a10bb46e6eaacbe2a95cb5ed" } diff --git a/renderer/Cargo.toml b/renderer/Cargo.toml index ac223f16..c95cae1b 100644 --- a/renderer/Cargo.toml +++ b/renderer/Cargo.toml @@ -14,7 +14,8 @@ keywords.workspace = true workspace = true [features] -wgpu = ["iced_wgpu"] +wgpu = ["iced_wgpu/default"] +wgpu-bare = ["iced_wgpu"] tiny-skia = ["iced_tiny_skia"] image = ["iced_tiny_skia?/image", "iced_wgpu?/image"] svg = ["iced_tiny_skia?/svg", "iced_wgpu?/svg"] diff --git a/wgpu/Cargo.toml b/wgpu/Cargo.toml index 7160421b..9995823b 100644 --- a/wgpu/Cargo.toml +++ b/wgpu/Cargo.toml @@ -18,6 +18,7 @@ rustdoc-args = ["--cfg", "docsrs"] all-features = true [features] +default = ["wgpu/default"] geometry = ["iced_graphics/geometry", "lyon"] image = ["iced_graphics/image"] svg = ["iced_graphics/svg", "resvg/text"] diff --git a/widget/Cargo.toml b/widget/Cargo.toml index dc64b61d..0769a34c 100644 --- a/widget/Cargo.toml +++ b/widget/Cargo.toml @@ -23,7 +23,7 @@ image = ["iced_renderer/image"] svg = ["iced_renderer/svg"] canvas = ["iced_renderer/geometry"] qr_code = ["canvas", "dep:qrcode"] -wgpu = ["iced_renderer/wgpu"] +wgpu = ["iced_renderer/wgpu-bare"] markdown = ["dep:pulldown-cmark", "dep:url"] highlighter = ["dep:iced_highlighter"] advanced = []