Refactor shader GPU state and memory access (#1203)

* Refactor shader GPU state and memory access

* Fix NVDEC project build

* Address PR feedback and add missing XML comments
This commit is contained in:
gdkchan 2020-05-05 22:02:28 -03:00 committed by GitHub
parent 7f500e7cae
commit b8eb6abecc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 633 additions and 684 deletions

View file

@ -240,28 +240,6 @@ namespace Ryujinx.Graphics.Gpu.Memory
return PteUnmapped;
}
/// <summary>
/// Gets the number of mapped or reserved pages on a given region.
/// </summary>
/// <param name="gpuVa">Start GPU virtual address of the region</param>
/// <param name="maxSize">Maximum size of the data</param>
/// <returns>Mapped size in bytes of the specified region</returns>
internal ulong GetSubSize(ulong gpuVa, ulong maxSize)
{
ulong size = 0;
while (GetPte(gpuVa + size) != PteUnmapped)
{
size += PageSize;
if (size >= maxSize)
{
return maxSize;
}
}
return size;
}
/// <summary>
/// Translates a GPU virtual address to a CPU virtual address.
/// </summary>
@ -279,25 +257,6 @@ namespace Ryujinx.Graphics.Gpu.Memory
return baseAddress + (gpuVa & PageMask);
}
/// <summary>
/// Checks if a given memory region is currently unmapped.
/// </summary>
/// <param name="gpuVa">Start GPU virtual address of the region</param>
/// <param name="size">Size in bytes of the region</param>
/// <returns>True if the region is unmapped (free), false otherwise</returns>
public bool IsRegionFree(ulong gpuVa, ulong size)
{
for (ulong offset = 0; offset < size; offset += PageSize)
{
if (IsPageInUse(gpuVa + offset))
{
return false;
}
}
return true;
}
/// <summary>
/// Checks if a given memory page is mapped or reserved.
/// </summary>