VideoCommon: move global variables out of BPFunctions

This commit is contained in:
iwubcode
2025-10-29 00:25:11 -05:00
parent b920182c97
commit ee7c476e24
10 changed files with 109 additions and 67 deletions

View File

@@ -381,7 +381,19 @@ static void BPWritten(PixelShaderManager& pixel_shader_manager, XFStateManager&
// Clear the rectangular region after copying it.
if (PE_copy.clear)
{
ClearScreen(srcRect);
const bool color_enable = bpmem.blendmode.color_update != 0;
const bool alpha_enable = bpmem.blendmode.alpha_update != 0;
const bool z_enable = bpmem.zmode.update_enable != 0;
const auto pixel_format = bpmem.zcontrol.pixel_format;
const auto color_ar = bpmem.clearcolorAR;
const auto color_gb = bpmem.clearcolorGB;
const auto z_value = bpmem.clearZValue;
ClearScreen(g_framebuffer_manager.get(), srcRect, color_enable, alpha_enable, z_enable,
pixel_format, color_ar, color_gb, z_value);
// Scissor rect must be restored.
BPFunctions::SetScissorAndViewport(g_framebuffer_manager.get(), bpmem.scissorTL,
bpmem.scissorBR, bpmem.scissorOffset, xfmem.viewport);
}
return;
@@ -523,7 +535,8 @@ static void BPWritten(PixelShaderManager& pixel_shader_manager, XFStateManager&
return;
case BPMEM_ZCOMPARE: // Set the Z-Compare and EFB pixel format
OnPixelFormatChange();
OnPixelFormatChange(g_framebuffer_manager.get(), bpmem.zcontrol.pixel_format,
bpmem.zcontrol.zformat);
if (bp.changes & 7)
SetBlendMode(); // dual source could be activated by changing to PIXELFMT_RGBA6_Z24
pixel_shader_manager.SetZModeControl();
@@ -1355,8 +1368,10 @@ void BPReload()
// let's not risk actually replaying any writes.
// note that PixelShaderManager is already covered since it has its own DoState.
SetGenerationMode();
SetScissorAndViewport();
BPFunctions::SetScissorAndViewport(g_framebuffer_manager.get(), bpmem.scissorTL, bpmem.scissorBR,
bpmem.scissorOffset, xfmem.viewport);
SetDepthMode();
SetBlendMode();
OnPixelFormatChange();
OnPixelFormatChange(g_framebuffer_manager.get(), bpmem.zcontrol.pixel_format,
bpmem.zcontrol.zformat);
}