diff options
Diffstat (limited to 'Ryujinx.Graphics.Shader')
| -rw-r--r-- | Ryujinx.Graphics.Shader/Decoders/Decoder.cs | 15 | ||||
| -rw-r--r-- | Ryujinx.Graphics.Shader/IGpuAccessor.cs | 5 |
2 files changed, 19 insertions, 1 deletions
diff --git a/Ryujinx.Graphics.Shader/Decoders/Decoder.cs b/Ryujinx.Graphics.Shader/Decoders/Decoder.cs index e2c9212b..a15d7f9e 100644 --- a/Ryujinx.Graphics.Shader/Decoders/Decoder.cs +++ b/Ryujinx.Graphics.Shader/Decoders/Decoder.cs @@ -128,7 +128,7 @@ namespace Ryujinx.Graphics.Shader.Decoders } // Do we have a block after the current one? - if (!IsExit(currBlock.GetLastOp()) && currBlock.BrIndir != null) + if (currBlock.BrIndir != null && HasBlockAfter(gpuAccessor, currBlock, startAddress)) { bool targetVisited = visited.ContainsKey(currBlock.EndAddress); @@ -154,6 +154,19 @@ namespace Ryujinx.Graphics.Shader.Decoders return blocks.ToArray(); } + private static bool HasBlockAfter(IGpuAccessor gpuAccessor, Block currBlock, ulong startAdddress) + { + if (!gpuAccessor.MemoryMapped(startAdddress + currBlock.EndAddress) || + !gpuAccessor.MemoryMapped(startAdddress + currBlock.EndAddress + 7)) + { + return false; + } + + ulong inst = gpuAccessor.MemoryRead<ulong>(startAdddress + currBlock.EndAddress); + + return inst != 0UL; + } + private static bool BinarySearch(List<Block> blocks, ulong address, out int index) { index = 0; diff --git a/Ryujinx.Graphics.Shader/IGpuAccessor.cs b/Ryujinx.Graphics.Shader/IGpuAccessor.cs index e10d869b..59069302 100644 --- a/Ryujinx.Graphics.Shader/IGpuAccessor.cs +++ b/Ryujinx.Graphics.Shader/IGpuAccessor.cs @@ -9,6 +9,11 @@ T MemoryRead<T>(ulong address) where T : unmanaged; + public bool MemoryMapped(ulong address) + { + return true; + } + public int QueryComputeLocalSizeX() { return 1; |
