Unified fallback device initialization

このコミットが含まれているのは:
Sergio Pedri committed 2021-01-02 17:28:46 +01:00
1 親 f0e1a6ded7
コミット 606faa70c9
3ファイル変更
+4 -88

検索条件に一致するファイルはありません

+4 -22
ファイルの表示
@@ -23,7 +23,7 @@ namespace ComputeSharp.Graphics.Helpers
{
DXGI_ADAPTER_DESC1 dxgiDescription1;
return TryGetDefaultDevice(null, &dxgiDescription1);
return TryGetDefaultDevice(null, &dxgiDescription1) || TryGetWarpDevice(null, &dxgiDescription1);
}
/// <summary>
@@ -36,7 +36,7 @@ namespace ComputeSharp.Graphics.Helpers
{
DXGI_ADAPTER_DESC1 dxgiDescription1;
_ = TryGetDefaultDevice(null, &dxgiDescription1);
_ = TryGetDefaultDevice(null, &dxgiDescription1) || TryGetWarpDevice(null, &dxgiDescription1);
return Luid.FromLUID(dxgiDescription1.AdapterLuid);
}
@@ -52,7 +52,8 @@ namespace ComputeSharp.Graphics.Helpers
DXGI_ADAPTER_DESC1 dxgiDescription1;
if (TryGetDefaultDevice(d3D12Device.GetAddressOf(), &dxgiDescription1))
if (TryGetDefaultDevice(d3D12Device.GetAddressOf(), &dxgiDescription1) ||
TryGetWarpDevice(d3D12Device.GetAddressOf(), &dxgiDescription1))
{
return GetOrCreateDevice(d3D12Device.Move(), &dxgiDescription1);
}
@@ -60,25 +61,6 @@ namespace ComputeSharp.Graphics.Helpers
return ThrowHelper.ThrowNotSupportedException<GraphicsDevice>("There isn't a supported GPU device on the current machine");
}
/// <summary>
/// Gets the warp <see cref="GraphicsDevice"/> instance.
/// </summary>
/// <returns>The default <see cref="GraphicsDevice"/> instance supporting at least DX12.0.</returns>
/// <exception cref="NotSupportedException">Thrown when a default device is not available.</exception>
public static unsafe GraphicsDevice GetWarpDevice()
{
using ComPtr<ID3D12Device> d3D12Device = default;
DXGI_ADAPTER_DESC1 dxgiDescription1;
if (TryGetWarpDevice(d3D12Device.GetAddressOf(), &dxgiDescription1))
{
return GetOrCreateDevice(d3D12Device.Move(), &dxgiDescription1);
}
return ThrowHelper.ThrowNotSupportedException<GraphicsDevice>("There isn't a supported device on the current machine");
}
/// <summary>
/// Tries to check or create a default <see cref="ID3D12Device"/> object.
/// </summary>