summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorAdmiral H. Curtiss <pikachu025@gmail.com>2022-12-10 17:10:14 +0100
committerAdmiral H. Curtiss <pikachu025@gmail.com>2022-12-11 21:57:30 +0100
commitc486baffe63afdd36ad2a60bfee9168dae26e1bb (patch)
tree5294c2a12c60d531daab56653d14daeb5324be33 /Source
parentec8aaf1f3040ed7dedf3c95c53e8101691c03208 (diff)
VideoCommon/PixelEngine: Pass Core::System to methods.
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/VideoCommon/BPStructs.cpp16
-rw-r--r--Source/Core/VideoCommon/PixelEngine.cpp21
-rw-r--r--Source/Core/VideoCommon/PixelEngine.h8
-rw-r--r--Source/Core/VideoCommon/VideoBackendBase.cpp2
4 files changed, 23 insertions, 24 deletions
diff --git a/Source/Core/VideoCommon/BPStructs.cpp b/Source/Core/VideoCommon/BPStructs.cpp
index 91b8b1e31e..b155f6b3c3 100644
--- a/Source/Core/VideoCommon/BPStructs.cpp
+++ b/Source/Core/VideoCommon/BPStructs.cpp
@@ -186,7 +186,7 @@ static void BPWritten(const BPCmd& bp, int cycles_into_future)
g_framebuffer_manager->RefreshPeekCache();
auto& system = Core::System::GetInstance();
if (!system.GetFifo().UseDeterministicGPUThread())
- system.GetPixelEngine().SetFinish(cycles_into_future); // may generate interrupt
+ system.GetPixelEngine().SetFinish(system, cycles_into_future); // may generate interrupt
DEBUG_LOG_FMT(VIDEO, "GXSetDrawDone SetPEFinish (value: {:#04X})", bp.newvalue & 0xFFFF);
return;
}
@@ -205,7 +205,7 @@ static void BPWritten(const BPCmd& bp, int cycles_into_future)
auto& system = Core::System::GetInstance();
if (!system.GetFifo().UseDeterministicGPUThread())
{
- system.GetPixelEngine().SetToken(static_cast<u16>(bp.newvalue & 0xFFFF), false,
+ system.GetPixelEngine().SetToken(system, static_cast<u16>(bp.newvalue & 0xFFFF), false,
cycles_into_future);
}
DEBUG_LOG_FMT(VIDEO, "SetPEToken {:#06X}", bp.newvalue & 0xFFFF);
@@ -220,7 +220,7 @@ static void BPWritten(const BPCmd& bp, int cycles_into_future)
auto& system = Core::System::GetInstance();
if (!system.GetFifo().UseDeterministicGPUThread())
{
- system.GetPixelEngine().SetToken(static_cast<u16>(bp.newvalue & 0xFFFF), true,
+ system.GetPixelEngine().SetToken(system, static_cast<u16>(bp.newvalue & 0xFFFF), true,
cycles_into_future);
}
DEBUG_LOG_FMT(VIDEO, "SetPEToken + INT {:#06X}", bp.newvalue & 0xFFFF);
@@ -764,21 +764,21 @@ void LoadBPReg(u8 reg, u32 value, int cycles_into_future)
void LoadBPRegPreprocess(u8 reg, u32 value, int cycles_into_future)
{
+ auto& system = Core::System::GetInstance();
+
// masking via BPMEM_BP_MASK could hypothetically be a problem
u32 newval = value & 0xffffff;
switch (reg)
{
case BPMEM_SETDRAWDONE:
if ((newval & 0xff) == 0x02)
- Core::System::GetInstance().GetPixelEngine().SetFinish(cycles_into_future);
+ system.GetPixelEngine().SetFinish(system, cycles_into_future);
break;
case BPMEM_PE_TOKEN_ID:
- Core::System::GetInstance().GetPixelEngine().SetToken(newval & 0xffff, false,
- cycles_into_future);
+ system.GetPixelEngine().SetToken(system, newval & 0xffff, false, cycles_into_future);
break;
case BPMEM_PE_TOKEN_INT_ID: // Pixel Engine Interrupt Token ID
- Core::System::GetInstance().GetPixelEngine().SetToken(newval & 0xffff, true,
- cycles_into_future);
+ system.GetPixelEngine().SetToken(system, newval & 0xffff, true, cycles_into_future);
break;
}
}
diff --git a/Source/Core/VideoCommon/PixelEngine.cpp b/Source/Core/VideoCommon/PixelEngine.cpp
index cd2b536dba..b1ede079d0 100644
--- a/Source/Core/VideoCommon/PixelEngine.cpp
+++ b/Source/Core/VideoCommon/PixelEngine.cpp
@@ -50,7 +50,7 @@ void PixelEngineManager::DoState(PointerWrap& p)
p.Do(m_signal_finish_interrupt);
}
-void PixelEngineManager::Init()
+void PixelEngineManager::Init(Core::System& system)
{
m_control.hex = 0;
m_z_conf.hex = 0;
@@ -68,8 +68,8 @@ void PixelEngineManager::Init()
m_signal_token_interrupt = false;
m_signal_finish_interrupt = false;
- m_event_type_set_token_finish = Core::System::GetInstance().GetCoreTiming().RegisterEvent(
- "SetTokenFinish", SetTokenFinish_OnMainThread_Static);
+ m_event_type_set_token_finish =
+ system.GetCoreTiming().RegisterEvent("SetTokenFinish", SetTokenFinish_OnMainThread_Static);
}
void PixelEngineManager::RegisterMMIO(MMIO::Mapping* mmio, u32 base)
@@ -199,7 +199,7 @@ void PixelEngineManager::SetTokenFinish_OnMainThread(Core::System& system, u64 u
// Raise the event handler above on the CPU thread.
// m_token_finish_mutex must be locked.
// THIS IS EXECUTED FROM VIDEO THREAD
-void PixelEngineManager::RaiseEvent(int cycles_into_future)
+void PixelEngineManager::RaiseEvent(Core::System& system, int cycles_into_future)
{
if (m_event_raised)
return;
@@ -208,7 +208,6 @@ void PixelEngineManager::RaiseEvent(int cycles_into_future)
CoreTiming::FromThread from = CoreTiming::FromThread::NON_CPU;
s64 cycles = 0; // we don't care about timings for dual core mode.
- auto& system = Core::System::GetInstance();
if (!system.IsDualCoreMode() || system.GetFifo().UseDeterministicGPUThread())
{
from = CoreTiming::FromThread::CPU;
@@ -217,13 +216,13 @@ void PixelEngineManager::RaiseEvent(int cycles_into_future)
// games time to setup any interrupt state
cycles = std::max(500, cycles_into_future);
}
- Core::System::GetInstance().GetCoreTiming().ScheduleEvent(cycles, m_event_type_set_token_finish,
- 0, from);
+ system.GetCoreTiming().ScheduleEvent(cycles, m_event_type_set_token_finish, 0, from);
}
// SetToken
// THIS IS EXECUTED FROM VIDEO THREAD
-void PixelEngineManager::SetToken(const u16 token, const bool interrupt, int cycles_into_future)
+void PixelEngineManager::SetToken(Core::System& system, const u16 token, const bool interrupt,
+ int cycles_into_future)
{
DEBUG_LOG_FMT(PIXELENGINE, "VIDEO Backend raises INT_CAUSE_PE_TOKEN (btw, token: {:04x})", token);
@@ -232,12 +231,12 @@ void PixelEngineManager::SetToken(const u16 token, const bool interrupt, int cyc
m_token_pending = token;
m_token_interrupt_pending |= interrupt;
- RaiseEvent(cycles_into_future);
+ RaiseEvent(system, cycles_into_future);
}
// SetFinish
// THIS IS EXECUTED FROM VIDEO THREAD (BPStructs.cpp) when a new frame has been drawn
-void PixelEngineManager::SetFinish(int cycles_into_future)
+void PixelEngineManager::SetFinish(Core::System& system, int cycles_into_future)
{
DEBUG_LOG_FMT(PIXELENGINE, "VIDEO Set Finish");
@@ -245,7 +244,7 @@ void PixelEngineManager::SetFinish(int cycles_into_future)
m_finish_interrupt_pending |= true;
- RaiseEvent(cycles_into_future);
+ RaiseEvent(system, cycles_into_future);
}
} // namespace PixelEngine
diff --git a/Source/Core/VideoCommon/PixelEngine.h b/Source/Core/VideoCommon/PixelEngine.h
index 09c7ffcb1f..6e60d5a761 100644
--- a/Source/Core/VideoCommon/PixelEngine.h
+++ b/Source/Core/VideoCommon/PixelEngine.h
@@ -179,18 +179,18 @@ union UPECtrlReg
class PixelEngineManager
{
public:
- void Init();
+ void Init(Core::System& system);
void DoState(PointerWrap& p);
void RegisterMMIO(MMIO::Mapping* mmio, u32 base);
// gfx backend support
- void SetToken(const u16 token, const bool interrupt, int cycle_delay);
- void SetFinish(int cycle_delay);
+ void SetToken(Core::System& system, const u16 token, const bool interrupt, int cycle_delay);
+ void SetFinish(Core::System& system, int cycle_delay);
AlphaReadMode GetAlphaReadMode() const { return m_alpha_read.read_mode; }
private:
- void RaiseEvent(int cycles_into_future);
+ void RaiseEvent(Core::System& system, int cycles_into_future);
void UpdateInterrupts();
void SetTokenFinish_OnMainThread(Core::System& system, u64 userdata, s64 cycles_late);
diff --git a/Source/Core/VideoCommon/VideoBackendBase.cpp b/Source/Core/VideoCommon/VideoBackendBase.cpp
index 4de713e053..41ae126693 100644
--- a/Source/Core/VideoCommon/VideoBackendBase.cpp
+++ b/Source/Core/VideoCommon/VideoBackendBase.cpp
@@ -325,7 +325,7 @@ void VideoBackendBase::InitializeShared()
auto& command_processor = system.GetCommandProcessor();
command_processor.Init(system);
system.GetFifo().Init(system);
- system.GetPixelEngine().Init();
+ system.GetPixelEngine().Init(system);
BPInit();
VertexLoaderManager::Init();
VertexShaderManager::Init();