InstEmitVote.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using Ryujinx.Graphics.Shader.Decoders;
  2. using Ryujinx.Graphics.Shader.IntermediateRepresentation;
  3. using Ryujinx.Graphics.Shader.Translation;
  4. using static Ryujinx.Graphics.Shader.Instructions.InstEmitHelper;
  5. using static Ryujinx.Graphics.Shader.IntermediateRepresentation.OperandHelper;
  6. namespace Ryujinx.Graphics.Shader.Instructions
  7. {
  8. static partial class InstEmit
  9. {
  10. public static void Vote(EmitterContext context)
  11. {
  12. OpCodeVote op = (OpCodeVote)context.CurrOp;
  13. Operand pred = GetPredicate39(context);
  14. Operand res = null;
  15. switch (op.VoteOp)
  16. {
  17. case VoteOp.All:
  18. res = context.VoteAll(pred);
  19. break;
  20. case VoteOp.Any:
  21. res = context.VoteAny(pred);
  22. break;
  23. case VoteOp.AllEqual:
  24. res = context.VoteAllEqual(pred);
  25. break;
  26. }
  27. if (res != null)
  28. {
  29. context.Copy(Register(op.Predicate45), res);
  30. }
  31. else
  32. {
  33. context.Config.GpuAccessor.Log($"Invalid vote operation: {op.VoteOp}.");
  34. }
  35. if (!op.Rd.IsRZ)
  36. {
  37. context.Copy(Register(op.Rd), context.Ballot(pred));
  38. }
  39. }
  40. }
  41. }