mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-11-15 09:35:27 +00:00
GAL: Fix sampler leaks on exit (#2353)
Before this, all samplers instance were leaking on exit because the dispose method was never getting called. This fix this issue by making TextureBindingsManager disposable and calling the dispose method in the TextureManager.
This commit is contained in:
parent
60cf3dfebc
commit
afd68d4c6c
|
@ -1,13 +1,14 @@
|
||||||
using Ryujinx.Graphics.GAL;
|
using Ryujinx.Graphics.GAL;
|
||||||
using Ryujinx.Graphics.Gpu.State;
|
using Ryujinx.Graphics.Gpu.State;
|
||||||
using Ryujinx.Graphics.Shader;
|
using Ryujinx.Graphics.Shader;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace Ryujinx.Graphics.Gpu.Image
|
namespace Ryujinx.Graphics.Gpu.Image
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Texture bindings manager.
|
/// Texture bindings manager.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class TextureBindingsManager
|
class TextureBindingsManager : IDisposable
|
||||||
{
|
{
|
||||||
private const int HandleHigh = 16;
|
private const int HandleHigh = 16;
|
||||||
private const int HandleMask = (1 << HandleHigh) - 1;
|
private const int HandleMask = (1 << HandleHigh) - 1;
|
||||||
|
@ -505,5 +506,13 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||||
{
|
{
|
||||||
_rebind = true;
|
_rebind = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Disposes all textures and samplers in the cache.
|
||||||
|
/// </summary>
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
_samplerPool?.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1286,7 +1286,7 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Disposes all textures in the cache.
|
/// Disposes all textures and samplers in the cache.
|
||||||
/// It's an error to use the texture manager after disposal.
|
/// It's an error to use the texture manager after disposal.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
@ -1297,6 +1297,9 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||||
{
|
{
|
||||||
texture.Dispose();
|
texture.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_cpBindingsManager.Dispose();
|
||||||
|
_gpBindingsManager.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue