mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-08 15:48:33 +00:00
4da44e09cb
* Make all structs readonly when applicable. It should reduce amount of needless defensive copies * Make structs with trivial boilerplate equality code record structs * Remove unnecessary readonly modifiers from TextureCreateInfo * Make BitMap structs readonly too
36 lines
933 B
C#
36 lines
933 B
C#
using System;
|
|
|
|
namespace Ryujinx.Graphics.Shader.Decoders
|
|
{
|
|
readonly struct Register : IEquatable<Register>
|
|
{
|
|
public int Index { get; }
|
|
|
|
public RegisterType Type { get; }
|
|
|
|
public bool IsRZ => Type == RegisterType.Gpr && Index == RegisterConsts.RegisterZeroIndex;
|
|
public bool IsPT => Type == RegisterType.Predicate && Index == RegisterConsts.PredicateTrueIndex;
|
|
|
|
public Register(int index, RegisterType type)
|
|
{
|
|
Index = index;
|
|
Type = type;
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return (ushort)Index | ((ushort)Type << 16);
|
|
}
|
|
|
|
public override bool Equals(object obj)
|
|
{
|
|
return obj is Register reg && Equals(reg);
|
|
}
|
|
|
|
public bool Equals(Register other)
|
|
{
|
|
return other.Index == Index &&
|
|
other.Type == Type;
|
|
}
|
|
}
|
|
} |