diff options
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Image/Pool.cs')
| -rw-r--r-- | Ryujinx.Graphics.Gpu/Image/Pool.cs | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/Ryujinx.Graphics.Gpu/Image/Pool.cs b/Ryujinx.Graphics.Gpu/Image/Pool.cs index 0abf6824..ff7a783b 100644 --- a/Ryujinx.Graphics.Gpu/Image/Pool.cs +++ b/Ryujinx.Graphics.Gpu/Image/Pool.cs @@ -1,4 +1,5 @@ using Ryujinx.Common; +using Ryujinx.Cpu.Tracking; using Ryujinx.Graphics.Gpu.Memory; using System; @@ -34,7 +35,7 @@ namespace Ryujinx.Graphics.Gpu.Image /// </summary> public ulong Size { get; } - private readonly (ulong, ulong)[] _modifiedRanges; + private readonly CpuMultiRegionHandle _memoryTracking; public Pool(GpuContext context, ulong address, int maximumId) { @@ -50,11 +51,7 @@ namespace Ryujinx.Graphics.Gpu.Image Address = address; Size = size; - ulong endAddress = BitUtils.AlignUp(Address + Size, PhysicalMemory.PageSize); - - ulong pagesCount = (endAddress - BitUtils.AlignDown(Address, PhysicalMemory.PageSize)) / PhysicalMemory.PageSize; - - _modifiedRanges = new (ulong, ulong)[pagesCount]; + _memoryTracking = context.PhysicalMemory.BeginGranularTracking(address, size); } /// <summary> @@ -71,12 +68,8 @@ namespace Ryujinx.Graphics.Gpu.Image /// </summary> public void SynchronizeMemory() { - int count = Context.PhysicalMemory.QueryModified(Address, Size, ResourceName.TexturePool, _modifiedRanges); - - for (int index = 0; index < count; index++) + _memoryTracking.QueryModified((ulong mAddress, ulong mSize) => { - (ulong mAddress, ulong mSize) = _modifiedRanges[index]; - if (mAddress < Address) { mAddress = Address; @@ -90,7 +83,7 @@ namespace Ryujinx.Graphics.Gpu.Image } InvalidateRangeImpl(mAddress, mSize); - } + }); } private void InvalidateRangeInternal(ulong offset, int size) @@ -152,6 +145,7 @@ namespace Ryujinx.Graphics.Gpu.Image Items = null; } + _memoryTracking.Dispose(); } } }
\ No newline at end of file |
