Added ThrowHelper type
このコミットが含まれているのは:
1 親
0c3f8f92c3
コミット
3d48a6fb0c
11ファイル変更
+125
-27
検索条件に一致するファイルはありません
@@ -14,6 +14,7 @@ using static TerraFX.Interop.D3D12_HEAP_TYPE;
|
||||
using static TerraFX.Interop.D3D12_RESOURCE_FLAGS;
|
||||
using static TerraFX.Interop.D3D12_RESOURCE_STATES;
|
||||
using FX = TerraFX.Interop.Windows;
|
||||
using ComputeSharp.Core.Helpers;
|
||||
|
||||
namespace ComputeSharp.Graphics.Extensions
|
||||
{
|
||||
@@ -116,7 +117,7 @@ namespace ComputeSharp.Graphics.Extensions
|
||||
BufferType.ReadWrite => (D3D12_HEAP_TYPE_DEFAULT, D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_COMMON),
|
||||
BufferType.ReadBack => (D3D12_HEAP_TYPE_READBACK, D3D12_RESOURCE_FLAG_NONE, D3D12_RESOURCE_STATE_COPY_DEST),
|
||||
BufferType.Upload => (D3D12_HEAP_TYPE_UPLOAD, D3D12_RESOURCE_FLAG_NONE, D3D12_RESOURCE_STATE_GENERIC_READ),
|
||||
_ => throw null!
|
||||
_ => ThrowHelper.ThrowArgumentException<(D3D12_HEAP_TYPE, D3D12_RESOURCE_FLAGS, D3D12_RESOURCE_STATES)>()
|
||||
};
|
||||
|
||||
using ComPtr<ID3D12Resource> d3D12Resource = default;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using ComputeSharp.Core.Interop;
|
||||
using ComputeSharp.Core.Helpers;
|
||||
using ComputeSharp.Core.Interop;
|
||||
using ComputeSharp.Graphics.Commands;
|
||||
using ComputeSharp.Graphics.Extensions;
|
||||
using ComputeSharp.Graphics.Helpers;
|
||||
@@ -137,7 +138,7 @@ namespace ComputeSharp.Graphics
|
||||
{
|
||||
D3D12_COMMAND_LIST_TYPE_COMPUTE => this.computeCommandAllocatorPool.GetCommandAllocator(this.d3D12Device, this.d3D12ComputeFence),
|
||||
D3D12_COMMAND_LIST_TYPE_COPY => this.copyCommandAllocatorPool.GetCommandAllocator(this.d3D12Device, this.d3D12CopyFence),
|
||||
_ => throw null!
|
||||
_ => ThrowHelper.ThrowArgumentException<ComPtr<ID3D12CommandAllocator>>()
|
||||
};
|
||||
}
|
||||
|
||||
@@ -178,7 +179,7 @@ namespace ComputeSharp.Graphics
|
||||
d3D12Fence = this.d3D12CopyFence;
|
||||
d3D12FenceValue = this.nextD3D12CopyFenceValue++;
|
||||
break;
|
||||
default: throw null!;
|
||||
default: ThrowHelper.ThrowArgumentException(); return;
|
||||
}
|
||||
|
||||
// Execute the command list and signal to the target fence
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.Contracts;
|
||||
using ComputeSharp.Core.Helpers;
|
||||
using TerraFX.Interop;
|
||||
using FX = TerraFX.Interop.Windows;
|
||||
using HRESULT = System.Int32;
|
||||
@@ -40,12 +41,7 @@ namespace ComputeSharp.Graphics.Helpers
|
||||
return new GraphicsDevice(d3d12device.Move(), &dxgiDescription1);
|
||||
}
|
||||
|
||||
static GraphicsDevice Throw()
|
||||
{
|
||||
throw new NotSupportedException("There isn't a supported GPU device on the current machine");
|
||||
}
|
||||
|
||||
return Throw();
|
||||
return ThrowHelper.ThrowNotSupportedException<GraphicsDevice>("There isn't a supported GPU device on the current machine");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする