Delete and Get Data from Buffer

This commit is contained in:
Isaac Marovitz 2023-07-28 11:55:52 -04:00 committed by Isaac Marovitz
parent da9a194023
commit 8da7c42cf8
2 changed files with 23 additions and 22 deletions

View file

@ -89,22 +89,7 @@ namespace Ryujinx.Graphics.Metal
public ITexture CreateTexture(TextureCreateInfo info)
{
MTLTextureDescriptor descriptor = new()
{
PixelFormat = FormatCapabilities.ConvertToMTLFormat(info.Format),
TextureType = info.Target.Convert(),
Width = (ulong)info.Width,
Height = (ulong)info.Height,
MipmapLevelCount = (ulong)info.Levels,
SampleCount = (ulong)info.Samples,
};
return CreateTextureView(info);
}
internal Texture CreateTextureView(TextureCreateInfo info)
{
throw new NotImplementedException();
return new Texture(_device, _pipeline, info);
}
public bool PrepareHostMapping(IntPtr address, ulong size)
@ -120,12 +105,14 @@ namespace Ryujinx.Graphics.Metal
public void DeleteBuffer(BufferHandle buffer)
{
throw new NotImplementedException();
MTLBuffer mtlBuffer = new(Unsafe.As<BufferHandle, IntPtr>(ref buffer));
mtlBuffer.SetPurgeableState(MTLPurgeableState.Empty);
}
public PinnedSpan<byte> GetBufferData(BufferHandle buffer, int offset, int size)
public unsafe PinnedSpan<byte> GetBufferData(BufferHandle buffer, int offset, int size)
{
throw new NotImplementedException();
MTLBuffer mtlBuffer = new(Unsafe.As<BufferHandle, IntPtr>(ref buffer));
return new PinnedSpan<byte>(IntPtr.Add(mtlBuffer.Contents, offset).ToPointer(), size);
}
public Capabilities GetCapabilities()