Do not set front face if face culling is not enabled
This commit is contained in:
parent
97ca974213
commit
92f950b290
3 changed files with 23 additions and 32 deletions
|
@ -2,7 +2,7 @@
|
|||
{
|
||||
public enum GalFrontFace
|
||||
{
|
||||
CW = 0x900,
|
||||
CCW = 0x901
|
||||
Cw = 0x900,
|
||||
Ccw = 0x901
|
||||
}
|
||||
}
|
|
@ -9,8 +9,8 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|||
{
|
||||
switch (FrontFace)
|
||||
{
|
||||
case GalFrontFace.CW: return FrontFaceDirection.Cw;
|
||||
case GalFrontFace.CCW: return FrontFaceDirection.Ccw;
|
||||
case GalFrontFace.Cw: return FrontFaceDirection.Cw;
|
||||
case GalFrontFace.Ccw: return FrontFaceDirection.Ccw;
|
||||
}
|
||||
|
||||
throw new ArgumentException(nameof(FrontFace));
|
||||
|
|
|
@ -79,8 +79,7 @@ namespace Ryujinx.HLE.Gpu.Engines
|
|||
|
||||
Gpu.Renderer.Shader.BindProgram();
|
||||
|
||||
SetFrontFace();
|
||||
SetCullFace();
|
||||
SetFaceCulling();
|
||||
SetDepth();
|
||||
SetStencil();
|
||||
SetAlphaBlending();
|
||||
|
@ -198,32 +197,7 @@ namespace Ryujinx.HLE.Gpu.Engines
|
|||
throw new ArgumentOutOfRangeException(nameof(Program));
|
||||
}
|
||||
|
||||
private void SetFrontFace()
|
||||
{
|
||||
float SignX = GetFlipSign(NvGpuEngine3dReg.ViewportScaleX);
|
||||
float SignY = GetFlipSign(NvGpuEngine3dReg.ViewportScaleY);
|
||||
|
||||
GalFrontFace FrontFace = (GalFrontFace)ReadRegister(NvGpuEngine3dReg.FrontFace);
|
||||
|
||||
//Flipping breaks facing. Flipping front facing too fixes it
|
||||
if (SignX != SignY)
|
||||
{
|
||||
switch (FrontFace)
|
||||
{
|
||||
case GalFrontFace.CW:
|
||||
FrontFace = GalFrontFace.CCW;
|
||||
break;
|
||||
|
||||
case GalFrontFace.CCW:
|
||||
FrontFace = GalFrontFace.CW;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Gpu.Renderer.Rasterizer.SetFrontFace(FrontFace);
|
||||
}
|
||||
|
||||
private void SetCullFace()
|
||||
private void SetFaceCulling()
|
||||
{
|
||||
bool Enable = (ReadRegister(NvGpuEngine3dReg.CullFaceEnable) & 1) != 0;
|
||||
|
||||
|
@ -241,6 +215,23 @@ namespace Ryujinx.HLE.Gpu.Engines
|
|||
return;
|
||||
}
|
||||
|
||||
float SignX = GetFlipSign(NvGpuEngine3dReg.ViewportScaleX);
|
||||
float SignY = GetFlipSign(NvGpuEngine3dReg.ViewportScaleY);
|
||||
|
||||
GalFrontFace FrontFace = (GalFrontFace)ReadRegister(NvGpuEngine3dReg.FrontFace);
|
||||
|
||||
//Flipping breaks facing. Flipping front facing too fixes it
|
||||
if (SignX != SignY)
|
||||
{
|
||||
switch (FrontFace)
|
||||
{
|
||||
case GalFrontFace.Cw: FrontFace = GalFrontFace.Ccw; break;
|
||||
case GalFrontFace.Ccw: FrontFace = GalFrontFace.Cw; break;
|
||||
}
|
||||
}
|
||||
|
||||
Gpu.Renderer.Rasterizer.SetFrontFace(FrontFace);
|
||||
|
||||
GalCullFace CullFace = (GalCullFace)ReadRegister(NvGpuEngine3dReg.CullFace);
|
||||
|
||||
Gpu.Renderer.Rasterizer.SetCullFace(CullFace);
|
||||
|
|
Loading…
Reference in a new issue