Skip to content

Commit 82add34

Browse files
committed
Introduce strict-assertions feature flag
For now, this feature flag only enables validation in `iced_wgpu`; which has become quite expensive since its `0.20` release.
1 parent a5e69cf commit 82add34

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ advanced = ["iced_core/advanced", "iced_widget/advanced"]
6565
fira-sans = ["iced_renderer/fira-sans"]
6666
# Enables auto-detecting light/dark mode for the built-in theme
6767
auto-detect-theme = ["iced_core/auto-detect-theme"]
68+
# Enables strict assertions for debugging purposes at the expense of performance
69+
strict-assertions = ["iced_wgpu/strict-assertions"]
6870

6971
[dependencies]
7072
iced_core.workspace = true

wgpu/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ image = ["iced_graphics/image"]
2323
svg = ["iced_graphics/svg", "resvg/text"]
2424
web-colors = ["iced_graphics/web-colors"]
2525
webgl = ["wgpu/webgl"]
26+
strict-assertions = []
2627

2728
[dependencies]
2829
iced_graphics.workspace = true

wgpu/src/window/compositor.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ impl Compositor {
5656
) -> Result<Self, Error> {
5757
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
5858
backends: settings.backends,
59+
flags: if cfg!(feature = "strict-assertions") {
60+
wgpu::InstanceFlags::debugging()
61+
} else {
62+
wgpu::InstanceFlags::empty()
63+
},
5964
..Default::default()
6065
});
6166

0 commit comments

Comments
 (0)