From 1c9aba6de1520aea5480c032e0ff5664ac1bb36f Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sat, 25 Apr 2020 10:40:29 -0300 Subject: [PATCH] Fix mode and Reg08.H1 decoding on XMAD instruction (#1156) --- .../Instructions/InstEmitAlu.cs | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/Ryujinx.Graphics.Shader/Instructions/InstEmitAlu.cs b/Ryujinx.Graphics.Shader/Instructions/InstEmitAlu.cs index 5a919c771..7c3d55c41 100644 --- a/Ryujinx.Graphics.Shader/Instructions/InstEmitAlu.cs +++ b/Ryujinx.Graphics.Shader/Instructions/InstEmitAlu.cs @@ -598,24 +598,23 @@ namespace Ryujinx.Graphics.Shader.Instructions bool signedA = context.CurrOp.RawOpCode.Extract(48); bool signedB = context.CurrOp.RawOpCode.Extract(49); bool highA = context.CurrOp.RawOpCode.Extract(53); - bool highB = false; - XmadCMode mode; + bool isReg = (op is OpCodeAluReg) && !(op is OpCodeAluRegCbuf); + bool isImm = (op is OpCodeAluImm); - if (op is OpCodeAluReg) + XmadCMode mode = isReg || isImm + ? (XmadCMode)context.CurrOp.RawOpCode.Extract(50, 3) + : (XmadCMode)context.CurrOp.RawOpCode.Extract(50, 2); + + bool highB = false; + + if (isReg) { highB = context.CurrOp.RawOpCode.Extract(35); - - mode = (XmadCMode)context.CurrOp.RawOpCode.Extract(50, 3); } - else + else if (!isImm) { - mode = (XmadCMode)context.CurrOp.RawOpCode.Extract(50, 2); - - if (!(op is OpCodeAluImm)) - { - highB = context.CurrOp.RawOpCode.Extract(52); - } + highB = context.CurrOp.RawOpCode.Extract(52); } Operand srcA = GetSrcA(context);