aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Shader/Instructions/InstEmitMove.cs
diff options
context:
space:
mode:
authorgdk <gab.dark.100@gmail.com>2019-10-31 00:29:22 -0300
committerThog <thog@protonmail.com>2020-01-09 02:13:00 +0100
commit278a4c317c0b87add67cc9ebc904afe1db23a031 (patch)
tree452b59bf4aebf45b9086cf1f59e006c089a2cba7 /Ryujinx.Graphics.Shader/Instructions/InstEmitMove.cs
parentd786d8d2b924da7cd116a2eb97d738a9f07b4e43 (diff)
Implement BFI, BRK, FLO, FSWZADD, PBK, SHFL and TXD shader instructions, misc. fixes
Diffstat (limited to 'Ryujinx.Graphics.Shader/Instructions/InstEmitMove.cs')
-rw-r--r--Ryujinx.Graphics.Shader/Instructions/InstEmitMove.cs35
1 files changed, 35 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.Shader/Instructions/InstEmitMove.cs b/Ryujinx.Graphics.Shader/Instructions/InstEmitMove.cs
index b9bb18d9..f0792245 100644
--- a/Ryujinx.Graphics.Shader/Instructions/InstEmitMove.cs
+++ b/Ryujinx.Graphics.Shader/Instructions/InstEmitMove.cs
@@ -27,6 +27,9 @@ namespace Ryujinx.Graphics.Shader.Instructions
switch (sysReg)
{
+ // TODO: Use value from Y direction GPU register.
+ case SystemRegister.YDirection: src = ConstF(1); break;
+
case SystemRegister.ThreadId:
{
Operand tidX = Attribute(AttributeConsts.ThreadIdX);
@@ -67,5 +70,37 @@ namespace Ryujinx.Graphics.Shader.Instructions
context.Copy(GetDest(context), res);
}
+
+ public static void Shfl(EmitterContext context)
+ {
+ OpCodeShuffle op = (OpCodeShuffle)context.CurrOp;
+
+ Operand pred = Register(op.Predicate48);
+
+ Operand srcA = GetSrcA(context);
+
+ Operand srcB = op.IsBImmediate ? Const(op.ImmediateB) : Register(op.Rb);
+ Operand srcC = op.IsCImmediate ? Const(op.ImmediateC) : Register(op.Rc);
+
+ Operand res = null;
+
+ switch (op.ShuffleType)
+ {
+ case ShuffleType.Indexed:
+ res = context.Shuffle(srcA, srcB, srcC);
+ break;
+ case ShuffleType.Up:
+ res = context.ShuffleUp(srcA, srcB, srcC);
+ break;
+ case ShuffleType.Down:
+ res = context.ShuffleDown(srcA, srcB, srcC);
+ break;
+ case ShuffleType.Butterfly:
+ res = context.ShuffleXor(srcA, srcB, srcC);
+ break;
+ }
+
+ context.Copy(GetDest(context), res);
+ }
}
} \ No newline at end of file