From 62602e58b76b8bee53589436039e79f890434135 Mon Sep 17 00:00:00 2001
From: Isaac Marovitz <isaacryu@icloud.com>
Date: Sat, 27 Jul 2024 11:31:29 +0100
Subject: [PATCH] Remove ClearSegments for now

Currently unimplemented and issues are arising with building BindingSegments in general.
---
 src/Ryujinx.Graphics.Metal/Program.cs | 58 ---------------------------
 1 file changed, 58 deletions(-)

diff --git a/src/Ryujinx.Graphics.Metal/Program.cs b/src/Ryujinx.Graphics.Metal/Program.cs
index 5ea3050718..c1eae22737 100644
--- a/src/Ryujinx.Graphics.Metal/Program.cs
+++ b/src/Ryujinx.Graphics.Metal/Program.cs
@@ -28,7 +28,6 @@ namespace Ryujinx.Graphics.Metal
         private MTLComputePipelineState? _computePipelineCache;
         private bool _firstBackgroundUse;
 
-        public ResourceBindingSegment[][] ClearSegments { get; }
         public ResourceBindingSegment[][] BindingSegments { get; }
         // Argument buffer sizes for Vertex or Compute stages
         public int[] ArgumentBufferSizes { get; }
@@ -53,7 +52,6 @@ namespace Ryujinx.Graphics.Metal
                 _handles[i] = device.NewLibrary(StringHelper.NSString(shader.Code), compileOptions, (library, error) => CompilationResultHandler(library, error, index));
             }
 
-            ClearSegments = BuildClearSegments(resourceLayout.Sets);
             (BindingSegments, ArgumentBufferSizes, FragArgumentBufferSizes) = BuildBindingSegments(resourceLayout.SetUsages);
         }
 
@@ -98,62 +96,6 @@ namespace Ryujinx.Graphics.Metal
             }
         }
 
-        private static ResourceBindingSegment[][] BuildClearSegments(ReadOnlyCollection<ResourceDescriptorCollection> sets)
-        {
-            ResourceBindingSegment[][] segments = new ResourceBindingSegment[sets.Count][];
-
-            for (int setIndex = 0; setIndex < sets.Count; setIndex++)
-            {
-                List<ResourceBindingSegment> currentSegments = new();
-
-                ResourceDescriptor currentDescriptor = default;
-                int currentCount = 0;
-
-                for (int index = 0; index < sets[setIndex].Descriptors.Count; index++)
-                {
-                    ResourceDescriptor descriptor = sets[setIndex].Descriptors[index];
-
-                    if (currentDescriptor.Binding + currentCount != descriptor.Binding ||
-                        currentDescriptor.Type != descriptor.Type ||
-                        currentDescriptor.Stages != descriptor.Stages ||
-                        currentDescriptor.Count > 1 ||
-                        descriptor.Count > 1)
-                    {
-                        if (currentCount != 0)
-                        {
-                            currentSegments.Add(new ResourceBindingSegment(
-                                currentDescriptor.Binding,
-                                currentCount,
-                                currentDescriptor.Type,
-                                currentDescriptor.Stages,
-                                currentDescriptor.Count > 1));
-                        }
-
-                        currentDescriptor = descriptor;
-                        currentCount = descriptor.Count;
-                    }
-                    else
-                    {
-                        currentCount += descriptor.Count;
-                    }
-                }
-
-                if (currentCount != 0)
-                {
-                    currentSegments.Add(new ResourceBindingSegment(
-                        currentDescriptor.Binding,
-                        currentCount,
-                        currentDescriptor.Type,
-                        currentDescriptor.Stages,
-                        currentDescriptor.Count > 1));
-                }
-
-                segments[setIndex] = currentSegments.ToArray();
-            }
-
-            return segments;
-        }
-
         private static (ResourceBindingSegment[][], int[], int[]) BuildBindingSegments(ReadOnlyCollection<ResourceUsageCollection> setUsages)
         {
             ResourceBindingSegment[][] segments = new ResourceBindingSegment[setUsages.Count][];