mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-10-01 12:30:00 +02:00
Scissor test fix (#563)
* Handle negative viewport coordinates * Disable scissor before framebuffer blit * Comment to explain scissor disable will be reenabled if needed * Comma and spelling mistake
This commit is contained in:
parent
d191b256a6
commit
f5b4f6ccc4
3 changed files with 20 additions and 14 deletions
|
@ -278,25 +278,22 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
||||||
{
|
{
|
||||||
forceUpdate = false;
|
forceUpdate = false;
|
||||||
|
|
||||||
if (New.ScissorTestEnabled[Index] != Old.ScissorTestEnabled[Index])
|
if (New.ScissorTestEnabled[Index])
|
||||||
{
|
{
|
||||||
if (New.ScissorTestEnabled[Index])
|
// If there is only 1 scissor test, geometry shaders are disabled so the scissor test applies to all viewports
|
||||||
|
if (New.ScissorTestCount == 1)
|
||||||
{
|
{
|
||||||
// If there is only 1 scissor test geometry shaders are disables so the scissor test applies to all viewports
|
GL.Enable(EnableCap.ScissorTest);
|
||||||
if (New.ScissorTestCount == 1)
|
|
||||||
{
|
|
||||||
GL.Enable(EnableCap.ScissorTest);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
GL.Enable(IndexedEnableCap.ScissorTest, Index);
|
|
||||||
}
|
|
||||||
forceUpdate = true;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GL.Disable(IndexedEnableCap.ScissorTest, Index);
|
GL.Enable(IndexedEnableCap.ScissorTest, Index);
|
||||||
}
|
}
|
||||||
|
forceUpdate = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GL.Disable(IndexedEnableCap.ScissorTest, Index);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (New.ScissorTestEnabled[Index] &&
|
if (New.ScissorTestEnabled[Index] &&
|
||||||
|
|
|
@ -367,6 +367,9 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
||||||
|
|
||||||
GL.Disable(EnableCap.FramebufferSrgb);
|
GL.Disable(EnableCap.FramebufferSrgb);
|
||||||
|
|
||||||
|
// Will be re-enabled if needed while binding, called before any game GL calls
|
||||||
|
GL.Disable(EnableCap.ScissorTest);
|
||||||
|
|
||||||
GL.BlitFramebuffer(
|
GL.BlitFramebuffer(
|
||||||
SrcX0,
|
SrcX0,
|
||||||
SrcY0,
|
SrcY0,
|
||||||
|
|
|
@ -419,7 +419,7 @@ namespace Ryujinx.Graphics.Graphics3d
|
||||||
// Once geometry shaders are fixed it should be equal to GalPipelineState.RenderTargetCount when shader loaded, otherwise equal to 1
|
// Once geometry shaders are fixed it should be equal to GalPipelineState.RenderTargetCount when shader loaded, otherwise equal to 1
|
||||||
State.ScissorTestCount = 1;
|
State.ScissorTestCount = 1;
|
||||||
|
|
||||||
for (int Index = 0; Index < GalPipelineState.RenderTargetsCount; Index++)
|
for (int Index = 0; Index < State.ScissorTestCount; Index++)
|
||||||
{
|
{
|
||||||
State.ScissorTestEnabled[Index] = ReadRegisterBool(NvGpuEngine3dReg.ScissorEnable + Index * 4);
|
State.ScissorTestEnabled[Index] = ReadRegisterBool(NvGpuEngine3dReg.ScissorEnable + Index * 4);
|
||||||
|
|
||||||
|
@ -438,6 +438,12 @@ namespace Ryujinx.Graphics.Graphics3d
|
||||||
if ((int)State.FlipY == -1)
|
if ((int)State.FlipY == -1)
|
||||||
{
|
{
|
||||||
State.ScissorTestY[Index] = ViewportHeight - State.ScissorTestY[Index] - State.ScissorTestHeight[Index];
|
State.ScissorTestY[Index] = ViewportHeight - State.ScissorTestY[Index] - State.ScissorTestHeight[Index];
|
||||||
|
|
||||||
|
// Handle negative viewpont coordinate
|
||||||
|
if (State.ScissorTestY[Index] < 0)
|
||||||
|
{
|
||||||
|
State.ScissorTestY[Index] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue