Fix backbuffer not being cleared and scissor not being re-enabled on OpenGL

This commit is contained in:
gdk 2022-04-13 21:04:32 -03:00 committed by riperiperi
parent 6543531db8
commit de87ed3edc
2 changed files with 27 additions and 5 deletions

View file

@ -1116,13 +1116,33 @@ namespace Ryujinx.Graphics.OpenGL
{
int vIndex = index * 4;
v[vIndex] = regions[index].X;
v[vIndex + 1] = regions[index].Y;
v[vIndex + 2] = regions[index].Width;
v[vIndex + 3] = regions[index].Height;
var region = regions[index];
bool enabled = (region.X | region.Y) != 0 || region.Width != 0xffff || region.Height != 0xffff;
uint mask = 1u << index;
if (enabled)
{
v[vIndex] = region.X;
v[vIndex + 1] = region.Y;
v[vIndex + 2] = region.Width;
v[vIndex + 3] = region.Height;
if ((_scissorEnables & mask) == 0)
{
_scissorEnables |= mask;
GL.Enable(IndexedEnableCap.ScissorTest, index);
}
}
else
{
if ((_scissorEnables & mask) != 0)
{
_scissorEnables &= ~mask;
GL.Disable(IndexedEnableCap.ScissorTest, index);
}
}
}
GL.ScissorArray(0, count, v);
}

View file

@ -106,6 +106,8 @@ namespace Ryujinx.Graphics.OpenGL
GL.Disable(EnableCap.RasterizerDiscard);
GL.Disable(IndexedEnableCap.ScissorTest, 0);
GL.Clear(ClearBufferMask.ColorBufferBit);
int srcX0, srcX1, srcY0, srcY1;
float scale = view.ScaleFactor;