Reintroduce backend selection through ICED_BACKEND env var

This commit is contained in:
Héctor Ramón Jiménez 2024-03-24 08:04:28 +01:00
parent 441e9237cd
commit 4f5b63f1f4
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
8 changed files with 196 additions and 83 deletions

View file

@ -29,30 +29,6 @@ pub struct Settings {
pub antialiasing: Option<Antialiasing>,
}
impl Settings {
/// Creates new [`Settings`] using environment configuration.
///
/// Specifically:
///
/// - The `internal_backend` can be configured using the `WGPU_BACKEND`
/// environment variable. If the variable is not set, the primary backend
/// will be used. The following values are allowed:
/// - `vulkan`
/// - `metal`
/// - `dx12`
/// - `dx11`
/// - `gl`
/// - `webgpu`
/// - `primary`
pub fn from_env() -> Self {
Settings {
internal_backend: wgpu::util::backend_bits_from_env()
.unwrap_or(wgpu::Backends::all()),
..Self::default()
}
}
}
impl Default for Settings {
fn default() -> Settings {
Settings {