ShaderDecodeFlow.cs 2.1 KB

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