summaryrefslogtreecommitdiffstats
path: root/wgpu
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-09-20 00:39:21 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-09-20 00:59:45 +0200
commit84b658dbef0b29c57f67e041a1496c699ce78615 (patch)
tree90a35a189a431adaff0d7121f12fbdf268083c67 /wgpu
parenta5e69cfb5f7856e4d139ef58e5d022b9d408b542 (diff)
downloadiced-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.
Diffstat (limited to 'wgpu')
-rw-r--r--wgpu/Cargo.toml1
-rw-r--r--wgpu/src/window/compositor.rs5
2 files changed, 6 insertions, 0 deletions
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()
});