diff --git a/src/Ryujinx.Graphics.Metal/MetalRenderer.cs b/src/Ryujinx.Graphics.Metal/MetalRenderer.cs index aabe0c1e6c..7342a363ba 100644 --- a/src/Ryujinx.Graphics.Metal/MetalRenderer.cs +++ b/src/Ryujinx.Graphics.Metal/MetalRenderer.cs @@ -152,6 +152,7 @@ namespace Ryujinx.Graphics.Metal supportsBgraFormat: true, supportsR4G4Format: false, supportsR4G4B4A4Format: true, + supportsScaledVertexFormats: true, supportsSnormBufferTextureFormat: true, supportsSparseBuffer: false, supports5BitComponentFormat: true, @@ -166,7 +167,7 @@ namespace Ryujinx.Graphics.Metal supportsMismatchingViewFormat: true, supportsCubemapView: true, supportsNonConstantTextureOffset: false, - supportsScaledVertexFormats: true, + supportsQuads: false, // TODO: Metal Bindless Support supportsSeparateSampler: false, supportsShaderBallot: false, diff --git a/src/Ryujinx.Graphics.Metal/RenderEncoderState.cs b/src/Ryujinx.Graphics.Metal/RenderEncoderState.cs index 832e0ba36c..9ee4ee642d 100644 --- a/src/Ryujinx.Graphics.Metal/RenderEncoderState.cs +++ b/src/Ryujinx.Graphics.Metal/RenderEncoderState.cs @@ -18,8 +18,8 @@ namespace Ryujinx.Graphics.Metal private MTLCompareFunction _depthCompareFunction = MTLCompareFunction.Always; private bool _depthWriteEnabled = false; - private MTLStencilDescriptor _backFaceStencil = new MTLStencilDescriptor(); - private MTLStencilDescriptor _frontFaceStencil = new MTLStencilDescriptor(); + private MTLStencilDescriptor _backFaceStencil = new(); + private MTLStencilDescriptor _frontFaceStencil = new(); public PrimitiveTopology Topology = PrimitiveTopology.Triangles; public MTLCullMode CullMode = MTLCullMode.None; @@ -27,7 +27,7 @@ namespace Ryujinx.Graphics.Metal private MTLViewport[] _viewports = []; private MTLScissorRect[] _scissors = []; - public int ViewportCount => _viewports.Length; + public readonly int ViewportCount => _viewports.Length; public RenderEncoderState(MTLFunction vertexFunction, MTLFunction fragmentFunction, MTLDevice device) { @@ -53,11 +53,11 @@ namespace Ryujinx.Graphics.Metal renderPipelineDescriptor.FragmentFunction = _fragmentFunction.Value; } - const int maxColorAttachments = 8; - for (int i = 0; i < maxColorAttachments; i++) + const int MaxColorAttachments = 8; + for (int i = 0; i < MaxColorAttachments; i++) { var renderAttachment = descriptor.ColorAttachments.Object((ulong)i); - if (renderAttachment.Texture != null) + if (renderAttachment.Texture != IntPtr.Zero) { var attachment = renderPipelineDescriptor.ColorAttachments.Object((ulong)i); attachment.SetBlendingEnabled(true); diff --git a/src/Ryujinx.Graphics.Metal/Sampler.cs b/src/Ryujinx.Graphics.Metal/Sampler.cs index 00570b8a98..0c556eac4c 100644 --- a/src/Ryujinx.Graphics.Metal/Sampler.cs +++ b/src/Ryujinx.Graphics.Metal/Sampler.cs @@ -1,7 +1,7 @@ using Ryujinx.Graphics.GAL; using SharpMetal.Metal; -using System.Runtime.Versioning; using System; +using System.Runtime.Versioning; namespace Ryujinx.Graphics.Metal { diff --git a/src/Ryujinx.Graphics.Metal/Texture.cs b/src/Ryujinx.Graphics.Metal/Texture.cs index 6dca2b2a33..abfadb53a1 100644 --- a/src/Ryujinx.Graphics.Metal/Texture.cs +++ b/src/Ryujinx.Graphics.Metal/Texture.cs @@ -54,7 +54,8 @@ namespace Ryujinx.Graphics.Metal MTLTexture = _device.NewTexture(descriptor); } - public Texture(MTLDevice device, Pipeline pipeline, TextureCreateInfo info, MTLTexture sourceTexture, int firstLayer, int firstLevel) { + public Texture(MTLDevice device, Pipeline pipeline, TextureCreateInfo info, MTLTexture sourceTexture, int firstLayer, int firstLevel) + { _device = device; _pipeline = pipeline; _info = info; @@ -82,7 +83,8 @@ namespace Ryujinx.Graphics.Metal MTLTexture = sourceTexture.NewTextureView(pixelFormat, textureType, levels, slices, swizzle); } - private MTLTextureSwizzleChannels GetSwizzle(TextureCreateInfo info, MTLPixelFormat pixelFormat) { + private MTLTextureSwizzleChannels GetSwizzle(TextureCreateInfo info, MTLPixelFormat pixelFormat) + { var swizzleR = Info.SwizzleR.Convert(); var swizzleG = Info.SwizzleG.Convert(); var swizzleB = Info.SwizzleB.Convert();