From 8d36681bf1eb732307086203f3bbd2509f55c234 Mon Sep 17 00:00:00 2001 From: riperiperi Date: Sat, 6 Mar 2021 14:43:55 +0000 Subject: Improve handling for unmapped GPU resources (#2083) * Improve handling for unmapped GPU resources - Fixed a memory tracking bug that would set protection on empty PTEs - When a texture's memory is (partially) unmapped, all pool references are forcibly removed and the texture must be rediscovered to draw with it. This will also force the texture discovery to always compare the texture's range for a match. - RegionHandles now know if they are unmapped, and automatically unset their dirty flag when unmapped. - Partial texture sync now loads only the region of texture that has been modified. Unmapped memory tracking handles cause dirty flags for a texture group handle to be ignored. This greatly improves the emulator's stability for newer UE4 games. * Address feedback, fix MultiRange slice Fixed an issue where the size of the multi-range slice would be miscalculated. * Update Ryujinx.Memory/Range/MultiRange.cs (feedback) Co-authored-by: Mary Co-authored-by: Mary --- Ryujinx.Memory/Tracking/VirtualRegion.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'Ryujinx.Memory/Tracking/VirtualRegion.cs') diff --git a/Ryujinx.Memory/Tracking/VirtualRegion.cs b/Ryujinx.Memory/Tracking/VirtualRegion.cs index 15a11568..fcf2fbe0 100644 --- a/Ryujinx.Memory/Tracking/VirtualRegion.cs +++ b/Ryujinx.Memory/Tracking/VirtualRegion.cs @@ -66,6 +66,18 @@ namespace Ryujinx.Memory.Tracking UpdatePhysicalChildren(); } + /// + /// Signal that this region has been mapped or unmapped. + /// + /// True if the region has been mapped, false if unmapped + public void SignalMappingChanged(bool mapped) + { + foreach (RegionHandle handle in Handles) + { + handle.SignalMappingChanged(mapped); + } + } + /// /// Gets the strictest permission that the child handles demand. Assumes that the tracking lock has been obtained. /// -- cgit v1.2.3