From 2c9ec6cb8abba5a4dfd7a3792b0d866ed4898118 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 5 Dec 2019 11:55:21 -0500 Subject: [PATCH] VideoCommon/BoundingBox: Move PixelShaderManager::SetBoundingBoxActive() calls into Enable()/Disable() Now that we have an actual interface to manage things, we can stop duplicating the calls to to the pixel shader manager and remove the need to remember to actually do so when disabling or enabling the bounding box. --- Source/Core/VideoCommon/BPStructs.cpp | 3 --- Source/Core/VideoCommon/BoundingBox.cpp | 3 +++ Source/Core/VideoCommon/PixelEngine.cpp | 2 -- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Source/Core/VideoCommon/BPStructs.cpp b/Source/Core/VideoCommon/BPStructs.cpp index 6cff479396..e8b0ee1f32 100644 --- a/Source/Core/VideoCommon/BPStructs.cpp +++ b/Source/Core/VideoCommon/BPStructs.cpp @@ -278,9 +278,7 @@ static void BPWritten(const BPCmd& bp) // We should be able to get away with deactivating the current bbox tracking // here. Not sure if there's a better spot to put this. // the number of lines copied is determined by the y scale * source efb height - BoundingBox::Disable(); - PixelShaderManager::SetBoundingBoxActive(false); float yScale; if (PE_copy.scale_invert) @@ -450,7 +448,6 @@ static void BPWritten(const BPCmd& bp) { const u8 offset = bp.address & 2; BoundingBox::Enable(); - PixelShaderManager::SetBoundingBoxActive(true); if (g_ActiveConfig.backend_info.bSupportsBBox && g_ActiveConfig.bBBoxEnable) { diff --git a/Source/Core/VideoCommon/BoundingBox.cpp b/Source/Core/VideoCommon/BoundingBox.cpp index 7c2127d353..805431c7d6 100644 --- a/Source/Core/VideoCommon/BoundingBox.cpp +++ b/Source/Core/VideoCommon/BoundingBox.cpp @@ -9,6 +9,7 @@ #include "Common/ChunkFile.h" #include "Common/CommonTypes.h" +#include "VideoCommon/PixelShaderManager.h" namespace BoundingBox { @@ -29,11 +30,13 @@ std::array s_coordinates{ void Enable() { s_is_active = true; + PixelShaderManager::SetBoundingBoxActive(s_is_active); } void Disable() { s_is_active = false; + PixelShaderManager::SetBoundingBoxActive(s_is_active); } bool IsEnabled() diff --git a/Source/Core/VideoCommon/PixelEngine.cpp b/Source/Core/VideoCommon/PixelEngine.cpp index fc44841622..d2a27c9d41 100644 --- a/Source/Core/VideoCommon/PixelEngine.cpp +++ b/Source/Core/VideoCommon/PixelEngine.cpp @@ -19,7 +19,6 @@ #include "VideoCommon/BoundingBox.h" #include "VideoCommon/Fifo.h" #include "VideoCommon/PerfQueryBase.h" -#include "VideoCommon/PixelShaderManager.h" #include "VideoCommon/VideoBackendBase.h" namespace PixelEngine @@ -234,7 +233,6 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base) { mmio->Register(base | (PE_BBOX_LEFT + 2 * i), MMIO::ComplexRead([i](u32) { BoundingBox::Disable(); - PixelShaderManager::SetBoundingBoxActive(false); return g_video_backend->Video_GetBoundingBox(i); }), MMIO::InvalidWrite());