GPU: Mask bit check should use existing colour not new colour

This commit is contained in:
Connor McLaughlin 2020-02-07 00:11:12 +09:00
parent a36fe8bfe6
commit ac5af4658d
1 changed files with 4 additions and 5 deletions

View File

@ -555,12 +555,11 @@ void GPU_SW::ShadePixel(u32 x, u32 y, u8 color_r, u8 color_g, u8 color_b, u8 tex
color.SetRGB24(color_r, color_g, color_b); color.SetRGB24(color_r, color_g, color_b);
} }
const VRAMPixel bg_color{GetPixel(static_cast<u32>(x), static_cast<u32>(y))};
if constexpr (transparency_enable) if constexpr (transparency_enable)
{ {
if (transparent) if (transparent)
{ {
const VRAMPixel bg_color{GetPixel(static_cast<u32>(x), static_cast<u32>(y))};
#define BLEND_AVERAGE(bg, fg) Truncate8(std::min<u32>((ZeroExtend32(bg) / 2) + (ZeroExtend32(fg) / 2), 0x1F)) #define BLEND_AVERAGE(bg, fg) Truncate8(std::min<u32>((ZeroExtend32(bg) / 2) + (ZeroExtend32(fg) / 2), 0x1F))
#define BLEND_ADD(bg, fg) Truncate8(std::min<u32>(ZeroExtend32(bg) + ZeroExtend32(fg), 0x1F)) #define BLEND_ADD(bg, fg) Truncate8(std::min<u32>(ZeroExtend32(bg) + ZeroExtend32(fg), 0x1F))
#define BLEND_SUBTRACT(bg, fg) Truncate8((bg > fg) ? ((bg) - (fg)) : 0) #define BLEND_SUBTRACT(bg, fg) Truncate8((bg > fg) ? ((bg) - (fg)) : 0)
@ -601,9 +600,9 @@ void GPU_SW::ShadePixel(u32 x, u32 y, u8 color_r, u8 color_g, u8 color_b, u8 tex
UNREFERENCED_VARIABLE(transparent); UNREFERENCED_VARIABLE(transparent);
} }
const u16 mask_and = m_GPUSTAT.GetMaskAND(); const u16 mask_and = m_GPUSTAT.GetMaskAND();
if ((color.bits & mask_and) != mask_and) if ((bg_color.bits & mask_and) != mask_and)
return; return;
SetPixel(static_cast<u32>(x), static_cast<u32>(y), color.bits | m_GPUSTAT.GetMaskOR()); SetPixel(static_cast<u32>(x), static_cast<u32>(y), color.bits | m_GPUSTAT.GetMaskOR());
} }