Flip component mask if target is BGRA. (#2087)
* Flip component mask if target is BGRA. * Make mask selection less ugly.
This commit is contained in:
parent
a539303e71
commit
da283ff3c3
1 changed files with 14 additions and 3 deletions
|
@ -862,7 +862,14 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
|
||||
_framebuffer.AttachColor(index, color);
|
||||
|
||||
_fpIsBgra[index] = color != null && color.Format.IsBgra8() ? 1 : 0;
|
||||
int isBgra = color != null && color.Format.IsBgra8() ? 1 : 0;
|
||||
|
||||
if (_fpIsBgra[index] != isBgra)
|
||||
{
|
||||
_fpIsBgra[index] = isBgra;
|
||||
|
||||
RestoreComponentMask(index);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateFpIsBgra();
|
||||
|
@ -1233,11 +1240,15 @@ namespace Ryujinx.Graphics.OpenGL
|
|||
|
||||
private void RestoreComponentMask(int index)
|
||||
{
|
||||
// If the bound render target is bgra, swap the red and blue masks.
|
||||
uint redMask = _fpIsBgra[index] == 0 ? 1u : 4u;
|
||||
uint blueMask = _fpIsBgra[index] == 0 ? 4u : 1u;
|
||||
|
||||
GL.ColorMask(
|
||||
index,
|
||||
(_componentMasks[index] & 1u) != 0,
|
||||
(_componentMasks[index] & redMask) != 0,
|
||||
(_componentMasks[index] & 2u) != 0,
|
||||
(_componentMasks[index] & 4u) != 0,
|
||||
(_componentMasks[index] & blueMask) != 0,
|
||||
(_componentMasks[index] & 8u) != 0);
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue