From 691b0de6e19540729e7db69e0d0ab99cf5092b4c Mon Sep 17 00:00:00 2001 From: Isaac Marovitz Date: Thu, 5 Sep 2024 20:42:53 +0200 Subject: [PATCH] Properly create stencil views of combined formats MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes Link’s Awakening --- src/Ryujinx.Graphics.Metal/Texture.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Ryujinx.Graphics.Metal/Texture.cs b/src/Ryujinx.Graphics.Metal/Texture.cs index bf13aea7f..1e2d83680 100644 --- a/src/Ryujinx.Graphics.Metal/Texture.cs +++ b/src/Ryujinx.Graphics.Metal/Texture.cs @@ -59,6 +59,17 @@ namespace Ryujinx.Graphics.Metal public Texture(MTLDevice device, MetalRenderer renderer, Pipeline pipeline, TextureCreateInfo info, MTLTexture sourceTexture, int firstLayer, int firstLevel) : base(device, renderer, pipeline, info) { var pixelFormat = FormatTable.GetFormat(Info.Format); + + if (info.DepthStencilMode == DepthStencilMode.Stencil) + { + pixelFormat = pixelFormat switch + { + MTLPixelFormat.Depth32FloatStencil8 => MTLPixelFormat.X32Stencil8, + MTLPixelFormat.Depth24UnormStencil8 => MTLPixelFormat.X24Stencil8, + _ => pixelFormat + }; + } + var textureType = Info.Target.Convert(); NSRange levels; levels.location = (ulong)firstLevel;