1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-12-20 07:12:02 +00:00

Clamp Viewport ZNear & ZFar

This commit is contained in:
Isaac Marovitz 2024-05-16 15:59:56 -04:00 committed by Isaac Marovitz
parent e99f9e2af0
commit 35b0436a2b

View file

@ -735,6 +735,11 @@ namespace Ryujinx.Graphics.Metal
public unsafe void SetViewports(ReadOnlySpan<Viewport> viewports)
{
static float Clamp(float value)
{
return Math.Clamp(value, 0f, 1f);
}
var mtlViewports = new MTLViewport[viewports.Length];
for (int i = 0; i < viewports.Length; i++)
@ -746,8 +751,8 @@ namespace Ryujinx.Graphics.Metal
originY = viewport.Region.Y,
width = viewport.Region.Width,
height = viewport.Region.Height,
znear = viewport.DepthNear,
zfar = viewport.DepthFar
znear = Clamp(viewport.DepthNear),
zfar = Clamp(viewport.DepthFar)
};
}