aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Shader/Instructions/InstEmitVote.cs
diff options
context:
space:
mode:
authorgdk <gab.dark.100@gmail.com>2019-11-08 17:29:41 -0300
committerThog <thog@protonmail.com>2020-01-09 02:13:00 +0100
commit769c02235f489f02b1791e6e76dc8b3ab18028ee (patch)
treeef0a2ffc5030360d5cef78e7c67e131e44348d50 /Ryujinx.Graphics.Shader/Instructions/InstEmitVote.cs
parent1e8bc29f32cde08616175f8f87405dfa7b8c4025 (diff)
Add ATOMS, LDS, POPC, RED, STS and VOTE shader instructions, start changing the way how global memory is handled
Diffstat (limited to 'Ryujinx.Graphics.Shader/Instructions/InstEmitVote.cs')
-rw-r--r--Ryujinx.Graphics.Shader/Instructions/InstEmitVote.cs48
1 files changed, 48 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.Shader/Instructions/InstEmitVote.cs b/Ryujinx.Graphics.Shader/Instructions/InstEmitVote.cs
new file mode 100644
index 00000000..9c4d5f1a
--- /dev/null
+++ b/Ryujinx.Graphics.Shader/Instructions/InstEmitVote.cs
@@ -0,0 +1,48 @@
+using Ryujinx.Graphics.Shader.Decoders;
+using Ryujinx.Graphics.Shader.IntermediateRepresentation;
+using Ryujinx.Graphics.Shader.Translation;
+
+using static Ryujinx.Graphics.Shader.Instructions.InstEmitHelper;
+using static Ryujinx.Graphics.Shader.IntermediateRepresentation.OperandHelper;
+
+namespace Ryujinx.Graphics.Shader.Instructions
+{
+ static partial class InstEmit
+ {
+ public static void Vote(EmitterContext context)
+ {
+ OpCodeVote op = (OpCodeVote)context.CurrOp;
+
+ Operand pred = GetPredicate39(context);
+
+ Operand res = null;
+
+ switch (op.VoteOp)
+ {
+ case VoteOp.All:
+ res = context.VoteAll(pred);
+ break;
+ case VoteOp.Any:
+ res = context.VoteAny(pred);
+ break;
+ case VoteOp.AllEqual:
+ res = context.VoteAllEqual(pred);
+ break;
+ }
+
+ if (res != null)
+ {
+ context.Copy(Register(op.Predicate45), res);
+ }
+ else
+ {
+ // Invalid.
+ }
+
+ if (!op.Rd.IsRZ)
+ {
+ context.Copy(Register(op.Rd), context.Ballot(pred));
+ }
+ }
+ }
+} \ No newline at end of file