From c393cdf8e3775bc95850e4d8c8e4c446b286d3b4 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Wed, 15 Aug 2018 15:59:51 -0300 Subject: 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 --- Ryujinx.HLE/Gpu/Texture/TextureReader.cs | 22 +++++++++++----------- Ryujinx.HLE/Gpu/Texture/TextureWriter.cs | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'Ryujinx.HLE/Gpu/Texture') diff --git a/Ryujinx.HLE/Gpu/Texture/TextureReader.cs b/Ryujinx.HLE/Gpu/Texture/TextureReader.cs index f8cd6765..0c6103af 100644 --- a/Ryujinx.HLE/Gpu/Texture/TextureReader.cs +++ b/Ryujinx.HLE/Gpu/Texture/TextureReader.cs @@ -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; diff --git a/Ryujinx.HLE/Gpu/Texture/TextureWriter.cs b/Ryujinx.HLE/Gpu/Texture/TextureWriter.cs index a87d4545..113dc6f6 100644 --- a/Ryujinx.HLE/Gpu/Texture/TextureWriter.cs +++ b/Ryujinx.HLE/Gpu/Texture/TextureWriter.cs @@ -25,7 +25,7 @@ namespace Ryujinx.HLE.Gpu.Texture int Pixel = *(int*)(BuffPtr + InOffs); - CpuMem.WriteInt32Unchecked(Position + Offset, Pixel); + CpuMem.WriteInt32(Position + Offset, Pixel); InOffs += 4; } -- cgit v1.2.3