diff --git a/src/ComputeSharp/Gpu.cs b/src/ComputeSharp/Gpu.cs
index a1dd8483..61314832 100644
--- a/src/ComputeSharp/Gpu.cs
+++ b/src/ComputeSharp/Gpu.cs
@@ -10,11 +10,6 @@ namespace ComputeSharp
///
public static class Gpu
{
- ///
- /// The instance used to produce the default device for .
- ///
- private static readonly Lazy DefaultFactory = new(DeviceHelper.GetDefaultDevice);
-
///
/// Gets the default instance for the current machine.
/// This instance cannot be manually disposed - attempting to do so is safe and it will
@@ -25,7 +20,7 @@ namespace ComputeSharp
/// or integrated GPU in the system in use. In that case, the WARP device will be used.
/// For more info, see .
///
- public static GraphicsDevice Default => DefaultFactory.Value;
+ public static GraphicsDevice Default => DeviceHelper.DefaultFactory.Value;
///
/// Enumerates all the currently available devices supporting the minimum necessary feature level.
diff --git a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.cs b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.cs
index 1a1b6e86..8837c23c 100644
--- a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.cs
+++ b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.cs
@@ -27,6 +27,11 @@ namespace ComputeSharp.Graphics.Helpers
///
private const uint WarpDeviceId = 0x8C;
+ ///
+ /// The instance used to produce the default instance.
+ ///
+ public static readonly Lazy DefaultFactory = new(GetDefaultDevice);
+
///
/// Gets the of the default device.
///
@@ -35,6 +40,11 @@ namespace ComputeSharp.Graphics.Helpers
[Pure]
public static unsafe Luid GetDefaultDeviceLuid()
{
+ if (DefaultFactory.IsValueCreated)
+ {
+ return DefaultFactory.Value.Luid;
+ }
+
DXGI_ADAPTER_DESC1 dxgiDescription1;
_ = TryGetDefaultDevice(null, null, &dxgiDescription1) || TryGetWarpDevice(null, null, &dxgiDescription1);
@@ -47,7 +57,7 @@ namespace ComputeSharp.Graphics.Helpers
///
/// The default instance supporting and .
/// Thrown when a default device is not available.
- public static unsafe GraphicsDevice GetDefaultDevice()
+ private static unsafe GraphicsDevice GetDefaultDevice()
{
using ComPtr d3D12Device = default;
using ComPtr dxgiAdapter = default;