From d323a8d44a862a9eeae9f01236081886b7c99265 Mon Sep 17 00:00:00 2001
From: Isaac Marovitz <isaacryu@icloud.com>
Date: Wed, 29 May 2024 16:38:11 +0100
Subject: [PATCH] Rebase Changes

---
 src/Ryujinx.Graphics.Metal/MetalRenderer.cs            |  6 ++++++
 src/Ryujinx.Graphics.Metal/Pipeline.cs                 | 10 ++++++++++
 .../CodeGen/Msl/Instructions/InstGenMemory.cs          |  4 ++--
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/src/Ryujinx.Graphics.Metal/MetalRenderer.cs b/src/Ryujinx.Graphics.Metal/MetalRenderer.cs
index 84333e1f9..0a4123621 100644
--- a/src/Ryujinx.Graphics.Metal/MetalRenderer.cs
+++ b/src/Ryujinx.Graphics.Metal/MetalRenderer.cs
@@ -182,6 +182,12 @@ namespace Ryujinx.Graphics.Metal
                 supportsViewportSwizzle: false,
                 supportsIndirectParameters: true,
                 supportsDepthClipControl: false,
+                uniformBufferSetIndex: 0,
+                storageBufferSetIndex: 1,
+                textureSetIndex: 2,
+                imageSetIndex: 3,
+                extraSetBaseIndex: 0,
+                maximumExtraSets: 0,
                 maximumUniformBuffersPerStage: Constants.MaxUniformBuffersPerStage,
                 maximumStorageBuffersPerStage: Constants.MaxStorageBuffersPerStage,
                 maximumTexturesPerStage: Constants.MaxTexturesPerStage,
diff --git a/src/Ryujinx.Graphics.Metal/Pipeline.cs b/src/Ryujinx.Graphics.Metal/Pipeline.cs
index 4d36893d4..c00c1d09b 100644
--- a/src/Ryujinx.Graphics.Metal/Pipeline.cs
+++ b/src/Ryujinx.Graphics.Metal/Pipeline.cs
@@ -414,6 +414,11 @@ namespace Ryujinx.Graphics.Metal
             Logger.Warning?.Print(LogClass.Gpu, "Not Implemented!");
         }
 
+        public void SetImageArraySeparate(ShaderStage stage, int setIndex, IImageArray array)
+        {
+            Logger.Warning?.Print(LogClass.Gpu, "Not Implemented!");
+        }
+
         public void SetLineParameters(float width, bool smooth)
         {
             // Metal does not support wide-lines.
@@ -517,6 +522,11 @@ namespace Ryujinx.Graphics.Metal
             Logger.Warning?.Print(LogClass.Gpu, "Not Implemented!");
         }
 
+        public void SetTextureArraySeparate(ShaderStage stage, int setIndex, ITextureArray array)
+        {
+            Logger.Warning?.Print(LogClass.Gpu, "Not Implemented!");
+        }
+
         public void SetUserClipDistance(int index, bool enableClip)
         {
             Logger.Warning?.Print(LogClass.Gpu, "Not Implemented!");
diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Instructions/InstGenMemory.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Instructions/InstGenMemory.cs
index 5a8152db7..2d38852df 100644
--- a/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Instructions/InstGenMemory.cs
+++ b/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Instructions/InstGenMemory.cs
@@ -305,7 +305,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
 
         private static string GetSamplerName(ShaderProperties resourceDefinitions, AstTextureOperation textOp)
         {
-            return resourceDefinitions.Textures[textOp.Binding].Name;
+            return resourceDefinitions.Textures[textOp.GetTextureSetAndBinding()].Name;
         }
 
         private static string GetMaskMultiDest(int mask)
@@ -362,7 +362,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions
             }
             else
             {
-                context.Properties.Textures.TryGetValue(texOp.Binding, out TextureDefinition definition);
+                context.Properties.Textures.TryGetValue(texOp.GetTextureSetAndBinding(), out TextureDefinition definition);
                 bool hasLod = !definition.Type.HasFlag(SamplerType.Multisample) && (definition.Type & SamplerType.Mask) != SamplerType.TextureBuffer;
                 texCall += "get_";