Avoid some redundant GL calls (#1958)

This commit is contained in:
gdkchan 2021-01-26 18:44:07 -03:00 committed by GitHub
parent d6bd0470fb
commit caf049ed15
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 115 additions and 51 deletions

View file

@ -1,6 +1,8 @@
using System;
namespace Ryujinx.Graphics.GAL
{
public struct VertexAttribDescriptor
public struct VertexAttribDescriptor : IEquatable<VertexAttribDescriptor>
{
public int BufferIndex { get; }
public int Offset { get; }
@ -16,5 +18,23 @@ namespace Ryujinx.Graphics.GAL
IsZero = isZero;
Format = format;
}
public override bool Equals(object obj)
{
return obj is VertexAttribDescriptor other && Equals(other);
}
public bool Equals(VertexAttribDescriptor other)
{
return BufferIndex == other.BufferIndex &&
Offset == other.Offset &&
IsZero == other.IsZero &&
Format == other.Format;
}
public override int GetHashCode()
{
return HashCode.Combine(BufferIndex, Offset, IsZero, Format);
}
}
}