diff --git a/CHANGELOG.md b/CHANGELOG.md index 367acb563a..92ee4deddc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,7 @@ Bottom level categories: #### Misc Breaking Changes - Change `AdapterInfo::{device,vendor}` to be `u32` instead of `usize`. By @ameknite in [#3760](https://github.com/gfx-rs/wgpu/pull/3760) +- Remove the `backend_bits` parameter in `initialize_adapter_from_env` and `initialize_adapter_from_env_or_default` - use [InstanceDescriptor::backends](https://docs.rs/wgpu/latest/wgpu/struct.InstanceDescriptor.html#structfield.backends) instead. By @fornwall in [#3904](https://github.com/gfx-rs/wgpu/pull/3904) #### DX12 diff --git a/examples/common/src/framework.rs b/examples/common/src/framework.rs index 27b76bf86b..af8a3b963b 100644 --- a/examples/common/src/framework.rs +++ b/examples/common/src/framework.rs @@ -180,10 +180,9 @@ async fn setup(title: &str) -> Setup { (size, surface) }; - let adapter = - wgpu::util::initialize_adapter_from_env_or_default(&instance, backends, Some(&surface)) - .await - .expect("No suitable GPU adapters found on the system!"); + let adapter = wgpu::util::initialize_adapter_from_env_or_default(&instance, Some(&surface)) + .await + .expect("No suitable GPU adapters found on the system!"); #[cfg(not(target_arch = "wasm32"))] { diff --git a/tests/src/lib.rs b/tests/src/lib.rs index b8a0fb2443..401e4cd273 100644 --- a/tests/src/lib.rs +++ b/tests/src/lib.rs @@ -392,7 +392,6 @@ fn initialize_adapter() -> (Adapter, SurfaceGuard) { let compatible_surface: Option<&Surface> = compatible_surface.as_ref(); let adapter = pollster::block_on(wgpu::util::initialize_adapter_from_env_or_default( &instance, - backends, compatible_surface, )) .expect("could not find suitable adapter on the system"); diff --git a/wgpu/src/util/init.rs b/wgpu/src/util/init.rs index d5c7c6ad47..e47a08a304 100644 --- a/wgpu/src/util/init.rs +++ b/wgpu/src/util/init.rs @@ -37,13 +37,13 @@ pub fn power_preference_from_env() -> Option { /// Initialize the adapter obeying the WGPU_ADAPTER_NAME environment variable. #[cfg(not(target_arch = "wasm32"))] -pub fn initialize_adapter_from_env(instance: &Instance, backend_bits: Backends) -> Option { +pub fn initialize_adapter_from_env(instance: &Instance) -> Option { let desired_adapter_name = std::env::var("WGPU_ADAPTER_NAME") .as_deref() .map(str::to_lowercase) .ok()?; - let adapters = instance.enumerate_adapters(backend_bits); + let adapters = instance.enumerate_adapters(Backends::all()); let mut chosen_adapter = None; for adapter in adapters { @@ -60,20 +60,16 @@ pub fn initialize_adapter_from_env(instance: &Instance, backend_bits: Backends) /// Initialize the adapter obeying the WGPU_ADAPTER_NAME environment variable. #[cfg(target_arch = "wasm32")] -pub fn initialize_adapter_from_env( - _instance: &Instance, - _backend_bits: Backends, -) -> Option { +pub fn initialize_adapter_from_env(_instance: &Instance) -> Option { None } /// Initialize the adapter obeying the WGPU_ADAPTER_NAME environment variable and if it doesn't exist fall back on a default adapter. pub async fn initialize_adapter_from_env_or_default( instance: &Instance, - backend_bits: wgt::Backends, compatible_surface: Option<&Surface>, ) -> Option { - match initialize_adapter_from_env(instance, backend_bits) { + match initialize_adapter_from_env(instance) { Some(a) => Some(a), None => { instance