diff --git a/Directory.Packages.props b/Directory.Packages.props index cfb884d01a..70404ef8eb 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -38,7 +38,7 @@ - + diff --git a/src/Ryujinx.Graphics.Metal/MetalRenderer.cs b/src/Ryujinx.Graphics.Metal/MetalRenderer.cs index b5496028c6..6e844e7c0c 100644 --- a/src/Ryujinx.Graphics.Metal/MetalRenderer.cs +++ b/src/Ryujinx.Graphics.Metal/MetalRenderer.cs @@ -215,17 +215,19 @@ namespace Ryujinx.Graphics.Metal { var blitEncoder = _pipeline.GetOrCreateBlitEncoder(); - MTLBuffer src = _device.NewBuffer((ulong)data.Length, MTLResourceOptions.ResourceStorageModeManaged); - var span = new Span(src.Contents.ToPointer(), data.Length); - data.CopyTo(span); - src.DidModifyRange(new NSRange + using MTLBuffer src = _device.NewBuffer((ulong)data.Length, MTLResourceOptions.ResourceStorageModeManaged); { - location = 0, - length = (ulong)data.Length - }); + var span = new Span(src.Contents.ToPointer(), data.Length); + data.CopyTo(span); + src.DidModifyRange(new NSRange + { + location = 0, + length = (ulong)data.Length + }); - MTLBuffer dst = new(Unsafe.As(ref buffer)); - blitEncoder.CopyFromBuffer(src, 0, dst, (ulong)offset, (ulong)data.Length); + MTLBuffer dst = new(Unsafe.As(ref buffer)); + blitEncoder.CopyFromBuffer(src, 0, dst, (ulong)offset, (ulong)data.Length); + } } public void UpdateCounters() diff --git a/src/Ryujinx.Graphics.Metal/Program.cs b/src/Ryujinx.Graphics.Metal/Program.cs index 764bcf126d..ee0ce4f784 100644 --- a/src/Ryujinx.Graphics.Metal/Program.cs +++ b/src/Ryujinx.Graphics.Metal/Program.cs @@ -63,7 +63,9 @@ namespace Ryujinx.Graphics.Metal public void Dispose() { - return; + VertexFunction.Dispose(); + FragmentFunction.Dispose(); + ComputeFunction.Dispose(); } } } diff --git a/src/Ryujinx.Graphics.Metal/Sampler.cs b/src/Ryujinx.Graphics.Metal/Sampler.cs index 5cb898a9f0..f416b5da50 100644 --- a/src/Ryujinx.Graphics.Metal/Sampler.cs +++ b/src/Ryujinx.Graphics.Metal/Sampler.cs @@ -45,6 +45,7 @@ namespace Ryujinx.Graphics.Metal public void Dispose() { + _mtlSamplerState.Dispose(); } } } diff --git a/src/Ryujinx.Graphics.Metal/Texture.cs b/src/Ryujinx.Graphics.Metal/Texture.cs index a50d416aaf..524cd6cf90 100644 --- a/src/Ryujinx.Graphics.Metal/Texture.cs +++ b/src/Ryujinx.Graphics.Metal/Texture.cs @@ -329,6 +329,7 @@ namespace Ryujinx.Graphics.Metal public void Dispose() { MTLTexture.SetPurgeableState(MTLPurgeableState.Volatile); + MTLTexture.Dispose(); } } }