diff options
| author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2018-08-31 13:14:04 -0300 |
|---|---|---|
| committer | gdkchan <gab.dark.100@gmail.com> | 2018-08-31 13:14:04 -0300 |
| commit | 42dc925c3da59bf8801b14779482ee5bd9c25dc0 (patch) | |
| tree | 6134135c08fe81414297b75fbf6e1a7479742d07 /Ryujinx.Graphics/Gal/Shader/ShaderDecoder.cs | |
| parent | 7cb6fd8090513b703da9b83dec04866647694f09 (diff) | |
Implement SSY/SYNC shader instructions (#382)
* Use a program counter to control shaders' flow
* Cleanup
* Implement SSY/SYNC
* Address feedback
* Fixup commentary
* Fixup Ssy instruction
Diffstat (limited to 'Ryujinx.Graphics/Gal/Shader/ShaderDecoder.cs')
| -rw-r--r-- | Ryujinx.Graphics/Gal/Shader/ShaderDecoder.cs | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/Ryujinx.Graphics/Gal/Shader/ShaderDecoder.cs b/Ryujinx.Graphics/Gal/Shader/ShaderDecoder.cs index 98f371b5..81d8f312 100644 --- a/Ryujinx.Graphics/Gal/Shader/ShaderDecoder.cs +++ b/Ryujinx.Graphics/Gal/Shader/ShaderDecoder.cs @@ -50,17 +50,29 @@ namespace Ryujinx.Graphics.Gal.Shader { ShaderIrNode LastNode = Current.GetLastNode(); - ShaderIrOp Op = GetInnermostOp(LastNode); + ShaderIrOp InnerOp = GetInnermostOp(LastNode); - if (Op?.Inst == ShaderIrInst.Bra) + if (InnerOp?.Inst == ShaderIrInst.Bra) { - int Offset = ((ShaderIrOperImm)Op.OperandA).Value; + int Offset = ((ShaderIrOperImm)InnerOp.OperandA).Value; long Target = Current.EndPosition + Offset; Current.Branch = Enqueue(Target, Current); } + foreach (ShaderIrNode Node in Current.Nodes) + { + if (Node is ShaderIrOp CurrOp && CurrOp.Inst == ShaderIrInst.Ssy) + { + int Offset = ((ShaderIrOperImm)CurrOp.OperandA).Value; + + long Target = Offset; + + Current.Branch = Enqueue(Target, Current); + } + } + if (NodeHasNext(LastNode)) { Current.Next = Enqueue(Current.EndPosition); @@ -157,7 +169,7 @@ namespace Ryujinx.Graphics.Gal.Shader { int Offset = ((int)(OpCode >> 20) << 8) >> 8; - long Target = Position + Offset; + long Target = Position + Offset - Beginning; DbgOpCode += " (0x" + Target.ToString("x16") + ")"; } @@ -170,7 +182,7 @@ namespace Ryujinx.Graphics.Gal.Shader continue; } - Decode(Block, OpCode); + Decode(Block, OpCode, Position); } while (!IsFlowChange(Block.GetLastNode())); |
