More flexible memory manager (#307)

* Keep track mapped buffers with fixed offsets

* Started rewriting the memory manager

* Initial support for MapPhysicalMemory and UnmapPhysicalMemory, other tweaks

* MapPhysicalMemory/UnmapPhysicalMemory support, other tweaks

* Rebased

* Optimize the map/unmap physical memory svcs

* Integrate shared font support

* Fix address space reserve alignment

* Some fixes related to gpu memory mapping

* Some cleanup

* Only try uploading const buffers that are really used

* Check if memory region is contiguous

* Rebased

* Add missing count increment on IsRegionModified

* Check for reads/writes outside of the address space, optimize translation with a tail call
This commit is contained in:
gdkchan 2018-08-15 15:59:51 -03:00 committed by GitHub
parent 76d95dee05
commit c393cdf8e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
64 changed files with 3289 additions and 1852 deletions

View file

@ -72,7 +72,7 @@ namespace Ryujinx.HLE.Gpu.Texture
{
long Offset = (uint)Swizzle.GetSwizzleOffset(X, Y);
byte Pixel = CpuMem.ReadByteUnchecked(Position + Offset);
byte Pixel = CpuMem.ReadByte(Position + Offset);
*(BuffPtr + OutOffs) = Pixel;
@ -105,7 +105,7 @@ namespace Ryujinx.HLE.Gpu.Texture
{
long Offset = (uint)Swizzle.GetSwizzleOffset(X, Y);
uint Pixel = (uint)CpuMem.ReadInt16Unchecked(Position + Offset);
uint Pixel = (uint)CpuMem.ReadInt16(Position + Offset);
Pixel = (Pixel & 0x001f) << 11 |
(Pixel & 0x03e0) << 1 |
@ -143,7 +143,7 @@ namespace Ryujinx.HLE.Gpu.Texture
{
long Offset = (uint)Swizzle.GetSwizzleOffset(X, Y);
uint Pixel = (uint)CpuMem.ReadInt16Unchecked(Position + Offset);
uint Pixel = (uint)CpuMem.ReadInt16(Position + Offset);
Pixel = (Pixel & 0x001f) << 11 |
(Pixel & 0x07e0) |
@ -180,7 +180,7 @@ namespace Ryujinx.HLE.Gpu.Texture
{
long Offset = (uint)Swizzle.GetSwizzleOffset(X, Y);
short Pixel = CpuMem.ReadInt16Unchecked(Position + Offset);
short Pixel = CpuMem.ReadInt16(Position + Offset);
*(short*)(BuffPtr + OutOffs) = Pixel;
@ -213,7 +213,7 @@ namespace Ryujinx.HLE.Gpu.Texture
{
long Offset = (uint)Swizzle.GetSwizzleOffset(X, Y);
int Pixel = CpuMem.ReadInt32Unchecked(Position + Offset);
int Pixel = CpuMem.ReadInt32(Position + Offset);
*(int*)(BuffPtr + OutOffs) = Pixel;
@ -246,7 +246,7 @@ namespace Ryujinx.HLE.Gpu.Texture
{
long Offset = (uint)Swizzle.GetSwizzleOffset(X, Y);
long Pixel = CpuMem.ReadInt64Unchecked(Position + Offset);
long Pixel = CpuMem.ReadInt64(Position + Offset);
*(long*)(BuffPtr + OutOffs) = Pixel;
@ -279,8 +279,8 @@ namespace Ryujinx.HLE.Gpu.Texture
{
long Offset = (uint)Swizzle.GetSwizzleOffset(X, Y);
long PxLow = CpuMem.ReadInt64Unchecked(Position + Offset + 0);
long PxHigh = CpuMem.ReadInt64Unchecked(Position + Offset + 8);
long PxLow = CpuMem.ReadInt64(Position + Offset + 0);
long PxHigh = CpuMem.ReadInt64(Position + Offset + 8);
*(long*)(BuffPtr + OutOffs + 0) = PxLow;
*(long*)(BuffPtr + OutOffs + 8) = PxHigh;
@ -314,7 +314,7 @@ namespace Ryujinx.HLE.Gpu.Texture
{
long Offset = (uint)Swizzle.GetSwizzleOffset(X, Y);
long Tile = CpuMem.ReadInt64Unchecked(Position + Offset);
long Tile = CpuMem.ReadInt64(Position + Offset);
*(long*)(BuffPtr + OutOffs) = Tile;
@ -347,8 +347,8 @@ namespace Ryujinx.HLE.Gpu.Texture
{
long Offset = (uint)Swizzle.GetSwizzleOffset(X, Y);
long Tile0 = CpuMem.ReadInt64Unchecked(Position + Offset + 0);
long Tile1 = CpuMem.ReadInt64Unchecked(Position + Offset + 8);
long Tile0 = CpuMem.ReadInt64(Position + Offset + 0);
long Tile1 = CpuMem.ReadInt64(Position + Offset + 8);
*(long*)(BuffPtr + OutOffs + 0) = Tile0;
*(long*)(BuffPtr + OutOffs + 8) = Tile1;