diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2021-10-12 17:35:31 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-12 22:35:31 +0200 |
| commit | a7109c767bdc014327b574012794156c92174495 (patch) | |
| tree | d7d7db6eaa63d4e3e0396a3182d0267b6ad31dd7 /Ryujinx.Graphics.Shader/Translation/ControlFlowGraph.cs | |
| parent | 0510fde25ae66ec0b55091746a52931248d75b89 (diff) | |
Rewrite shader decoding stage (#2698)
* Rewrite shader decoding stage
* Fix P2R constant buffer encoding
* Fix PSET/PSETP
* PR feedback
* Log unimplemented shader instructions
* Implement NOP
* Remove using
* PR feedback
Diffstat (limited to 'Ryujinx.Graphics.Shader/Translation/ControlFlowGraph.cs')
| -rw-r--r-- | Ryujinx.Graphics.Shader/Translation/ControlFlowGraph.cs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.Shader/Translation/ControlFlowGraph.cs b/Ryujinx.Graphics.Shader/Translation/ControlFlowGraph.cs index fb0535c8..65328fd7 100644 --- a/Ryujinx.Graphics.Shader/Translation/ControlFlowGraph.cs +++ b/Ryujinx.Graphics.Shader/Translation/ControlFlowGraph.cs @@ -129,6 +129,31 @@ namespace Ryujinx.Graphics.Shader.Translation } } + // Remove unreachable blocks. + bool hasUnreachable; + + do + { + hasUnreachable = false; + + for (int blkIndex = 1; blkIndex < blocks.Count; blkIndex++) + { + BasicBlock block = blocks[blkIndex]; + + if (block.Predecessors.Count == 0) + { + block.Next = null; + block.Branch = null; + blocks.RemoveAt(blkIndex--); + hasUnreachable = true; + } + else + { + block.Index = blkIndex; + } + } + } while (hasUnreachable); + return new ControlFlowGraph(blocks.ToArray()); } |
