IoDefinition.cs
1 using Ryujinx.Graphics.Shader.IntermediateRepresentation; 2 using System; 3 4 namespace Ryujinx.Graphics.Shader.StructuredIr 5 { 6 readonly struct IoDefinition : IEquatable<IoDefinition> 7 { 8 public StorageKind StorageKind { get; } 9 public IoVariable IoVariable { get; } 10 public int Location { get; } 11 public int Component { get; } 12 13 public IoDefinition(StorageKind storageKind, IoVariable ioVariable, int location = 0, int component = 0) 14 { 15 StorageKind = storageKind; 16 IoVariable = ioVariable; 17 Location = location; 18 Component = component; 19 } 20 21 public override bool Equals(object other) 22 { 23 return other is IoDefinition ioDefinition && Equals(ioDefinition); 24 } 25 26 public bool Equals(IoDefinition other) 27 { 28 return StorageKind == other.StorageKind && 29 IoVariable == other.IoVariable && 30 Location == other.Location && 31 Component == other.Component; 32 } 33 34 public override int GetHashCode() 35 { 36 return (int)StorageKind | ((int)IoVariable << 8) | (Location << 16) | (Component << 24); 37 } 38 39 public override string ToString() 40 { 41 return $"{StorageKind}.{IoVariable}.{Location}.{Component}"; 42 } 43 } 44 }