1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-12-21 01:12:01 +00:00

Rebase + Format

This commit is contained in:
Isaac Marovitz 2024-05-15 09:03:53 -04:00 committed by Isaac Marovitz
parent 559122f591
commit 2d609ad57b
4 changed files with 13 additions and 10 deletions

View file

@ -152,6 +152,7 @@ namespace Ryujinx.Graphics.Metal
supportsBgraFormat: true, supportsBgraFormat: true,
supportsR4G4Format: false, supportsR4G4Format: false,
supportsR4G4B4A4Format: true, supportsR4G4B4A4Format: true,
supportsScaledVertexFormats: true,
supportsSnormBufferTextureFormat: true, supportsSnormBufferTextureFormat: true,
supportsSparseBuffer: false, supportsSparseBuffer: false,
supports5BitComponentFormat: true, supports5BitComponentFormat: true,
@ -166,7 +167,7 @@ namespace Ryujinx.Graphics.Metal
supportsMismatchingViewFormat: true, supportsMismatchingViewFormat: true,
supportsCubemapView: true, supportsCubemapView: true,
supportsNonConstantTextureOffset: false, supportsNonConstantTextureOffset: false,
supportsScaledVertexFormats: true, supportsQuads: false,
// TODO: Metal Bindless Support // TODO: Metal Bindless Support
supportsSeparateSampler: false, supportsSeparateSampler: false,
supportsShaderBallot: false, supportsShaderBallot: false,

View file

@ -18,8 +18,8 @@ namespace Ryujinx.Graphics.Metal
private MTLCompareFunction _depthCompareFunction = MTLCompareFunction.Always; private MTLCompareFunction _depthCompareFunction = MTLCompareFunction.Always;
private bool _depthWriteEnabled = false; private bool _depthWriteEnabled = false;
private MTLStencilDescriptor _backFaceStencil = new MTLStencilDescriptor(); private MTLStencilDescriptor _backFaceStencil = new();
private MTLStencilDescriptor _frontFaceStencil = new MTLStencilDescriptor(); private MTLStencilDescriptor _frontFaceStencil = new();
public PrimitiveTopology Topology = PrimitiveTopology.Triangles; public PrimitiveTopology Topology = PrimitiveTopology.Triangles;
public MTLCullMode CullMode = MTLCullMode.None; public MTLCullMode CullMode = MTLCullMode.None;
@ -27,7 +27,7 @@ namespace Ryujinx.Graphics.Metal
private MTLViewport[] _viewports = []; private MTLViewport[] _viewports = [];
private MTLScissorRect[] _scissors = []; private MTLScissorRect[] _scissors = [];
public int ViewportCount => _viewports.Length; public readonly int ViewportCount => _viewports.Length;
public RenderEncoderState(MTLFunction vertexFunction, MTLFunction fragmentFunction, MTLDevice device) public RenderEncoderState(MTLFunction vertexFunction, MTLFunction fragmentFunction, MTLDevice device)
{ {
@ -53,11 +53,11 @@ namespace Ryujinx.Graphics.Metal
renderPipelineDescriptor.FragmentFunction = _fragmentFunction.Value; renderPipelineDescriptor.FragmentFunction = _fragmentFunction.Value;
} }
const int maxColorAttachments = 8; const int MaxColorAttachments = 8;
for (int i = 0; i < maxColorAttachments; i++) for (int i = 0; i < MaxColorAttachments; i++)
{ {
var renderAttachment = descriptor.ColorAttachments.Object((ulong)i); var renderAttachment = descriptor.ColorAttachments.Object((ulong)i);
if (renderAttachment.Texture != null) if (renderAttachment.Texture != IntPtr.Zero)
{ {
var attachment = renderPipelineDescriptor.ColorAttachments.Object((ulong)i); var attachment = renderPipelineDescriptor.ColorAttachments.Object((ulong)i);
attachment.SetBlendingEnabled(true); attachment.SetBlendingEnabled(true);

View file

@ -1,7 +1,7 @@
using Ryujinx.Graphics.GAL; using Ryujinx.Graphics.GAL;
using SharpMetal.Metal; using SharpMetal.Metal;
using System.Runtime.Versioning;
using System; using System;
using System.Runtime.Versioning;
namespace Ryujinx.Graphics.Metal namespace Ryujinx.Graphics.Metal
{ {

View file

@ -54,7 +54,8 @@ namespace Ryujinx.Graphics.Metal
MTLTexture = _device.NewTexture(descriptor); 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; _device = device;
_pipeline = pipeline; _pipeline = pipeline;
_info = info; _info = info;
@ -82,7 +83,8 @@ namespace Ryujinx.Graphics.Metal
MTLTexture = sourceTexture.NewTextureView(pixelFormat, textureType, levels, slices, swizzle); 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 swizzleR = Info.SwizzleR.Convert();
var swizzleG = Info.SwizzleG.Convert(); var swizzleG = Info.SwizzleG.Convert();
var swizzleB = Info.SwizzleB.Convert(); var swizzleB = Info.SwizzleB.Convert();