ComputeSharp.Graphics project switched to Vortice.Windows
このコミットが含まれているのは:
1 親
1f312787ac
コミット
07b3608fe0
13ファイル変更
+103
-108
検索条件に一致するファイルはありません
@@ -1,7 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using SharpDX.DXGI;
|
||||
using Device = SharpDX.Direct3D12.Device;
|
||||
using Vortice.DirectX.Direct3D;
|
||||
using Vortice.DirectX.Direct3D12;
|
||||
using Vortice.DirectX.DXGI;
|
||||
|
||||
namespace ComputeSharp.Graphics.Helpers
|
||||
{
|
||||
@@ -13,28 +14,29 @@ namespace ComputeSharp.Graphics.Helpers
|
||||
/// <summary>
|
||||
/// Gets a collection of all the supported devices on the current machine
|
||||
/// </summary>
|
||||
/// <returns>The collection of <see cref="Device"/> objects with support for DX12.1</returns>
|
||||
/// <returns>The collection of <see cref="ID3D12Device"/> objects with support for DX12.1</returns>
|
||||
[Pure]
|
||||
public static IReadOnlyList<(Device, AdapterDescription)> QueryAllSupportedDevices()
|
||||
public static IReadOnlyList<(ID3D12Device, AdapterDescription)> QueryAllSupportedDevices()
|
||||
{
|
||||
using Factory factory = new Factory1();
|
||||
List<(Device, AdapterDescription)> devices = new List<(Device, AdapterDescription)>();
|
||||
|
||||
foreach (Adapter adapter in factory.Adapters)
|
||||
if (!DXGI.CreateDXGIFactory1(out IDXGIFactory1 factory).Success) return new (ID3D12Device, AdapterDescription)[0];
|
||||
try
|
||||
{
|
||||
if (adapter.Description.DedicatedVideoMemory == 0) continue;
|
||||
try
|
||||
{
|
||||
Device device = new Device(adapter, GraphicsDevice.FeatureLevel);
|
||||
devices.Add((device, adapter.Description));
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Unsupported device
|
||||
}
|
||||
}
|
||||
List<(ID3D12Device, AdapterDescription)> devices = new List<(ID3D12Device, AdapterDescription)>();
|
||||
|
||||
return devices;
|
||||
foreach (IDXGIAdapter1 adapter in factory.EnumAdapters1())
|
||||
{
|
||||
if (adapter.Description.DedicatedVideoMemory == 0) continue;
|
||||
if (D3D12.D3D12CreateDevice(adapter, FeatureLevel.Level_12_1, out ID3D12Device device).Success)
|
||||
devices.Add((device, adapter.Description));
|
||||
}
|
||||
|
||||
return devices;
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Explicit using statement
|
||||
factory?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする