aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Shader/Instructions
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2020-11-09 21:06:46 -0300
committerGitHub <noreply@github.com>2020-11-10 01:06:46 +0100
commitc3d62bd0783a20efb78fa0776f4c620970774cf9 (patch)
tree9ed3aaf6e7eec9d11e43021633be29f122a1bf4a /Ryujinx.Graphics.Shader/Instructions
parent934a78005e75653529c320cf90e78fe6536447c2 (diff)
Implement ATOM shader instruction (#1687)
* Implement ATOM shader instruction * Fix reduction type decoding
Diffstat (limited to 'Ryujinx.Graphics.Shader/Instructions')
-rw-r--r--Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs38
1 files changed, 36 insertions, 2 deletions
diff --git a/Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs b/Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs
index 2a2c8927..63f9cff7 100644
--- a/Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs
+++ b/Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs
@@ -57,13 +57,47 @@ namespace Ryujinx.Graphics.Shader.Instructions
}
}
+ public static void Atom(EmitterContext context)
+ {
+ OpCodeAtom op = (OpCodeAtom)context.CurrOp;
+
+ ReductionType type = (ReductionType)op.RawOpCode.Extract(49, 2);
+
+ int sOffset = (op.RawOpCode.Extract(28, 20) << 12) >> 12;
+
+ (Operand addrLow, Operand addrHigh) = Get40BitsAddress(context, op.Ra, op.Extended, sOffset);
+
+ Operand value = GetSrcB(context);
+
+ Operand res = EmitAtomicOp(
+ context,
+ Instruction.MrGlobal,
+ op.AtomicOp,
+ type,
+ addrLow,
+ addrHigh,
+ value);
+
+ context.Copy(GetDest(context), res);
+ }
+
public static void Atoms(EmitterContext context)
{
OpCodeAtom op = (OpCodeAtom)context.CurrOp;
+ ReductionType type = op.RawOpCode.Extract(28, 2) switch
+ {
+ 0 => ReductionType.U32,
+ 1 => ReductionType.S32,
+ 2 => ReductionType.U64,
+ _ => ReductionType.S64
+ };
+
Operand offset = context.ShiftRightU32(GetSrcA(context), Const(2));
- offset = context.IAdd(offset, Const(op.Offset));
+ int sOffset = (op.RawOpCode.Extract(30, 22) << 10) >> 10;
+
+ offset = context.IAdd(offset, Const(sOffset));
Operand value = GetSrcB(context);
@@ -71,7 +105,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
context,
Instruction.MrShared,
op.AtomicOp,
- op.Type,
+ type,
offset,
Const(0),
value);