Add depth range support on the GPU (#472)

* Add depth range support on the GPU

* Address PR feedback
This commit is contained in:
gdkchan 2018-10-23 16:04:08 -03:00 committed by GitHub
parent e674b37710
commit 044b84b078
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 20 deletions

View File

@ -43,6 +43,8 @@
public bool DepthTestEnabled;
public bool DepthWriteEnabled;
public GalComparisonOp DepthFunc;
public float DepthRangeNear;
public float DepthRangeFar;
public bool StencilTestEnabled;
public bool StencilTwoSideEnabled;

View File

@ -100,6 +100,8 @@ namespace Ryujinx.Graphics.Gal.OpenGL
DepthTestEnabled = false,
DepthWriteEnabled = true,
DepthFunc = GalComparisonOp.Less,
DepthRangeNear = 0,
DepthRangeFar = 1,
StencilTestEnabled = false,
@ -195,6 +197,12 @@ namespace Ryujinx.Graphics.Gal.OpenGL
}
}
if (New.DepthRangeNear != Old.DepthRangeNear ||
New.DepthRangeFar != Old.DepthRangeFar)
{
GL.DepthRange(New.DepthRangeNear, New.DepthRangeFar);
}
if (New.StencilTestEnabled != Old.StencilTestEnabled)
{
Enable(EnableCap.StencilTest, New.StencilTestEnabled);

View File

@ -371,6 +371,9 @@ namespace Ryujinx.Graphics
{
State.DepthFunc = (GalComparisonOp)ReadRegister(NvGpuEngine3dReg.DepthTestFunction);
}
State.DepthRangeNear = ReadRegisterFloat(NvGpuEngine3dReg.DepthRangeNNear);
State.DepthRangeFar = ReadRegisterFloat(NvGpuEngine3dReg.DepthRangeNFar);
}
private void SetStencil(GalPipelineState State)

View File

@ -15,6 +15,8 @@ namespace Ryujinx.Graphics
ViewportNTranslateZ = 0x285,
ViewportNHoriz = 0x300,
ViewportNVert = 0x301,
DepthRangeNNear = 0x302,
DepthRangeNFar = 0x303,
VertexArrayFirst = 0x35d,
VertexArrayCount = 0x35e,
ClearNColor = 0x360,