mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-12-28 03:23:05 +00:00
Clamp Viewport ZNear & ZFar
This commit is contained in:
parent
e99f9e2af0
commit
35b0436a2b
1 changed files with 7 additions and 2 deletions
|
@ -735,6 +735,11 @@ namespace Ryujinx.Graphics.Metal
|
||||||
|
|
||||||
public unsafe void SetViewports(ReadOnlySpan<Viewport> viewports)
|
public unsafe void SetViewports(ReadOnlySpan<Viewport> viewports)
|
||||||
{
|
{
|
||||||
|
static float Clamp(float value)
|
||||||
|
{
|
||||||
|
return Math.Clamp(value, 0f, 1f);
|
||||||
|
}
|
||||||
|
|
||||||
var mtlViewports = new MTLViewport[viewports.Length];
|
var mtlViewports = new MTLViewport[viewports.Length];
|
||||||
|
|
||||||
for (int i = 0; i < viewports.Length; i++)
|
for (int i = 0; i < viewports.Length; i++)
|
||||||
|
@ -746,8 +751,8 @@ namespace Ryujinx.Graphics.Metal
|
||||||
originY = viewport.Region.Y,
|
originY = viewport.Region.Y,
|
||||||
width = viewport.Region.Width,
|
width = viewport.Region.Width,
|
||||||
height = viewport.Region.Height,
|
height = viewport.Region.Height,
|
||||||
znear = viewport.DepthNear,
|
znear = Clamp(viewport.DepthNear),
|
||||||
zfar = viewport.DepthFar
|
zfar = Clamp(viewport.DepthFar)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue