mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-03 12:27:21 +12:00
[PICA] Rework how external registers work, format
This commit is contained in:
parent
a8a76ab64d
commit
9695b57bf5
13 changed files with 54 additions and 38 deletions
|
@ -14,8 +14,11 @@
|
|||
|
||||
class GPU {
|
||||
static constexpr u32 regNum = 0x300;
|
||||
static constexpr u32 extRegNum = 0x1000;
|
||||
|
||||
using vec4f = std::array<Floats::f24, 4>;
|
||||
using Registers = std::array<u32, regNum>;
|
||||
using Registers = std::array<u32, regNum>; // Internal registers (named registers in short since they're the main ones)
|
||||
using ExternalRegisters = std::array<u32, extRegNum>;
|
||||
|
||||
Memory& mem;
|
||||
EmulatorConfig& config;
|
||||
|
@ -29,7 +32,6 @@ class GPU {
|
|||
static constexpr u32 vramSize = u32(6_MB);
|
||||
Registers regs; // GPU internal registers
|
||||
std::array<vec4f, 16> currentAttributes; // Vertex attributes before being passed to the shader
|
||||
std::array<u32, 0x1000> external_regs; // GPU external registers
|
||||
|
||||
std::array<vec4f, 16> immediateModeAttributes; // Vertex attributes uploaded via immediate mode submission
|
||||
std::array<PICA::Vertex, 3> immediateModeVertices;
|
||||
|
@ -144,4 +146,10 @@ class GPU {
|
|||
Helpers::panic("[GPU] Tried to access unknown physical address: %08X", paddr);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
// GPU external registers
|
||||
// We have them in the end of the struct for cache locality reasons. Tl;dr we want the more commonly used things to be packed in the start
|
||||
// Of the struct, instead of externalRegs being in the middle
|
||||
ExternalRegisters externalRegs;
|
||||
};
|
||||
|
|
|
@ -21,8 +21,11 @@ struct SDL_Window;
|
|||
class Renderer {
|
||||
protected:
|
||||
GPU& gpu;
|
||||
static constexpr u32 regNum = 0x300; // Number of internal PICA registers
|
||||
static constexpr u32 regNum = 0x300; // Number of internal PICA registers
|
||||
static constexpr u32 extRegNum = 0x1000; // Number of external PICA registers
|
||||
|
||||
const std::array<u32, regNum>& regs;
|
||||
const std::array<u32, extRegNum>& externalRegs;
|
||||
|
||||
std::array<u32, 2> fbSize; // The size of the framebuffer (ie both the colour and depth buffer)'
|
||||
|
||||
|
@ -34,7 +37,7 @@ class Renderer {
|
|||
PICA::DepthFmt depthBufferFormat;
|
||||
|
||||
public:
|
||||
Renderer(GPU& gpu, const std::array<u32, regNum>& internalRegs);
|
||||
Renderer(GPU& gpu, const std::array<u32, regNum>& internalRegs, const std::array<u32, extRegNum>& externalRegs);
|
||||
virtual ~Renderer();
|
||||
|
||||
static constexpr u32 vertexBufferSize = 0x10000;
|
||||
|
|
|
@ -68,7 +68,8 @@ class RendererGL final : public Renderer {
|
|||
void updateLightingLUT();
|
||||
|
||||
public:
|
||||
RendererGL(GPU& gpu, const std::array<u32, regNum>& internalRegs) : Renderer(gpu, internalRegs) {}
|
||||
RendererGL(GPU& gpu, const std::array<u32, regNum>& internalRegs, const std::array<u32, extRegNum>& externalRegs)
|
||||
: Renderer(gpu, internalRegs, externalRegs) {}
|
||||
~RendererGL() override;
|
||||
|
||||
void reset() override;
|
||||
|
|
|
@ -4,7 +4,7 @@ class GPU;
|
|||
|
||||
class RendererNull final : public Renderer {
|
||||
public:
|
||||
RendererNull(GPU& gpu, const std::array<u32, regNum>& internalRegs);
|
||||
RendererNull(GPU& gpu, const std::array<u32, regNum>& internalRegs, const std::array<u32, extRegNum>& externalRegs);
|
||||
~RendererNull() override;
|
||||
|
||||
void reset() override;
|
||||
|
|
|
@ -4,7 +4,7 @@ class GPU;
|
|||
|
||||
class RendererSw final : public Renderer {
|
||||
public:
|
||||
RendererSw(GPU& gpu, const std::array<u32, regNum>& internalRegs);
|
||||
RendererSw(GPU& gpu, const std::array<u32, regNum>& internalRegs, const std::array<u32, extRegNum>& externalRegs);
|
||||
~RendererSw() override;
|
||||
|
||||
void reset() override;
|
||||
|
|
|
@ -44,7 +44,7 @@ class RendererVK final : public Renderer {
|
|||
|
||||
u64 currentFrame = 0;
|
||||
public:
|
||||
RendererVK(GPU& gpu, const std::array<u32, regNum>& internalRegs);
|
||||
RendererVK(GPU& gpu, const std::array<u32, regNum>& internalRegs, const std::array<u32, extRegNum>& externalRegs);
|
||||
~RendererVK() override;
|
||||
|
||||
void reset() override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue