Refactor the GPU to be object-oriented (#1873)

* Refactor GPU3D to be an object

- Who has two thumbs and is the sworn enemy of global state? This guy!

* Refactor GPU itself to be an object

- Wow, it's used in a lot of places
- Also introduce a new `Melon` namespace for a few classes
- I expect other classes will be moved into `Melon` over time

* Change signature of Renderer3D::SetRenderSettings

- Make it noexcept, and its argument const

* Remove some stray whitespace
This commit is contained in:
Jesse Talavera-Greenberg
2023-11-09 15:54:51 -05:00
committed by GitHub
parent 88072a02c5
commit 4558be0d8e
25 changed files with 1513 additions and 1490 deletions

View File

@ -109,10 +109,11 @@ u32 ARM::ConditionTable[16] =
};
ARM::ARM(u32 num)
ARM::ARM(u32 num, Melon::GPU& gpu) :
#ifdef GDBSTUB_ENABLED
: GdbStub(this, Platform::GetConfigInt(num ? Platform::GdbPortARM7 : Platform::GdbPortARM9))
GdbStub(this, Platform::GetConfigInt(num ? Platform::GdbPortARM7 : Platform::GdbPortARM9)),
#endif
GPU(gpu)
{
// well uh
Num = num;
@ -133,7 +134,7 @@ ARM::~ARM()
// dorp
}
ARMv5::ARMv5() : ARM(0)
ARMv5::ARMv5(Melon::GPU& gpu) : ARM(0, gpu)
{
#ifndef JIT_ENABLED
DTCM = new u8[DTCMPhysicalSize];
@ -142,7 +143,7 @@ ARMv5::ARMv5() : ARM(0)
PU_Map = PU_PrivMap;
}
ARMv4::ARMv4() : ARM(1)
ARMv4::ARMv4(Melon::GPU& gpu) : ARM(1, gpu)
{
//
}
@ -1144,7 +1145,7 @@ void ARM::WriteMem(u32 addr, int size, u32 v)
void ARM::ResetGdb()
{
NDS::Reset();
GPU::StartFrame(); // need this to properly kick off the scheduler & frame output
GPU.StartFrame(); // need this to properly kick off the scheduler & frame output
}
int ARM::RemoteCmd(const u8* cmd, size_t len)
{