Add ColorMask support, other tweaks
This commit is contained in:
parent
8374949a17
commit
e37cd0d289
5 changed files with 38 additions and 3 deletions
|
@ -26,6 +26,7 @@
|
|||
public GalComparisonOp DepthFunc;
|
||||
|
||||
public bool StencilTestEnabled;
|
||||
public bool StencilTwoSideEnabled;
|
||||
|
||||
public GalComparisonOp StencilBackFuncFunc;
|
||||
public int StencilBackFuncRef;
|
||||
|
@ -52,6 +53,11 @@
|
|||
public GalBlendFactor BlendFuncSrcAlpha;
|
||||
public GalBlendFactor BlendFuncDstAlpha;
|
||||
|
||||
public bool ColorMaskR;
|
||||
public bool ColorMaskG;
|
||||
public bool ColorMaskB;
|
||||
public bool ColorMaskA;
|
||||
|
||||
public bool PrimitiveRestartEnabled;
|
||||
public uint PrimitiveRestartIndex;
|
||||
|
||||
|
|
|
@ -195,6 +195,11 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|||
Enable(EnableCap.StencilTest, New.StencilTestEnabled);
|
||||
}
|
||||
|
||||
if (New.StencilTwoSideEnabled != Old.StencilTwoSideEnabled)
|
||||
{
|
||||
Enable((EnableCap)All.StencilTestTwoSideExt, New.StencilTwoSideEnabled);
|
||||
}
|
||||
|
||||
if (New.StencilTestEnabled)
|
||||
{
|
||||
if (New.StencilBackFuncFunc != Old.StencilBackFuncFunc ||
|
||||
|
@ -298,6 +303,18 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|||
}
|
||||
}
|
||||
|
||||
if (New.ColorMaskR != Old.ColorMaskR ||
|
||||
New.ColorMaskG != Old.ColorMaskG ||
|
||||
New.ColorMaskB != Old.ColorMaskB ||
|
||||
New.ColorMaskA != Old.ColorMaskA)
|
||||
{
|
||||
GL.ColorMask(
|
||||
New.ColorMaskR,
|
||||
New.ColorMaskG,
|
||||
New.ColorMaskB,
|
||||
New.ColorMaskA);
|
||||
}
|
||||
|
||||
if (New.PrimitiveRestartEnabled != Old.PrimitiveRestartEnabled)
|
||||
{
|
||||
Enable(EnableCap.PrimitiveRestart, New.PrimitiveRestartEnabled);
|
||||
|
|
|
@ -360,7 +360,7 @@ namespace Ryujinx.Graphics.Gal.Shader
|
|||
|
||||
private void PrintDeclSsy()
|
||||
{
|
||||
SB.AppendLine("uint " + GlslDecl.SsyCursorName + "= 0;");
|
||||
SB.AppendLine("uint " + GlslDecl.SsyCursorName + " = 0;");
|
||||
|
||||
SB.AppendLine("uint " + GlslDecl.SsyStackName + "[" + GlslDecl.SsyStackSize + "];" + Environment.NewLine);
|
||||
}
|
||||
|
|
|
@ -97,7 +97,8 @@ namespace Ryujinx.Graphics
|
|||
SetCullFace(State);
|
||||
SetDepth(State);
|
||||
SetStencil(State);
|
||||
SetAlphaBlending(State);
|
||||
SetBlending(State);
|
||||
SetColorMask(State);
|
||||
SetPrimitiveRestart(State);
|
||||
|
||||
for (int FbIndex = 0; FbIndex < 8; FbIndex++)
|
||||
|
@ -403,7 +404,7 @@ namespace Ryujinx.Graphics
|
|||
}
|
||||
}
|
||||
|
||||
private void SetAlphaBlending(GalPipelineState State)
|
||||
private void SetBlending(GalPipelineState State)
|
||||
{
|
||||
//TODO: Support independent blend properly.
|
||||
State.BlendEnabled = ReadRegisterBool(NvGpuEngine3dReg.IBlendNEnable);
|
||||
|
@ -421,6 +422,16 @@ namespace Ryujinx.Graphics
|
|||
}
|
||||
}
|
||||
|
||||
private void SetColorMask(GalPipelineState State)
|
||||
{
|
||||
int ColorMask = ReadRegister(NvGpuEngine3dReg.ColorMask);
|
||||
|
||||
State.ColorMaskR = ((ColorMask >> 0) & 0xf) != 0;
|
||||
State.ColorMaskG = ((ColorMask >> 4) & 0xf) != 0;
|
||||
State.ColorMaskB = ((ColorMask >> 8) & 0xf) != 0;
|
||||
State.ColorMaskA = ((ColorMask >> 12) & 0xf) != 0;
|
||||
}
|
||||
|
||||
private void SetPrimitiveRestart(GalPipelineState State)
|
||||
{
|
||||
State.PrimitiveRestartEnabled = ReadRegisterBool(NvGpuEngine3dReg.PrimRestartEnable);
|
||||
|
|
|
@ -78,6 +78,7 @@ namespace Ryujinx.Graphics
|
|||
CullFaceEnable = 0x646,
|
||||
FrontFace = 0x647,
|
||||
CullFace = 0x648,
|
||||
ColorMask = 0x680,
|
||||
QueryAddress = 0x6c0,
|
||||
QuerySequence = 0x6c2,
|
||||
QueryControl = 0x6c3,
|
||||
|
|
Loading…
Add table
Reference in a new issue