From 84b658dbef0b29c57f67e041a1496c699ce78615 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Fri, 20 Sep 2024 00:39:21 +0200 Subject: 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. --- wgpu/Cargo.toml | 1 + wgpu/src/window/compositor.rs | 5 +++++ 2 files changed, 6 insertions(+) (limited to 'wgpu') 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 { 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() }); -- cgit