From 32764f95602611e9daa50362330d760e8ed83fda Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sun, 29 Dec 2019 20:26:37 -0300 Subject: Add XML documentation to Ryujinx.Graphics.Gpu.Image --- Ryujinx.Graphics.Gpu/Image/AutoDeleteCache.cs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'Ryujinx.Graphics.Gpu/Image/AutoDeleteCache.cs') diff --git a/Ryujinx.Graphics.Gpu/Image/AutoDeleteCache.cs b/Ryujinx.Graphics.Gpu/Image/AutoDeleteCache.cs index 33ed7881..fc30d03c 100644 --- a/Ryujinx.Graphics.Gpu/Image/AutoDeleteCache.cs +++ b/Ryujinx.Graphics.Gpu/Image/AutoDeleteCache.cs @@ -3,17 +3,31 @@ using System.Collections.Generic; namespace Ryujinx.Graphics.Gpu.Image { + /// + /// A texture cache that automatically removes older textures that are not used for some time. + /// The cache works with a rotated list with a fixed size. When new textures are added, the + /// old ones at the bottom of the list are deleted. + /// class AutoDeleteCache : IEnumerable { private const int MaxCapacity = 2048; - private LinkedList _textures; + private readonly LinkedList _textures; + /// + /// Creates a new instance of the automatic deletion cache. + /// public AutoDeleteCache() { _textures = new LinkedList(); } + /// + /// Adds a new texture to the cache, even if the texture added is already on the cache. + /// Using this method is only recommended if you know that the texture is not yet on the cache, + /// otherwise it would store the same texture more than once. + /// + /// The texture to be added to the cache public void Add(Texture texture) { texture.IncrementReferenceCount(); @@ -32,6 +46,12 @@ namespace Ryujinx.Graphics.Gpu.Image } } + /// + /// Adds a new texture to the cache, or just moves it to the top of the list if the + /// texture is already on the cache. Moving the texture to the top of the list prevents + /// it from being deleted, as the textures on the bottom of the list are deleted when new ones are added. + /// + /// The texture to be added, or moved to the top public void Lift(Texture texture) { if (texture.CacheNode != null) -- cgit v1.2.3