ShaderDecodeFlow.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using System;
  2. namespace Ryujinx.Graphics.Gal.Shader
  3. {
  4. static partial class ShaderDecode
  5. {
  6. public static void Bra(ShaderIrBlock Block, long OpCode, int Position)
  7. {
  8. if ((OpCode & 0x20) != 0)
  9. {
  10. //This reads the target offset from the constant buffer.
  11. //Almost impossible to support with GLSL.
  12. throw new NotImplementedException();
  13. }
  14. ShaderIrOperImm Imm = new ShaderIrOperImm(Position + OpCode.Branch());
  15. Block.AddNode(OpCode.PredNode(new ShaderIrOp(ShaderIrInst.Bra, Imm)));
  16. }
  17. public static void Exit(ShaderIrBlock Block, long OpCode, int Position)
  18. {
  19. int CCode = (int)OpCode & 0x1f;
  20. //TODO: Figure out what the other condition codes mean...
  21. if (CCode == 0xf)
  22. {
  23. Block.AddNode(OpCode.PredNode(new ShaderIrOp(ShaderIrInst.Exit)));
  24. }
  25. }
  26. public static void Kil(ShaderIrBlock Block, long OpCode, int Position)
  27. {
  28. Block.AddNode(OpCode.PredNode(new ShaderIrOp(ShaderIrInst.Kil)));
  29. }
  30. public static void Ssy(ShaderIrBlock Block, long OpCode, int Position)
  31. {
  32. if ((OpCode & 0x20) != 0)
  33. {
  34. //This reads the target offset from the constant buffer.
  35. //Almost impossible to support with GLSL.
  36. throw new NotImplementedException();
  37. }
  38. ShaderIrOperImm Imm = new ShaderIrOperImm(Position + OpCode.Branch());
  39. Block.AddNode(new ShaderIrOp(ShaderIrInst.Ssy, Imm));
  40. }
  41. public static void Sync(ShaderIrBlock Block, long OpCode, int Position)
  42. {
  43. //TODO: Implement Sync condition codes
  44. Block.AddNode(OpCode.PredNode(new ShaderIrOp(ShaderIrInst.Sync)));
  45. }
  46. }
  47. }