Skip to content

Commit

Permalink
Fix off by one error in pages count calculation on GPU pool (#1511)
Browse files Browse the repository at this point in the history
  • Loading branch information
gdkchan authored Aug 29, 2020
1 parent 000ba5f commit 09341dc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Ryujinx.Graphics.Gpu/Image/Pool.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Ryujinx.Common;
using Ryujinx.Graphics.Gpu.Memory;
using System;

Expand Down Expand Up @@ -49,7 +50,11 @@ public Pool(GpuContext context, ulong address, int maximumId)
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>
Expand Down

0 comments on commit 09341dc

Please sign in to comment.