From fe30c03cac9d1f09270a4156aceab273dbac81fb Mon Sep 17 00:00:00 2001 From: gdkchan Date: Thu, 8 Jun 2023 17:09:14 -0300 Subject: Implement soft float64 conversion on shaders when host has no support (#5159) * Implement soft float64 conversion on shaders when host has no support * Shader cache version bump * Fix rebase error --- .../IntermediateRepresentation/Operation.cs | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/Ryujinx.Graphics.Shader/IntermediateRepresentation') diff --git a/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/Operation.cs b/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/Operation.cs index d502a9b6..425cfd90 100644 --- a/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/Operation.cs +++ b/src/Ryujinx.Graphics.Shader/IntermediateRepresentation/Operation.cs @@ -255,5 +255,35 @@ namespace Ryujinx.Graphics.Shader.IntermediateRepresentation _sources = new Operand[] { source }; } + + public void TurnDoubleIntoFloat() + { + if ((Inst & ~Instruction.Mask) == Instruction.FP64) + { + Inst = (Inst & Instruction.Mask) | Instruction.FP32; + } + else + { + switch (Inst) + { + case Instruction.ConvertFP32ToFP64: + case Instruction.ConvertFP64ToFP32: + Inst = Instruction.Copy; + break; + case Instruction.ConvertFP64ToS32: + Inst = Instruction.ConvertFP32ToS32; + break; + case Instruction.ConvertFP64ToU32: + Inst = Instruction.ConvertFP32ToU32; + break; + case Instruction.ConvertS32ToFP64: + Inst = Instruction.ConvertS32ToFP32; + break; + case Instruction.ConvertU32ToFP64: + Inst = Instruction.ConvertU32ToFP32; + break; + } + } + } } } \ No newline at end of file -- cgit v1.2.3