Add ReferenceEqualityComparer from jD for the HashSet

This commit is contained in:
riperiperi 2020-02-06 00:05:42 +00:00
parent 4999e3a44a
commit cc9f09fd70
2 changed files with 20 additions and 1 deletions

View file

@ -0,0 +1,19 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
namespace Ryujinx.Common
{
public class ReferenceEqualityComparer<T> : IEqualityComparer<T>
where T : class
{
public bool Equals(T x, T y)
{
return x == y;
}
public int GetHashCode([DisallowNull] T obj)
{
return obj.GetHashCode();
}
}
}

View file

@ -61,7 +61,7 @@ namespace Ryujinx.Graphics.Gpu.Image
_cache = new AutoDeleteCache();
_modified = new HashSet<Texture>();
_modified = new HashSet<Texture>(new ReferenceEqualityComparer<Texture>());
}
/// <summary>