Move clear values from VertexEndGl to ClearBuffers
This commit is contained in:
parent
b3972745d5
commit
81f6120dfb
6 changed files with 31 additions and 21 deletions
|
@ -28,11 +28,9 @@
|
||||||
public GalCullFace CullFace;
|
public GalCullFace CullFace;
|
||||||
|
|
||||||
public bool DepthTestEnabled;
|
public bool DepthTestEnabled;
|
||||||
public float DepthClear;
|
|
||||||
public GalComparisonOp DepthFunc;
|
public GalComparisonOp DepthFunc;
|
||||||
|
|
||||||
public bool StencilTestEnabled;
|
public bool StencilTestEnabled;
|
||||||
public int StencilClear;
|
|
||||||
|
|
||||||
public GalComparisonOp StencilBackFuncFunc;
|
public GalComparisonOp StencilBackFuncFunc;
|
||||||
public int StencilBackFuncRef;
|
public int StencilBackFuncRef;
|
||||||
|
|
|
@ -7,7 +7,11 @@ namespace Ryujinx.Graphics.Gal
|
||||||
void LockCaches();
|
void LockCaches();
|
||||||
void UnlockCaches();
|
void UnlockCaches();
|
||||||
|
|
||||||
void ClearBuffers(GalClearBufferFlags Flags);
|
void ClearBuffers(
|
||||||
|
GalClearBufferFlags Flags,
|
||||||
|
float Red, float Green, float Blue, float Alpha,
|
||||||
|
float Depth,
|
||||||
|
int Stencil);
|
||||||
|
|
||||||
bool IsVboCached(long Key, long DataSize);
|
bool IsVboCached(long Key, long DataSize);
|
||||||
|
|
||||||
|
|
|
@ -67,11 +67,9 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
||||||
CullFace = GalCullFace.Back,
|
CullFace = GalCullFace.Back,
|
||||||
|
|
||||||
DepthTestEnabled = false,
|
DepthTestEnabled = false,
|
||||||
DepthClear = 1f,
|
|
||||||
DepthFunc = GalComparisonOp.Less,
|
DepthFunc = GalComparisonOp.Less,
|
||||||
|
|
||||||
StencilTestEnabled = false,
|
StencilTestEnabled = false,
|
||||||
StencilClear = 0,
|
|
||||||
|
|
||||||
StencilBackFuncFunc = GalComparisonOp.Always,
|
StencilBackFuncFunc = GalComparisonOp.Always,
|
||||||
StencilBackFuncRef = 0,
|
StencilBackFuncRef = 0,
|
||||||
|
@ -142,11 +140,6 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
||||||
Enable(EnableCap.DepthTest, S.DepthTestEnabled);
|
Enable(EnableCap.DepthTest, S.DepthTestEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (S.DepthClear != O.DepthClear)
|
|
||||||
{
|
|
||||||
GL.ClearDepth(S.DepthClear);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (S.DepthTestEnabled)
|
if (S.DepthTestEnabled)
|
||||||
{
|
{
|
||||||
if (S.DepthFunc != O.DepthFunc)
|
if (S.DepthFunc != O.DepthFunc)
|
||||||
|
@ -160,11 +153,6 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
||||||
Enable(EnableCap.StencilTest, S.StencilTestEnabled);
|
Enable(EnableCap.StencilTest, S.StencilTestEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (S.StencilClear != O.StencilClear)
|
|
||||||
{
|
|
||||||
GL.ClearStencil(S.StencilClear);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (S.StencilTestEnabled)
|
if (S.StencilTestEnabled)
|
||||||
{
|
{
|
||||||
if (S.StencilBackFuncFunc != O.StencilBackFuncFunc ||
|
if (S.StencilBackFuncFunc != O.StencilBackFuncFunc ||
|
||||||
|
|
|
@ -43,7 +43,11 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
||||||
IboCache.Unlock();
|
IboCache.Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearBuffers(GalClearBufferFlags Flags)
|
public void ClearBuffers(
|
||||||
|
GalClearBufferFlags Flags,
|
||||||
|
float Red, float Green, float Blue, float Alpha,
|
||||||
|
float Depth,
|
||||||
|
int Stencil)
|
||||||
{
|
{
|
||||||
ClearBufferMask Mask = ClearBufferMask.ColorBufferBit;
|
ClearBufferMask Mask = ClearBufferMask.ColorBufferBit;
|
||||||
|
|
||||||
|
@ -63,6 +67,12 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
||||||
Mask |= ClearBufferMask.StencilBufferBit;
|
Mask |= ClearBufferMask.StencilBufferBit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GL.ClearColor(Red, Green, Blue, Alpha);
|
||||||
|
|
||||||
|
GL.ClearDepth(Depth);
|
||||||
|
|
||||||
|
GL.ClearStencil(Stencil);
|
||||||
|
|
||||||
GL.Clear(Mask);
|
GL.Clear(Mask);
|
||||||
|
|
||||||
GL.ColorMask(true, true, true, true);
|
GL.ColorMask(true, true, true, true);
|
||||||
|
|
|
@ -131,9 +131,22 @@ namespace Ryujinx.HLE.Gpu.Engines
|
||||||
|
|
||||||
GalClearBufferFlags Flags = (GalClearBufferFlags)(Arg0 & 0x3f);
|
GalClearBufferFlags Flags = (GalClearBufferFlags)(Arg0 & 0x3f);
|
||||||
|
|
||||||
|
float Red = ReadRegisterFloat(NvGpuEngine3dReg.ClearNColor + 0);
|
||||||
|
float Green = ReadRegisterFloat(NvGpuEngine3dReg.ClearNColor + 1);
|
||||||
|
float Blue = ReadRegisterFloat(NvGpuEngine3dReg.ClearNColor + 2);
|
||||||
|
float Alpha = ReadRegisterFloat(NvGpuEngine3dReg.ClearNColor + 3);
|
||||||
|
|
||||||
|
float Depth = ReadRegisterFloat(NvGpuEngine3dReg.ClearDepth);
|
||||||
|
|
||||||
|
int Stencil = ReadRegister(NvGpuEngine3dReg.ClearStencil);
|
||||||
|
|
||||||
SetFrameBuffer(Vmm, FbIndex);
|
SetFrameBuffer(Vmm, FbIndex);
|
||||||
|
|
||||||
Gpu.Renderer.Rasterizer.ClearBuffers(Flags);
|
Gpu.Renderer.Rasterizer.ClearBuffers(
|
||||||
|
Flags,
|
||||||
|
Red, Green, Blue, Alpha,
|
||||||
|
Depth,
|
||||||
|
Stencil);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetFrameBuffer(NvGpuVmm Vmm, int FbIndex)
|
private void SetFrameBuffer(NvGpuVmm Vmm, int FbIndex)
|
||||||
|
@ -287,8 +300,6 @@ namespace Ryujinx.HLE.Gpu.Engines
|
||||||
{
|
{
|
||||||
State.DepthTestEnabled = (ReadRegister(NvGpuEngine3dReg.DepthTestEnable) & 1) != 0;
|
State.DepthTestEnabled = (ReadRegister(NvGpuEngine3dReg.DepthTestEnable) & 1) != 0;
|
||||||
|
|
||||||
State.DepthClear = ReadRegisterFloat(NvGpuEngine3dReg.ClearDepth);
|
|
||||||
|
|
||||||
if (State.DepthTestEnabled)
|
if (State.DepthTestEnabled)
|
||||||
{
|
{
|
||||||
State.DepthFunc = (GalComparisonOp)ReadRegister(NvGpuEngine3dReg.DepthTestFunction);
|
State.DepthFunc = (GalComparisonOp)ReadRegister(NvGpuEngine3dReg.DepthTestFunction);
|
||||||
|
@ -298,8 +309,6 @@ namespace Ryujinx.HLE.Gpu.Engines
|
||||||
private void SetStencil(GalPipelineState State)
|
private void SetStencil(GalPipelineState State)
|
||||||
{
|
{
|
||||||
State.StencilTestEnabled = (ReadRegister(NvGpuEngine3dReg.StencilEnable) & 1) != 0;
|
State.StencilTestEnabled = (ReadRegister(NvGpuEngine3dReg.StencilEnable) & 1) != 0;
|
||||||
|
|
||||||
State.StencilClear = ReadRegister(NvGpuEngine3dReg.ClearStencil);
|
|
||||||
|
|
||||||
if (State.StencilTestEnabled)
|
if (State.StencilTestEnabled)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,6 +16,7 @@ namespace Ryujinx.HLE.Gpu.Engines
|
||||||
ViewportNVert = 0x301,
|
ViewportNVert = 0x301,
|
||||||
VertexArrayFirst = 0x35d,
|
VertexArrayFirst = 0x35d,
|
||||||
VertexArrayCount = 0x35e,
|
VertexArrayCount = 0x35e,
|
||||||
|
ClearNColor = 0x360,
|
||||||
ClearDepth = 0x364,
|
ClearDepth = 0x364,
|
||||||
ClearStencil = 0x368,
|
ClearStencil = 0x368,
|
||||||
StencilBackFuncRef = 0x3d5,
|
StencilBackFuncRef = 0x3d5,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue