1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-12-22 15:42:01 +00:00
Ryujinx/Ryujinx.Graphics.Shader/IntermediateRepresentation/OperandHelper.cs
gdkchan d512ce122c
Initial tessellation shader support (#2534)
* Initial tessellation shader support

* Nits

* Re-arrange built-in table

* This is not needed anymore

* PR feedback
2021-10-18 18:38:04 -03:00

72 lines
No EOL
1.7 KiB
C#

using Ryujinx.Graphics.Shader.Decoders;
using System;
namespace Ryujinx.Graphics.Shader.IntermediateRepresentation
{
static class OperandHelper
{
public static Operand Argument(int value)
{
return new Operand(OperandType.Argument, value);
}
public static Operand Attribute(int value)
{
return new Operand(OperandType.Attribute, value);
}
public static Operand AttributePerPatch(int value)
{
return new Operand(OperandType.AttributePerPatch, value);
}
public static Operand Cbuf(int slot, int offset)
{
return new Operand(slot, offset);
}
public static Operand Const(int value)
{
return new Operand(OperandType.Constant, value);
}
public static Operand ConstF(float value)
{
return new Operand(OperandType.Constant, BitConverter.SingleToInt32Bits(value));
}
public static Operand Label()
{
return new Operand(OperandType.Label);
}
public static Operand Local()
{
return new Operand(OperandType.LocalVariable);
}
public static Operand Register(int index, RegisterType type)
{
return Register(new Register(index, type));
}
public static Operand Register(Register reg)
{
if (reg.IsRZ)
{
return Const(0);
}
else if (reg.IsPT)
{
return Const(IrConsts.True);
}
return new Operand(reg);
}
public static Operand Undef()
{
return new Operand(OperandType.Undefined);
}
}
}