StructuredFunction.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System.Collections.Generic;
  2. namespace Ryujinx.Graphics.Shader.StructuredIr
  3. {
  4. class StructuredFunction
  5. {
  6. public AstBlock MainBlock { get; }
  7. public string Name { get; }
  8. public VariableType ReturnType { get; }
  9. public VariableType[] InArguments { get; }
  10. public VariableType[] OutArguments { get; }
  11. public HashSet<AstOperand> Locals { get; }
  12. public StructuredFunction(
  13. AstBlock mainBlock,
  14. string name,
  15. VariableType returnType,
  16. VariableType[] inArguments,
  17. VariableType[] outArguments)
  18. {
  19. MainBlock = mainBlock;
  20. Name = name;
  21. ReturnType = returnType;
  22. InArguments = inArguments;
  23. OutArguments = outArguments;
  24. Locals = new HashSet<AstOperand>();
  25. }
  26. public VariableType GetArgumentType(int index)
  27. {
  28. return index >= InArguments.Length
  29. ? OutArguments[index - InArguments.Length]
  30. : InArguments[index];
  31. }
  32. }
  33. }