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.
This commit is contained in:
Lioncash 2019-12-05 11:55:21 -05:00
parent 9bd533ebe4
commit 2c9ec6cb8a
3 changed files with 3 additions and 5 deletions

View File

@ -278,9 +278,7 @@ static void BPWritten(const BPCmd& bp)
// We should be able to get away with deactivating the current bbox tracking // 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. // 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 // the number of lines copied is determined by the y scale * source efb height
BoundingBox::Disable(); BoundingBox::Disable();
PixelShaderManager::SetBoundingBoxActive(false);
float yScale; float yScale;
if (PE_copy.scale_invert) if (PE_copy.scale_invert)
@ -450,7 +448,6 @@ static void BPWritten(const BPCmd& bp)
{ {
const u8 offset = bp.address & 2; const u8 offset = bp.address & 2;
BoundingBox::Enable(); BoundingBox::Enable();
PixelShaderManager::SetBoundingBoxActive(true);
if (g_ActiveConfig.backend_info.bSupportsBBox && g_ActiveConfig.bBBoxEnable) if (g_ActiveConfig.backend_info.bSupportsBBox && g_ActiveConfig.bBBoxEnable)
{ {

View File

@ -9,6 +9,7 @@
#include "Common/ChunkFile.h" #include "Common/ChunkFile.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "VideoCommon/PixelShaderManager.h"
namespace BoundingBox namespace BoundingBox
{ {
@ -29,11 +30,13 @@ std::array<u16, 4> s_coordinates{
void Enable() void Enable()
{ {
s_is_active = true; s_is_active = true;
PixelShaderManager::SetBoundingBoxActive(s_is_active);
} }
void Disable() void Disable()
{ {
s_is_active = false; s_is_active = false;
PixelShaderManager::SetBoundingBoxActive(s_is_active);
} }
bool IsEnabled() bool IsEnabled()

View File

@ -19,7 +19,6 @@
#include "VideoCommon/BoundingBox.h" #include "VideoCommon/BoundingBox.h"
#include "VideoCommon/Fifo.h" #include "VideoCommon/Fifo.h"
#include "VideoCommon/PerfQueryBase.h" #include "VideoCommon/PerfQueryBase.h"
#include "VideoCommon/PixelShaderManager.h"
#include "VideoCommon/VideoBackendBase.h" #include "VideoCommon/VideoBackendBase.h"
namespace PixelEngine namespace PixelEngine
@ -234,7 +233,6 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
{ {
mmio->Register(base | (PE_BBOX_LEFT + 2 * i), MMIO::ComplexRead<u16>([i](u32) { mmio->Register(base | (PE_BBOX_LEFT + 2 * i), MMIO::ComplexRead<u16>([i](u32) {
BoundingBox::Disable(); BoundingBox::Disable();
PixelShaderManager::SetBoundingBoxActive(false);
return g_video_backend->Video_GetBoundingBox(i); return g_video_backend->Video_GetBoundingBox(i);
}), }),
MMIO::InvalidWrite<u16>()); MMIO::InvalidWrite<u16>());