diff --git a/Ryujinx.Graphics.Shader/Decoders/FPType.cs b/Ryujinx.Graphics.Shader/Decoders/FPType.cs index 6fea5f9cdd..b5af2c1d24 100644 --- a/Ryujinx.Graphics.Shader/Decoders/FPType.cs +++ b/Ryujinx.Graphics.Shader/Decoders/FPType.cs @@ -13,7 +13,7 @@ namespace Ryujinx.Graphics.Shader.Decoders { public static Instruction ToInstFPType(this FPType type) { - return type == FPType.FP64 ? Instruction.FP64 : Instruction.FP; + return type == FPType.FP64 ? Instruction.FP64 : Instruction.FP32; } } } \ No newline at end of file diff --git a/Ryujinx.Graphics.Shader/Instructions/InstEmitAluHelper.cs b/Ryujinx.Graphics.Shader/Instructions/InstEmitAluHelper.cs index 45003e650b..588ec2163b 100644 --- a/Ryujinx.Graphics.Shader/Instructions/InstEmitAluHelper.cs +++ b/Ryujinx.Graphics.Shader/Instructions/InstEmitAluHelper.cs @@ -85,7 +85,7 @@ namespace Ryujinx.Graphics.Shader.Instructions context.Copy(GetNF(), context.ICompareLess(dest, Const(0))); } - public static void SetFPZnFlags(EmitterContext context, Operand dest, bool setCC, Instruction fpType = Instruction.FP) + public static void SetFPZnFlags(EmitterContext context, Operand dest, bool setCC, Instruction fpType = Instruction.FP32) { if (setCC) { diff --git a/Ryujinx.Graphics.Shader/Instructions/InstEmitFArith.cs b/Ryujinx.Graphics.Shader/Instructions/InstEmitFArith.cs index fec874150a..fa5c684c13 100644 --- a/Ryujinx.Graphics.Shader/Instructions/InstEmitFArith.cs +++ b/Ryujinx.Graphics.Shader/Instructions/InstEmitFArith.cs @@ -15,8 +15,8 @@ namespace Ryujinx.Graphics.Shader.Instructions public static void Dfma(EmitterContext context) => EmitFPFma(context, Instruction.FP64); public static void Dmul(EmitterContext context) => EmitFPMultiply(context, Instruction.FP64); - public static void Fadd(EmitterContext context) => EmitFPAdd(context, Instruction.FP); - public static void Ffma(EmitterContext context) => EmitFPFma(context, Instruction.FP); + public static void Fadd(EmitterContext context) => EmitFPAdd(context, Instruction.FP32); + public static void Ffma(EmitterContext context) => EmitFPFma(context, Instruction.FP32); public static void Ffma32i(EmitterContext context) { @@ -62,7 +62,7 @@ namespace Ryujinx.Graphics.Shader.Instructions SetFPZnFlags(context, dest, op.SetCondCode); } - public static void Fmul(EmitterContext context) => EmitFPMultiply(context, Instruction.FP); + public static void Fmul(EmitterContext context) => EmitFPMultiply(context, Instruction.FP32); public static void Fset(EmitterContext context) { @@ -474,7 +474,7 @@ namespace Ryujinx.Graphics.Shader.Instructions default: throw new InvalidOperationException($"Unexpected condition \"{cond}\"."); } - res = context.Add(inst | Instruction.FP, Local(), srcA, srcB); + res = context.Add(inst | Instruction.FP32, Local(), srcA, srcB); if ((cond & Condition.Nan) != 0) { diff --git a/Ryujinx.Graphics.Shader/IntermediateRepresentation/Instruction.cs b/Ryujinx.Graphics.Shader/IntermediateRepresentation/Instruction.cs index 7b5510fd10..4a6c3a786a 100644 --- a/Ryujinx.Graphics.Shader/IntermediateRepresentation/Instruction.cs +++ b/Ryujinx.Graphics.Shader/IntermediateRepresentation/Instruction.cs @@ -124,7 +124,7 @@ namespace Ryujinx.Graphics.Shader.IntermediateRepresentation Count, - FP = 1 << 16, + FP32 = 1 << 16, FP64 = 1 << 17, MrShift = 18, diff --git a/Ryujinx.Graphics.Shader/StructuredIr/InstructionInfo.cs b/Ryujinx.Graphics.Shader/StructuredIr/InstructionInfo.cs index 9d189e8618..3fcc5f1189 100644 --- a/Ryujinx.Graphics.Shader/StructuredIr/InstructionInfo.cs +++ b/Ryujinx.Graphics.Shader/StructuredIr/InstructionInfo.cs @@ -159,7 +159,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr { if (type == VariableType.Scalar) { - if ((inst & Instruction.FP) != 0) + if ((inst & Instruction.FP32) != 0) { return VariableType.F32; } diff --git a/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgram.cs b/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgram.cs index 504dc38676..4758b08fac 100644 --- a/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgram.cs +++ b/Ryujinx.Graphics.Shader/StructuredIr/StructuredProgram.cs @@ -104,7 +104,7 @@ namespace Ryujinx.Graphics.Shader.StructuredIr if (isCondSel && type == VariableType.F32) { - inst |= Instruction.FP; + inst |= Instruction.FP32; } dest.VarType = type; diff --git a/Ryujinx.Graphics.Shader/Translation/EmitterContextInsts.cs b/Ryujinx.Graphics.Shader/Translation/EmitterContextInsts.cs index f6affea3df..c8d622b2c8 100644 --- a/Ryujinx.Graphics.Shader/Translation/EmitterContextInsts.cs +++ b/Ryujinx.Graphics.Shader/Translation/EmitterContextInsts.cs @@ -191,12 +191,12 @@ namespace Ryujinx.Graphics.Shader.Translation return context.Add(Instruction.ConvertFP64ToFP32, Local(), a); } - public static Operand FPAbsNeg(this EmitterContext context, Operand a, bool abs, bool neg, Instruction fpType = Instruction.FP) + public static Operand FPAbsNeg(this EmitterContext context, Operand a, bool abs, bool neg, Instruction fpType = Instruction.FP32) { return context.FPNegate(context.FPAbsolute(a, abs, fpType), neg, fpType); } - public static Operand FPAbsolute(this EmitterContext context, Operand a, bool abs, Instruction fpType = Instruction.FP) + public static Operand FPAbsolute(this EmitterContext context, Operand a, bool abs, Instruction fpType = Instruction.FP32) { if (abs) { @@ -206,27 +206,27 @@ namespace Ryujinx.Graphics.Shader.Translation return a; } - public static Operand FPAbsolute(this EmitterContext context, Operand a, Instruction fpType = Instruction.FP) + public static Operand FPAbsolute(this EmitterContext context, Operand a, Instruction fpType = Instruction.FP32) { return context.Add(fpType | Instruction.Absolute, Local(), a); } - public static Operand FPAdd(this EmitterContext context, Operand a, Operand b, Instruction fpType = Instruction.FP) + public static Operand FPAdd(this EmitterContext context, Operand a, Operand b, Instruction fpType = Instruction.FP32) { return context.Add(fpType | Instruction.Add, Local(), a, b); } - public static Operand FPCeiling(this EmitterContext context, Operand a, Instruction fpType = Instruction.FP) + public static Operand FPCeiling(this EmitterContext context, Operand a, Instruction fpType = Instruction.FP32) { return context.Add(fpType | Instruction.Ceiling, Local(), a); } - public static Operand FPCompareEqual(this EmitterContext context, Operand a, Operand b, Instruction fpType = Instruction.FP) + public static Operand FPCompareEqual(this EmitterContext context, Operand a, Operand b, Instruction fpType = Instruction.FP32) { return context.Add(fpType | Instruction.CompareEqual, Local(), a, b); } - public static Operand FPCompareLess(this EmitterContext context, Operand a, Operand b, Instruction fpType = Instruction.FP) + public static Operand FPCompareLess(this EmitterContext context, Operand a, Operand b, Instruction fpType = Instruction.FP32) { return context.Add(fpType | Instruction.CompareLess, Local(), a, b); } @@ -243,50 +243,50 @@ namespace Ryujinx.Graphics.Shader.Translation public static Operand FPCosine(this EmitterContext context, Operand a) { - return context.Add(Instruction.FP | Instruction.Cosine, Local(), a); + return context.Add(Instruction.FP32 | Instruction.Cosine, Local(), a); } public static Operand FPDivide(this EmitterContext context, Operand a, Operand b) { - return context.Add(Instruction.FP | Instruction.Divide, Local(), a, b); + return context.Add(Instruction.FP32 | Instruction.Divide, Local(), a, b); } public static Operand FPExponentB2(this EmitterContext context, Operand a) { - return context.Add(Instruction.FP | Instruction.ExponentB2, Local(), a); + return context.Add(Instruction.FP32 | Instruction.ExponentB2, Local(), a); } - public static Operand FPFloor(this EmitterContext context, Operand a, Instruction fpType = Instruction.FP) + public static Operand FPFloor(this EmitterContext context, Operand a, Instruction fpType = Instruction.FP32) { return context.Add(fpType | Instruction.Floor, Local(), a); } - public static Operand FPFusedMultiplyAdd(this EmitterContext context, Operand a, Operand b, Operand c, Instruction fpType = Instruction.FP) + public static Operand FPFusedMultiplyAdd(this EmitterContext context, Operand a, Operand b, Operand c, Instruction fpType = Instruction.FP32) { return context.Add(fpType | Instruction.FusedMultiplyAdd, Local(), a, b, c); } public static Operand FPLogarithmB2(this EmitterContext context, Operand a) { - return context.Add(Instruction.FP | Instruction.LogarithmB2, Local(), a); + return context.Add(Instruction.FP32 | Instruction.LogarithmB2, Local(), a); } public static Operand FPMaximum(this EmitterContext context, Operand a, Operand b) { - return context.Add(Instruction.FP | Instruction.Maximum, Local(), a, b); + return context.Add(Instruction.FP32 | Instruction.Maximum, Local(), a, b); } public static Operand FPMinimum(this EmitterContext context, Operand a, Operand b) { - return context.Add(Instruction.FP | Instruction.Minimum, Local(), a, b); + return context.Add(Instruction.FP32 | Instruction.Minimum, Local(), a, b); } - public static Operand FPMultiply(this EmitterContext context, Operand a, Operand b, Instruction fpType = Instruction.FP) + public static Operand FPMultiply(this EmitterContext context, Operand a, Operand b, Instruction fpType = Instruction.FP32) { return context.Add(fpType | Instruction.Multiply, Local(), a, b); } - public static Operand FPNegate(this EmitterContext context, Operand a, bool neg, Instruction fpType = Instruction.FP) + public static Operand FPNegate(this EmitterContext context, Operand a, bool neg, Instruction fpType = Instruction.FP32) { if (neg) { @@ -296,7 +296,7 @@ namespace Ryujinx.Graphics.Shader.Translation return a; } - public static Operand FPNegate(this EmitterContext context, Operand a, Instruction fpType = Instruction.FP) + public static Operand FPNegate(this EmitterContext context, Operand a, Instruction fpType = Instruction.FP32) { return context.Add(fpType | Instruction.Negate, Local(), a); } @@ -308,15 +308,15 @@ namespace Ryujinx.Graphics.Shader.Translation public static Operand FPReciprocalSquareRoot(this EmitterContext context, Operand a) { - return context.Add(Instruction.FP | Instruction.ReciprocalSquareRoot, Local(), a); + return context.Add(Instruction.FP32 | Instruction.ReciprocalSquareRoot, Local(), a); } - public static Operand FPRound(this EmitterContext context, Operand a, Instruction fpType = Instruction.FP) + public static Operand FPRound(this EmitterContext context, Operand a, Instruction fpType = Instruction.FP32) { return context.Add(fpType | Instruction.Round, Local(), a); } - public static Operand FPSaturate(this EmitterContext context, Operand a, bool sat, Instruction fpType = Instruction.FP) + public static Operand FPSaturate(this EmitterContext context, Operand a, bool sat, Instruction fpType = Instruction.FP32) { if (sat) { @@ -326,22 +326,22 @@ namespace Ryujinx.Graphics.Shader.Translation return a; } - public static Operand FPSaturate(this EmitterContext context, Operand a, Instruction fpType = Instruction.FP) + public static Operand FPSaturate(this EmitterContext context, Operand a, Instruction fpType = Instruction.FP32) { return context.Add(fpType | Instruction.Clamp, Local(), a, ConstF(0), ConstF(1)); } public static Operand FPSine(this EmitterContext context, Operand a) { - return context.Add(Instruction.FP | Instruction.Sine, Local(), a); + return context.Add(Instruction.FP32 | Instruction.Sine, Local(), a); } public static Operand FPSquareRoot(this EmitterContext context, Operand a) { - return context.Add(Instruction.FP | Instruction.SquareRoot, Local(), a); + return context.Add(Instruction.FP32 | Instruction.SquareRoot, Local(), a); } - public static Operand FPTruncate(this EmitterContext context, Operand a, Instruction fpType = Instruction.FP) + public static Operand FPTruncate(this EmitterContext context, Operand a, Instruction fpType = Instruction.FP32) { return context.Add(fpType | Instruction.Truncate, Local(), a); } diff --git a/Ryujinx.Graphics.Shader/Translation/Lowering.cs b/Ryujinx.Graphics.Shader/Translation/Lowering.cs index 99aea26e68..0b5ec59273 100644 --- a/Ryujinx.Graphics.Shader/Translation/Lowering.cs +++ b/Ryujinx.Graphics.Shader/Translation/Lowering.cs @@ -304,7 +304,7 @@ namespace Ryujinx.Graphics.Shader.Translation Operand coordNormalized = Local(); - node.List.AddBefore(node, new Operation(Instruction.FP | Instruction.Divide, coordNormalized, source, Float(coordSize))); + node.List.AddBefore(node, new Operation(Instruction.FP32 | Instruction.Divide, coordNormalized, source, Float(coordSize))); sources[coordsIndex + index] = coordNormalized; } @@ -375,13 +375,13 @@ namespace Ryujinx.Graphics.Shader.Translation Operand intOffset = offsets[index + (hasOffsets ? texOp.Index * coordsCount : 0)]; - node.List.AddBefore(node, new Operation(Instruction.FP | Instruction.Divide, offset, Float(intOffset), Float(coordSize))); + node.List.AddBefore(node, new Operation(Instruction.FP32 | Instruction.Divide, offset, Float(intOffset), Float(coordSize))); Operand source = sources[coordsIndex + index]; Operand coordPlusOffset = Local(); - node.List.AddBefore(node, new Operation(Instruction.FP | Instruction.Add, coordPlusOffset, source, offset)); + node.List.AddBefore(node, new Operation(Instruction.FP32 | Instruction.Add, coordPlusOffset, source, offset)); sources[coordsIndex + index] = coordPlusOffset; } diff --git a/Ryujinx.Graphics.Shader/Translation/Optimizations/ConstantFolding.cs b/Ryujinx.Graphics.Shader/Translation/Optimizations/ConstantFolding.cs index b69589294d..856a5598d6 100644 --- a/Ryujinx.Graphics.Shader/Translation/Optimizations/ConstantFolding.cs +++ b/Ryujinx.Graphics.Shader/Translation/Optimizations/ConstantFolding.cs @@ -101,51 +101,51 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations EvaluateBinary(operation, (x, y) => y != 0 ? x / y : 0); break; - case Instruction.FP | Instruction.Add: + case Instruction.FP32 | Instruction.Add: EvaluateFPBinary(operation, (x, y) => x + y); break; - case Instruction.FP | Instruction.Clamp: + case Instruction.FP32 | Instruction.Clamp: EvaluateFPTernary(operation, (x, y, z) => Math.Clamp(x, y, z)); break; - case Instruction.FP | Instruction.CompareEqual: + case Instruction.FP32 | Instruction.CompareEqual: EvaluateFPBinary(operation, (x, y) => x == y); break; - case Instruction.FP | Instruction.CompareGreater: + case Instruction.FP32 | Instruction.CompareGreater: EvaluateFPBinary(operation, (x, y) => x > y); break; - case Instruction.FP | Instruction.CompareGreaterOrEqual: + case Instruction.FP32 | Instruction.CompareGreaterOrEqual: EvaluateFPBinary(operation, (x, y) => x >= y); break; - case Instruction.FP | Instruction.CompareLess: + case Instruction.FP32 | Instruction.CompareLess: EvaluateFPBinary(operation, (x, y) => x < y); break; - case Instruction.FP | Instruction.CompareLessOrEqual: + case Instruction.FP32 | Instruction.CompareLessOrEqual: EvaluateFPBinary(operation, (x, y) => x <= y); break; - case Instruction.FP | Instruction.CompareNotEqual: + case Instruction.FP32 | Instruction.CompareNotEqual: EvaluateFPBinary(operation, (x, y) => x != y); break; - case Instruction.FP | Instruction.Divide: + case Instruction.FP32 | Instruction.Divide: EvaluateFPBinary(operation, (x, y) => x / y); break; - case Instruction.FP | Instruction.Multiply: + case Instruction.FP32 | Instruction.Multiply: EvaluateFPBinary(operation, (x, y) => x * y); break; - case Instruction.FP | Instruction.Negate: + case Instruction.FP32 | Instruction.Negate: EvaluateFPUnary(operation, (x) => -x); break; - case Instruction.FP | Instruction.Subtract: + case Instruction.FP32 | Instruction.Subtract: EvaluateFPBinary(operation, (x, y) => x - y); break;