AstOperand.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 int Value { get; }
  12. public int CbufSlot { get; }
  13. public int CbufOffset { get; }
  14. private AstOperand()
  15. {
  16. Defs = new HashSet<IAstNode>();
  17. Uses = new HashSet<IAstNode>();
  18. VarType = VariableType.S32;
  19. }
  20. public AstOperand(Operand operand) : this()
  21. {
  22. Type = operand.Type;
  23. if (Type == OperandType.ConstantBuffer)
  24. {
  25. CbufSlot = operand.GetCbufSlot();
  26. CbufOffset = operand.GetCbufOffset();
  27. }
  28. else
  29. {
  30. Value = operand.Value;
  31. }
  32. }
  33. public AstOperand(OperandType type, int value = 0) : this()
  34. {
  35. Type = type;
  36. Value = value;
  37. }
  38. }
  39. }