Removed Gpu.IsSupported property
このコミットが含まれているのは:
1 親
dc1a23a447
コミット
c80a558162
3ファイル変更
+7
-22
検索条件に一致するファイルはありません
@@ -15,19 +15,16 @@ namespace ComputeSharp
|
||||
/// </summary>
|
||||
private static readonly Lazy<GraphicsDevice> DefaultFactory = new(DeviceHelper.GetDefaultDevice);
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether or not the <see cref="Gpu"/> APIs can be used on the
|
||||
/// current machine (ie. if there is at least a supported GPU device).
|
||||
/// </summary>
|
||||
public static bool IsSupported => DeviceHelper.IsDefaultDeviceAvailable();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default <see cref="GraphicsDevice"/> instance for the current machine.
|
||||
/// This instance cannot be manually disposed - attempting to do so is safe and it will
|
||||
/// not cause an exception, but it will simply do nothing and not dispose the device.
|
||||
/// </summary>
|
||||
/// <exception cref="NotSupportedException">Thrown when a default device is not available.</exception>
|
||||
/// <remarks>Make sure to check <see cref="IsSupported"/> before accessing this property.</remarks>
|
||||
/// <remarks>
|
||||
/// This device will always be available, even when there isn't a compatible physical GPU
|
||||
/// or integrated GPU in the system in use. In that case, the WARP device will be used.
|
||||
/// For more info, see <see href="https://docs.microsoft.com/windows/win32/direct3darticles/directx-warp"/>.
|
||||
/// </remarks>
|
||||
public static GraphicsDevice Default => DefaultFactory.Value;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -24,18 +24,6 @@ namespace ComputeSharp.Graphics.Helpers
|
||||
/// </summary>
|
||||
private const uint WarpDeviceId = 0x8C;
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether or not there is a default device available, without creating it.
|
||||
/// </summary>
|
||||
/// <returns>Whether or not there is a device supporting at least DX12.0.</returns>
|
||||
[Pure]
|
||||
public static unsafe bool IsDefaultDeviceAvailable()
|
||||
{
|
||||
DXGI_ADAPTER_DESC1 dxgiDescription1;
|
||||
|
||||
return TryGetDefaultDevice(null, null, &dxgiDescription1) || TryGetWarpDevice(null, null, &dxgiDescription1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="Luid"/> of the default device.
|
||||
/// </summary>
|
||||
@@ -69,7 +57,7 @@ namespace ComputeSharp.Graphics.Helpers
|
||||
return GetOrCreateDevice(d3D12Device.Get(), dxgiAdapter.Get(), &dxgiDescription1);
|
||||
}
|
||||
|
||||
return ThrowHelper.ThrowNotSupportedException<GraphicsDevice>("There isn't a supported GPU device on the current machine");
|
||||
return ThrowHelper.ThrowNotSupportedException<GraphicsDevice>("Failed to retrieve the default device.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace ComputeSharp.Tests
|
||||
[TestMethod]
|
||||
public void IsSupported()
|
||||
{
|
||||
Assert.IsTrue(Gpu.IsSupported);
|
||||
Assert.IsTrue(Gpu.Default is not null);
|
||||
}
|
||||
|
||||
[CombinatorialTestMethod]
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする