From 01122ca032b8cde58dd50c1ad4aeb6d6d8268f61 Mon Sep 17 00:00:00 2001 From: Isaac Marovitz Date: Mon, 27 May 2024 21:46:43 -0400 Subject: [PATCH] Stencil Fixes --- .../EncoderStateManager.cs | 4 +--- src/Ryujinx.Graphics.Metal/FormatTable.cs | 19 +++---------------- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/src/Ryujinx.Graphics.Metal/EncoderStateManager.cs b/src/Ryujinx.Graphics.Metal/EncoderStateManager.cs index c737c25ba..e9d615c96 100644 --- a/src/Ryujinx.Graphics.Metal/EncoderStateManager.cs +++ b/src/Ryujinx.Graphics.Metal/EncoderStateManager.cs @@ -141,9 +141,7 @@ namespace Ryujinx.Graphics.Metal depthAttachment.LoadAction = MTLLoadAction.Load; depthAttachment.StoreAction = MTLStoreAction.Store; - var unpackedFormat = FormatTable.PackedStencilToXFormat(_currentState.DepthStencil.MTLTexture.PixelFormat); - var stencilView = _currentState.DepthStencil.MTLTexture.NewTextureView(unpackedFormat); - stencilAttachment.Texture = stencilView; + stencilAttachment.Texture = _currentState.DepthStencil.MTLTexture; stencilAttachment.LoadAction = MTLLoadAction.Load; stencilAttachment.StoreAction = MTLStoreAction.Store; break; diff --git a/src/Ryujinx.Graphics.Metal/FormatTable.cs b/src/Ryujinx.Graphics.Metal/FormatTable.cs index 3014cdafd..7cac4f7c4 100644 --- a/src/Ryujinx.Graphics.Metal/FormatTable.cs +++ b/src/Ryujinx.Graphics.Metal/FormatTable.cs @@ -171,29 +171,16 @@ namespace Ryujinx.Graphics.Metal { var mtlFormat = _table[(int)format]; - if (mtlFormat == MTLPixelFormat.Depth24UnormStencil8 || mtlFormat == MTLPixelFormat.Depth32FloatStencil8) + if (mtlFormat == MTLPixelFormat.Depth24UnormStencil8) { if (!MTLDevice.CreateSystemDefaultDevice().Depth24Stencil8PixelFormatSupported) { - mtlFormat = MTLPixelFormat.Depth32Float; + Logger.Error?.PrintMsg(LogClass.Gpu, "Application requested Depth24Stencil8, which is unsupported on this device!"); + mtlFormat = MTLPixelFormat.Depth32FloatStencil8; } } return mtlFormat; } - - public static MTLPixelFormat PackedStencilToXFormat(MTLPixelFormat format) - { - switch (format) - { - case MTLPixelFormat.Depth24UnormStencil8: - return MTLPixelFormat.X24Stencil8; - case MTLPixelFormat.Depth32FloatStencil8: - return MTLPixelFormat.X32Stencil8; - default: - Logger.Warning?.PrintMsg(LogClass.Gpu, $"Attempted to get stencil format for non packed format {format}!"); - return MTLPixelFormat.Invalid; - } - } } }