`eframe`: If both `glow` and `wgpu` features are enabled, default to `wgpu` (#3717)

By default, only the `glow` feature is enabled, so if the user added
`wgpu` to the feature list they probably wanted to use `wgpu`.
This commit is contained in:
Emil Ernerfeldt 2023-12-19 09:51:05 +01:00 committed by GitHub
parent 4a2cafee7c
commit 9253cafedd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 3 deletions

View File

@ -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;
}
}