CommandProcessor: Fix shadowing warnings

This commit is contained in:
Pokechu22 2023-02-02 16:06:29 -08:00
parent f1b1f5c013
commit 9559c45cae
1 changed files with 63 additions and 61 deletions

View File

@ -221,30 +221,30 @@ void CommandProcessorManager::RegisterMMIO(Core::System& system, MMIO::Mapping*
MMIO::InvalidWrite<u16>()); MMIO::InvalidWrite<u16>());
} }
mmio->Register(base | STATUS_REGISTER, MMIO::ComplexRead<u16>([](Core::System& system, u32) { mmio->Register(base | STATUS_REGISTER, MMIO::ComplexRead<u16>([](Core::System& system_, u32) {
auto& cp = system.GetCommandProcessor(); auto& cp = system_.GetCommandProcessor();
system.GetFifo().SyncGPUForRegisterAccess(system); system_.GetFifo().SyncGPUForRegisterAccess(system_);
cp.SetCpStatusRegister(system); cp.SetCpStatusRegister(system_);
return cp.m_cp_status_reg.Hex; return cp.m_cp_status_reg.Hex;
}), }),
MMIO::InvalidWrite<u16>()); MMIO::InvalidWrite<u16>());
mmio->Register(base | CTRL_REGISTER, MMIO::DirectRead<u16>(&m_cp_ctrl_reg.Hex), mmio->Register(base | CTRL_REGISTER, MMIO::DirectRead<u16>(&m_cp_ctrl_reg.Hex),
MMIO::ComplexWrite<u16>([](Core::System& system, u32, u16 val) { MMIO::ComplexWrite<u16>([](Core::System& system_, u32, u16 val) {
auto& cp = system.GetCommandProcessor(); auto& cp = system_.GetCommandProcessor();
UCPCtrlReg tmp(val); UCPCtrlReg tmp(val);
cp.m_cp_ctrl_reg.Hex = tmp.Hex; cp.m_cp_ctrl_reg.Hex = tmp.Hex;
cp.SetCpControlRegister(system); cp.SetCpControlRegister(system_);
system.GetFifo().RunGpu(system); system_.GetFifo().RunGpu(system_);
})); }));
mmio->Register(base | CLEAR_REGISTER, MMIO::DirectRead<u16>(&m_cp_clear_reg.Hex), mmio->Register(base | CLEAR_REGISTER, MMIO::DirectRead<u16>(&m_cp_clear_reg.Hex),
MMIO::ComplexWrite<u16>([](Core::System& system, u32, u16 val) { MMIO::ComplexWrite<u16>([](Core::System& system_, u32, u16 val) {
auto& cp = system.GetCommandProcessor(); auto& cp = system_.GetCommandProcessor();
UCPClearReg tmp(val); UCPClearReg tmp(val);
cp.m_cp_clear_reg.Hex = tmp.Hex; cp.m_cp_clear_reg.Hex = tmp.Hex;
cp.SetCpClearRegister(); cp.SetCpClearRegister();
system.GetFifo().RunGpu(system); system_.GetFifo().RunGpu(system_);
})); }));
mmio->Register(base | PERF_SELECT, MMIO::InvalidRead<u16>(), MMIO::Nop<u16>()); mmio->Register(base | PERF_SELECT, MMIO::InvalidRead<u16>(), MMIO::Nop<u16>());
@ -254,20 +254,20 @@ void CommandProcessorManager::RegisterMMIO(Core::System& system, MMIO::Mapping*
MMIO::ReadHandlingMethod<u16>* fifo_rw_distance_lo_r; MMIO::ReadHandlingMethod<u16>* fifo_rw_distance_lo_r;
if (is_on_thread) if (is_on_thread)
{ {
fifo_rw_distance_lo_r = MMIO::ComplexRead<u16>([](Core::System& system, u32) { fifo_rw_distance_lo_r = MMIO::ComplexRead<u16>([](Core::System& system_, u32) {
const auto& fifo = system.GetCommandProcessor().GetFifo(); const auto& fifo_ = system_.GetCommandProcessor().GetFifo();
if (fifo.CPWritePointer.load(std::memory_order_relaxed) >= if (fifo_.CPWritePointer.load(std::memory_order_relaxed) >=
fifo.SafeCPReadPointer.load(std::memory_order_relaxed)) fifo_.SafeCPReadPointer.load(std::memory_order_relaxed))
{ {
return static_cast<u16>(fifo.CPWritePointer.load(std::memory_order_relaxed) - return static_cast<u16>(fifo_.CPWritePointer.load(std::memory_order_relaxed) -
fifo.SafeCPReadPointer.load(std::memory_order_relaxed)); fifo_.SafeCPReadPointer.load(std::memory_order_relaxed));
} }
else else
{ {
return static_cast<u16>(fifo.CPEnd.load(std::memory_order_relaxed) - return static_cast<u16>(fifo_.CPEnd.load(std::memory_order_relaxed) -
fifo.SafeCPReadPointer.load(std::memory_order_relaxed) + fifo_.SafeCPReadPointer.load(std::memory_order_relaxed) +
fifo.CPWritePointer.load(std::memory_order_relaxed) - fifo_.CPWritePointer.load(std::memory_order_relaxed) -
fifo.CPBase.load(std::memory_order_relaxed) + 32); fifo_.CPBase.load(std::memory_order_relaxed) + 32);
} }
}); });
} }
@ -282,40 +282,40 @@ void CommandProcessorManager::RegisterMMIO(Core::System& system, MMIO::Mapping*
MMIO::ReadHandlingMethod<u16>* fifo_rw_distance_hi_r; MMIO::ReadHandlingMethod<u16>* fifo_rw_distance_hi_r;
if (is_on_thread) if (is_on_thread)
{ {
fifo_rw_distance_hi_r = MMIO::ComplexRead<u16>([](Core::System& system, u32) { fifo_rw_distance_hi_r = MMIO::ComplexRead<u16>([](Core::System& system_, u32) {
const auto& fifo = system.GetCommandProcessor().GetFifo(); const auto& fifo_ = system_.GetCommandProcessor().GetFifo();
system.GetFifo().SyncGPUForRegisterAccess(system); system_.GetFifo().SyncGPUForRegisterAccess(system_);
if (fifo.CPWritePointer.load(std::memory_order_relaxed) >= if (fifo_.CPWritePointer.load(std::memory_order_relaxed) >=
fifo.SafeCPReadPointer.load(std::memory_order_relaxed)) fifo_.SafeCPReadPointer.load(std::memory_order_relaxed))
{ {
return (fifo.CPWritePointer.load(std::memory_order_relaxed) - return (fifo_.CPWritePointer.load(std::memory_order_relaxed) -
fifo.SafeCPReadPointer.load(std::memory_order_relaxed)) >> fifo_.SafeCPReadPointer.load(std::memory_order_relaxed)) >>
16; 16;
} }
else else
{ {
return (fifo.CPEnd.load(std::memory_order_relaxed) - return (fifo_.CPEnd.load(std::memory_order_relaxed) -
fifo.SafeCPReadPointer.load(std::memory_order_relaxed) + fifo_.SafeCPReadPointer.load(std::memory_order_relaxed) +
fifo.CPWritePointer.load(std::memory_order_relaxed) - fifo_.CPWritePointer.load(std::memory_order_relaxed) -
fifo.CPBase.load(std::memory_order_relaxed) + 32) >> fifo_.CPBase.load(std::memory_order_relaxed) + 32) >>
16; 16;
} }
}); });
} }
else else
{ {
fifo_rw_distance_hi_r = MMIO::ComplexRead<u16>([](Core::System& system, u32) { fifo_rw_distance_hi_r = MMIO::ComplexRead<u16>([](Core::System& system_, u32) {
const auto& fifo = system.GetCommandProcessor().GetFifo(); const auto& fifo_ = system_.GetCommandProcessor().GetFifo();
system.GetFifo().SyncGPUForRegisterAccess(system); system_.GetFifo().SyncGPUForRegisterAccess(system_);
return fifo.CPReadWriteDistance.load(std::memory_order_relaxed) >> 16; return fifo_.CPReadWriteDistance.load(std::memory_order_relaxed) >> 16;
}); });
} }
mmio->Register(base | FIFO_RW_DISTANCE_HI, fifo_rw_distance_hi_r, mmio->Register(base | FIFO_RW_DISTANCE_HI, fifo_rw_distance_hi_r,
MMIO::ComplexWrite<u16>([WMASK_HI_RESTRICT](Core::System& system, u32, u16 val) { MMIO::ComplexWrite<u16>([WMASK_HI_RESTRICT](Core::System& system_, u32, u16 val) {
auto& fifo = system.GetCommandProcessor().GetFifo(); auto& fifo_ = system_.GetCommandProcessor().GetFifo();
system.GetFifo().SyncGPUForRegisterAccess(system); system_.GetFifo().SyncGPUForRegisterAccess(system_);
WriteHigh(fifo.CPReadWriteDistance, val & WMASK_HI_RESTRICT); WriteHigh(fifo_.CPReadWriteDistance, val & WMASK_HI_RESTRICT);
system.GetFifo().RunGpu(system); system_.GetFifo().RunGpu(system_);
})); }));
mmio->Register( mmio->Register(
@ -328,31 +328,33 @@ void CommandProcessorManager::RegisterMMIO(Core::System& system, MMIO::Mapping*
MMIO::WriteHandlingMethod<u16>* fifo_read_hi_w; MMIO::WriteHandlingMethod<u16>* fifo_read_hi_w;
if (is_on_thread) if (is_on_thread)
{ {
fifo_read_hi_r = MMIO::ComplexRead<u16>([](Core::System& system, u32) { fifo_read_hi_r = MMIO::ComplexRead<u16>([](Core::System& system_, u32) {
auto& fifo = system.GetCommandProcessor().GetFifo(); auto& fifo_ = system_.GetCommandProcessor().GetFifo();
system.GetFifo().SyncGPUForRegisterAccess(system); system_.GetFifo().SyncGPUForRegisterAccess(system_);
return fifo.SafeCPReadPointer.load(std::memory_order_relaxed) >> 16; return fifo_.SafeCPReadPointer.load(std::memory_order_relaxed) >> 16;
});
fifo_read_hi_w = MMIO::ComplexWrite<u16>([WMASK_HI_RESTRICT](Core::System& sys, u32, u16 val) {
auto& fifo = sys.GetCommandProcessor().GetFifo();
sys.GetFifo().SyncGPUForRegisterAccess(sys);
WriteHigh(fifo.CPReadPointer, val & WMASK_HI_RESTRICT);
fifo.SafeCPReadPointer.store(fifo.CPReadPointer.load(std::memory_order_relaxed),
std::memory_order_relaxed);
}); });
fifo_read_hi_w =
MMIO::ComplexWrite<u16>([WMASK_HI_RESTRICT](Core::System& system_, u32, u16 val) {
auto& fifo_ = system_.GetCommandProcessor().GetFifo();
system_.GetFifo().SyncGPUForRegisterAccess(system_);
WriteHigh(fifo_.CPReadPointer, val & WMASK_HI_RESTRICT);
fifo_.SafeCPReadPointer.store(fifo_.CPReadPointer.load(std::memory_order_relaxed),
std::memory_order_relaxed);
});
} }
else else
{ {
fifo_read_hi_r = MMIO::ComplexRead<u16>([](Core::System& system, u32) { fifo_read_hi_r = MMIO::ComplexRead<u16>([](Core::System& system_, u32) {
const auto& fifo = system.GetCommandProcessor().GetFifo(); const auto& fifo_ = system_.GetCommandProcessor().GetFifo();
system.GetFifo().SyncGPUForRegisterAccess(system); system_.GetFifo().SyncGPUForRegisterAccess(system_);
return fifo.CPReadPointer.load(std::memory_order_relaxed) >> 16; return fifo_.CPReadPointer.load(std::memory_order_relaxed) >> 16;
});
fifo_read_hi_w = MMIO::ComplexWrite<u16>([WMASK_HI_RESTRICT](Core::System& sys, u32, u16 val) {
auto& fifo = sys.GetCommandProcessor().GetFifo();
sys.GetFifo().SyncGPUForRegisterAccess(sys);
WriteHigh(fifo.CPReadPointer, val & WMASK_HI_RESTRICT);
}); });
fifo_read_hi_w =
MMIO::ComplexWrite<u16>([WMASK_HI_RESTRICT](Core::System& system_, u32, u16 val) {
auto& fifo_ = system_.GetCommandProcessor().GetFifo();
system_.GetFifo().SyncGPUForRegisterAccess(system_);
WriteHigh(fifo_.CPReadPointer, val & WMASK_HI_RESTRICT);
});
} }
mmio->Register(base | FIFO_READ_POINTER_HI, fifo_read_hi_r, fifo_read_hi_w); mmio->Register(base | FIFO_READ_POINTER_HI, fifo_read_hi_r, fifo_read_hi_w);
} }