Ryujinx/src/Ryujinx.Graphics.Metal/DisposableBuffer.cs
Evan Husted 80d619f010 Revert "Revert the Metal Experiment (#701)"
This reverts commit fe1617ffeae0edd58bf61b1e008304e1221a1f7d.
2025-02-22 21:33:38 -06:00

27 lines
562 B
C#

using SharpMetal.Metal;
using System;
using System.Runtime.Versioning;
namespace Ryujinx.Graphics.Metal
{
[SupportedOSPlatform("macos")]
readonly struct DisposableBuffer : IDisposable
{
public MTLBuffer Value { get; }
public DisposableBuffer(MTLBuffer buffer)
{
Value = buffer;
}
public void Dispose()
{
if (Value != IntPtr.Zero)
{
Value.SetPurgeableState(MTLPurgeableState.Empty);
Value.Dispose();
}
}
}
}