Rebase + Format

This commit is contained in:
Isaac Marovitz 2024-05-15 09:03:53 -04:00
parent 0cda74a780
commit 6e524358d4
No known key found for this signature in database
GPG Key ID: 97250B2B09A132E1
4 changed files with 13 additions and 10 deletions

View File

@ -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,

View File

@ -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);

View File

@ -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
{

View File

@ -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();