Migrate ArgumentException/InvalidOperationException throw helpers

このコミットが含まれているのは:
Sergio Pedri committed 2023-02-25 18:00:08 +01:00
1 親 e27fb13a01
コミット fe41277fe7
13ファイル変更
+77 -51

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

+27 -1
ファイルの表示
@@ -8,6 +8,32 @@ namespace System;
/// </summary>
internal static class ArgumentExceptionExtensions
{
/// <summary>
/// Throws an <see cref="ArgumentException"/> for a given parameter name.
/// </summary>
/// <param name="_">Dummy value to invoke the extension upon (always pass <see langword="null"/>.</param>
/// <param name="parameterName">The name of the parameter to report in the exception.</param>
/// <exception cref="ArgumentException">Thrown with <paramref name="parameterName"/>.</exception>
[DoesNotReturn]
public static void Throw(this ArgumentException? _, string? parameterName)
{
throw new ArgumentException(null, parameterName);
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> for a given parameter name.
/// </summary>
/// <typeparam name="T">The type to let the compiler assume it returns.</typeparam>
/// <param name="_">Dummy value to invoke the extension upon (always pass <see langword="null"/>.</param>
/// <param name="parameterName">The name of the parameter to report in the exception.</param>
/// <returns>This method never returns any values.</returns>
/// <exception cref="ArgumentException">Thrown with <paramref name="parameterName"/>.</exception>
[DoesNotReturn]
public static T Throw<T>(this ArgumentException? _, string? parameterName)
{
throw new ArgumentException(null, parameterName);
}
/// <summary>
/// Throws an <see cref="ArgumentException"/> if <paramref name="condition"/> is <see langword="true"/>.
/// </summary>
@@ -31,6 +57,6 @@ internal static class ArgumentExceptionExtensions
[DoesNotReturn]
private static void Throw(string? parameterName)
{
throw new ArgumentException(parameterName);
throw new ArgumentException(null, parameterName);
}
}
+1 -4
ファイルの表示
@@ -1,7 +1,4 @@
using System;
#if !SOURCE_GENERATOR
using CommunityToolkit.Diagnostics;
#endif
namespace ComputeSharp;
@@ -64,7 +61,7 @@ public sealed class EmbeddedBytecodeAttribute : Attribute
DispatchAxis.XZ => (8, 1, 8),
DispatchAxis.YZ => (1, 8, 8),
DispatchAxis.XYZ => (4, 4, 4),
_ => ThrowHelper.ThrowArgumentException<(int, int, int)>(nameof(dispatchAxis), "Invalid dispatch axis value.")
_ => default(ArgumentException).Throw<(int, int, int)>(nameof(dispatchAxis))
};
#endif
}
+1 -2
ファイルの表示
@@ -1,6 +1,5 @@
using System;
using System.Text;
using CommunityToolkit.Diagnostics;
namespace ComputeSharp.Exceptions;
@@ -36,7 +35,7 @@ public sealed class UnsupportedTextureTypeException : NotSupportedException
1 => $"{nameof(GraphicsDevice.IsReadOnlyTexture1DSupportedForType)}<T>() or {nameof(GraphicsDevice)}.{nameof(GraphicsDevice.IsReadWriteTexture1DSupportedForType)}<T>().",
2 => $"{nameof(GraphicsDevice.IsReadOnlyTexture2DSupportedForType)}<T>() or {nameof(GraphicsDevice)}.{nameof(GraphicsDevice.IsReadWriteTexture2DSupportedForType)}<T>().",
3 => $"{nameof(GraphicsDevice.IsReadOnlyTexture3DSupportedForType)}<T>() or {nameof(GraphicsDevice)}.{nameof(GraphicsDevice.IsReadWriteTexture3DSupportedForType)}<T>().",
_ => ThrowHelper.ThrowArgumentException<string>("Invalid texture rank.")
_ => default(ArgumentException).Throw<string>(nameof(rank))
});
_ = builder.Append("As a possible workaround on older devices, consider using a texture type of lower rank, or a linear buffer.");
+5 -5
ファイルの表示
@@ -1,6 +1,6 @@
#if NET6_0_OR_GREATER
using CommunityToolkit.Diagnostics;
using System;
using ComputeSharp.Core.Extensions;
using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows;
@@ -66,7 +66,7 @@ internal static unsafe class AllocatorExtensions
ResourceType.ReadWrite => (D3D12_HEAP_TYPE_DEFAULT, D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_COMMON),
ResourceType.ReadBack => (D3D12_HEAP_TYPE_READBACK, D3D12_RESOURCE_FLAG_NONE, D3D12_RESOURCE_STATE_COPY_DEST),
ResourceType.Upload => (D3D12_HEAP_TYPE_UPLOAD, D3D12_RESOURCE_FLAG_NONE, D3D12_RESOURCE_STATE_GENERIC_READ),
_ => ThrowHelper.ThrowArgumentException<(D3D12_HEAP_TYPE, D3D12_RESOURCE_FLAGS, D3D12_RESOURCE_STATES)>()
_ => default(ArgumentException).Throw<(D3D12_HEAP_TYPE, D3D12_RESOURCE_FLAGS, D3D12_RESOURCE_STATES)>(nameof(resourceType))
};
using ComPtr<D3D12MA_Allocation> allocation = default;
@@ -117,7 +117,7 @@ internal static unsafe class AllocatorExtensions
{
ResourceType.ReadOnly => (D3D12_RESOURCE_FLAG_NONE, D3D12_RESOURCE_STATE_COMMON),
ResourceType.ReadWrite => (D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_UNORDERED_ACCESS),
_ => ThrowHelper.ThrowArgumentException<(D3D12_RESOURCE_FLAGS, D3D12_RESOURCE_STATES)>()
_ => default(ArgumentException).Throw<(D3D12_RESOURCE_FLAGS, D3D12_RESOURCE_STATES)>(nameof(resourceType))
};
using ComPtr<D3D12MA_Allocation> allocation = default;
@@ -170,7 +170,7 @@ internal static unsafe class AllocatorExtensions
{
ResourceType.ReadOnly => (D3D12_RESOURCE_FLAG_NONE, D3D12_RESOURCE_STATE_COMMON),
ResourceType.ReadWrite => (D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_UNORDERED_ACCESS),
_ => ThrowHelper.ThrowArgumentException<(D3D12_RESOURCE_FLAGS, D3D12_RESOURCE_STATES)>()
_ => default(ArgumentException).Throw<(D3D12_RESOURCE_FLAGS, D3D12_RESOURCE_STATES)>(nameof(resourceType))
};
using ComPtr<D3D12MA_Allocation> allocation = default;
@@ -225,7 +225,7 @@ internal static unsafe class AllocatorExtensions
{
ResourceType.ReadOnly => (D3D12_RESOURCE_FLAG_NONE, D3D12_RESOURCE_STATE_COMMON),
ResourceType.ReadWrite => (D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_UNORDERED_ACCESS),
_ => ThrowHelper.ThrowArgumentException<(D3D12_RESOURCE_FLAGS, D3D12_RESOURCE_STATES)>()
_ => default(ArgumentException).Throw<(D3D12_RESOURCE_FLAGS, D3D12_RESOURCE_STATES)>(nameof(resourceType))
};
using ComPtr<D3D12MA_Allocation> allocation = default;
+4 -6
ファイルの表示
@@ -1,8 +1,6 @@
using System;
#if NET6_0_OR_GREATER
using System.Runtime.CompilerServices;
#else
using CommunityToolkit.Diagnostics;
#endif
using ComputeSharp.Core.Extensions;
#if !NET6_0_OR_GREATER
@@ -82,7 +80,7 @@ internal static unsafe class ID3D12DeviceExtensions
ResourceType.ReadWrite => (D3D12_HEAP_TYPE_DEFAULT, D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_COMMON),
ResourceType.ReadBack => (D3D12_HEAP_TYPE_READBACK, D3D12_RESOURCE_FLAG_NONE, D3D12_RESOURCE_STATE_COPY_DEST),
ResourceType.Upload => (D3D12_HEAP_TYPE_UPLOAD, D3D12_RESOURCE_FLAG_NONE, D3D12_RESOURCE_STATE_GENERIC_READ),
_ => ThrowHelper.ThrowArgumentException<(D3D12_HEAP_TYPE, D3D12_RESOURCE_FLAGS, D3D12_RESOURCE_STATES)>()
_ => default(ArgumentException).Throw<(D3D12_HEAP_TYPE, D3D12_RESOURCE_FLAGS, D3D12_RESOURCE_STATES)>(nameof(resourceType))
};
using ComPtr<ID3D12Resource> d3D12Resource = default;
@@ -142,7 +140,7 @@ internal static unsafe class ID3D12DeviceExtensions
{
ResourceType.ReadOnly => (D3D12_RESOURCE_FLAG_NONE, D3D12_RESOURCE_STATE_COMMON),
ResourceType.ReadWrite => (D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_UNORDERED_ACCESS),
_ => ThrowHelper.ThrowArgumentException<(D3D12_RESOURCE_FLAGS, D3D12_RESOURCE_STATES)>()
_ => default(ArgumentException).Throw<(D3D12_RESOURCE_FLAGS, D3D12_RESOURCE_STATES)>(nameof(resourceType))
};
using ComPtr<ID3D12Resource> d3D12Resource = default;
@@ -204,7 +202,7 @@ internal static unsafe class ID3D12DeviceExtensions
{
ResourceType.ReadOnly => (D3D12_RESOURCE_FLAG_NONE, D3D12_RESOURCE_STATE_COMMON),
ResourceType.ReadWrite => (D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_UNORDERED_ACCESS),
_ => ThrowHelper.ThrowArgumentException<(D3D12_RESOURCE_FLAGS, D3D12_RESOURCE_STATES)>()
_ => default(ArgumentException).Throw<(D3D12_RESOURCE_FLAGS, D3D12_RESOURCE_STATES)>(nameof(resourceType))
};
using ComPtr<ID3D12Resource> d3D12Resource = default;
@@ -268,7 +266,7 @@ internal static unsafe class ID3D12DeviceExtensions
{
ResourceType.ReadOnly => (D3D12_RESOURCE_FLAG_NONE, D3D12_RESOURCE_STATE_COMMON),
ResourceType.ReadWrite => (D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS, D3D12_RESOURCE_STATE_UNORDERED_ACCESS),
_ => ThrowHelper.ThrowArgumentException<(D3D12_RESOURCE_FLAGS, D3D12_RESOURCE_STATES)>()
_ => default(ArgumentException).Throw<(D3D12_RESOURCE_FLAGS, D3D12_RESOURCE_STATES)>(nameof(resourceType))
};
using ComPtr<ID3D12Resource> d3D12Resource = default;
+1 -1
ファイルの表示
@@ -59,7 +59,7 @@ unsafe partial class GraphicsDevice
d3D12Fence = this.d3D12CopyFence;
d3D12FenceValue = ref this.nextD3D12CopyFenceValue;
break;
default: ThrowHelper.ThrowArgumentException(); return;
default: default(ArgumentException).Throw(nameof(commandList)); return;
}
// Execute the command list
+1 -2
ファイルの表示
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using CommunityToolkit.Diagnostics;
using ComputeSharp.Graphics.Commands.Interop;
#if NET6_0_OR_GREATER
using ComputeSharp.Core.Extensions;
@@ -440,7 +439,7 @@ public sealed unsafe partial class GraphicsDevice : IReferenceTrackedObject
this.copyCommandListPool.Rent(this.d3D12Device.Get(), null, out d3D12CommandList, out d3D12CommandAllocator);
break;
default:
_ = ThrowHelper.ThrowArgumentException<ComPtr<ID3D12CommandAllocator>>();
default(ArgumentException).Throw(nameof(d3D12CommandListType));
d3D12CommandList = null;
d3D12CommandAllocator = null;
break;
+3 -3
ファイルの表示
@@ -1,6 +1,6 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using CommunityToolkit.Diagnostics;
using TerraFX.Interop.DirectX;
using static TerraFX.Interop.DirectX.DXGI_FORMAT;
@@ -46,7 +46,7 @@ internal static class DXGIFormatHelper
if (typeof(T) == typeof(Rg16)) return DXGI_FORMAT_R8G8_UNORM;
if (typeof(T) == typeof(Rg32)) return DXGI_FORMAT_R16G16_UNORM;
return ThrowHelper.ThrowArgumentException<DXGI_FORMAT>("Invalid texture type.");
return default(ArgumentException).Throw<DXGI_FORMAT>(nameof(T));
}
/// <summary>
@@ -89,7 +89,7 @@ internal static class DXGIFormatHelper
return true;
}
return ThrowHelper.ThrowArgumentException<bool>("Invalid texture type.");
return default(ArgumentException).Throw<bool>(nameof(T));
}
/// <summary>
+12 -3
ファイルの表示
@@ -72,17 +72,26 @@ partial class DeviceHelper
// If the device removal reason is available, also include that in the output message
if (result != S.S_OK)
{
string deviceRemovalReason = (int)result switch
string? deviceRemovalReason = (int)result switch
{
DXGI.DXGI_ERROR_DEVICE_HUNG => nameof(DXGI.DXGI_ERROR_DEVICE_HUNG),
DXGI.DXGI_ERROR_DEVICE_REMOVED => nameof(DXGI.DXGI_ERROR_DEVICE_REMOVED),
DXGI.DXGI_ERROR_DEVICE_RESET => nameof(DXGI.DXGI_ERROR_DEVICE_RESET),
DXGI.DXGI_ERROR_DRIVER_INTERNAL_ERROR => nameof(DXGI.DXGI_ERROR_DRIVER_INTERNAL_ERROR),
DXGI.DXGI_ERROR_INVALID_CALL => nameof(DXGI.DXGI_ERROR_INVALID_CALL),
_ => ThrowHelper.ThrowArgumentOutOfRangeException<string>("Invalid GetDeviceRemovedReason HRESULT.")
_ => null
};
_ = builder.AppendLine($"[Reason]: {deviceRemovalReason}");
// If it is a known HRESULT (this should always be the case), print the nicely formatted value
if (deviceRemovalReason is not null)
{
_ = builder.AppendLine($"[Reason]: {deviceRemovalReason}");
}
else
{
// Otherwise just format the HRESULT as a hexadecimal number
_ = builder.AppendLine($"[Reason]: 0x{(int)result:X8}");
}
}
}
+10 -11
ファイルの表示
@@ -1,6 +1,5 @@
using System;
using System.Runtime.CompilerServices;
using CommunityToolkit.Diagnostics;
using TerraFX.Interop.Windows;
#if NET6_0_OR_GREATER
using Path = System.IO.Path;
@@ -33,7 +32,7 @@ internal static class WICFormatHelper
if (typeof(T) == typeof(R8)) return GUID.GUID_WICPixelFormat8bppGray;
if (typeof(T) == typeof(R16)) return GUID.GUID_WICPixelFormat16bppGray;
return ThrowHelper.ThrowArgumentException<Guid>("Invalid texture type.");
return default(ArgumentException).Throw<Guid>(nameof(T));
}
/// <summary>
@@ -53,7 +52,7 @@ internal static class WICFormatHelper
else if (typeof(T) == typeof(Rgba64)) intermediateFormat = GUID.GUID_WICPixelFormat32bppBGRA;
else if (typeof(T) == typeof(R8)) intermediateFormat = GUID.GUID_WICPixelFormat24bppBGR;
else if (typeof(T) == typeof(R16)) intermediateFormat = GUID.GUID_WICPixelFormat24bppBGR;
else intermediateFormat = ThrowHelper.ThrowArgumentException<Guid>("Invalid texture type.");
else intermediateFormat = default(ArgumentException).Throw<Guid>(nameof(T));
}
else if (containerFormat == GUID.GUID_ContainerFormatPng)
{
@@ -62,7 +61,7 @@ internal static class WICFormatHelper
else if (typeof(T) == typeof(Rgba64)) intermediateFormat = default;
else if (typeof(T) == typeof(R8)) intermediateFormat = default;
else if (typeof(T) == typeof(R16)) intermediateFormat = GUID.GUID_WICPixelFormat8bppGray;
else intermediateFormat = ThrowHelper.ThrowArgumentException<Guid>("Invalid texture type.");
else intermediateFormat = default(ArgumentException).Throw<Guid>(nameof(T));
}
else if (containerFormat == GUID.GUID_ContainerFormatJpeg)
{
@@ -71,7 +70,7 @@ internal static class WICFormatHelper
else if (typeof(T) == typeof(Rgba64)) intermediateFormat = GUID.GUID_WICPixelFormat24bppBGR;
else if (typeof(T) == typeof(R8)) intermediateFormat = default;
else if (typeof(T) == typeof(R16)) intermediateFormat = GUID.GUID_WICPixelFormat8bppGray;
else intermediateFormat = ThrowHelper.ThrowArgumentException<Guid>("Invalid texture type.");
else intermediateFormat = default(ArgumentException).Throw<Guid>(nameof(T));
}
else if (containerFormat == GUID.GUID_ContainerFormatWmp)
{
@@ -80,7 +79,7 @@ internal static class WICFormatHelper
else if (typeof(T) == typeof(Rgba64)) intermediateFormat = default;
else if (typeof(T) == typeof(R8)) intermediateFormat = default;
else if (typeof(T) == typeof(R16)) intermediateFormat = default;
else intermediateFormat = ThrowHelper.ThrowArgumentException<Guid>("Invalid texture type.");
else intermediateFormat = default(ArgumentException).Throw<Guid>(nameof(T));
}
else if (containerFormat == GUID.GUID_ContainerFormatTiff)
{
@@ -89,7 +88,7 @@ internal static class WICFormatHelper
else if (typeof(T) == typeof(Rgba64)) intermediateFormat = default;
else if (typeof(T) == typeof(R8)) intermediateFormat = default;
else if (typeof(T) == typeof(R16)) intermediateFormat = default;
else intermediateFormat = ThrowHelper.ThrowArgumentException<Guid>("Invalid texture type.");
else intermediateFormat = default(ArgumentException).Throw<Guid>(nameof(T));
}
else if (containerFormat == GUID.GUID_ContainerFormatDds)
{
@@ -98,11 +97,11 @@ internal static class WICFormatHelper
else if (typeof(T) == typeof(Rgba64)) intermediateFormat = GUID.GUID_WICPixelFormat32bppBGRA;
else if (typeof(T) == typeof(R8)) intermediateFormat = GUID.GUID_WICPixelFormat32bppBGRA;
else if (typeof(T) == typeof(R16)) intermediateFormat = GUID.GUID_WICPixelFormat32bppBGRA;
else intermediateFormat = ThrowHelper.ThrowArgumentException<Guid>("Invalid texture type.");
else intermediateFormat = default(ArgumentException).Throw<Guid>(nameof(T));
}
else
{
intermediateFormat = ThrowHelper.ThrowArgumentException<Guid>("Invalid container format.");
intermediateFormat = default(ArgumentException).Throw<Guid>(nameof(containerFormat));
}
return intermediateFormat != default;
@@ -128,7 +127,7 @@ internal static class WICFormatHelper
".wmp" => GUID.GUID_ContainerFormatWmp,
".tiff" => GUID.GUID_ContainerFormatTiff,
".dds" => GUID.GUID_ContainerFormatDds,
_ => ThrowHelper.ThrowArgumentException<Guid>("Invalid filename."),
_ => default(ArgumentException).Throw<Guid>(nameof(filename))
};
}
@@ -148,7 +147,7 @@ internal static class WICFormatHelper
ImageFormat.Wmp => GUID.GUID_ContainerFormatWmp,
ImageFormat.Tiff => GUID.GUID_ContainerFormatTiff,
ImageFormat.Dds => GUID.GUID_ContainerFormatDds,
_ => ThrowHelper.ThrowArgumentException<Guid>("Invalid format."),
_ => default(ArgumentException).Throw<Guid>(nameof(format))
};
}
}
+9 -10
ファイルの表示
@@ -1,7 +1,6 @@
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using CommunityToolkit.Diagnostics;
using ComputeSharp.Interop;
using ComputeSharp.Resources;
using TerraFX.Interop.DirectX;
@@ -140,7 +139,7 @@ public static class GraphicsResourceHelper
return *(ulong*)&d3D12GpuDescriptorHandle;
}
return ThrowHelper.ThrowArgumentException<ulong>("The input texture is not a valid instance.");
return default(ArgumentException).Throw<ulong>(nameof(texture));
}
/// <summary>
@@ -163,7 +162,7 @@ public static class GraphicsResourceHelper
return *(ulong*)&d3D12GpuDescriptorHandle;
}
return ThrowHelper.ThrowArgumentException<ulong>("The input texture is not a valid instance.");
return default(ArgumentException).Throw<ulong>(nameof(texture));
}
/// <summary>
@@ -186,7 +185,7 @@ public static class GraphicsResourceHelper
return *(ulong*)&d3D12GpuDescriptorHandle;
}
return ThrowHelper.ThrowArgumentException<ulong>("The input texture is not a valid instance.");
return default(ArgumentException).Throw<ulong>(nameof(texture));
}
/// <summary>
@@ -253,7 +252,7 @@ public static class GraphicsResourceHelper
return *(ulong*)&d3D12GpuDescriptorHandle;
}
return ThrowHelper.ThrowArgumentException<ulong>("The input texture is not a valid instance.");
return default(ArgumentException).Throw<ulong>(nameof(texture));
}
/// <summary>
@@ -276,7 +275,7 @@ public static class GraphicsResourceHelper
return *(ulong*)&d3D12GpuDescriptorHandle;
}
return ThrowHelper.ThrowArgumentException<ulong>("The input texture is not a valid instance.");
return default(ArgumentException).Throw<ulong>(nameof(texture));
}
/// <summary>
@@ -299,7 +298,7 @@ public static class GraphicsResourceHelper
return *(ulong*)&d3D12GpuDescriptorHandle;
}
return ThrowHelper.ThrowArgumentException<ulong>("The input texture is not a valid instance.");
return default(ArgumentException).Throw<ulong>(nameof(texture));
}
/// <summary>
@@ -366,7 +365,7 @@ public static class GraphicsResourceHelper
return *(ulong*)&d3D12GpuDescriptorHandle;
}
return ThrowHelper.ThrowArgumentException<ulong>("The input texture is not a valid instance.");
return default(ArgumentException).Throw<ulong>(nameof(texture));
}
/// <summary>
@@ -389,7 +388,7 @@ public static class GraphicsResourceHelper
return *(ulong*)&d3D12GpuDescriptorHandle;
}
return ThrowHelper.ThrowArgumentException<ulong>("The input texture is not a valid instance.");
return default(ArgumentException).Throw<ulong>(nameof(texture));
}
/// <summary>
@@ -412,6 +411,6 @@ public static class GraphicsResourceHelper
return *(ulong*)&d3D12GpuDescriptorHandle;
}
return ThrowHelper.ThrowArgumentException<ulong>("The input texture is not a valid instance.");
return default(ArgumentException).Throw<ulong>(nameof(texture));
}
}
+1 -1
ファイルの表示
@@ -68,7 +68,7 @@ internal struct ReferenceTracker : IDisposable
if (!leaseTaken)
{
// We can't use ThrowHelper here as we only want to invoke ToString if we
// We can't use a throw helper here as we only want to invoke ToString if we
// are about to throw an exception. The JIT will recognize this pattern
// as this method has a single basic block that always throws an exception.
static void Throw(object trackedObject) => throw new ObjectDisposedException(trackedObject.ToString());
+2 -2
ファイルの表示
@@ -1,5 +1,5 @@
using System;
using System.Runtime.CompilerServices;
using CommunityToolkit.Diagnostics;
using TerraFX.Interop.DirectX;
using static TerraFX.Interop.DirectX.D3D12_RESOURCE_STATES;
@@ -28,6 +28,6 @@ internal static class ResourceStateHelper
return D3D12_RESOURCE_STATE_UNORDERED_ACCESS;
}
return ThrowHelper.ThrowArgumentException<D3D12_RESOURCE_STATES>("The target resource state is not valid.");
return default(ArgumentException).Throw<D3D12_RESOURCE_STATES>(nameof(resourceState));
}
}