Switch to EquatableArray<T> in ComputeSharp.D2D1 models

このコミットが含まれているのは:
Sergio Pedri committed 2022-10-20 03:24:31 +02:00
1 親 23e5300dee
コミット 4def9f65a9
14ファイル変更
+29 -472

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

+1 -53
ファイルの表示
@@ -1,7 +1,3 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using ComputeSharp.SourceGeneration.Extensions;
using ComputeSharp.SourceGeneration.Helpers;
using ComputeSharp.SourceGeneration.Models;
@@ -28,52 +24,4 @@ internal sealed record D2D1ShaderInfo(
OutputBufferInfo OutputBuffer,
InputDescriptionsInfo InputDescriptions,
D2D1PixelOptions PixelOptions,
ImmutableArray<DiagnosticInfo> Diagnostcs)
{
/// <inheritdoc/>
public bool Equals(D2D1ShaderInfo? obj)
{
return Comparer.Default.Equals(this, obj);
}
/// <inheritdoc/>
public override int GetHashCode()
{
return Comparer.Default.GetHashCode(this);
}
/// <summary>
/// An <see cref="IEqualityComparer{T}"/> implementation for <see cref="D2D1ShaderInfo"/>.
/// </summary>
private sealed class Comparer : Comparer<D2D1ShaderInfo, Comparer>
{
/// <inheritdoc/>
protected override void AddToHashCode(ref HashCode hashCode, D2D1ShaderInfo obj)
{
hashCode.Add(obj.Hierarchy);
hashCode.Add(obj.DispatchData);
hashCode.Add(obj.InputTypes);
hashCode.Add(obj.ResourceTextureDescriptions);
hashCode.Add(obj.HlslShaderSource);
hashCode.Add(obj.OutputBuffer);
hashCode.Add(obj.InputDescriptions);
hashCode.Add(obj.PixelOptions);
hashCode.AddRange(obj.Diagnostcs);
}
/// <inheritdoc/>
protected override bool AreEqual(D2D1ShaderInfo x, D2D1ShaderInfo y)
{
return
x.Hierarchy == y.Hierarchy &&
x.DispatchData == y.DispatchData &&
x.InputTypes == y.InputTypes &&
x.ResourceTextureDescriptions == y.ResourceTextureDescriptions &&
x.HlslShaderSource == y.HlslShaderSource &&
x.OutputBuffer == y.OutputBuffer &&
x.InputDescriptions == y.InputDescriptions &&
x.PixelOptions == y.PixelOptions &&
x.Diagnostcs.SequenceEqual(y.Diagnostcs);
}
}
}
EquatableArray<DiagnosticInfo> Diagnostcs);