From 1ee9d80ba7aead6e4516d52ecf23f506b8df01c0 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Wed, 18 Nov 2020 13:36:01 +0100 Subject: [PATCH] Added Gpu.EnumerateDevices API --- src/ComputeSharp/Gpu.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/ComputeSharp/Gpu.cs b/src/ComputeSharp/Gpu.cs index 220a0916..1e3610b2 100644 --- a/src/ComputeSharp/Gpu.cs +++ b/src/ComputeSharp/Gpu.cs @@ -29,6 +29,18 @@ namespace ComputeSharp /// Make sure to check before accessing this property. public static GraphicsDevice Default => DefaultFactory.Value; + /// + /// Enumerates all the currently available DX12.0 devices. Note that creating a device is a relatively + /// expensive operation, so consider using to be able to filter the available + /// devices before creating them, to reduce the system overhead and avoiding creating unnecessary devices. + /// + /// A sequence of instances. + [Pure] + public static IEnumerable EnumerateDevices() + { + return new DeviceHelper.DeviceQuery(static _ => true); + } + /// /// Executes a query on the currently available DX12.0 devices matching a given predicate. ///