GPU: Implement mask bit handling in software renderer

Still needs implementation in the hardware renderers.
This commit is contained in:
Connor McLaughlin
2019-11-24 18:47:40 +10:00
parent 6c6bf8714c
commit 9d6d00480c
4 changed files with 55 additions and 16 deletions

View File

@ -212,10 +212,15 @@ bool GPU::HandleSetMaskBitCommand(const u32*& command_ptr, u32 command_size)
{
const u32 param = *(command_ptr++) & 0x00FFFFFF;
m_GPUSTAT.draw_set_mask_bit = (param & 0x01) != 0;
m_GPUSTAT.draw_to_masked_pixels = (param & 0x01) != 0;
Log_DebugPrintf("Set mask bit %u %u", BoolToUInt32(m_GPUSTAT.draw_set_mask_bit),
BoolToUInt32(m_GPUSTAT.draw_to_masked_pixels));
constexpr u32 gpustat_mask = (1 << 11) | (1 << 12);
const u32 gpustat_bits = (param & 0x03) << 11;
if ((m_GPUSTAT.bits & gpustat_mask) != gpustat_bits)
{
FlushRender();
m_GPUSTAT.bits = (m_GPUSTAT.bits & ~gpustat_mask) | gpustat_bits;
}
Log_DebugPrintf("Set mask bit %u %u", BoolToUInt32(m_GPUSTAT.set_mask_while_drawing),
BoolToUInt32(m_GPUSTAT.check_mask_before_draw));
EndCommand();
return true;