diff options
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Image')
| -rw-r--r-- | Ryujinx.Graphics.Gpu/Image/Pool.cs | 15 | ||||
| -rw-r--r-- | Ryujinx.Graphics.Gpu/Image/Texture.cs | 12 |
2 files changed, 20 insertions, 7 deletions
diff --git a/Ryujinx.Graphics.Gpu/Image/Pool.cs b/Ryujinx.Graphics.Gpu/Image/Pool.cs index 7cf06d0b..8796894c 100644 --- a/Ryujinx.Graphics.Gpu/Image/Pool.cs +++ b/Ryujinx.Graphics.Gpu/Image/Pool.cs @@ -33,6 +33,8 @@ namespace Ryujinx.Graphics.Gpu.Image /// </summary> public ulong Size { get; } + private readonly (ulong, ulong)[] _modifiedRanges; + public Pool(GpuContext context, ulong address, int maximumId) { Context = context; @@ -46,6 +48,8 @@ namespace Ryujinx.Graphics.Gpu.Image Address = address; Size = size; + + _modifiedRanges = new (ulong, ulong)[size / PhysicalMemory.PageSize]; } /// <summary> @@ -62,11 +66,11 @@ namespace Ryujinx.Graphics.Gpu.Image /// </summary> public void SynchronizeMemory() { - (ulong, ulong)[] modifiedRanges = Context.PhysicalMemory.GetModifiedRanges(Address, Size, ResourceName.TexturePool); + int count = Context.PhysicalMemory.QueryModified(Address, Size, ResourceName.TexturePool, _modifiedRanges); - for (int index = 0; index < modifiedRanges.Length; index++) + for (int index = 0; index < count; index++) { - (ulong mAddress, ulong mSize) = modifiedRanges[index]; + (ulong mAddress, ulong mSize) = _modifiedRanges[index]; if (mAddress < Address) { @@ -84,6 +88,11 @@ namespace Ryujinx.Graphics.Gpu.Image } } + private void InvalidateRangeInternal(ulong offset, int size) + { + InvalidateRangeImpl(Address + offset, (ulong)size); + } + /// <summary> /// Invalidates a range of memory of the GPU resource pool. /// Entries that falls inside the speicified range will be invalidated, diff --git a/Ryujinx.Graphics.Gpu/Image/Texture.cs b/Ryujinx.Graphics.Gpu/Image/Texture.cs index d02c3665..9554bc6b 100644 --- a/Ryujinx.Graphics.Gpu/Image/Texture.cs +++ b/Ryujinx.Graphics.Gpu/Image/Texture.cs @@ -78,6 +78,8 @@ namespace Ryujinx.Graphics.Gpu.Image /// </summary> public ulong Size => (ulong)_sizeInfo.TotalSize; + private (ulong, ulong)[] _modifiedRanges; + private int _referenceCount; private int _sequenceNumber; @@ -133,6 +135,8 @@ namespace Ryujinx.Graphics.Gpu.Image _context = context; _sizeInfo = sizeInfo; + _modifiedRanges = new (ulong, ulong)[(sizeInfo.TotalSize / PhysicalMemory.PageSize) + 1]; + SetInfo(info); _viewStorage = this; @@ -304,9 +308,9 @@ namespace Ryujinx.Graphics.Gpu.Image _sequenceNumber = _context.SequenceNumber; - (ulong, ulong)[] modifiedRanges = _context.PhysicalMemory.GetModifiedRanges(Address, Size, ResourceName.Texture); + int modifiedCount = _context.PhysicalMemory.QueryModified(Address, Size, ResourceName.Texture, _modifiedRanges); - if (modifiedRanges.Length == 0 && _hasData) + if (modifiedCount == 0 && _hasData) { return; } @@ -325,9 +329,9 @@ namespace Ryujinx.Graphics.Gpu.Image ulong endAddress = Address + Size; - for (int i = 0; i < modifiedRanges.Length; i++) + for (int i = 0; i < modifiedCount; i++) { - (ulong modifiedAddress, ulong modifiedSize) = modifiedRanges[i]; + (ulong modifiedAddress, ulong modifiedSize) = _modifiedRanges[i]; ulong endModifiedAddress = modifiedAddress + modifiedSize; |
