From ce5f5a64423e8a63e4c3f706d39e80870b55b05d Mon Sep 17 00:00:00 2001 From: Isaac Marovitz Date: Wed, 2 Aug 2023 21:32:41 -0400 Subject: [PATCH] Check if packed depth is supported --- src/Ryujinx.Graphics.Metal/FormatTable.cs | 14 +++++++++++++- src/Ryujinx.Graphics.Metal/Texture.cs | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Ryujinx.Graphics.Metal/FormatTable.cs b/src/Ryujinx.Graphics.Metal/FormatTable.cs index b093ff3e5..7b07cb4c7 100644 --- a/src/Ryujinx.Graphics.Metal/FormatTable.cs +++ b/src/Ryujinx.Graphics.Metal/FormatTable.cs @@ -1,9 +1,11 @@ using Ryujinx.Graphics.GAL; using SharpMetal.Metal; using System; +using System.Runtime.Versioning; namespace Ryujinx.Graphics.Metal { + [SupportedOSPlatform("macos")] static class FormatTable { private static readonly MTLPixelFormat[] _table; @@ -167,7 +169,17 @@ namespace Ryujinx.Graphics.Metal 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; } } } diff --git a/src/Ryujinx.Graphics.Metal/Texture.cs b/src/Ryujinx.Graphics.Metal/Texture.cs index d8607a618..7074e7da3 100644 --- a/src/Ryujinx.Graphics.Metal/Texture.cs +++ b/src/Ryujinx.Graphics.Metal/Texture.cs @@ -107,7 +107,7 @@ namespace Ryujinx.Graphics.Metal 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)