Add missing U8/S8 types from shader I2I instruction (#2740)

* Add missing U8/S8 types from shader I2I instruction

* Better names

* Fix dstIsSignedInt
This commit is contained in:
gdkchan 2021-10-17 17:48:36 -03:00 committed by GitHub
parent 25fd4ef10e
commit 7603dbe3c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 61 additions and 24 deletions

View file

@ -34,6 +34,34 @@ namespace Ryujinx.Graphics.Shader.Instructions
};
}
public static long GetIntMin(ISrcDstFmt type)
{
return type switch
{
ISrcDstFmt.U8 => byte.MinValue,
ISrcDstFmt.S8 => sbyte.MinValue,
ISrcDstFmt.U16 => ushort.MinValue,
ISrcDstFmt.S16 => short.MinValue,
ISrcDstFmt.U32 => uint.MinValue,
ISrcDstFmt.S32 => int.MinValue,
_ => throw new ArgumentException($"The type \"{type}\" is not a supported integer type.")
};
}
public static long GetIntMax(ISrcDstFmt type)
{
return type switch
{
ISrcDstFmt.U8 => byte.MaxValue,
ISrcDstFmt.S8 => sbyte.MaxValue,
ISrcDstFmt.U16 => ushort.MaxValue,
ISrcDstFmt.S16 => short.MaxValue,
ISrcDstFmt.U32 => uint.MaxValue,
ISrcDstFmt.S32 => int.MaxValue,
_ => throw new ArgumentException($"The type \"{type}\" is not a supported integer type.")
};
}
public static Operand GetPredLogicalOp(EmitterContext context, BoolOp logicOp, Operand input, Operand pred)
{
return logicOp switch