diff --git a/Directory.Packages.props b/Directory.Packages.props
index 70404ef8e..afef0d7ff 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -38,7 +38,11 @@
+<<<<<<< HEAD
+=======
+
+>>>>>>> 3eab14be7 (Set scissors & viewports)
diff --git a/src/Ryujinx.Graphics.Metal/Pipeline.cs b/src/Ryujinx.Graphics.Metal/Pipeline.cs
index 5a0785299..e782c9540 100644
--- a/src/Ryujinx.Graphics.Metal/Pipeline.cs
+++ b/src/Ryujinx.Graphics.Metal/Pipeline.cs
@@ -440,7 +440,26 @@ namespace Ryujinx.Graphics.Metal
public void SetScissors(ReadOnlySpan> regions)
{
- _encoderStateManager.UpdateScissors(regions);
+ // TODO: Test max allowed scissor rects on device
+ var mtlScissorRects = new MTLScissorRect[regions.Length];
+
+ for (int i = 0; i < regions.Length; i++)
+ {
+ var region = regions[i];
+ mtlScissorRects[i] = new MTLScissorRect
+ {
+ height = (ulong)region.Height,
+ width = (ulong)region.Width,
+ x = (ulong)region.X,
+ y = (ulong)region.Y
+ };
+ }
+
+ fixed (MTLScissorRect* pMtlScissorRects = mtlScissorRects)
+ {
+ var renderCommandEncoder = GetOrCreateRenderEncoder();
+ renderCommandEncoder.SetScissorRects((IntPtr)pMtlScissorRects, (ulong)regions.Length);
+ }
}
public void SetStencilTest(StencilTestDescriptor stencilTest)
@@ -508,7 +527,28 @@ namespace Ryujinx.Graphics.Metal
public void SetViewports(ReadOnlySpan viewports)
{
- _encoderStateManager.UpdateViewports(viewports);
+ // TODO: Test max allowed viewports on device
+ var mtlViewports = new MTLViewport[viewports.Length];
+
+ for (int i = 0; i < viewports.Length; i++)
+ {
+ var viewport = viewports[i];
+ mtlViewports[i] = new MTLViewport
+ {
+ originX = viewport.Region.X,
+ originY = viewport.Region.Y,
+ width = viewport.Region.Width,
+ height = viewport.Region.Height,
+ znear = viewport.DepthNear,
+ zfar = viewport.DepthFar
+ };
+ }
+
+ fixed (MTLViewport* pMtlViewports = mtlViewports)
+ {
+ var renderCommandEncoder = GetOrCreateRenderEncoder();
+ renderCommandEncoder.SetViewports((IntPtr)pMtlViewports, (ulong)viewports.Length);
+ }
}
public void TextureBarrier()