ShaderAddresses.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using System;
  2. namespace Ryujinx.Graphics.Gpu.Shader
  3. {
  4. /// <summary>
  5. /// Shader code addresses in memory for each shader stage.
  6. /// </summary>
  7. struct ShaderAddresses : IEquatable<ShaderAddresses>
  8. {
  9. public ulong VertexA;
  10. public ulong Vertex;
  11. public ulong TessControl;
  12. public ulong TessEvaluation;
  13. public ulong Geometry;
  14. public ulong Fragment;
  15. /// <summary>
  16. /// Check if the addresses are equal.
  17. /// </summary>
  18. /// <param name="other">Shader addresses structure to compare with</param>
  19. /// <returns>True if they are equal, false otherwise</returns>
  20. public override bool Equals(object other)
  21. {
  22. return other is ShaderAddresses addresses && Equals(addresses);
  23. }
  24. /// <summary>
  25. /// Check if the addresses are equal.
  26. /// </summary>
  27. /// <param name="other">Shader addresses structure to compare with</param>
  28. /// <returns>True if they are equal, false otherwise</returns>
  29. public bool Equals(ShaderAddresses other)
  30. {
  31. return VertexA == other.VertexA &&
  32. Vertex == other.Vertex &&
  33. TessControl == other.TessControl &&
  34. TessEvaluation == other.TessEvaluation &&
  35. Geometry == other.Geometry &&
  36. Fragment == other.Fragment;
  37. }
  38. /// <summary>
  39. /// Computes hash code from the addresses.
  40. /// </summary>
  41. /// <returns>Hash code</returns>
  42. public override int GetHashCode()
  43. {
  44. return HashCode.Combine(VertexA, Vertex, TessControl, TessEvaluation, Geometry, Fragment);
  45. }
  46. }
  47. }