Some leftovers from constant folding

This commit is contained in:
gdkchan 2019-03-29 21:13:54 -03:00
parent af82b1214e
commit 17a777fbae
2 changed files with 10 additions and 2 deletions

View file

@ -8,7 +8,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
{
static class ConstantFolding
{
public static void FoldOperation(Operation operation)
public static void Fold(Operation operation)
{
if (!AreAllSourcesConstant(operation))
{
@ -89,6 +89,10 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
EvaluateBinary(operation, (x, y) => (uint)x < (uint)y);
break;
case Instruction.CompareNotEqual:
EvaluateBinary(operation, (x, y) => x != y);
break;
case Instruction.Divide:
EvaluateBinary(operation, (x, y) => y != 0 ? x / y : 0);
break;
@ -121,6 +125,10 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
EvaluateFPBinary(operation, (x, y) => x <= y);
break;
case Instruction.FP | Instruction.CompareNotEqual:
EvaluateFPBinary(operation, (x, y) => x != y);
break;
case Instruction.FP | Instruction.Divide:
EvaluateFPBinary(operation, (x, y) => x / y);
break;

View file

@ -39,7 +39,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
continue;
}
ConstantFolding.FoldOperation(operation);
ConstantFolding.Fold(operation);
Simplification.Simplify(operation);