Add ReferenceEqualityComparer from jD for the HashSet
This commit is contained in:
parent
4999e3a44a
commit
cc9f09fd70
2 changed files with 20 additions and 1 deletions
19
Ryujinx.Common/ReferenceEqualityComparer.cs
Normal file
19
Ryujinx.Common/ReferenceEqualityComparer.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -61,7 +61,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
|||
|
||||
_cache = new AutoDeleteCache();
|
||||
|
||||
_modified = new HashSet<Texture>();
|
||||
_modified = new HashSet<Texture>(new ReferenceEqualityComparer<Texture>());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Add table
Reference in a new issue