Some leftovers from constant folding

This commit is contained in:
gdkchan 2019-03-29 21:13:54 -03:00
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 static class ConstantFolding
{ {
public static void FoldOperation(Operation operation) public static void Fold(Operation operation)
{ {
if (!AreAllSourcesConstant(operation)) if (!AreAllSourcesConstant(operation))
{ {
@ -89,6 +89,10 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
EvaluateBinary(operation, (x, y) => (uint)x < (uint)y); EvaluateBinary(operation, (x, y) => (uint)x < (uint)y);
break; break;
case Instruction.CompareNotEqual:
EvaluateBinary(operation, (x, y) => x != y);
break;
case Instruction.Divide: case Instruction.Divide:
EvaluateBinary(operation, (x, y) => y != 0 ? x / y : 0); EvaluateBinary(operation, (x, y) => y != 0 ? x / y : 0);
break; break;
@ -121,6 +125,10 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations
EvaluateFPBinary(operation, (x, y) => x <= y); EvaluateFPBinary(operation, (x, y) => x <= y);
break; break;
case Instruction.FP | Instruction.CompareNotEqual:
EvaluateFPBinary(operation, (x, y) => x != y);
break;
case Instruction.FP | Instruction.Divide: case Instruction.FP | Instruction.Divide:
EvaluateFPBinary(operation, (x, y) => x / y); EvaluateFPBinary(operation, (x, y) => x / y);
break; break;

View file

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