diff options
author | gdkchan <gab.dark.100@gmail.com> | 2022-02-22 13:34:16 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-22 13:34:16 -0300 |
commit | 0a24aa6af26cc55c079e265a071a42569d28d2c0 (patch) | |
tree | c0652d606c253f3575cf33b592d2ae3d34b71000 /Ryujinx.Memory/Range/MultiRangeList.cs | |
parent | c9c65af59edea05e7206a076cb818128c004384e (diff) |
Allow textures to have their data partially mapped (#2629)1.1.52
* Allow textures to have their data partially mapped
* Explicitly check for invalid memory ranges on the MultiRangeList
* Update GetWritableRegion to also support unmapped ranges
Diffstat (limited to 'Ryujinx.Memory/Range/MultiRangeList.cs')
-rw-r--r-- | Ryujinx.Memory/Range/MultiRangeList.cs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Ryujinx.Memory/Range/MultiRangeList.cs b/Ryujinx.Memory/Range/MultiRangeList.cs index 38ca63b4..5131889f 100644 --- a/Ryujinx.Memory/Range/MultiRangeList.cs +++ b/Ryujinx.Memory/Range/MultiRangeList.cs @@ -29,6 +29,12 @@ namespace Ryujinx.Memory.Range for (int i = 0; i < range.Count; i++) { var subrange = range.GetSubRange(i); + + if (IsInvalid(ref subrange)) + { + continue; + } + _items.Add(subrange.Address, subrange.EndAddress, item); } @@ -49,6 +55,12 @@ namespace Ryujinx.Memory.Range for (int i = 0; i < range.Count; i++) { var subrange = range.GetSubRange(i); + + if (IsInvalid(ref subrange)) + { + continue; + } + removed += _items.Remove(subrange.Address, item); } @@ -86,6 +98,12 @@ namespace Ryujinx.Memory.Range for (int i = 0; i < range.Count; i++) { var subrange = range.GetSubRange(i); + + if (IsInvalid(ref subrange)) + { + continue; + } + overlapCount = _items.Get(subrange.Address, subrange.EndAddress, ref output, overlapCount); } @@ -125,6 +143,17 @@ namespace Ryujinx.Memory.Range } /// <summary> + /// Checks if a given sub-range of memory is invalid. + /// Those are used to represent unmapped memory regions (holes in the region mapping). + /// </summary> + /// <param name="subRange">Memory range to checl</param> + /// <returns>True if the memory range is considered invalid, false otherwise</returns> + private static bool IsInvalid(ref MemoryRange subRange) + { + return subRange.Address == ulong.MaxValue; + } + + /// <summary> /// Gets all items on the list starting at the specified memory address. /// </summary> /// <param name="baseAddress">Base address to find</param> |