From 94a64f2aea3225d83a2aa1e61ed8d4bf8be49e5c Mon Sep 17 00:00:00 2001 From: gdkchan <gab.dark.100@gmail.com> Date: Tue, 10 Jan 2023 22:53:56 -0300 Subject: Remove textures from cache on unmap if not mapped and modified (#4211) --- Ryujinx.Graphics.Gpu/Image/Texture.cs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Ryujinx.Graphics.Gpu/Image/Texture.cs') diff --git a/Ryujinx.Graphics.Gpu/Image/Texture.cs b/Ryujinx.Graphics.Gpu/Image/Texture.cs index 0995314d..f0c31be6 100644 --- a/Ryujinx.Graphics.Gpu/Image/Texture.cs +++ b/Ryujinx.Graphics.Gpu/Image/Texture.cs @@ -1676,6 +1676,13 @@ namespace Ryujinx.Graphics.Gpu.Image } RemoveFromPools(true); + + // We only want to remove if there's no mapped region of the texture that was modified by the GPU, + // otherwise we could lose data. + if (!Group.AnyModified(this)) + { + _physicalMemory.TextureCache.QueueAutoDeleteCacheRemoval(this); + } } /// <summary> -- cgit v1.2.3-70-g09d2