AstOperand.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using Ryujinx.Graphics.Shader.IntermediateRepresentation;
  2. using Ryujinx.Graphics.Shader.Translation;
  3. using System.Collections.Generic;
  4. namespace Ryujinx.Graphics.Shader.StructuredIr
  5. {
  6. class AstOperand : AstNode
  7. {
  8. public HashSet<IAstNode> Defs { get; }
  9. public HashSet<IAstNode> Uses { get; }
  10. public OperandType Type { get; }
  11. public AggregateType VarType { get; set; }
  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 = AggregateType.S32;
  20. }
  21. public AstOperand(Operand operand) : this()
  22. {
  23. Type = operand.Type;
  24. if (Type == OperandType.ConstantBuffer)
  25. {
  26. CbufSlot = operand.GetCbufSlot();
  27. CbufOffset = operand.GetCbufOffset();
  28. }
  29. else
  30. {
  31. Value = operand.Value;
  32. }
  33. }
  34. public AstOperand(OperandType type, int value = 0) : this()
  35. {
  36. Type = type;
  37. Value = value;
  38. }
  39. }
  40. }