From ba388f16402d97e4f78490e824bc5bd4346ea2dc Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Tue, 19 Dec 2023 09:40:23 +0100 Subject: [PATCH] If both `glow` and `wgpu` features are enabled, default to `wgpu` --- crates/eframe/src/epi.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/crates/eframe/src/epi.rs b/crates/eframe/src/epi.rs index 3d9867a6323..115235cd34a 100644 --- a/crates/eframe/src/epi.rs +++ b/crates/eframe/src/epi.rs @@ -526,16 +526,23 @@ pub enum Renderer { #[cfg(any(feature = "glow", feature = "wgpu"))] impl Default for Renderer { fn default() -> Self { + #[cfg(not(feature = "glow"))] + #[cfg(not(feature = "wgpu"))] + compile_error!("eframe: you must enable at least one of the rendering backend features: 'glow' or 'wgpu'"); + #[cfg(feature = "glow")] + #[cfg(not(feature = "wgpu"))] return Self::Glow; #[cfg(not(feature = "glow"))] #[cfg(feature = "wgpu")] return Self::Wgpu; - #[cfg(not(feature = "glow"))] - #[cfg(not(feature = "wgpu"))] - compile_error!("eframe: you must enable at least one of the rendering backend features: 'glow' or 'wgpu'"); + // By default, only the `glow` feature is enabled, so if the user added `wgpu` to the feature list + // they probably wanted to use wgpu: + #[cfg(feature = "glow")] + #[cfg(feature = "wgpu")] + return Self::Wgpu; } }