From fad653c12ec6b3ed813feaae86946021a7415172 Mon Sep 17 00:00:00 2001 From: Isaac Marovitz Date: Thu, 30 May 2024 13:24:05 +0100 Subject: [PATCH] Workaround for Wonder --- src/Ryujinx.Graphics.Metal/Pipeline.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Ryujinx.Graphics.Metal/Pipeline.cs b/src/Ryujinx.Graphics.Metal/Pipeline.cs index 912a28ac0..7cdc2c6d8 100644 --- a/src/Ryujinx.Graphics.Metal/Pipeline.cs +++ b/src/Ryujinx.Graphics.Metal/Pipeline.cs @@ -252,6 +252,13 @@ namespace Ryujinx.Graphics.Metal float[] colors = [color.Red, color.Green, color.Blue, color.Alpha]; var dst = _encoderStateManager.RenderTarget; + // TODO: Remove workaround for Wonder which has an invalid texture due to unsupported format + if (dst == null) + { + Logger.Warning?.PrintMsg(LogClass.Gpu, "Attempted to clear invalid render target!"); + return; + } + _helperShader.ClearColor(index, colors, componentMask, dst.Width, dst.Height); } @@ -259,6 +266,13 @@ namespace Ryujinx.Graphics.Metal { var depthStencil = _encoderStateManager.DepthStencil; + // TODO: Remove workaround for Wonder which has an invalid texture due to unsupported format + if (depthStencil == null) + { + Logger.Warning?.PrintMsg(LogClass.Gpu, "Attempted to clear invalid depth stencil!"); + return; + } + _helperShader.ClearDepthStencil(depthValue, depthMask, stencilValue, stencilMask, depthStencil.Width, depthStencil.Height); }