mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-28 02:14:08 +00:00
Remove MultiRange Min/MaxAddress and rename GetSlice to Slice (#4566)
* Delete MinAddress and MaxAddress from MultiRange * Rename MultiRange.GetSlice to MultiRange.Slice
This commit is contained in:
parent
c05c688ee8
commit
67b4e63cff
3 changed files with 8 additions and 44 deletions
|
@ -1475,8 +1475,8 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||||
|
|
||||||
MultiRange otherRange = texture.Range;
|
MultiRange otherRange = texture.Range;
|
||||||
|
|
||||||
IEnumerable<MultiRange> regions = _sizeInfo.AllRegions().Select((region) => Range.GetSlice((ulong)region.Offset, (ulong)region.Size));
|
IEnumerable<MultiRange> regions = _sizeInfo.AllRegions().Select((region) => Range.Slice((ulong)region.Offset, (ulong)region.Size));
|
||||||
IEnumerable<MultiRange> otherRegions = texture._sizeInfo.AllRegions().Select((region) => otherRange.GetSlice((ulong)region.Offset, (ulong)region.Size));
|
IEnumerable<MultiRange> otherRegions = texture._sizeInfo.AllRegions().Select((region) => otherRange.Slice((ulong)region.Offset, (ulong)region.Size));
|
||||||
|
|
||||||
foreach (MultiRange region in regions)
|
foreach (MultiRange region in regions)
|
||||||
{
|
{
|
||||||
|
|
|
@ -397,7 +397,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||||
int endOffset = Math.Min(spanLast + _sliceSizes[endInfo.BaseLevel + endInfo.Levels - 1], (int)Storage.Size);
|
int endOffset = Math.Min(spanLast + _sliceSizes[endInfo.BaseLevel + endInfo.Levels - 1], (int)Storage.Size);
|
||||||
int size = endOffset - spanBase;
|
int size = endOffset - spanBase;
|
||||||
|
|
||||||
dataSpan = _physicalMemory.GetSpan(Storage.Range.GetSlice((ulong)spanBase, (ulong)size));
|
dataSpan = _physicalMemory.GetSpan(Storage.Range.Slice((ulong)spanBase, (ulong)size));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only one of these will be greater than 1, as partial sync is only called when there are sub-image views.
|
// Only one of these will be greater than 1, as partial sync is only called when there are sub-image views.
|
||||||
|
@ -473,7 +473,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||||
int endOffset = Math.Min(offset + _sliceSizes[level], (int)Storage.Size);
|
int endOffset = Math.Min(offset + _sliceSizes[level], (int)Storage.Size);
|
||||||
int size = endOffset - offset;
|
int size = endOffset - offset;
|
||||||
|
|
||||||
using WritableRegion region = _physicalMemory.GetWritableRegion(Storage.Range.GetSlice((ulong)offset, (ulong)size), tracked);
|
using WritableRegion region = _physicalMemory.GetWritableRegion(Storage.Range.Slice((ulong)offset, (ulong)size), tracked);
|
||||||
|
|
||||||
Storage.GetTextureDataSliceFromGpu(region.Memory.Span, layer, level, tracked, texture);
|
Storage.GetTextureDataSliceFromGpu(region.Memory.Span, layer, level, tracked, texture);
|
||||||
}
|
}
|
||||||
|
@ -1419,13 +1419,13 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||||
for (int i = 0; i < _allOffsets.Length; i++)
|
for (int i = 0; i < _allOffsets.Length; i++)
|
||||||
{
|
{
|
||||||
(int layer, int level) = GetLayerLevelForView(i);
|
(int layer, int level) = GetLayerLevelForView(i);
|
||||||
MultiRange handleRange = Storage.Range.GetSlice((ulong)_allOffsets[i], 1);
|
MultiRange handleRange = Storage.Range.Slice((ulong)_allOffsets[i], 1);
|
||||||
ulong handleBase = handleRange.GetSubRange(0).Address;
|
ulong handleBase = handleRange.GetSubRange(0).Address;
|
||||||
|
|
||||||
for (int j = 0; j < other._handles.Length; j++)
|
for (int j = 0; j < other._handles.Length; j++)
|
||||||
{
|
{
|
||||||
(int otherLayer, int otherLevel) = other.GetLayerLevelForView(j);
|
(int otherLayer, int otherLevel) = other.GetLayerLevelForView(j);
|
||||||
MultiRange otherHandleRange = other.Storage.Range.GetSlice((ulong)other._allOffsets[j], 1);
|
MultiRange otherHandleRange = other.Storage.Range.Slice((ulong)other._allOffsets[j], 1);
|
||||||
ulong otherHandleBase = otherHandleRange.GetSubRange(0).Address;
|
ulong otherHandleBase = otherHandleRange.GetSubRange(0).Address;
|
||||||
|
|
||||||
if (handleBase == otherHandleBase)
|
if (handleBase == otherHandleBase)
|
||||||
|
@ -1502,7 +1502,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||||
// Handles list is not modified by another thread, only replaced, so this is thread safe.
|
// Handles list is not modified by another thread, only replaced, so this is thread safe.
|
||||||
// Remove modified flags from all overlapping handles, so that the textures don't flush to unmapped/remapped GPU memory.
|
// Remove modified flags from all overlapping handles, so that the textures don't flush to unmapped/remapped GPU memory.
|
||||||
|
|
||||||
MultiRange subRange = Storage.Range.GetSlice((ulong)handle.Offset, (ulong)handle.Size);
|
MultiRange subRange = Storage.Range.Slice((ulong)handle.Offset, (ulong)handle.Size);
|
||||||
|
|
||||||
if (range.OverlapsWith(subRange))
|
if (range.OverlapsWith(subRange))
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,16 +20,6 @@ namespace Ryujinx.Memory.Range
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Count => HasSingleRange ? 1 : _ranges.Length;
|
public int Count => HasSingleRange ? 1 : _ranges.Length;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Minimum start address of all sub-ranges.
|
|
||||||
/// </summary>
|
|
||||||
public ulong MinAddress { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Maximum end address of all sub-ranges.
|
|
||||||
/// </summary>
|
|
||||||
public ulong MaxAddress { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new multi-range with a single physical region.
|
/// Creates a new multi-range with a single physical region.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -39,8 +29,6 @@ namespace Ryujinx.Memory.Range
|
||||||
{
|
{
|
||||||
_singleRange = new MemoryRange(address, size);
|
_singleRange = new MemoryRange(address, size);
|
||||||
_ranges = null;
|
_ranges = null;
|
||||||
MinAddress = address;
|
|
||||||
MaxAddress = address + size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -52,30 +40,6 @@ namespace Ryujinx.Memory.Range
|
||||||
{
|
{
|
||||||
_singleRange = MemoryRange.Empty;
|
_singleRange = MemoryRange.Empty;
|
||||||
_ranges = ranges ?? throw new ArgumentNullException(nameof(ranges));
|
_ranges = ranges ?? throw new ArgumentNullException(nameof(ranges));
|
||||||
|
|
||||||
if (ranges.Length != 0)
|
|
||||||
{
|
|
||||||
MinAddress = ulong.MaxValue;
|
|
||||||
MaxAddress = 0UL;
|
|
||||||
|
|
||||||
foreach (MemoryRange range in ranges)
|
|
||||||
{
|
|
||||||
if (MinAddress > range.Address)
|
|
||||||
{
|
|
||||||
MinAddress = range.Address;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (MaxAddress < range.EndAddress)
|
|
||||||
{
|
|
||||||
MaxAddress = range.EndAddress;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MinAddress = 0UL;
|
|
||||||
MaxAddress = 0UL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -84,7 +48,7 @@ namespace Ryujinx.Memory.Range
|
||||||
/// <param name="offset">Offset of the slice into the multi-range in bytes</param>
|
/// <param name="offset">Offset of the slice into the multi-range in bytes</param>
|
||||||
/// <param name="size">Size of the slice in bytes</param>
|
/// <param name="size">Size of the slice in bytes</param>
|
||||||
/// <returns>A new multi-range representing the given slice of this one</returns>
|
/// <returns>A new multi-range representing the given slice of this one</returns>
|
||||||
public MultiRange GetSlice(ulong offset, ulong size)
|
public MultiRange Slice(ulong offset, ulong size)
|
||||||
{
|
{
|
||||||
if (HasSingleRange)
|
if (HasSingleRange)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue