diff options
| author | riperiperi <rhy3756547@hotmail.com> | 2021-09-19 13:22:26 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-19 14:22:26 +0200 |
| commit | 7379bc2f39557929f283a423fe7f4b7390d08261 (patch) | |
| tree | 5fef97c385bbc3daae29923ecc19dc084e88fdfd /Ryujinx.Memory/WindowsShared/EmulatedSharedMemoryWindows.cs | |
| parent | b0af010247a2bc1d9af1fb1068d4fad0319ad216 (diff) | |
Array based RangeList that caches Address/EndAddress (#2642)
* Array based RangeList that caches Address/EndAddress
In isolation, this was more than 2x faster than the RangeList that checks using the interface. In practice I'm seeing much better results than I expected. The array is used because checking it is slightly faster than using a list, which loses time to struct copies, but I still want that data locality.
A method has been added to the list to update the cached end address, as some users of the RangeList currently modify it dynamically.
Greatly improves performance in Super Mario Odyssey, Xenoblade and any other GPU limited games.
* Address Feedback
Diffstat (limited to 'Ryujinx.Memory/WindowsShared/EmulatedSharedMemoryWindows.cs')
| -rw-r--r-- | Ryujinx.Memory/WindowsShared/EmulatedSharedMemoryWindows.cs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/Ryujinx.Memory/WindowsShared/EmulatedSharedMemoryWindows.cs b/Ryujinx.Memory/WindowsShared/EmulatedSharedMemoryWindows.cs index 46399504..1417f7d5 100644 --- a/Ryujinx.Memory/WindowsShared/EmulatedSharedMemoryWindows.cs +++ b/Ryujinx.Memory/WindowsShared/EmulatedSharedMemoryWindows.cs @@ -41,10 +41,12 @@ namespace Ryujinx.Memory.WindowsShared return Address < address + size && address < EndAddress; } - public void ExtendTo(ulong endAddress) + public void ExtendTo(ulong endAddress, RangeList<SharedMemoryMapping> list) { EndAddress = endAddress; Size = endAddress - Address; + + list.UpdateEndAddress(this); } public void AddBlocks(IEnumerable<int> blocks) @@ -300,14 +302,14 @@ namespace Ryujinx.Memory.WindowsShared _mappings.Remove(endOverlap); - startOverlap.ExtendTo(endOverlap.EndAddress); + startOverlap.ExtendTo(endOverlap.EndAddress, _mappings); startOverlap.AddBlocks(blocks); startOverlap.AddBlocks(endOverlap.Blocks); } else if (startOverlap != null) { - startOverlap.ExtendTo(endAddress); + startOverlap.ExtendTo(endAddress, _mappings); startOverlap.AddBlocks(blocks); } @@ -317,7 +319,7 @@ namespace Ryujinx.Memory.WindowsShared if (endOverlap != null) { - mapping.ExtendTo(endOverlap.EndAddress); + mapping.ExtendTo(endOverlap.EndAddress, _mappings); mapping.AddBlocks(endOverlap.Blocks); @@ -381,6 +383,7 @@ namespace Ryujinx.Memory.WindowsShared if (mapping.EndAddress > endAddress) { var newMapping = (SharedMemoryMapping)mapping.Split(endAddress); + _mappings.UpdateEndAddress(mapping); _mappings.Add(newMapping); if ((endAddress & MappingMask) != 0) @@ -400,7 +403,9 @@ namespace Ryujinx.Memory.WindowsShared // If the first region starts before the decommit address, split it by modifying its end address. if (mapping.Address < address) { + var oldMapping = mapping; mapping = (SharedMemoryMapping)mapping.Split(address); + _mappings.UpdateEndAddress(oldMapping); if ((address & MappingMask) != 0) { |
