From ad79f611a9d32c0877dbfd0b8eb842fd4a1f5c6a Mon Sep 17 00:00:00 2001 From: Isaac Marovitz Date: Thu, 3 Aug 2023 19:01:34 -0400 Subject: [PATCH] Fix Metal Validation Error --- src/Ryujinx.Graphics.Metal/MetalRenderer.cs | 11 +++++++---- src/Ryujinx.Graphics.Metal/Pipeline.cs | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/Ryujinx.Graphics.Metal/MetalRenderer.cs b/src/Ryujinx.Graphics.Metal/MetalRenderer.cs index a202db426..6d1a2f5e2 100644 --- a/src/Ryujinx.Graphics.Metal/MetalRenderer.cs +++ b/src/Ryujinx.Graphics.Metal/MetalRenderer.cs @@ -204,11 +204,14 @@ namespace Ryujinx.Graphics.Metal MTLBuffer mtlBuffer = new(Unsafe.As(ref buffer)); var span = new Span(mtlBuffer.Contents.ToPointer(), (int)mtlBuffer.Length); data.CopyTo(span[offset..]); - mtlBuffer.DidModifyRange(new NSRange + if (mtlBuffer.StorageMode == MTLStorageMode.Managed) { - location = (ulong)offset, - length = (ulong)data.Length - }); + mtlBuffer.DidModifyRange(new NSRange + { + location = (ulong)offset, + length = (ulong)data.Length + }); + } } public void UpdateCounters() diff --git a/src/Ryujinx.Graphics.Metal/Pipeline.cs b/src/Ryujinx.Graphics.Metal/Pipeline.cs index 5f1eddabf..8166b8a29 100644 --- a/src/Ryujinx.Graphics.Metal/Pipeline.cs +++ b/src/Ryujinx.Graphics.Metal/Pipeline.cs @@ -15,7 +15,7 @@ namespace Ryujinx.Graphics.Metal { // 0 Frames = No capture // Some games like Undertale trigger a stack overflow on capture end - private const int MaxFramesPerCapture = 5; + private const int MaxFramesPerCapture = 0; private const string CaptureLocation = "/Users/isaacmarovitz/Desktop/Captures/Trace-"; private readonly MTLDevice _device;