From e1279f67fe264b8652d355a52dde5198e3a52aa0 Mon Sep 17 00:00:00 2001 From: Isaac Marovitz Date: Wed, 22 May 2024 21:32:24 -0400 Subject: [PATCH] =?UTF-8?q?Fix=20StoreActions=20&=20Don=E2=80=99t=20Clamp?= =?UTF-8?q?=20Scissor=20for=20Now?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Ryujinx.Graphics.Metal/EncoderStateManager.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Ryujinx.Graphics.Metal/EncoderStateManager.cs b/src/Ryujinx.Graphics.Metal/EncoderStateManager.cs index fac656132..2c6893c92 100644 --- a/src/Ryujinx.Graphics.Metal/EncoderStateManager.cs +++ b/src/Ryujinx.Graphics.Metal/EncoderStateManager.cs @@ -1,7 +1,6 @@ using Ryujinx.Common.Logging; using Ryujinx.Graphics.GAL; using Ryujinx.Graphics.Shader; -using SharpMetal.Foundation; using SharpMetal.Metal; using System; using System.Collections.Generic; @@ -57,6 +56,7 @@ namespace Ryujinx.Graphics.Metal var passAttachment = renderPassDescriptor.ColorAttachments.Object((ulong)i); passAttachment.Texture = _currentState.RenderTargets[i].MTLTexture; passAttachment.LoadAction = MTLLoadAction.Load; + passAttachment.StoreAction = MTLStoreAction.Store; } } @@ -72,12 +72,14 @@ namespace Ryujinx.Graphics.Metal case MTLPixelFormat.Depth32Float: depthAttachment.Texture = _currentState.DepthStencil.MTLTexture; depthAttachment.LoadAction = MTLLoadAction.Load; + depthAttachment.StoreAction = MTLStoreAction.Store; break; // Stencil Only Attachment case MTLPixelFormat.Stencil8: stencilAttachment.Texture = _currentState.DepthStencil.MTLTexture; stencilAttachment.LoadAction = MTLLoadAction.Load; + stencilAttachment.StoreAction = MTLStoreAction.Store; break; // Combined Attachment @@ -85,11 +87,13 @@ namespace Ryujinx.Graphics.Metal case MTLPixelFormat.Depth32FloatStencil8: depthAttachment.Texture = _currentState.DepthStencil.MTLTexture; 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.LoadAction = MTLLoadAction.Load; + stencilAttachment.StoreAction = MTLStoreAction.Store; break; default: Logger.Error?.PrintMsg(LogClass.Gpu, $"Unsupported Depth/Stencil Format: {_currentState.DepthStencil.MTLTexture.PixelFormat}!"); @@ -385,8 +389,8 @@ namespace Ryujinx.Graphics.Metal _currentState.Scissors[i] = new MTLScissorRect { - height = Math.Clamp((ulong)region.Height, 0, (ulong)_currentState.Viewports[i].height), - width = Math.Clamp((ulong)region.Width, 0, (ulong)_currentState.Viewports[i].width), + height = (ulong)region.Height, + width = (ulong)region.Width, x = (ulong)region.X, y = (ulong)region.Y };