From c97e7d621b9aa7cdeb1822063da2128737035dc6 Mon Sep 17 00:00:00 2001 From: Isaac Marovitz Date: Sat, 18 May 2024 20:40:37 -0400 Subject: [PATCH] Format --- src/Ryujinx.Graphics.Metal/EncoderStateManager.cs | 13 ++++++------- src/Ryujinx.Graphics.Metal/FormatTable.cs | 6 ++++-- src/Ryujinx.Graphics.Metal/HelperShader.cs | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Ryujinx.Graphics.Metal/EncoderStateManager.cs b/src/Ryujinx.Graphics.Metal/EncoderStateManager.cs index 341490354..e2ad3bb13 100644 --- a/src/Ryujinx.Graphics.Metal/EncoderStateManager.cs +++ b/src/Ryujinx.Graphics.Metal/EncoderStateManager.cs @@ -14,16 +14,15 @@ namespace Ryujinx.Graphics.Metal struct EncoderStateManager { private readonly MTLDevice _device; - private Pipeline _pipeline; + private readonly Pipeline _pipeline; private EncoderState _currentState = new(); private EncoderState _backState = new(); - // Public accessors - public MTLBuffer IndexBuffer => _currentState.IndexBuffer; - public MTLIndexType IndexType => _currentState.IndexType; - public ulong IndexBufferOffset => _currentState.IndexBufferOffset; - public PrimitiveTopology Topology => _currentState.Topology; + public readonly MTLBuffer IndexBuffer => _currentState.IndexBuffer; + public readonly MTLIndexType IndexType => _currentState.IndexType; + public readonly ulong IndexBufferOffset => _currentState.IndexBufferOffset; + public readonly PrimitiveTopology Topology => _currentState.Topology; public EncoderStateManager(MTLDevice device, Pipeline pipeline) { @@ -495,7 +494,7 @@ namespace Ryujinx.Graphics.Metal } // Inlineable - public void UpdateTextureAndSampler(ShaderStage stage, ulong binding, MTLTexture texture, MTLSamplerState sampler) + public readonly void UpdateTextureAndSampler(ShaderStage stage, ulong binding, MTLTexture texture, MTLSamplerState sampler) { switch (stage) { diff --git a/src/Ryujinx.Graphics.Metal/FormatTable.cs b/src/Ryujinx.Graphics.Metal/FormatTable.cs index 0ef710011..3014cdafd 100644 --- a/src/Ryujinx.Graphics.Metal/FormatTable.cs +++ b/src/Ryujinx.Graphics.Metal/FormatTable.cs @@ -186,8 +186,10 @@ namespace Ryujinx.Graphics.Metal { switch (format) { - case MTLPixelFormat.Depth24UnormStencil8: return MTLPixelFormat.X24Stencil8; - case MTLPixelFormat.Depth32FloatStencil8: return MTLPixelFormat.X32Stencil8; + case MTLPixelFormat.Depth24UnormStencil8: + return MTLPixelFormat.X24Stencil8; + case MTLPixelFormat.Depth32FloatStencil8: + return MTLPixelFormat.X32Stencil8; default: Logger.Warning?.PrintMsg(LogClass.Gpu, $"Attempted to get stencil format for non packed format {format}!"); return MTLPixelFormat.Invalid; diff --git a/src/Ryujinx.Graphics.Metal/HelperShader.cs b/src/Ryujinx.Graphics.Metal/HelperShader.cs index a700cd68a..b4ddfe02c 100644 --- a/src/Ryujinx.Graphics.Metal/HelperShader.cs +++ b/src/Ryujinx.Graphics.Metal/HelperShader.cs @@ -19,8 +19,8 @@ namespace Ryujinx.Graphics.Metal class HelperShader : IDisposable { private const string ShadersSourcePath = "/Ryujinx.Graphics.Metal/Shaders"; + private readonly Pipeline _pipeline; private MTLDevice _device; - private Pipeline _pipeline; private readonly IProgram _programColorBlit; private readonly IProgram _programColorClearF;