From d584105943873bc221a470220e83742fc8dfdca8 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Wed, 26 Feb 2020 16:35:31 +0100 Subject: [PATCH] [rs] Expose `enumerate_adapters`. --- wgpu/src/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index 6852e0094d..a2ef9e5ba2 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -522,6 +522,14 @@ impl Surface { } impl Adapter { + /// Retrieves all available [`Adapter`]s that match the given backends. + pub fn enumerate(backends: BackendBit) -> Vec { + wgn::wgpu_enumerate_adapters(backends) + .into_iter() + .map(|id| Adapter { id }) + .collect() + } + /// Retrieves an [`Adapter`] which matches the given options. /// /// Some options are "soft", so treated as non-mandatory. Others are "hard".