Improve BRX target detection heuristics (#1591)
This commit is contained in:
parent
86412ed30a
commit
0954e76a26
4 changed files with 39 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue