From ee7c476e24d59af2c6b8e24486cd08ff09946112 Mon Sep 17 00:00:00 2001 From: iwubcode Date: Wed, 29 Oct 2025 00:25:11 -0500 Subject: VideoCommon: move global variables out of BPFunctions --- Source/Core/VideoCommon/BPStructs.cpp | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'Source/Core/VideoCommon/BPStructs.cpp') diff --git a/Source/Core/VideoCommon/BPStructs.cpp b/Source/Core/VideoCommon/BPStructs.cpp index 9679ed6237..dd0cd59570 100644 --- a/Source/Core/VideoCommon/BPStructs.cpp +++ b/Source/Core/VideoCommon/BPStructs.cpp @@ -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); } -- cgit v1.2.3