Tweaked default GPU device retrieval logic

このコミットが含まれているのは:
Sergio Pedri committed 2021-02-24 02:28:06 +01:00
1 親 ada133aacd
コミット f9f7b4c626
3ファイル変更
+20 -12

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

+5 -1
ファイルの表示
@@ -159,7 +159,11 @@ namespace ComputeSharp.Graphics.Helpers
dxgiAdapter1.Get()->GetDesc1(&dxgiDescription1).Assert();
if (dxgiDescription1.DedicatedVideoMemory == 0) continue;
if (dxgiDescription1.VendorId == MicrosoftVendorId &&
dxgiDescription1.DeviceId == WarpDeviceId)
{
continue;
}
HRESULT createDeviceResult = FX.D3D12CreateDevice(
dxgiAdapter1.AsIUnknown().Get(),
+15 -1
ファイルの表示
@@ -14,6 +14,16 @@ namespace ComputeSharp.Graphics.Helpers
/// </summary>
internal static partial class DeviceHelper
{
/// <summary>
/// The vendor id for Microsoft adapters (the "Microsoft Basic Render").
/// </summary>
private const uint MicrosoftVendorId = 0x1414;
/// <summary>
/// The device id for the WARP device.
/// </summary>
private const uint WarpDeviceId = 0x8C;
/// <summary>
/// Gets whether or not there is a default device available, without creating it.
/// </summary>
@@ -92,7 +102,11 @@ namespace ComputeSharp.Graphics.Helpers
dxgiAdapter1.Get()->GetDesc1(dxgiDescription1).Assert();
if (dxgiDescription1->DedicatedVideoMemory == 0) continue;
if (dxgiDescription1->VendorId == MicrosoftVendorId &&
dxgiDescription1->DeviceId == WarpDeviceId)
{
continue;
}
HRESULT createDeviceResult = FX.D3D12CreateDevice(
dxgiAdapter1.AsIUnknown().Get(),
-10
ファイルの表示
@@ -24,16 +24,6 @@ namespace ComputeSharp.Tests
Assert.IsTrue(gpu.Luid != default);
Assert.IsTrue(gpu.Name is { Length: > 0 });
if (gpu.IsHardwareAccelerated)
{
Assert.IsTrue(gpu.DedicatedMemorySize != 0);
}
else
{
Assert.IsTrue(gpu.SharedMemorySize != 0);
}
Assert.IsTrue(gpu.ComputeUnits != 0);
Assert.IsTrue(gpu.WavefrontSize != 0);
}