diff options
| author | gdk <gab.dark.100@gmail.com> | 2019-11-24 19:49:56 -0300 |
|---|---|---|
| committer | Thog <thog@protonmail.com> | 2020-01-09 02:13:00 +0100 |
| commit | e0c95b18eb225d62301b8e3c3fe9d4f689381100 (patch) | |
| tree | b59631ab491dfef70fdde3c2575a6dbe2edf3ee3 /Ryujinx.Graphics.Shader/Instructions | |
| parent | 73e68edd09cc322579ec832576f766c836851fdf (diff) | |
Add PSET shader instruction
Diffstat (limited to 'Ryujinx.Graphics.Shader/Instructions')
| -rw-r--r-- | Ryujinx.Graphics.Shader/Instructions/InstEmitAlu.cs | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/Ryujinx.Graphics.Shader/Instructions/InstEmitAlu.cs b/Ryujinx.Graphics.Shader/Instructions/InstEmitAlu.cs index 31375e43..1f6f389d 100644 --- a/Ryujinx.Graphics.Shader/Instructions/InstEmitAlu.cs +++ b/Ryujinx.Graphics.Shader/Instructions/InstEmitAlu.cs @@ -58,7 +58,7 @@ namespace Ryujinx.Graphics.Shader.Instructions public static void Csetp(EmitterContext context) { - OpCodePsetp op = (OpCodePsetp)context.CurrOp; + OpCodePset op = (OpCodePset)context.CurrOp; // TODO: Implement that properly @@ -381,15 +381,38 @@ namespace Ryujinx.Graphics.Shader.Instructions context.Copy(GetDest(context), res); } - public static void Psetp(EmitterContext context) + public static void Pset(EmitterContext context) { - OpCodePsetp op = (OpCodePsetp)context.CurrOp; + OpCodePset op = (OpCodePset)context.CurrOp; + + bool boolFloat = op.RawOpCode.Extract(44); + + Operand srcA = context.BitwiseNot(Register(op.Predicate12), op.InvertA); + Operand srcB = context.BitwiseNot(Register(op.Predicate29), op.InvertB); + Operand srcC = context.BitwiseNot(Register(op.Predicate39), op.InvertP); + + Operand res = GetPredLogicalOp(context, op.LogicalOpAB, srcA, srcB); + + res = GetPredLogicalOp(context, op.LogicalOp, res, srcC); + + Operand dest = GetDest(context); + + if (boolFloat) + { + context.Copy(dest, context.ConditionalSelect(res, ConstF(1), Const(0))); + } + else + { + context.Copy(dest, res); + } + } - bool invertA = op.RawOpCode.Extract(15); - bool invertB = op.RawOpCode.Extract(32); + public static void Psetp(EmitterContext context) + { + OpCodePset op = (OpCodePset)context.CurrOp; - Operand srcA = context.BitwiseNot(Register(op.Predicate12), invertA); - Operand srcB = context.BitwiseNot(Register(op.Predicate29), invertB); + Operand srcA = context.BitwiseNot(Register(op.Predicate12), op.InvertA); + Operand srcB = context.BitwiseNot(Register(op.Predicate29), op.InvertB); Operand p0Res = GetPredLogicalOp(context, op.LogicalOpAB, srcA, srcB); |
