using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using ComputeSharp.SourceGeneration.Extensions;
using ComputeSharp.SourceGeneration.Helpers;
namespace ComputeSharp.D2D1Interop.SourceGenerators.Models;
///
/// A model representing gathered info on a shader dispatch data.
///
/// The description on shader instance fields.
/// The size of the shader root signature, in 32 bit constants.
internal sealed record DispatchDataInfo(ImmutableArray FieldInfos, int Root32BitConstantCount)
{
///
/// An implementation for .
///
public sealed class Comparer : Comparer
{
///
protected override void AddToHashCode(ref HashCode hashCode, DispatchDataInfo obj)
{
hashCode.AddRange(obj.FieldInfos, FieldInfo.Comparer.Default);
hashCode.Add(obj.Root32BitConstantCount);
}
///
protected override bool AreEqual(DispatchDataInfo x, DispatchDataInfo y)
{
return
x.FieldInfos.SequenceEqual(y.FieldInfos, FieldInfo.Comparer.Default) &&
x.Root32BitConstantCount == y.Root32BitConstantCount;
}
}
}