diff options
Diffstat (limited to 'src/Ryujinx.Graphics.Gpu/Image/TextureCache.cs')
-rw-r--r-- | src/Ryujinx.Graphics.Gpu/Image/TextureCache.cs | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/Ryujinx.Graphics.Gpu/Image/TextureCache.cs b/src/Ryujinx.Graphics.Gpu/Image/TextureCache.cs index 97d78a34..fc2c07e5 100644 --- a/src/Ryujinx.Graphics.Gpu/Image/TextureCache.cs +++ b/src/Ryujinx.Graphics.Gpu/Image/TextureCache.cs @@ -848,7 +848,17 @@ namespace Ryujinx.Graphics.Gpu.Image if (overlapInCache) { - _cache.Remove(overlap, flush); + if (flush || overlap.HadPoolOwner || overlap.IsView) + { + _cache.Remove(overlap, flush); + } + else + { + // This texture has only ever been referenced in the AutoDeleteCache. + // Keep this texture alive with the short duration cache, as it may be used often but not sampled. + + _cache.AddShortCache(overlap); + } } removeOverlap = modified; @@ -1199,6 +1209,16 @@ namespace Ryujinx.Graphics.Gpu.Image } /// <summary> + /// Adds a texture to the short duration cache without a descriptor. This typically keeps it alive for two ticks. + /// On expiry, it will be removed from the AutoDeleteCache. + /// </summary> + /// <param name="texture">Texture to add to the short cache</param> + public void AddShortCache(Texture texture) + { + _cache.AddShortCache(texture); + } + + /// <summary> /// Removes a texture from the short duration cache. /// </summary> /// <param name="texture">Texture to remove from the short cache</param> |