AstOperand.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using Ryujinx.Graphics.Shader.IntermediateRepresentation;
  2. using System.Collections.Generic;
  3. namespace Ryujinx.Graphics.Shader.StructuredIr
  4. {
  5. class AstOperand : AstNode
  6. {
  7. public HashSet<IAstNode> Defs { get; }
  8. public HashSet<IAstNode> Uses { get; }
  9. public OperandType Type { get; }
  10. public VariableType VarType { get; set; }
  11. public InterpolationQualifier Interpolation { get; }
  12. public int Value { get; }
  13. public int CbufSlot { get; }
  14. public int CbufOffset { get; }
  15. private AstOperand()
  16. {
  17. Defs = new HashSet<IAstNode>();
  18. Uses = new HashSet<IAstNode>();
  19. VarType = VariableType.S32;
  20. }
  21. public AstOperand(Operand operand) : this()
  22. {
  23. Type = operand.Type;
  24. Interpolation = operand.Interpolation;
  25. if (Type == OperandType.ConstantBuffer)
  26. {
  27. CbufSlot = operand.GetCbufSlot();
  28. CbufOffset = operand.GetCbufOffset();
  29. }
  30. else
  31. {
  32. Value = operand.Value;
  33. }
  34. }
  35. public AstOperand(OperandType type, int value = 0) : this()
  36. {
  37. Type = type;
  38. Value = value;
  39. }
  40. }
  41. }