[PICA] Get vertex attributes being semi-properly read

This commit is contained in:
wheremyfoodat 2022-09-22 16:48:43 +03:00
parent 1bbd377ee7
commit 434c840aeb
6 changed files with 135 additions and 14 deletions

View file

@ -6,14 +6,41 @@
class GPU {
Memory& mem;
static constexpr u32 regNum = 0x300;
ShaderUnit shaderUnit;
std::array<u32, regNum> regs; // GPU internal registers
u8* vram = nullptr;
static constexpr u32 totalAttribCount = 12; // Up to 12 vertex attributes
static constexpr u32 regNum = 0x300;
static constexpr u32 vramSize = 6_MB;
std::array<u32, regNum> regs; // GPU internal registers
template<typename T>
T readPhysical(u32 paddr) {
if (paddr >= PhysicalAddrs::FCRAM && paddr <= PhysicalAddrs::FCRAMEnd) {
u8* fcram = mem.getFCRAM();
u32 index = paddr - PhysicalAddrs::FCRAM;
return *(T*)&fcram[index];
} else {
Helpers::panic("[PICA] Read unimplemented paddr %08X", paddr);
}
}
template <bool indexed>
void drawArrays();
// Silly method of avoiding linking problems. TODO: Change to something less silly
void drawArrays(bool indexed);
struct AttribInfo {
u32 offset = 0; // Offset from base vertex array
int size = 0; // Bytes per vertex
};
std::array<AttribInfo, totalAttribCount> attributeInfo;
public:
GPU(Memory& mem) : mem(mem) {}
GPU(Memory& mem);
void clearBuffer(u32 startAddress, u32 endAddress, u32 value, u32 control);
void reset();