From 28336428583d073cfcb92eb8330b6e392c9d7627 Mon Sep 17 00:00:00 2001 From: Samuliak Date: Sat, 25 May 2024 15:23:13 +0200 Subject: [PATCH] dispose all temporary buffers --- src/Ryujinx.Graphics.Metal/Texture.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Ryujinx.Graphics.Metal/Texture.cs b/src/Ryujinx.Graphics.Metal/Texture.cs index f16029809..63da29966 100644 --- a/src/Ryujinx.Graphics.Metal/Texture.cs +++ b/src/Ryujinx.Graphics.Metal/Texture.cs @@ -222,7 +222,6 @@ namespace Ryujinx.Graphics.Metal bytesPerImage ); - // TODO: Dispose the buffer return new PinnedSpan(mtlBuffer.Contents.ToPointer(), (int)length, () => mtlBuffer.Dispose()); } } @@ -278,6 +277,9 @@ namespace Ryujinx.Graphics.Metal depth = Math.Max(1, depth >> 1); } } + + // Cleanup + mtlBuffer.Dispose(); } public void SetData(IMemoryOwner data, int layer, int level) @@ -309,6 +311,9 @@ namespace Ryujinx.Graphics.Metal (ulong)level, new MTLOrigin() ); + + // Cleanup + mtlBuffer.Dispose(); } } @@ -341,6 +346,9 @@ namespace Ryujinx.Graphics.Metal (ulong)level, new MTLOrigin { x = (ulong)region.X, y = (ulong)region.Y } ); + + // Cleanup + mtlBuffer.Dispose(); } }