Simplified F2I shader instruction codegen

This commit is contained in:
gdk 2019-11-26 01:00:58 -03:00 committed by Thog
parent b8528c6317
commit 99f236fcf0
5 changed files with 26 additions and 9 deletions

View file

@ -99,12 +99,26 @@ namespace Ryujinx.Graphics.Shader.Instructions
break;
}
long min = GetIntMin(intType);
long max = GetIntMax(intType);
if (!isSignedInt)
{
// Negative float to uint cast is undefined, so we clamp
// the value before conversion.
srcB = context.FPMaximum(srcB, ConstF(0));
}
srcB = context.FPClamp(srcB, ConstF(min), ConstF(max));
srcB = isSignedInt
? context.FPConvertToS32(srcB)
: context.FPConvertToU32(srcB);
srcB = context.FPConvertToS32(srcB);
if (isSmallInt)
{
int min = (int)GetIntMin(intType);
int max = (int)GetIntMax(intType);
srcB = isSignedInt
? context.IClampS32(srcB, Const(min), Const(max))
: context.IClampU32(srcB, Const(min), Const(max));
}
Operand dest = GetDest(context);