From b1928461bbea12da3d900900b741572a22431784 Mon Sep 17 00:00:00 2001 From: Isaac Marovitz Date: Fri, 21 Jun 2024 00:21:06 +0100 Subject: [PATCH] Cleanup Pipeline Housekeeping More housekeeping --- src/Ryujinx.Graphics.Metal/Auto.cs | 6 +- .../BackgroundResources.cs | 2 +- src/Ryujinx.Graphics.Metal/BufferHolder.cs | 2 +- src/Ryujinx.Graphics.Metal/BufferManager.cs | 4 +- src/Ryujinx.Graphics.Metal/CacheByRange.cs | 5 +- .../CommandBufferPool.cs | 7 +- .../CommandBufferScoped.cs | 2 +- .../ComputePipelineCache.cs | 2 +- .../DepthStencilCache.cs | 4 +- .../DisposableBuffer.cs | 2 +- src/Ryujinx.Graphics.Metal/EncoderState.cs | 4 +- .../EncoderStateManager.cs | 10 +-- src/Ryujinx.Graphics.Metal/FenceHolder.cs | 2 +- src/Ryujinx.Graphics.Metal/HelperShader.cs | 4 +- src/Ryujinx.Graphics.Metal/MetalRenderer.cs | 7 +- .../MultiFenceHolder.cs | 2 +- src/Ryujinx.Graphics.Metal/Pipeline.cs | 84 ++++++++----------- .../RenderPipelineCache.cs | 4 +- src/Ryujinx.Graphics.Metal/StagingBuffer.cs | 4 +- src/Ryujinx.Graphics.Metal/StateCache.cs | 2 +- src/Ryujinx.Graphics.Metal/StringHelper.cs | 2 +- src/Ryujinx.Graphics.Metal/SyncManager.cs | 2 +- src/Ryujinx.Graphics.Metal/Texture.cs | 4 +- src/Ryujinx.Graphics.Metal/TextureBase.cs | 2 +- 24 files changed, 77 insertions(+), 92 deletions(-) diff --git a/src/Ryujinx.Graphics.Metal/Auto.cs b/src/Ryujinx.Graphics.Metal/Auto.cs index 8793923a7..7e79ecbc3 100644 --- a/src/Ryujinx.Graphics.Metal/Auto.cs +++ b/src/Ryujinx.Graphics.Metal/Auto.cs @@ -5,7 +5,7 @@ using System.Threading; namespace Ryujinx.Graphics.Metal { - public interface IAuto + interface IAuto { bool HasCommandBufferDependency(CommandBufferScoped cbs); @@ -14,13 +14,13 @@ namespace Ryujinx.Graphics.Metal void DecrementReferenceCount(); } - public interface IAutoPrivate : IAuto + interface IAutoPrivate : IAuto { void AddCommandBufferDependencies(CommandBufferScoped cbs); } [SupportedOSPlatform("macos")] - public class Auto : IAutoPrivate, IDisposable where T : IDisposable + class Auto : IAutoPrivate, IDisposable where T : IDisposable { private int _referenceCount; private T _value; diff --git a/src/Ryujinx.Graphics.Metal/BackgroundResources.cs b/src/Ryujinx.Graphics.Metal/BackgroundResources.cs index 2f846392e..f02fd7205 100644 --- a/src/Ryujinx.Graphics.Metal/BackgroundResources.cs +++ b/src/Ryujinx.Graphics.Metal/BackgroundResources.cs @@ -26,7 +26,7 @@ namespace Ryujinx.Graphics.Metal if (_pool == null) { MTLCommandQueue queue = _renderer.BackgroundQueue; - _pool = new CommandBufferPool(queue.Device, queue); + _pool = new CommandBufferPool(queue); } return _pool; diff --git a/src/Ryujinx.Graphics.Metal/BufferHolder.cs b/src/Ryujinx.Graphics.Metal/BufferHolder.cs index 075ac21fe..af1d42744 100644 --- a/src/Ryujinx.Graphics.Metal/BufferHolder.cs +++ b/src/Ryujinx.Graphics.Metal/BufferHolder.cs @@ -8,7 +8,7 @@ using System.Threading; namespace Ryujinx.Graphics.Metal { [SupportedOSPlatform("macos")] - public class BufferHolder : IDisposable + class BufferHolder : IDisposable { private CacheByRange _cachedConvertedBuffers; diff --git a/src/Ryujinx.Graphics.Metal/BufferManager.cs b/src/Ryujinx.Graphics.Metal/BufferManager.cs index bf7f00901..766c1dea2 100644 --- a/src/Ryujinx.Graphics.Metal/BufferManager.cs +++ b/src/Ryujinx.Graphics.Metal/BufferManager.cs @@ -8,7 +8,7 @@ using System.Runtime.Versioning; namespace Ryujinx.Graphics.Metal { - public readonly struct ScopedTemporaryBuffer : IDisposable + readonly struct ScopedTemporaryBuffer : IDisposable { private readonly BufferManager _bufferManager; private readonly bool _isReserved; @@ -39,7 +39,7 @@ namespace Ryujinx.Graphics.Metal } [SupportedOSPlatform("macos")] - public class BufferManager : IDisposable + class BufferManager : IDisposable { private readonly IdList _buffers; diff --git a/src/Ryujinx.Graphics.Metal/CacheByRange.cs b/src/Ryujinx.Graphics.Metal/CacheByRange.cs index d507dcaeb..39255de39 100644 --- a/src/Ryujinx.Graphics.Metal/CacheByRange.cs +++ b/src/Ryujinx.Graphics.Metal/CacheByRange.cs @@ -1,11 +1,10 @@ -using SharpMetal.Metal; using System; using System.Collections.Generic; using System.Runtime.Versioning; namespace Ryujinx.Graphics.Metal { - public interface ICacheKey : IDisposable + interface ICacheKey : IDisposable { bool KeyEqual(ICacheKey other); } @@ -116,7 +115,7 @@ namespace Ryujinx.Graphics.Metal } [SupportedOSPlatform("macos")] - public readonly struct Dependency + readonly struct Dependency { private readonly BufferHolder _buffer; private readonly int _offset; diff --git a/src/Ryujinx.Graphics.Metal/CommandBufferPool.cs b/src/Ryujinx.Graphics.Metal/CommandBufferPool.cs index aa659775a..925e4980b 100644 --- a/src/Ryujinx.Graphics.Metal/CommandBufferPool.cs +++ b/src/Ryujinx.Graphics.Metal/CommandBufferPool.cs @@ -7,14 +7,12 @@ using System.Runtime.Versioning; namespace Ryujinx.Graphics.Metal { [SupportedOSPlatform("macos")] - public class CommandBufferPool : IDisposable + class CommandBufferPool : IDisposable { public const int MaxCommandBuffers = 16; private readonly int _totalCommandBuffers; private readonly int _totalCommandBuffersMask; - - private readonly MTLDevice _device; private readonly MTLCommandQueue _queue; [SupportedOSPlatform("macos")] @@ -45,9 +43,8 @@ namespace Ryujinx.Graphics.Metal private int _queuedCount; private int _inUseCount; - public CommandBufferPool(MTLDevice device, MTLCommandQueue queue) + public CommandBufferPool(MTLCommandQueue queue) { - _device = device; _queue = queue; _totalCommandBuffers = MaxCommandBuffers; diff --git a/src/Ryujinx.Graphics.Metal/CommandBufferScoped.cs b/src/Ryujinx.Graphics.Metal/CommandBufferScoped.cs index 48c4d3a1e..43cea6fe9 100644 --- a/src/Ryujinx.Graphics.Metal/CommandBufferScoped.cs +++ b/src/Ryujinx.Graphics.Metal/CommandBufferScoped.cs @@ -5,7 +5,7 @@ using System.Runtime.Versioning; namespace Ryujinx.Graphics.Metal { [SupportedOSPlatform("macos")] - public readonly struct CommandBufferScoped : IDisposable + readonly struct CommandBufferScoped : IDisposable { private readonly CommandBufferPool _pool; public MTLCommandBuffer CommandBuffer { get; } diff --git a/src/Ryujinx.Graphics.Metal/ComputePipelineCache.cs b/src/Ryujinx.Graphics.Metal/ComputePipelineCache.cs index c35b580eb..a76f4c33c 100644 --- a/src/Ryujinx.Graphics.Metal/ComputePipelineCache.cs +++ b/src/Ryujinx.Graphics.Metal/ComputePipelineCache.cs @@ -7,7 +7,7 @@ using System.Runtime.Versioning; namespace Ryujinx.Graphics.Metal { [SupportedOSPlatform("macos")] - public class ComputePipelineCache : StateCache + class ComputePipelineCache : StateCache { private readonly MTLDevice _device; diff --git a/src/Ryujinx.Graphics.Metal/DepthStencilCache.cs b/src/Ryujinx.Graphics.Metal/DepthStencilCache.cs index 1964d093b..be47653c0 100644 --- a/src/Ryujinx.Graphics.Metal/DepthStencilCache.cs +++ b/src/Ryujinx.Graphics.Metal/DepthStencilCache.cs @@ -4,7 +4,7 @@ using System.Runtime.Versioning; namespace Ryujinx.Graphics.Metal { [SupportedOSPlatform("macos")] - public struct DepthStencilHash + struct DepthStencilHash { public struct StencilHash { @@ -22,7 +22,7 @@ namespace Ryujinx.Graphics.Metal } [SupportedOSPlatform("macos")] - public class DepthStencilCache : StateCache + class DepthStencilCache : StateCache { private readonly MTLDevice _device; diff --git a/src/Ryujinx.Graphics.Metal/DisposableBuffer.cs b/src/Ryujinx.Graphics.Metal/DisposableBuffer.cs index cb7760c1e..a2d2247c4 100644 --- a/src/Ryujinx.Graphics.Metal/DisposableBuffer.cs +++ b/src/Ryujinx.Graphics.Metal/DisposableBuffer.cs @@ -5,7 +5,7 @@ using System.Runtime.Versioning; namespace Ryujinx.Graphics.Metal { [SupportedOSPlatform("macos")] - public readonly struct DisposableBuffer : IDisposable + readonly struct DisposableBuffer : IDisposable { public MTLBuffer Value { get; } diff --git a/src/Ryujinx.Graphics.Metal/EncoderState.cs b/src/Ryujinx.Graphics.Metal/EncoderState.cs index f99f52aec..72422c70d 100644 --- a/src/Ryujinx.Graphics.Metal/EncoderState.cs +++ b/src/Ryujinx.Graphics.Metal/EncoderState.cs @@ -5,7 +5,7 @@ using System.Runtime.Versioning; namespace Ryujinx.Graphics.Metal { - public struct DirtyFlags + struct DirtyFlags { public bool RenderPipeline = false; public bool ComputePipeline = false; @@ -21,7 +21,7 @@ namespace Ryujinx.Graphics.Metal } } - public record struct BufferRef + record struct BufferRef { public Auto Buffer; public int Index; diff --git a/src/Ryujinx.Graphics.Metal/EncoderStateManager.cs b/src/Ryujinx.Graphics.Metal/EncoderStateManager.cs index 9919db5f2..923f562bd 100644 --- a/src/Ryujinx.Graphics.Metal/EncoderStateManager.cs +++ b/src/Ryujinx.Graphics.Metal/EncoderStateManager.cs @@ -360,7 +360,7 @@ namespace Ryujinx.Graphics.Metal { _currentState.IndexType = MTLIndexType.UInt16; _currentState.IndexBufferOffset = (ulong)buffer.Offset; - _currentState.IndexBuffer = _bufferManager.GetBufferI8ToI16(_pipeline.CurrentCommandBuffer, buffer.Handle, buffer.Offset, buffer.Size); + _currentState.IndexBuffer = _bufferManager.GetBufferI8ToI16(_pipeline.Cbs, buffer.Handle, buffer.Offset, buffer.Size); } else { @@ -1036,12 +1036,12 @@ namespace Ryujinx.Graphics.Metal if (range.HasValue) { offset = range.Value.Offset; - mtlBuffer = autoBuffer.Get(_pipeline.CurrentCommandBuffer, offset, range.Value.Size, range.Value.Write).Value; + mtlBuffer = autoBuffer.Get(_pipeline.Cbs, offset, range.Value.Size, range.Value.Write).Value; } else { - mtlBuffer = autoBuffer.Get(_pipeline.CurrentCommandBuffer).Value; + mtlBuffer = autoBuffer.Get(_pipeline.Cbs).Value; } renderCommandEncoder.SetVertexBuffer(mtlBuffer, (ulong)offset, (ulong)index); @@ -1072,12 +1072,12 @@ namespace Ryujinx.Graphics.Metal if (range.HasValue) { offset = range.Value.Offset; - mtlBuffer = autoBuffer.Get(_pipeline.CurrentCommandBuffer, offset, range.Value.Size, range.Value.Write).Value; + mtlBuffer = autoBuffer.Get(_pipeline.Cbs, offset, range.Value.Size, range.Value.Write).Value; } else { - mtlBuffer = autoBuffer.Get(_pipeline.CurrentCommandBuffer).Value; + mtlBuffer = autoBuffer.Get(_pipeline.Cbs).Value; } computeCommandEncoder.SetBuffer(mtlBuffer, (ulong)offset, (ulong)index); diff --git a/src/Ryujinx.Graphics.Metal/FenceHolder.cs b/src/Ryujinx.Graphics.Metal/FenceHolder.cs index 3f11fd971..a8dd28c0d 100644 --- a/src/Ryujinx.Graphics.Metal/FenceHolder.cs +++ b/src/Ryujinx.Graphics.Metal/FenceHolder.cs @@ -6,7 +6,7 @@ using System.Threading; namespace Ryujinx.Graphics.Metal { [SupportedOSPlatform("macos")] - public class FenceHolder : IDisposable + class FenceHolder : IDisposable { private MTLCommandBuffer _fence; private int _referenceCount; diff --git a/src/Ryujinx.Graphics.Metal/HelperShader.cs b/src/Ryujinx.Graphics.Metal/HelperShader.cs index 0673a42c2..dcb5a4f62 100644 --- a/src/Ryujinx.Graphics.Metal/HelperShader.cs +++ b/src/Ryujinx.Graphics.Metal/HelperShader.cs @@ -10,7 +10,7 @@ using System.Runtime.Versioning; namespace Ryujinx.Graphics.Metal { [SupportedOSPlatform("macos")] - public class HelperShader : IDisposable + class HelperShader : IDisposable { private const int ConvertElementsPerWorkgroup = 32 * 100; // Work group size of 32 times 100 elements. private const string ShadersSourcePath = "/Ryujinx.Graphics.Metal/Shaders"; @@ -268,7 +268,7 @@ namespace Ryujinx.Graphics.Metal // TODO: Flush - using var buffer = _renderer.BufferManager.ReserveOrCreate(_pipeline.CurrentCommandBuffer, ClearColorBufferSize); + using var buffer = _renderer.BufferManager.ReserveOrCreate(_pipeline.Cbs, ClearColorBufferSize); buffer.Holder.SetDataUnchecked(buffer.Offset, clearColor); _pipeline.SetUniformBuffers([new BufferAssignment(0, buffer.Range)]); diff --git a/src/Ryujinx.Graphics.Metal/MetalRenderer.cs b/src/Ryujinx.Graphics.Metal/MetalRenderer.cs index 08d1ca540..c68da5a4a 100644 --- a/src/Ryujinx.Graphics.Metal/MetalRenderer.cs +++ b/src/Ryujinx.Graphics.Metal/MetalRenderer.cs @@ -21,7 +21,6 @@ namespace Ryujinx.Graphics.Metal public event EventHandler ScreenCaptured; public bool PreferThreading => true; - public IPipeline Pipeline => _pipeline; public IWindow Window => _window; @@ -54,9 +53,9 @@ namespace Ryujinx.Graphics.Metal layer.Device = _device; layer.FramebufferOnly = false; - CommandBufferPool = new CommandBufferPool(_device, _queue); + CommandBufferPool = new CommandBufferPool(_queue); _window = new Window(this, layer); - _pipeline = new Pipeline(_device, this, _queue); + _pipeline = new Pipeline(_device, this); BufferManager = new BufferManager(_device, this, _pipeline); _pipeline.InitEncoderStateManager(BufferManager); @@ -222,7 +221,7 @@ namespace Ryujinx.Graphics.Metal public void SetBufferData(BufferHandle buffer, int offset, ReadOnlySpan data) { - BufferManager.SetData(buffer, offset, data, _pipeline.CurrentCommandBuffer, _pipeline.EndRenderPassDelegate); + BufferManager.SetData(buffer, offset, data, _pipeline.Cbs, _pipeline.EndRenderPassDelegate); } public void UpdateCounters() diff --git a/src/Ryujinx.Graphics.Metal/MultiFenceHolder.cs b/src/Ryujinx.Graphics.Metal/MultiFenceHolder.cs index 481580b8e..cd5ad08ba 100644 --- a/src/Ryujinx.Graphics.Metal/MultiFenceHolder.cs +++ b/src/Ryujinx.Graphics.Metal/MultiFenceHolder.cs @@ -8,7 +8,7 @@ namespace Ryujinx.Graphics.Metal /// Holder for multiple host GPU fences. /// [SupportedOSPlatform("macos")] - public class MultiFenceHolder + class MultiFenceHolder { private const int BufferUsageTrackingGranularity = 4096; diff --git a/src/Ryujinx.Graphics.Metal/Pipeline.cs b/src/Ryujinx.Graphics.Metal/Pipeline.cs index 7a83a02a7..3a913986b 100644 --- a/src/Ryujinx.Graphics.Metal/Pipeline.cs +++ b/src/Ryujinx.Graphics.Metal/Pipeline.cs @@ -18,40 +18,30 @@ namespace Ryujinx.Graphics.Metal } [SupportedOSPlatform("macos")] - public class Pipeline : IPipeline, IDisposable + class Pipeline : IPipeline, IDisposable { private readonly MTLDevice _device; - private readonly MTLCommandQueue _commandQueue; private readonly MetalRenderer _renderer; - - private CommandBufferScoped Cbs; - private CommandBufferScoped? PreloadCbs; - public MTLCommandBuffer CommandBuffer; - - public readonly Action EndRenderPassDelegate; - - public CommandBufferScoped CurrentCommandBuffer => Cbs; - - private MTLCommandEncoder? _currentEncoder; - public MTLCommandEncoder? CurrentEncoder => _currentEncoder; - - private EncoderType _currentEncoderType = EncoderType.None; - public EncoderType CurrentEncoderType => _currentEncoderType; - private EncoderStateManager _encoderStateManager; - public Pipeline(MTLDevice device, MetalRenderer renderer, MTLCommandQueue commandQueue) + public readonly Action EndRenderPassDelegate; + public MTLCommandBuffer CommandBuffer; + + internal CommandBufferScoped Cbs { get; private set; } + internal MTLCommandEncoder? CurrentEncoder { get; private set; } + internal EncoderType CurrentEncoderType { get; private set; } = EncoderType.None; + + public Pipeline(MTLDevice device, MetalRenderer renderer) { _device = device; _renderer = renderer; - _commandQueue = commandQueue; EndRenderPassDelegate = EndCurrentPass; CommandBuffer = (Cbs = _renderer.CommandBufferPool.Rent()).CommandBuffer; } - public void InitEncoderStateManager(BufferManager bufferManager) + internal void InitEncoderStateManager(BufferManager bufferManager) { _encoderStateManager = new EncoderStateManager(_device, bufferManager, this); } @@ -79,13 +69,13 @@ namespace Ryujinx.Graphics.Metal public MTLRenderCommandEncoder GetOrCreateRenderEncoder(bool forDraw = false) { MTLRenderCommandEncoder renderCommandEncoder; - if (_currentEncoder == null || _currentEncoderType != EncoderType.Render) + if (CurrentEncoder == null || CurrentEncoderType != EncoderType.Render) { renderCommandEncoder = BeginRenderPass(); } else { - renderCommandEncoder = new MTLRenderCommandEncoder(_currentEncoder.Value); + renderCommandEncoder = new MTLRenderCommandEncoder(CurrentEncoder.Value); } if (forDraw) @@ -98,11 +88,11 @@ namespace Ryujinx.Graphics.Metal public MTLBlitCommandEncoder GetOrCreateBlitEncoder() { - if (_currentEncoder != null) + if (CurrentEncoder != null) { - if (_currentEncoderType == EncoderType.Blit) + if (CurrentEncoderType == EncoderType.Blit) { - return new MTLBlitCommandEncoder(_currentEncoder.Value); + return new MTLBlitCommandEncoder(CurrentEncoder.Value); } } @@ -112,13 +102,13 @@ namespace Ryujinx.Graphics.Metal public MTLComputeCommandEncoder GetOrCreateComputeEncoder() { MTLComputeCommandEncoder computeCommandEncoder; - if (_currentEncoder == null || _currentEncoderType != EncoderType.Compute) + if (CurrentEncoder == null || CurrentEncoderType != EncoderType.Compute) { computeCommandEncoder = BeginComputePass(); } else { - computeCommandEncoder = new MTLComputeCommandEncoder(_currentEncoder.Value); + computeCommandEncoder = new MTLComputeCommandEncoder(CurrentEncoder.Value); } _encoderStateManager.RebindComputeState(computeCommandEncoder); @@ -128,62 +118,62 @@ namespace Ryujinx.Graphics.Metal public void EndCurrentPass() { - if (_currentEncoder != null) + if (CurrentEncoder != null) { - switch (_currentEncoderType) + switch (CurrentEncoderType) { case EncoderType.Blit: - new MTLBlitCommandEncoder(_currentEncoder.Value).EndEncoding(); - _currentEncoder = null; + new MTLBlitCommandEncoder(CurrentEncoder.Value).EndEncoding(); + CurrentEncoder = null; break; case EncoderType.Compute: - new MTLComputeCommandEncoder(_currentEncoder.Value).EndEncoding(); - _currentEncoder = null; + new MTLComputeCommandEncoder(CurrentEncoder.Value).EndEncoding(); + CurrentEncoder = null; break; case EncoderType.Render: - new MTLRenderCommandEncoder(_currentEncoder.Value).EndEncoding(); - _currentEncoder = null; + new MTLRenderCommandEncoder(CurrentEncoder.Value).EndEncoding(); + CurrentEncoder = null; break; default: throw new ArgumentOutOfRangeException(); } - _currentEncoderType = EncoderType.None; + CurrentEncoderType = EncoderType.None; } } - public MTLRenderCommandEncoder BeginRenderPass() + private MTLRenderCommandEncoder BeginRenderPass() { EndCurrentPass(); var renderCommandEncoder = _encoderStateManager.CreateRenderCommandEncoder(); - _currentEncoder = renderCommandEncoder; - _currentEncoderType = EncoderType.Render; + CurrentEncoder = renderCommandEncoder; + CurrentEncoderType = EncoderType.Render; return renderCommandEncoder; } - public MTLBlitCommandEncoder BeginBlitPass() + private MTLBlitCommandEncoder BeginBlitPass() { EndCurrentPass(); var descriptor = new MTLBlitPassDescriptor(); var blitCommandEncoder = Cbs.CommandBuffer.BlitCommandEncoder(descriptor); - _currentEncoder = blitCommandEncoder; - _currentEncoderType = EncoderType.Blit; + CurrentEncoder = blitCommandEncoder; + CurrentEncoderType = EncoderType.Blit; return blitCommandEncoder; } - public MTLComputeCommandEncoder BeginComputePass() + private MTLComputeCommandEncoder BeginComputePass() { EndCurrentPass(); var computeCommandEncoder = _encoderStateManager.CreateComputeCommandEncoder(); - _currentEncoder = computeCommandEncoder; - _currentEncoderType = EncoderType.Compute; + CurrentEncoder = computeCommandEncoder; + CurrentEncoderType = EncoderType.Compute; return computeCommandEncoder; } @@ -232,7 +222,7 @@ namespace Ryujinx.Graphics.Metal public void Barrier() { - switch (_currentEncoderType) + switch (CurrentEncoderType) { case EncoderType.Render: { @@ -546,7 +536,7 @@ namespace Ryujinx.Graphics.Metal _encoderStateManager.UpdateStorageBuffers(buffers); } - public void SetStorageBuffers(int first, ReadOnlySpan> buffers) + internal void SetStorageBuffers(int first, ReadOnlySpan> buffers) { _encoderStateManager.UpdateStorageBuffers(first, buffers); } diff --git a/src/Ryujinx.Graphics.Metal/RenderPipelineCache.cs b/src/Ryujinx.Graphics.Metal/RenderPipelineCache.cs index 6fb171816..b8e6005c4 100644 --- a/src/Ryujinx.Graphics.Metal/RenderPipelineCache.cs +++ b/src/Ryujinx.Graphics.Metal/RenderPipelineCache.cs @@ -7,7 +7,7 @@ using System.Runtime.Versioning; namespace Ryujinx.Graphics.Metal { [SupportedOSPlatform("macos")] - public struct RenderPipelineHash + struct RenderPipelineHash { public MTLFunction VertexFunction; public MTLFunction FragmentFunction; @@ -162,7 +162,7 @@ namespace Ryujinx.Graphics.Metal } [SupportedOSPlatform("macos")] - public class RenderPipelineCache : StateCache + class RenderPipelineCache : StateCache { private readonly MTLDevice _device; diff --git a/src/Ryujinx.Graphics.Metal/StagingBuffer.cs b/src/Ryujinx.Graphics.Metal/StagingBuffer.cs index 81adcd116..07450f6b0 100644 --- a/src/Ryujinx.Graphics.Metal/StagingBuffer.cs +++ b/src/Ryujinx.Graphics.Metal/StagingBuffer.cs @@ -8,7 +8,7 @@ using System.Runtime.Versioning; namespace Ryujinx.Graphics.Metal { - public readonly struct StagingBufferReserved + readonly struct StagingBufferReserved { public readonly BufferHolder Buffer; public readonly int Offset; @@ -23,7 +23,7 @@ namespace Ryujinx.Graphics.Metal } [SupportedOSPlatform("macos")] - public class StagingBuffer : IDisposable + class StagingBuffer : IDisposable { private const int BufferSize = 32 * 1024 * 1024; diff --git a/src/Ryujinx.Graphics.Metal/StateCache.cs b/src/Ryujinx.Graphics.Metal/StateCache.cs index f333814e6..9b8391ffc 100644 --- a/src/Ryujinx.Graphics.Metal/StateCache.cs +++ b/src/Ryujinx.Graphics.Metal/StateCache.cs @@ -5,7 +5,7 @@ using System.Runtime.Versioning; namespace Ryujinx.Graphics.Metal { [SupportedOSPlatform("macos")] - public abstract class StateCache : IDisposable where T : IDisposable + abstract class StateCache : IDisposable where T : IDisposable { private readonly Dictionary _cache = new(); diff --git a/src/Ryujinx.Graphics.Metal/StringHelper.cs b/src/Ryujinx.Graphics.Metal/StringHelper.cs index 21cd474dc..46e8ad2e9 100644 --- a/src/Ryujinx.Graphics.Metal/StringHelper.cs +++ b/src/Ryujinx.Graphics.Metal/StringHelper.cs @@ -5,7 +5,7 @@ using System.Runtime.Versioning; namespace Ryujinx.Graphics.Metal { [SupportedOSPlatform("macos")] - public class StringHelper + class StringHelper { public static NSString NSString(string source) { diff --git a/src/Ryujinx.Graphics.Metal/SyncManager.cs b/src/Ryujinx.Graphics.Metal/SyncManager.cs index 528531575..0ec508365 100644 --- a/src/Ryujinx.Graphics.Metal/SyncManager.cs +++ b/src/Ryujinx.Graphics.Metal/SyncManager.cs @@ -7,7 +7,7 @@ using System.Runtime.Versioning; namespace Ryujinx.Graphics.Metal { [SupportedOSPlatform("macos")] - public class SyncManager + class SyncManager { private class SyncHandle { diff --git a/src/Ryujinx.Graphics.Metal/Texture.cs b/src/Ryujinx.Graphics.Metal/Texture.cs index da52e61e7..bb5a6bb5f 100644 --- a/src/Ryujinx.Graphics.Metal/Texture.cs +++ b/src/Ryujinx.Graphics.Metal/Texture.cs @@ -8,7 +8,7 @@ using System.Runtime.Versioning; namespace Ryujinx.Graphics.Metal { [SupportedOSPlatform("macos")] - public class Texture : TextureBase, ITexture + class Texture : TextureBase, ITexture { public Texture(MTLDevice device, MetalRenderer renderer, Pipeline pipeline, TextureCreateInfo info) : base(device, renderer, pipeline, info) { @@ -162,7 +162,7 @@ namespace Ryujinx.Graphics.Metal public void CopyTo(BufferRange range, int layer, int level, int stride) { var blitCommandEncoder = _pipeline.GetOrCreateBlitEncoder(); - var cbs = _pipeline.CurrentCommandBuffer; + var cbs = _pipeline.Cbs; int outSize = Info.GetMipSize(level); diff --git a/src/Ryujinx.Graphics.Metal/TextureBase.cs b/src/Ryujinx.Graphics.Metal/TextureBase.cs index 4b71ec9f9..51f5ec8d2 100644 --- a/src/Ryujinx.Graphics.Metal/TextureBase.cs +++ b/src/Ryujinx.Graphics.Metal/TextureBase.cs @@ -6,7 +6,7 @@ using System.Runtime.Versioning; namespace Ryujinx.Graphics.Metal { [SupportedOSPlatform("macos")] - public abstract class TextureBase : IDisposable + abstract class TextureBase : IDisposable { private bool _disposed;