Check if packed depth is supported

This commit is contained in:
Isaac Marovitz 2023-08-02 21:32:41 -04:00
parent e8ebda10ef
commit 1da7e7bc70
No known key found for this signature in database
GPG Key ID: 97250B2B09A132E1
2 changed files with 14 additions and 2 deletions

View File

@ -1,9 +1,11 @@
using Ryujinx.Graphics.GAL; using Ryujinx.Graphics.GAL;
using SharpMetal.Metal; using SharpMetal.Metal;
using System; using System;
using System.Runtime.Versioning;
namespace Ryujinx.Graphics.Metal namespace Ryujinx.Graphics.Metal
{ {
[SupportedOSPlatform("macos")]
static class FormatTable static class FormatTable
{ {
private static readonly MTLPixelFormat[] _table; private static readonly MTLPixelFormat[] _table;
@ -167,7 +169,17 @@ namespace Ryujinx.Graphics.Metal
public static MTLPixelFormat GetFormat(Format format) public static MTLPixelFormat GetFormat(Format format)
{ {
return _table[(int)format]; var mtlFormat = _table[(int)format];
if (mtlFormat == MTLPixelFormat.Depth24UnormStencil8 || mtlFormat == MTLPixelFormat.Depth32FloatStencil8)
{
if (!MTLDevice.CreateSystemDefaultDevice().Depth24Stencil8PixelFormatSupported)
{
mtlFormat = MTLPixelFormat.Depth32Float;
}
}
return mtlFormat;
} }
} }
} }

View File

@ -107,7 +107,7 @@ namespace Ryujinx.Graphics.Metal
public void CopyTo(ITexture destination, Extents2D srcRegion, Extents2D dstRegion, bool linearFilter) public void CopyTo(ITexture destination, Extents2D srcRegion, Extents2D dstRegion, bool linearFilter)
{ {
throw new NotImplementedException(); Logger.Warning?.Print(LogClass.Gpu, "Not Implemented!");
} }
public void CopyTo(BufferRange range, int layer, int level, int stride) public void CopyTo(BufferRange range, int layer, int level, int stride)