ShaderAddresses.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. #pragma warning disable CS0649
  10. public ulong VertexA;
  11. public ulong Vertex;
  12. public ulong TessControl;
  13. public ulong TessEvaluation;
  14. public ulong Geometry;
  15. public ulong Fragment;
  16. #pragma warning restore CS0649
  17. /// <summary>
  18. /// Check if the addresses are equal.
  19. /// </summary>
  20. /// <param name="other">Shader addresses structure to compare with</param>
  21. /// <returns>True if they are equal, false otherwise</returns>
  22. public override bool Equals(object other)
  23. {
  24. return other is ShaderAddresses addresses && Equals(addresses);
  25. }
  26. /// <summary>
  27. /// Check if the addresses are equal.
  28. /// </summary>
  29. /// <param name="other">Shader addresses structure to compare with</param>
  30. /// <returns>True if they are equal, false otherwise</returns>
  31. public bool Equals(ShaderAddresses other)
  32. {
  33. return VertexA == other.VertexA &&
  34. Vertex == other.Vertex &&
  35. TessControl == other.TessControl &&
  36. TessEvaluation == other.TessEvaluation &&
  37. Geometry == other.Geometry &&
  38. Fragment == other.Fragment;
  39. }
  40. /// <summary>
  41. /// Computes hash code from the addresses.
  42. /// </summary>
  43. /// <returns>Hash code</returns>
  44. public override int GetHashCode()
  45. {
  46. return HashCode.Combine(VertexA, Vertex, TessControl, TessEvaluation, Geometry, Fragment);
  47. }
  48. }
  49. }