aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Shader/Decoders/Decoder.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Graphics.Shader/Decoders/Decoder.cs')
-rw-r--r--Ryujinx.Graphics.Shader/Decoders/Decoder.cs15
1 files changed, 14 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;