diff options
author | gdkchan <gab.dark.100@gmail.com> | 2021-08-11 15:59:42 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-11 20:59:42 +0200 |
commit | d9d18439f6900fd9f05bde41998526281f7638c5 (patch) | |
tree | 14e8cd74e10ca9c92d1b85ccf17cecad00e3a8f7 /Ryujinx.Graphics.Shader/Decoders/Block.cs | |
parent | 70f79e689bc947313aab11c41e59928ce43be517 (diff) |
Use a new approach for shader BRX targets (#2532)
* Use a new approach for shader BRX targets
* Make shader cache actually work
* Improve the shader pattern matching a bit
* Extend LDC search to predecessor blocks, catches more cases
* Nit
* Only save the amount of constant buffer data actually used. Avoids crashes on partially mapped buffers
* Ignore Rd on predicate instructions, as they do not have a Rd register (catches more cases)
Diffstat (limited to 'Ryujinx.Graphics.Shader/Decoders/Block.cs')
-rw-r--r-- | Ryujinx.Graphics.Shader/Decoders/Block.cs | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/Ryujinx.Graphics.Shader/Decoders/Block.cs b/Ryujinx.Graphics.Shader/Decoders/Block.cs index e1470237..69cb55b9 100644 --- a/Ryujinx.Graphics.Shader/Decoders/Block.cs +++ b/Ryujinx.Graphics.Shader/Decoders/Block.cs @@ -8,10 +8,38 @@ namespace Ryujinx.Graphics.Shader.Decoders public ulong Address { get; set; } public ulong EndAddress { get; set; } - public Block Next { get; set; } - public Block Branch { get; set; } + private Block _next; + private Block _branch; - public OpCodeBranchIndir BrIndir { get; set; } + public Block Next + { + get + { + return _next; + } + set + { + _next?.Predecessors.Remove(this); + value?.Predecessors.Add(this); + _next = value; + } + } + + public Block Branch + { + get + { + return _branch; + } + set + { + _branch?.Predecessors.Remove(this); + value?.Predecessors.Add(this); + _branch = value; + } + } + + public HashSet<Block> Predecessors { get; } public List<OpCode> OpCodes { get; } public List<OpCodePush> PushOpCodes { get; } @@ -20,6 +48,8 @@ namespace Ryujinx.Graphics.Shader.Decoders { Address = address; + Predecessors = new HashSet<Block>(); + OpCodes = new List<OpCode>(); PushOpCodes = new List<OpCodePush>(); } |