mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-07 22:55:40 +12:00
[PICA] Implement drawArrays, get our first triangle data
This commit is contained in:
parent
eb536ee147
commit
00d82ca6ed
4 changed files with 21 additions and 0 deletions
|
@ -10,6 +10,8 @@ class GPU {
|
||||||
ShaderUnit shaderUnit;
|
ShaderUnit shaderUnit;
|
||||||
std::array<u32, regNum> regs; // GPU internal registers
|
std::array<u32, regNum> regs; // GPU internal registers
|
||||||
|
|
||||||
|
void drawArrays();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GPU(Memory& mem) : mem(mem) {}
|
GPU(Memory& mem) : mem(mem) {}
|
||||||
void clearBuffer(u32 startAddress, u32 endAddress, u32 value, u32 control);
|
void clearBuffer(u32 startAddress, u32 endAddress, u32 value, u32 control);
|
||||||
|
|
|
@ -2,6 +2,12 @@
|
||||||
|
|
||||||
namespace PICAInternalRegs {
|
namespace PICAInternalRegs {
|
||||||
enum : u32 {
|
enum : u32 {
|
||||||
|
// Draw command regs
|
||||||
|
VertexCountReg = 0x228,
|
||||||
|
VertexOffsetReg = 0x22A,
|
||||||
|
SignalDrawArrays = 0x22E,
|
||||||
|
|
||||||
|
// Vertex shader registers
|
||||||
VertexShaderTransferEnd = 0x2BF,
|
VertexShaderTransferEnd = 0x2BF,
|
||||||
VertexShaderTransferIndex = 0x2CB,
|
VertexShaderTransferIndex = 0x2CB,
|
||||||
VertexShaderData0 = 0x2CC,
|
VertexShaderData0 = 0x2CC,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "PICA/gpu.hpp"
|
#include "PICA/gpu.hpp"
|
||||||
|
#include "PICA/regs.hpp"
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
void GPU::reset() {
|
void GPU::reset() {
|
||||||
|
@ -9,4 +10,11 @@ void GPU::reset() {
|
||||||
|
|
||||||
void GPU::clearBuffer(u32 startAddress, u32 endAddress, u32 value, u32 control) {
|
void GPU::clearBuffer(u32 startAddress, u32 endAddress, u32 value, u32 control) {
|
||||||
printf("GPU: Clear buffer\nStart: %08X End: %08X\nValue: %08X Control: %08X\n", startAddress, endAddress, value, control);
|
printf("GPU: Clear buffer\nStart: %08X End: %08X\nValue: %08X Control: %08X\n", startAddress, endAddress, value, control);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GPU::drawArrays() {
|
||||||
|
const u32 vertexCount = regs[PICAInternalRegs::VertexCountReg];
|
||||||
|
const u32 vertexOffset = regs[PICAInternalRegs::VertexOffsetReg];
|
||||||
|
|
||||||
|
printf("PICA::DrawArrays(vertex count = %d, vertexOffset = %d)\n", vertexCount, vertexOffset);
|
||||||
}
|
}
|
|
@ -34,10 +34,15 @@ void GPU::writeInternalReg(u32 index, u32 value, u32 mask) {
|
||||||
|
|
||||||
u32 currentValue = regs[index];
|
u32 currentValue = regs[index];
|
||||||
u32 newValue = (currentValue & ~mask) | (value & mask); // Only overwrite the bits specified by "mask"
|
u32 newValue = (currentValue & ~mask) | (value & mask); // Only overwrite the bits specified by "mask"
|
||||||
|
regs[index] = newValue;
|
||||||
|
|
||||||
// TODO: Figure out if things like the shader index use the unmasked value or the masked one
|
// TODO: Figure out if things like the shader index use the unmasked value or the masked one
|
||||||
// We currently use the unmasked value like Citra does
|
// We currently use the unmasked value like Citra does
|
||||||
switch (index) {
|
switch (index) {
|
||||||
|
case SignalDrawArrays:
|
||||||
|
if (value != 0) drawArrays();
|
||||||
|
break;
|
||||||
|
|
||||||
case VertexShaderTransferEnd:
|
case VertexShaderTransferEnd:
|
||||||
if (value != 0) shaderUnit.vs.finalize();
|
if (value != 0) shaderUnit.vs.finalize();
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Reference in a new issue