Match texture if the physical range is the same (#1934)
* Match texture if the physical range is the same * XML docs and comments
This commit is contained in:
parent
6982282cc8
commit
f565b0e5a6
2 changed files with 53 additions and 6 deletions
|
@ -343,6 +343,39 @@ namespace Ryujinx.Graphics.Gpu.Memory
|
|||
return new MultiRange(regions.ToArray());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if a given GPU virtual memory range is mapped to the same physical regions
|
||||
/// as the specified physical memory multi-range.
|
||||
/// </summary>
|
||||
/// <param name="range">Physical memory multi-range</param>
|
||||
/// <param name="va">GPU virtual memory address</param>
|
||||
/// <returns>True if the virtual memory region is mapped into the specified physical one, false otherwise</returns>
|
||||
public bool CompareRange(MultiRange range, ulong va)
|
||||
{
|
||||
va &= ~PageMask;
|
||||
|
||||
for (int i = 0; i < range.Count; i++)
|
||||
{
|
||||
MemoryRange currentRange = range.GetSubRange(i);
|
||||
|
||||
ulong address = currentRange.Address & ~PageMask;
|
||||
ulong endAddress = (currentRange.EndAddress + PageMask) & ~PageMask;
|
||||
|
||||
while (address < endAddress)
|
||||
{
|
||||
if (Translate(va) != address)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
va += PageSize;
|
||||
address += PageSize;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Validates a GPU virtual address.
|
||||
/// </summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue