Remove CommunityToolkit.Diagnostics from ComputeSharp package
このコミットが含まれているのは:
1 親
72338416c2
コミット
5a4fd9a4ce
19ファイル変更
+58
-46
検索条件に一致するファイルはありません
@@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BenchmarkDotNet" Version="0.13.4" />
|
||||
<PackageReference Include="CommunityToolkit.Diagnostics" Version="8.1.0" />
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="2.1.3" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Diagnostics" Version="8.1.0" />
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="2.1.3" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using CommunityToolkit.Diagnostics;
|
||||
|
||||
namespace ComputeSharp.Sample;
|
||||
|
||||
@@ -19,12 +18,6 @@ internal static class Formatting
|
||||
/// <param name="name">The name of the matrix to print.</param>
|
||||
public static void PrintMatrix(float[] array, int width, int height, string name)
|
||||
{
|
||||
Guard.IsNotNull(array);
|
||||
Guard.IsGreaterThan(width, 0);
|
||||
Guard.IsGreaterThan(height, 0);
|
||||
Guard.IsEqualTo(array.Length, (long)width * height, nameof(array));
|
||||
Guard.IsNotNullOrEmpty(name);
|
||||
|
||||
int pad = 48 - name.Length;
|
||||
string title = $"{new string('=', pad / 2)} {name} {new string('=', (pad + 1) / 2)}";
|
||||
|
||||
|
||||
@@ -160,6 +160,9 @@
|
||||
</ApplicationDefinition>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Diagnostics">
|
||||
<Version>8.1.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="CommunityToolkit.Mvvm">
|
||||
<Version>8.1.0</Version>
|
||||
</PackageReference>
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.2.230118.102" />
|
||||
<PackageReference Include="CommunityToolkit.Diagnostics" Version="8.1.0" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.1.0" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.UI.Controls.Core" Version="7.1.2" />
|
||||
<PackageReference Include="CommunityToolkit.WinUI.UI.Media" Version="7.1.2" />
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace System;
|
||||
|
||||
/// <summary>
|
||||
/// Throw helper extensions for <see cref="NotSupportedException"/>.
|
||||
/// </summary>
|
||||
internal static class NotSupportedExceptionExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Throws an <see cref="NotSupportedException"/>.
|
||||
/// </summary>
|
||||
/// <param name="_">Dummy value to invoke the extension upon (always pass <see langword="null"/>.</param>
|
||||
/// <exception cref="NotSupportedException">Thrown with no parameters.</exception>
|
||||
[DoesNotReturn]
|
||||
public static void Throw(this NotSupportedException? _)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Throws an <see cref="NotSupportedException"/> 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>
|
||||
/// <returns>This method never returns any values.</returns>
|
||||
/// <exception cref="NotSupportedException">Thrown with no parameters.</exception>
|
||||
[DoesNotReturn]
|
||||
public static T Throw<T>(this NotSupportedException? _)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using CommunityToolkit.Diagnostics;
|
||||
using TerraFX.Interop.Windows;
|
||||
|
||||
namespace ComputeSharp.Shaders.Translation;
|
||||
@@ -31,7 +30,7 @@ unsafe partial class ShaderCompiler
|
||||
{
|
||||
Architecture.X64 => "win-x64",
|
||||
Architecture.Arm64 => "win-arm64",
|
||||
_ => ThrowHelper.ThrowNotSupportedException<string>("Invalid process architecture.")
|
||||
_ => default(NotSupportedException).Throw<string>()
|
||||
};
|
||||
|
||||
// Test whether the native libraries are present in the same folder of the executable
|
||||
|
||||
@@ -18,10 +18,6 @@
|
||||
<ProjectReference Include="..\ComputeSharp.Core\ComputeSharp.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Diagnostics" Version="8.1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- .NET 6 uses the NuGet packages for TerraFX -->
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
|
||||
<PackageReference Include="TerraFX.Interop.D3D12MemoryAllocator" Version="2.0.1.3" />
|
||||
|
||||
@@ -4,7 +4,6 @@ using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
#if NET6_0_OR_GREATER
|
||||
using CommunityToolkit.Diagnostics;
|
||||
using TerraFX.Interop;
|
||||
#endif
|
||||
using TerraFX.Interop.Windows;
|
||||
@@ -49,7 +48,7 @@ unsafe partial class IWICStreamExtensions
|
||||
{
|
||||
#if NET6_0_OR_GREATER
|
||||
/// <inheritdoc/>
|
||||
static Guid* INativeGuid.NativeGuid => (Guid*)ThrowHelper.ThrowNotSupportedException<nint>();
|
||||
static Guid* INativeGuid.NativeGuid => (Guid*)default(NotSupportedException).Throw<nint>();
|
||||
#else
|
||||
/// <inheritdoc cref="QueryInterface"/>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
|
||||
@@ -3,7 +3,6 @@ using System.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using CommunityToolkit.Diagnostics;
|
||||
#if NET6_0_OR_GREATER
|
||||
using TerraFX.Interop;
|
||||
#endif
|
||||
@@ -51,7 +50,7 @@ internal static unsafe partial class IWICStreamExtensions
|
||||
{
|
||||
#if NET6_0_OR_GREATER
|
||||
/// <inheritdoc/>
|
||||
static Guid* INativeGuid.NativeGuid => (Guid*)ThrowHelper.ThrowNotSupportedException<nint>();
|
||||
static Guid* INativeGuid.NativeGuid => (Guid*)default(NotSupportedException).Throw<nint>();
|
||||
#else
|
||||
/// <inheritdoc cref="QueryInterface"/>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
@@ -571,7 +570,7 @@ internal static unsafe partial class IWICStreamExtensions
|
||||
}
|
||||
else
|
||||
{
|
||||
ThrowHelper.ThrowNotSupportedException();
|
||||
default(NotSupportedException).Throw();
|
||||
}
|
||||
|
||||
pstatstg->type = (uint)STGTY_STREAM;
|
||||
|
||||
@@ -35,7 +35,7 @@ unsafe partial class GraphicsDevice
|
||||
// For the same reason, this method doesn't have to worry about raising the event either.
|
||||
if (Volatile.Read(ref Unsafe.As<HRESULT, int>(ref this.deviceRemovedReason)) != S.S_OK)
|
||||
{
|
||||
static void Throw(object self) => throw new InvalidOperationException($"The device \"{self}\" has been lost and can no longer be used.");
|
||||
static void Throw(object self) => throw new InvalidOperationException($"""The device "{self}" has been lost and can no longer be used.""");
|
||||
|
||||
Throw(this);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using CommunityToolkit.Diagnostics;
|
||||
using ComputeSharp.Core.Extensions;
|
||||
using ComputeSharp.Graphics.Extensions;
|
||||
using TerraFX.Interop.DirectX;
|
||||
@@ -45,7 +44,7 @@ internal static partial class DeviceHelper
|
||||
return GetOrCreateDevice(d3D12Device.Get(), dxgiAdapter.Get(), &dxgiDescription1);
|
||||
}
|
||||
|
||||
return ThrowHelper.ThrowNotSupportedException<GraphicsDevice>("Failed to retrieve the default device.");
|
||||
return default(NotSupportedException).Throw<GraphicsDevice>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using CommunityToolkit.Diagnostics;
|
||||
|
||||
#pragma warning disable CS0809, CA1065
|
||||
|
||||
@@ -194,11 +193,8 @@ public readonly unsafe ref struct TextureView2D<T>
|
||||
/// <exception cref="ArgumentException">Thrown when <paramref name="destination"/> doesn't match the size of the current <see cref="TextureView2D{T}"/> instance.</exception>
|
||||
public void CopyTo(TextureView2D<T> destination)
|
||||
{
|
||||
if (destination.width != this.width ||
|
||||
destination.height != this.height)
|
||||
{
|
||||
ThrowHelper.ThrowArgumentException();
|
||||
}
|
||||
default(ArgumentException).ThrowIf(destination.width != this.width, nameof(destination));
|
||||
default(ArgumentException).ThrowIf(destination.height != this.height, nameof(destination));
|
||||
|
||||
if (IsEmpty)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using CommunityToolkit.Diagnostics;
|
||||
|
||||
#pragma warning disable CS0809, CA1065
|
||||
|
||||
@@ -224,12 +223,9 @@ public readonly unsafe ref struct TextureView3D<T>
|
||||
/// <exception cref="ArgumentException">Thrown when <paramref name="destination"/> doesn't match the size of the current <see cref="TextureView3D{T}"/> instance.</exception>
|
||||
public void CopyTo(TextureView3D<T> destination)
|
||||
{
|
||||
if (destination.width != this.width ||
|
||||
destination.height != this.height ||
|
||||
destination.depth != this.depth)
|
||||
{
|
||||
ThrowHelper.ThrowArgumentException();
|
||||
}
|
||||
default(ArgumentException).ThrowIf(destination.width != this.width, nameof(destination));
|
||||
default(ArgumentException).ThrowIf(destination.height != this.height, nameof(destination));
|
||||
default(ArgumentException).ThrowIf(destination.depth != this.depth, nameof(destination));
|
||||
|
||||
if (IsEmpty)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using CommunityToolkit.Diagnostics;
|
||||
using ComputeSharp.__Internals;
|
||||
using ComputeSharp.Shaders.Models;
|
||||
using TerraFX.Interop.DirectX;
|
||||
@@ -27,23 +26,16 @@ internal struct ShaderBytecodeLoader : IBytecodeLoader
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public ICachedShader GetCachedShader()
|
||||
{
|
||||
if (this.cachedShader is not ICachedShader cachedShader)
|
||||
{
|
||||
return ThrowHelper.ThrowInvalidOperationException<ICachedShader>("The shader has not been initialized.");
|
||||
}
|
||||
default(InvalidOperationException).ThrowIf(this.cachedShader is null);
|
||||
|
||||
return cachedShader;
|
||||
return this.cachedShader;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public unsafe void LoadDynamicBytecode(IntPtr handle)
|
||||
{
|
||||
default(InvalidOperationException).ThrowIf(this.cachedShader is not null);
|
||||
|
||||
if (handle == IntPtr.Zero)
|
||||
{
|
||||
ThrowHelper.ThrowNotSupportedException("Runtime shader compilation is not supported by the current configuration.");
|
||||
}
|
||||
default(InvalidOperationException).ThrowIf(handle == IntPtr.Zero);
|
||||
|
||||
this.cachedShader = new ICachedShader.Dynamic((IDxcBlob*)handle);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Diagnostics" Version="8.1.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="3.0.2" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="3.0.2" />
|
||||
|
||||
+1
@@ -7,6 +7,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Diagnostics" Version="8.1.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="3.0.2" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="3.0.2" />
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Diagnostics" Version="8.1.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="3.0.2" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="3.0.2" />
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommunityToolkit.Diagnostics" Version="8.1.0" />
|
||||
<PackageReference Include="CommunityToolkit.HighPerformance" Version="8.1.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="3.0.2" />
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする