OperandInfo.cs 985 B

123456789101112131415161718192021222324252627282930313233
  1. using Ryujinx.Graphics.Shader.IntermediateRepresentation;
  2. using System;
  3. namespace Ryujinx.Graphics.Shader.StructuredIr
  4. {
  5. static class OperandInfo
  6. {
  7. public static VariableType GetVarType(AstOperand operand)
  8. {
  9. if (operand.Type == OperandType.LocalVariable)
  10. {
  11. return operand.VarType;
  12. }
  13. else
  14. {
  15. return GetVarType(operand.Type);
  16. }
  17. }
  18. public static VariableType GetVarType(OperandType type)
  19. {
  20. switch (type)
  21. {
  22. case OperandType.Attribute: return VariableType.F32;
  23. case OperandType.Constant: return VariableType.S32;
  24. case OperandType.ConstantBuffer: return VariableType.F32;
  25. case OperandType.Undefined: return VariableType.S32;
  26. }
  27. throw new ArgumentException($"Invalid operand type \"{type}\".");
  28. }
  29. }
  30. }