aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Image/TexturePoolCache.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Image/TexturePoolCache.cs')
-rw-r--r--Ryujinx.Graphics.Gpu/Image/TexturePoolCache.cs17
1 files changed, 16 insertions, 1 deletions
diff --git a/Ryujinx.Graphics.Gpu/Image/TexturePoolCache.cs b/Ryujinx.Graphics.Gpu/Image/TexturePoolCache.cs
index 268cec38..c9eebf8b 100644
--- a/Ryujinx.Graphics.Gpu/Image/TexturePoolCache.cs
+++ b/Ryujinx.Graphics.Gpu/Image/TexturePoolCache.cs
@@ -1,3 +1,4 @@
+using System;
using System.Collections.Generic;
namespace Ryujinx.Graphics.Gpu.Image
@@ -7,7 +8,7 @@ namespace Ryujinx.Graphics.Gpu.Image
/// This can keep multiple texture pools, and return the current one as needed.
/// It is useful for applications that uses multiple texture pools.
/// </summary>
- class TexturePoolCache
+ class TexturePoolCache : IDisposable
{
private const int MaxCapacity = 4;
@@ -72,5 +73,19 @@ namespace Ryujinx.Graphics.Gpu.Image
return pool;
}
+
+ /// <summary>
+ /// Disposes the texture pool cache.
+ /// It's an error to use the texture pool cache after disposal.
+ /// </summary>
+ public void Dispose()
+ {
+ foreach (TexturePool pool in _pools)
+ {
+ pool.Dispose();
+ }
+
+ _pools.Clear();
+ }
}
} \ No newline at end of file