aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.GAL/VertexAttribDescriptor.cs
blob: b3248b621f54ee34123864e2773a2ac98adeca87 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;

namespace Ryujinx.Graphics.GAL
{
    public struct VertexAttribDescriptor : IEquatable<VertexAttribDescriptor>
    {
        public int BufferIndex { get; }
        public int Offset      { get; }

        public bool IsZero { get; }

        public Format Format { get; }

        public VertexAttribDescriptor(int bufferIndex, int offset, bool isZero, Format format)
        {
            BufferIndex = bufferIndex;
            Offset      = offset;
            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);
        }
    }
}