diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2020-08-29 16:42:34 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-29 16:42:34 -0300 |
| commit | 09341dc11d88de39b2b4fb990ec730b4d57f8b0a (patch) | |
| tree | f1c6b39c6a5a27de49bb8a063ec64ec34940d849 | |
| parent | 000ba5f7cc2509086cbebbcfb1415f2beebe5f22 (diff) | |
Fix off by one error in pages count calculation on GPU pool (#1511)
| -rw-r--r-- | Ryujinx.Graphics.Gpu/Image/Pool.cs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Ryujinx.Graphics.Gpu/Image/Pool.cs b/Ryujinx.Graphics.Gpu/Image/Pool.cs index 8796894c..0abf6824 100644 --- a/Ryujinx.Graphics.Gpu/Image/Pool.cs +++ b/Ryujinx.Graphics.Gpu/Image/Pool.cs @@ -1,3 +1,4 @@ +using Ryujinx.Common; using Ryujinx.Graphics.Gpu.Memory; using System; @@ -49,7 +50,11 @@ namespace Ryujinx.Graphics.Gpu.Image Address = address; Size = size; - _modifiedRanges = new (ulong, ulong)[size / PhysicalMemory.PageSize]; + ulong endAddress = BitUtils.AlignUp(Address + Size, PhysicalMemory.PageSize); + + ulong pagesCount = (endAddress - BitUtils.AlignDown(Address, PhysicalMemory.PageSize)) / PhysicalMemory.PageSize; + + _modifiedRanges = new (ulong, ulong)[pagesCount]; } /// <summary> |
