mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-05-05 03:34:49 +12:00
[PICA] Get vertex attributes being semi-properly read
This commit is contained in:
parent
1bbd377ee7
commit
434c840aeb
6 changed files with 135 additions and 14 deletions
|
@ -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();
|
||||
|
||||
|
|
|
@ -2,10 +2,42 @@
|
|||
|
||||
namespace PICAInternalRegs {
|
||||
enum : u32 {
|
||||
// Draw command regs
|
||||
// Geometry pipelin regs
|
||||
VertexAttribLoc = 0x200,
|
||||
IndexBufferConfig = 0x227,
|
||||
VertexCountReg = 0x228,
|
||||
VertexOffsetReg = 0x22A,
|
||||
SignalDrawArrays = 0x22E,
|
||||
SignalDrawElements = 0x22F,
|
||||
|
||||
Attrib0Offset = 0x203,
|
||||
Attrib1Offset = 0x206,
|
||||
Attrib2Offset = 0x209,
|
||||
Attrib3Offset = 0x20C,
|
||||
Attrib4Offset = 0x20F,
|
||||
Attrib5Offset = 0x212,
|
||||
Attrib6Offset = 0x215,
|
||||
Attrib7Offset = 0x218,
|
||||
Attrib8Offset = 0x21B,
|
||||
Attrib9Offset = 0x21E,
|
||||
Attrib10Offset = 0x221,
|
||||
Attrib11Offset = 0x224,
|
||||
|
||||
Attrib0Config2 = 0x205,
|
||||
Attrib1Config2 = 0x208,
|
||||
Attrib2Config2 = 0x20B,
|
||||
Attrib3Config2 = 0x20E,
|
||||
Attrib4Config2 = 0x211,
|
||||
Attrib5Config2 = 0x214,
|
||||
Attrib6Config2 = 0x217,
|
||||
Attrib7Config2 = 0x21A,
|
||||
Attrib8Config2 = 0x21D,
|
||||
Attrib9Config2 = 0x220,
|
||||
Attrib10Config2 = 0x223,
|
||||
Attrib11Config2 = 0x226,
|
||||
|
||||
AttribInfoStart = Attrib0Offset,
|
||||
AttribInfoEnd = Attrib11Config2,
|
||||
|
||||
// Vertex shader registers
|
||||
VertexShaderTransferEnd = 0x2BF,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue