mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-01-17 22:25:37 +00:00
GPU: Fix incorrect handling of check mask bit
Fixes boxes in Silent Hill in Software Renderer.
This commit is contained in:
parent
d46d681179
commit
f9a298f1b7
|
@ -870,7 +870,7 @@ void GPU::UpdateVRAM(u32 x, u32 y, u32 width, u32 height, const void* data)
|
||||||
{
|
{
|
||||||
// TODO: Handle unaligned reads...
|
// TODO: Handle unaligned reads...
|
||||||
u16* pixel_ptr = &dst_row_ptr[(x + col++) % VRAM_WIDTH];
|
u16* pixel_ptr = &dst_row_ptr[(x + col++) % VRAM_WIDTH];
|
||||||
if (((*pixel_ptr) & mask_and) == mask_and)
|
if (((*pixel_ptr) & mask_and) == 0)
|
||||||
*pixel_ptr = *(src_ptr++) | mask_or;
|
*pixel_ptr = *(src_ptr++) | mask_or;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -892,7 +892,7 @@ void GPU::CopyVRAM(u32 src_x, u32 src_y, u32 dst_x, u32 dst_y, u32 width, u32 he
|
||||||
{
|
{
|
||||||
const u16 src_pixel = src_row_ptr[(src_x + col) % VRAM_WIDTH];
|
const u16 src_pixel = src_row_ptr[(src_x + col) % VRAM_WIDTH];
|
||||||
u16* dst_pixel_ptr = &dst_row_ptr[(dst_x + col) % VRAM_WIDTH];
|
u16* dst_pixel_ptr = &dst_row_ptr[(dst_x + col) % VRAM_WIDTH];
|
||||||
if ((*dst_pixel_ptr & mask_and) == mask_and)
|
if ((*dst_pixel_ptr & mask_and) == 0)
|
||||||
*dst_pixel_ptr = src_pixel | mask_or;
|
*dst_pixel_ptr = src_pixel | mask_or;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -390,9 +390,17 @@ protected:
|
||||||
return ((bits & MASK) == MASK);
|
return ((bits & MASK) == MASK);
|
||||||
}
|
}
|
||||||
|
|
||||||
// During transfer/render operations, if ((dst_pixel & mask_and) == mask_and) { pixel = src_pixel | mask_or }
|
// During transfer/render operations, if ((dst_pixel & mask_and) == 0) { pixel = src_pixel | mask_or }
|
||||||
u16 GetMaskAND() const { return check_mask_before_draw ? 0x8000 : 0x0000; }
|
u16 GetMaskAND() const
|
||||||
u16 GetMaskOR() const { return set_mask_while_drawing ? 0x8000 : 0x0000; }
|
{
|
||||||
|
// return check_mask_before_draw ? 0x8000 : 0x0000;
|
||||||
|
return Truncate16((bits << 3) & 0x8000);
|
||||||
|
}
|
||||||
|
u16 GetMaskOR() const
|
||||||
|
{
|
||||||
|
// return set_mask_while_drawing ? 0x8000 : 0x0000;
|
||||||
|
return Truncate16((bits << 4) & 0x8000);
|
||||||
|
}
|
||||||
} m_GPUSTAT = {};
|
} m_GPUSTAT = {};
|
||||||
|
|
||||||
struct DrawMode
|
struct DrawMode
|
||||||
|
|
|
@ -570,7 +570,7 @@ void GPU_SW::ShadePixel(u32 x, u32 y, u8 color_r, u8 color_g, u8 color_b, u8 tex
|
||||||
}
|
}
|
||||||
|
|
||||||
const u16 mask_and = m_GPUSTAT.GetMaskAND();
|
const u16 mask_and = m_GPUSTAT.GetMaskAND();
|
||||||
if ((bg_color.bits & mask_and) != mask_and)
|
if ((bg_color.bits & mask_and) != 0)
|
||||||
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());
|
||||||
|
|
Loading…
Reference in a new issue