Small manual code style tweaks and warning suppressions
このコミットが含まれているのは:
1 親
9343ac7f7b
コミット
27c629f3b4
8ファイル変更
+42
-37
検索条件に一致するファイルはありません
@@ -1,6 +1,8 @@
|
||||
using ComputeSharp.Core.Intrinsics.Attributes;
|
||||
using ComputeSharp.Exceptions;
|
||||
|
||||
#pragma warning disable IDE0022
|
||||
|
||||
namespace ComputeSharp.D2D1;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -162,7 +162,7 @@ internal static class SyntaxNodeExtensions
|
||||
/// <returns>A node like the one in input, but just as a definition.</returns>
|
||||
public static MethodDeclarationSyntax AsDefinition(this MethodDeclarationSyntax node)
|
||||
{
|
||||
if (node.ExpressionBody is ArrowExpressionClauseSyntax)
|
||||
if (node.ExpressionBody is not null)
|
||||
{
|
||||
return node.WithExpressionBody(null).WithSemicolonToken(Token(SyntaxKind.SemicolonToken));
|
||||
}
|
||||
@@ -205,7 +205,7 @@ internal static class SyntaxNodeExtensions
|
||||
/// <returns>A node like the one in input, but just as a definition.</returns>
|
||||
public static LocalFunctionStatementSyntax AsDefinition(this LocalFunctionStatementSyntax node)
|
||||
{
|
||||
if (node.ExpressionBody is ArrowExpressionClauseSyntax)
|
||||
if (node.ExpressionBody is not null)
|
||||
{
|
||||
return node.WithExpressionBody(null).WithSemicolonToken(Token(SyntaxKind.SemicolonToken));
|
||||
}
|
||||
|
||||
@@ -49,10 +49,7 @@ internal static class DiagnosticsExtensions
|
||||
/// <param name="diagnostics">The input <see cref="IncrementalValuesProvider{TValues}"/> sequence of diagnostics.</param>
|
||||
public static void ReportDiagnostics(this IncrementalGeneratorInitializationContext context, IncrementalValuesProvider<DiagnosticInfo> diagnostics)
|
||||
{
|
||||
context.RegisterSourceOutput(diagnostics, static (context, diagnostic) =>
|
||||
{
|
||||
context.ReportDiagnostic(diagnostic.ToDiagnostic());
|
||||
});
|
||||
context.RegisterSourceOutput(diagnostics, static (context, diagnostic) => context.ReportDiagnostic(diagnostic.ToDiagnostic()));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -188,9 +188,6 @@ unsafe partial class GraphicsDevice
|
||||
handle.Free();
|
||||
|
||||
// If the device is available, then also queue the device lost event to be raised on the thread pool
|
||||
if (device is not null)
|
||||
{
|
||||
device.QueueRaiseDeviceLostEventIfNeeded();
|
||||
}
|
||||
device?.QueueRaiseDeviceLostEventIfNeeded();
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,8 @@ using CommunityToolkit.Diagnostics;
|
||||
using TerraFX.Interop.DirectX;
|
||||
using static TerraFX.Interop.DirectX.DXGI_FORMAT;
|
||||
|
||||
#pragma warning disable IDE0011
|
||||
|
||||
namespace ComputeSharp.Graphics.Helpers;
|
||||
|
||||
/// <summary>
|
||||
@@ -22,28 +24,29 @@ internal static class DXGIFormatHelper
|
||||
where T : unmanaged
|
||||
{
|
||||
if (typeof(T) == typeof(int)) return DXGI_FORMAT_R32_SINT;
|
||||
else if (typeof(T) == typeof(Int2)) return DXGI_FORMAT_R32G32_SINT;
|
||||
else if (typeof(T) == typeof(Int3)) return DXGI_FORMAT_R32G32B32_SINT;
|
||||
else if (typeof(T) == typeof(Int4)) return DXGI_FORMAT_R32G32B32A32_SINT;
|
||||
else if (typeof(T) == typeof(uint)) return DXGI_FORMAT_R32_UINT;
|
||||
else if (typeof(T) == typeof(UInt2)) return DXGI_FORMAT_R32G32_UINT;
|
||||
else if (typeof(T) == typeof(UInt3)) return DXGI_FORMAT_R32G32B32_UINT;
|
||||
else if (typeof(T) == typeof(UInt4)) return DXGI_FORMAT_R32G32B32A32_UINT;
|
||||
else if (typeof(T) == typeof(float)) return DXGI_FORMAT_R32_FLOAT;
|
||||
else if (typeof(T) == typeof(Float2)) return DXGI_FORMAT_R32G32_FLOAT;
|
||||
else if (typeof(T) == typeof(Float3)) return DXGI_FORMAT_R32G32B32_FLOAT;
|
||||
else if (typeof(T) == typeof(Float4)) return DXGI_FORMAT_R32G32B32A32_FLOAT;
|
||||
else if (typeof(T) == typeof(Vector2)) return DXGI_FORMAT_R32G32_FLOAT;
|
||||
else if (typeof(T) == typeof(Vector3)) return DXGI_FORMAT_R32G32B32_FLOAT;
|
||||
else if (typeof(T) == typeof(Vector4)) return DXGI_FORMAT_R32G32B32A32_FLOAT;
|
||||
else if (typeof(T) == typeof(Bgra32)) return DXGI_FORMAT_B8G8R8A8_UNORM;
|
||||
else if (typeof(T) == typeof(Rgba32)) return DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
else if (typeof(T) == typeof(Rgba64)) return DXGI_FORMAT_R16G16B16A16_UNORM;
|
||||
else if (typeof(T) == typeof(R8)) return DXGI_FORMAT_R8_UNORM;
|
||||
else if (typeof(T) == typeof(R16)) return DXGI_FORMAT_R16_UNORM;
|
||||
else if (typeof(T) == typeof(Rg16)) return DXGI_FORMAT_R8G8_UNORM;
|
||||
else if (typeof(T) == typeof(Rg32)) return DXGI_FORMAT_R16G16_UNORM;
|
||||
else return ThrowHelper.ThrowArgumentException<DXGI_FORMAT>("Invalid texture type.");
|
||||
if (typeof(T) == typeof(Int2)) return DXGI_FORMAT_R32G32_SINT;
|
||||
if (typeof(T) == typeof(Int3)) return DXGI_FORMAT_R32G32B32_SINT;
|
||||
if (typeof(T) == typeof(Int4)) return DXGI_FORMAT_R32G32B32A32_SINT;
|
||||
if (typeof(T) == typeof(uint)) return DXGI_FORMAT_R32_UINT;
|
||||
if (typeof(T) == typeof(UInt2)) return DXGI_FORMAT_R32G32_UINT;
|
||||
if (typeof(T) == typeof(UInt3)) return DXGI_FORMAT_R32G32B32_UINT;
|
||||
if (typeof(T) == typeof(UInt4)) return DXGI_FORMAT_R32G32B32A32_UINT;
|
||||
if (typeof(T) == typeof(float)) return DXGI_FORMAT_R32_FLOAT;
|
||||
if (typeof(T) == typeof(Float2)) return DXGI_FORMAT_R32G32_FLOAT;
|
||||
if (typeof(T) == typeof(Float3)) return DXGI_FORMAT_R32G32B32_FLOAT;
|
||||
if (typeof(T) == typeof(Float4)) return DXGI_FORMAT_R32G32B32A32_FLOAT;
|
||||
if (typeof(T) == typeof(Vector2)) return DXGI_FORMAT_R32G32_FLOAT;
|
||||
if (typeof(T) == typeof(Vector3)) return DXGI_FORMAT_R32G32B32_FLOAT;
|
||||
if (typeof(T) == typeof(Vector4)) return DXGI_FORMAT_R32G32B32A32_FLOAT;
|
||||
if (typeof(T) == typeof(Bgra32)) return DXGI_FORMAT_B8G8R8A8_UNORM;
|
||||
if (typeof(T) == typeof(Rgba32)) return DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
if (typeof(T) == typeof(Rgba64)) return DXGI_FORMAT_R16G16B16A16_UNORM;
|
||||
if (typeof(T) == typeof(R8)) return DXGI_FORMAT_R8_UNORM;
|
||||
if (typeof(T) == typeof(R16)) return DXGI_FORMAT_R16_UNORM;
|
||||
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.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -8,6 +8,8 @@ using Path = System.IO.Path;
|
||||
using Path = ComputeSharp.NetStandard.System.IO.Path;
|
||||
#endif
|
||||
|
||||
#pragma warning disable IDE0011
|
||||
|
||||
namespace ComputeSharp.Graphics.Helpers;
|
||||
|
||||
/// <summary>
|
||||
@@ -26,11 +28,12 @@ internal static class WICFormatHelper
|
||||
where T : unmanaged
|
||||
{
|
||||
if (typeof(T) == typeof(Bgra32)) return GUID.GUID_WICPixelFormat32bppBGRA;
|
||||
else if (typeof(T) == typeof(Rgba32)) return GUID.GUID_WICPixelFormat32bppRGBA;
|
||||
else if (typeof(T) == typeof(Rgba64)) return GUID.GUID_WICPixelFormat64bppRGBA;
|
||||
else if (typeof(T) == typeof(R8)) return GUID.GUID_WICPixelFormat8bppGray;
|
||||
else if (typeof(T) == typeof(R16)) return GUID.GUID_WICPixelFormat16bppGray;
|
||||
else return ThrowHelper.ThrowArgumentException<Guid>("Invalid texture type.");
|
||||
if (typeof(T) == typeof(Rgba32)) return GUID.GUID_WICPixelFormat32bppRGBA;
|
||||
if (typeof(T) == typeof(Rgba64)) return GUID.GUID_WICPixelFormat64bppRGBA;
|
||||
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.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -175,6 +175,7 @@ public unsafe abstract class TransferTexture1D<T> : NativeObject, IGraphicsResou
|
||||
/// <inheritdoc/>
|
||||
public override Memory<T> Memory
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => CreateMemory(this.buffer.Width);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,8 @@ using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using RuntimeHelpers = ComputeSharp.NetStandard.System.Runtime.CompilerServices.RuntimeHelpers;
|
||||
|
||||
#pragma warning disable IDE1006
|
||||
|
||||
namespace TerraFX.Interop.Windows
|
||||
{
|
||||
internal static partial class Windows
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする