OperandHelper.cs
1 using Ryujinx.Graphics.Shader.Decoders; 2 using System; 3 4 namespace Ryujinx.Graphics.Shader.IntermediateRepresentation 5 { 6 static class OperandHelper 7 { 8 public static Operand Argument(int value) 9 { 10 return new Operand(OperandType.Argument, value); 11 } 12 13 public static Operand Cbuf(int slot, int offset) 14 { 15 return new Operand(slot, offset); 16 } 17 18 public static Operand Const(int value) 19 { 20 return new Operand(OperandType.Constant, value); 21 } 22 23 public static Operand ConstF(float value) 24 { 25 return new Operand(OperandType.Constant, BitConverter.SingleToInt32Bits(value)); 26 } 27 28 public static Operand Label() 29 { 30 return new Operand(OperandType.Label); 31 } 32 33 public static Operand Local() 34 { 35 return new Operand(OperandType.LocalVariable); 36 } 37 38 public static Operand Register(int index, RegisterType type) 39 { 40 return Register(new Register(index, type)); 41 } 42 43 public static Operand Register(Register reg) 44 { 45 if (reg.IsRZ) 46 { 47 return Const(0); 48 } 49 else if (reg.IsPT) 50 { 51 return Const(IrConsts.True); 52 } 53 54 return new Operand(reg); 55 } 56 57 public static Operand Undef() 58 { 59 return new Operand(OperandType.Undefined); 60 } 61 } 62 }