From f58920b944e745879b6ca0e7a69a0316258a31dc Mon Sep 17 00:00:00 2001 From: Isaac Marovitz Date: Sun, 8 Sep 2024 01:29:36 +0200 Subject: [PATCH] Check for null resources before declaring them resident --- src/Ryujinx.Graphics.Metal/EncoderStateManager.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Ryujinx.Graphics.Metal/EncoderStateManager.cs b/src/Ryujinx.Graphics.Metal/EncoderStateManager.cs index 679cc9daf..13d276af7 100644 --- a/src/Ryujinx.Graphics.Metal/EncoderStateManager.cs +++ b/src/Ryujinx.Graphics.Metal/EncoderStateManager.cs @@ -293,7 +293,10 @@ namespace Ryujinx.Graphics.Metal foreach (var resource in _currentState.RenderEncoderResources.Resources) { - renderCommandEncoder.UseResource(resource.MtlResource, resource.ResourceUsage, resource.Stages); + if (resource.MtlResource.NativePtr != IntPtr.Zero) + { + renderCommandEncoder.UseResource(resource.MtlResource, resource.ResourceUsage, resource.Stages); + } } foreach (var buffer in _currentState.RenderEncoderResources.VertexBuffers)