mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-07-09 12:50:34 +00:00
[Graphics] Implemented structural equality
GraphicsContexts are now considered equal if they store the same context handle. Debugging information is also improved.
This commit is contained in:
parent
29af70274d
commit
15f87c15a1
|
@ -36,7 +36,7 @@ using OpenTK.Platform;
|
||||||
namespace OpenTK.Graphics
|
namespace OpenTK.Graphics
|
||||||
{
|
{
|
||||||
// Provides the foundation for all IGraphicsContext implementations.
|
// Provides the foundation for all IGraphicsContext implementations.
|
||||||
abstract class GraphicsContextBase : IGraphicsContext, IGraphicsContextInternal
|
abstract class GraphicsContextBase : IGraphicsContext, IGraphicsContextInternal, IEquatable<IGraphicsContextInternal>
|
||||||
{
|
{
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
|
@ -127,5 +127,36 @@ namespace OpenTK.Graphics
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region IEquatable<IGraphicsContextInternal> Members
|
||||||
|
|
||||||
|
public bool Equals(IGraphicsContextInternal other)
|
||||||
|
{
|
||||||
|
return Context.Equals(other.Context);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Public Members
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return string.Format("[{0}: IsCurrent={1}, IsDisposed={2}, VSync={3}, SwapInterval={4}, GraphicsMode={5}, ErrorChecking={6}, Implementation={7}, Context={8}]",
|
||||||
|
GetType().Name, IsCurrent, IsDisposed, VSync, SwapInterval, GraphicsMode, ErrorChecking, Implementation, Context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return Handle.GetHashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
obj is IGraphicsContextInternal &&
|
||||||
|
Equals((IGraphicsContextInternal)obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue