diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2019-12-31 19:09:49 -0300 |
|---|---|---|
| committer | Thog <thog@protonmail.com> | 2020-01-09 02:13:00 +0100 |
| commit | 59fdaa744b20f91928ee3fcaf5fabfcb7b409451 (patch) | |
| tree | f01e21d930e456398411317784c5063c532a7215 /Ryujinx.Graphics.Gpu/Image | |
| parent | f7bcc884e46805f4dcda4fc7d7e7bccb2a3ac316 (diff) | |
GPU resource disposal
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Image')
| -rw-r--r-- | Ryujinx.Graphics.Gpu/Image/Texture.cs | 10 | ||||
| -rw-r--r-- | Ryujinx.Graphics.Gpu/Image/TextureManager.cs | 14 |
2 files changed, 22 insertions, 2 deletions
diff --git a/Ryujinx.Graphics.Gpu/Image/Texture.cs b/Ryujinx.Graphics.Gpu/Image/Texture.cs index 9b5c19f3..076718e5 100644 --- a/Ryujinx.Graphics.Gpu/Image/Texture.cs +++ b/Ryujinx.Graphics.Gpu/Image/Texture.cs @@ -13,7 +13,7 @@ namespace Ryujinx.Graphics.Gpu.Image /// <summary> /// Represents a cached GPU texture. /// </summary> - class Texture : IRange<Texture> + class Texture : IRange<Texture>, IDisposable { private GpuContext _context; @@ -1011,5 +1011,13 @@ namespace Ryujinx.Graphics.Gpu.Image _arrayViewTexture?.Dispose(); _arrayViewTexture = null; } + + /// <summary> + /// Performs texture disposal, deleting the texture. + /// </summary> + public void Dispose() + { + DisposeTextures(); + } } }
\ No newline at end of file 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 /// <summary> /// Texture manager. /// </summary> - 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); } + + /// <summary> + /// Disposes all textures in the cache. + /// It's an error to use the texture manager after disposal. + /// </summary> + public void Dispose() + { + foreach (Texture texture in _textures) + { + texture.Dispose(); + } + } } }
\ No newline at end of file |
