GPU resource disposal

This commit is contained in:
gdkchan 2019-12-31 19:09:49 -03:00 committed by Thog
parent f7bcc884e4
commit 59fdaa744b
20 changed files with 195 additions and 46 deletions

View file

@ -1,9 +1,10 @@
using Ryujinx.Graphics.GAL;
using OpenTK.Graphics.OpenGL;
using System;
namespace Ryujinx.Graphics.OpenGL
{
class TextureCopy
class TextureCopy : IDisposable
{
private int _srcFramebuffer;
private int _dstFramebuffer;
@ -53,11 +54,6 @@ namespace Ryujinx.Graphics.OpenGL
GL.Enable(EnableCap.FramebufferSrgb);
}
private static void Detach(FramebufferTarget target, Format format)
{
Attach(target, format, 0);
}
private static void Attach(FramebufferTarget target, Format format, int handle)
{
if (format == Format.D24UnormS8Uint || format == Format.D32FloatS8Uint)
@ -124,5 +120,22 @@ namespace Ryujinx.Graphics.OpenGL
return _dstFramebuffer;
}
public void Dispose()
{
if (_srcFramebuffer != 0)
{
GL.DeleteFramebuffer(_srcFramebuffer);
_srcFramebuffer = 0;
}
if (_dstFramebuffer != 0)
{
GL.DeleteFramebuffer(_dstFramebuffer);
_dstFramebuffer = 0;
}
}
}
}