diff options
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Image/Texture.cs')
-rw-r--r-- | Ryujinx.Graphics.Gpu/Image/Texture.cs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.Gpu/Image/Texture.cs b/Ryujinx.Graphics.Gpu/Image/Texture.cs index f0c31be6..cfe57756 100644 --- a/Ryujinx.Graphics.Gpu/Image/Texture.cs +++ b/Ryujinx.Graphics.Gpu/Image/Texture.cs @@ -138,6 +138,10 @@ namespace Ryujinx.Graphics.Gpu.Image public LinkedListNode<Texture> CacheNode { get; set; } /// <summary> + /// Entry for this texture in the short duration cache, if present. + /// </summary> + public ShortTextureCacheEntry ShortCacheEntry { get; set; } + /// Physical memory ranges where the texture data is located. /// </summary> public MultiRange Range { get; private set; } @@ -1555,6 +1559,20 @@ namespace Ryujinx.Graphics.Gpu.Image _poolOwners.Add(new TexturePoolOwner { Pool = pool, ID = id }); } _referenceCount++; + + if (ShortCacheEntry != null) + { + _physicalMemory.TextureCache.RemoveShortCache(this); + } + } + + /// <summary> + /// Indicates that the texture has one reference left, and will delete on reference decrement. + /// </summary> + /// <returns>True if there is one reference remaining, false otherwise</returns> + public bool HasOneReference() + { + return _referenceCount == 1; } /// <summary> @@ -1624,6 +1642,14 @@ namespace Ryujinx.Graphics.Gpu.Image _poolOwners.Clear(); } + if (ShortCacheEntry != null && _context.IsGpuThread()) + { + // If this is called from another thread (unmapped), the short cache will + // have to remove this texture on a future tick. + + _physicalMemory.TextureCache.RemoveShortCache(this); + } + InvalidatedSequence++; } |