aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Shader/Instructions/InstEmitMove.cs
diff options
context:
space:
mode:
authorgdk <gab.dark.100@gmail.com>2019-11-19 10:45:46 -0300
committerThog <thog@protonmail.com>2020-01-09 02:13:00 +0100
commit6a8ba6d60080ca15fc25a6812998b19e63171610 (patch)
tree1532717900dda140ff75844adb9824c74c059d98 /Ryujinx.Graphics.Shader/Instructions/InstEmitMove.cs
parent8eb773d81f0b580851b840f3abc222b784523fbc (diff)
Add R2P shader instruction
Diffstat (limited to 'Ryujinx.Graphics.Shader/Instructions/InstEmitMove.cs')
-rw-r--r--Ryujinx.Graphics.Shader/Instructions/InstEmitMove.cs32
1 files changed, 32 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.Shader/Instructions/InstEmitMove.cs b/Ryujinx.Graphics.Shader/Instructions/InstEmitMove.cs
index 5833d879..17e80f4a 100644
--- a/Ryujinx.Graphics.Shader/Instructions/InstEmitMove.cs
+++ b/Ryujinx.Graphics.Shader/Instructions/InstEmitMove.cs
@@ -16,6 +16,38 @@ namespace Ryujinx.Graphics.Shader.Instructions
context.Copy(GetDest(context), GetSrcB(context));
}
+ public static void R2p(EmitterContext context)
+ {
+ OpCodeAlu op = (OpCodeAlu)context.CurrOp;
+
+ bool isCC = op.RawOpCode.Extract(40);
+ int shift = op.RawOpCode.Extract(41, 2) * 8;
+
+ Operand value = GetSrcA(context);
+ Operand mask = GetSrcB(context);
+
+ Operand Test(Operand value, int bit)
+ {
+ return context.ICompareNotEqual(context.BitwiseAnd(value, Const(1 << bit)), Const(0));
+ }
+
+ if (isCC)
+ {
+ // TODO.
+ }
+ else
+ {
+ for (int bit = 0; bit < 7; bit++)
+ {
+ Operand pred = Register(bit, RegisterType.Predicate);
+
+ Operand res = context.ConditionalSelect(Test(mask, bit), Test(value, bit + shift), pred);
+
+ context.Copy(pred, res);
+ }
+ }
+ }
+
public static void S2r(EmitterContext context)
{
// TODO: Better impl.