diff options
author | 2024-09-20 00:39:21 +0200 | |
---|---|---|
committer | 2024-09-20 00:59:45 +0200 | |
commit | 84b658dbef0b29c57f67e041a1496c699ce78615 (patch) | |
tree | 90a35a189a431adaff0d7121f12fbdf268083c67 | |
parent | a5e69cfb5f7856e4d139ef58e5d022b9d408b542 (diff) | |
download | iced-84b658dbef0b29c57f67e041a1496c699ce78615.tar.gz iced-84b658dbef0b29c57f67e041a1496c699ce78615.tar.bz2 iced-84b658dbef0b29c57f67e041a1496c699ce78615.zip |
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.
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | renderer/Cargo.toml | 1 | ||||
-rw-r--r-- | wgpu/Cargo.toml | 1 | ||||
-rw-r--r-- | wgpu/src/window/compositor.rs | 5 |
4 files changed, 9 insertions, 0 deletions
@@ -65,6 +65,8 @@ advanced = ["iced_core/advanced", "iced_widget/advanced"] fira-sans = ["iced_renderer/fira-sans"] # Enables auto-detecting light/dark mode for the built-in theme auto-detect-theme = ["iced_core/auto-detect-theme"] +# Enables strict assertions for debugging purposes at the expense of performance +strict-assertions = ["iced_renderer/strict-assertions"] [dependencies] iced_core.workspace = true diff --git a/renderer/Cargo.toml b/renderer/Cargo.toml index 458681dd..ac223f16 100644 --- a/renderer/Cargo.toml +++ b/renderer/Cargo.toml @@ -22,6 +22,7 @@ geometry = ["iced_graphics/geometry", "iced_tiny_skia?/geometry", "iced_wgpu?/ge web-colors = ["iced_wgpu?/web-colors"] webgl = ["iced_wgpu?/webgl"] fira-sans = ["iced_graphics/fira-sans"] +strict-assertions = ["iced_wgpu?/strict-assertions"] [dependencies] iced_graphics.workspace = true diff --git a/wgpu/Cargo.toml b/wgpu/Cargo.toml index b13ecb36..a8ebf3aa 100644 --- a/wgpu/Cargo.toml +++ b/wgpu/Cargo.toml @@ -23,6 +23,7 @@ image = ["iced_graphics/image"] svg = ["iced_graphics/svg", "resvg/text"] web-colors = ["iced_graphics/web-colors"] webgl = ["wgpu/webgl"] +strict-assertions = [] [dependencies] iced_graphics.workspace = true diff --git a/wgpu/src/window/compositor.rs b/wgpu/src/window/compositor.rs index 0cfd49b7..56f33b50 100644 --- a/wgpu/src/window/compositor.rs +++ b/wgpu/src/window/compositor.rs @@ -56,6 +56,11 @@ impl Compositor { ) -> Result<Self, Error> { let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { backends: settings.backends, + flags: if cfg!(feature = "strict-assertions") { + wgpu::InstanceFlags::debugging() + } else { + wgpu::InstanceFlags::empty() + }, ..Default::default() }); |