From 59fdaa744b20f91928ee3fcaf5fabfcb7b409451 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Tue, 31 Dec 2019 19:09:49 -0300 Subject: GPU resource disposal --- Ryujinx.Graphics.Gpu/Image/TextureManager.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'Ryujinx.Graphics.Gpu/Image/TextureManager.cs') diff --git a/Ryujinx.Graphics.Gpu/Image/TextureManager.cs b/Ryujinx.Graphics.Gpu/Image/TextureManager.cs index ecc5dc51..e0a8908a 100644 --- a/Ryujinx.Graphics.Gpu/Image/TextureManager.cs +++ b/Ryujinx.Graphics.Gpu/Image/TextureManager.cs @@ -11,7 +11,7 @@ namespace Ryujinx.Graphics.Gpu.Image /// /// Texture manager. /// - class TextureManager + class TextureManager : IDisposable { private const int OverlapsBufferInitialCapacity = 10; private const int OverlapsBufferMaxCapacity = 10000; @@ -761,5 +761,17 @@ namespace Ryujinx.Graphics.Gpu.Image { _textures.Remove(texture); } + + /// + /// Disposes all textures in the cache. + /// It's an error to use the texture manager after disposal. + /// + public void Dispose() + { + foreach (Texture texture in _textures) + { + texture.Dispose(); + } + } } } \ No newline at end of file -- cgit v1.2.3