[GPU] Stub FlushCacheRange, increase size of shader memory

This commit is contained in:
wheremyfoodat 2022-10-09 19:48:51 +03:00
parent 4930c1a947
commit 5f7804e99f
3 changed files with 15 additions and 8 deletions

View file

@ -148,8 +148,8 @@ class PICAShader {
bool isCondTrue(u32 instruction);
public:
std::array<u32, 512> loadedShader; // Currently loaded & active shader
std::array<u32, 512> bufferedShader; // Shader to be transferred when the SH_CODETRANSFER_END reg gets written to
std::array<u32, 4096> loadedShader; // Currently loaded & active shader
std::array<u32, 4096> bufferedShader; // Shader to be transferred when the SH_CODETRANSFER_END reg gets written to
u32 entrypoint = 0; // Initial shader PC
u32 boolUniform;
@ -164,12 +164,12 @@ public:
// Theese functions are in the header to be inlined more easily, though with LTO I hope I'll be able to move them
void finalize() {
std::memcpy(&loadedShader[0], &bufferedShader[0], 512 * sizeof(u32));
std::memcpy(&loadedShader[0], &bufferedShader[0], 4096 * sizeof(u32));
}
void setBufferIndex(u32 index) {
if (index != 0) Helpers::panic("Is this register 9 or 11 bit?");
bufferIndex = (index >> 2) & 0x1ff;
if (index != 0) Helpers::panic("How many bits is the shader buffer index reg meant to be?");
bufferIndex = (index >> 2) & 0xfff;
}
void setOpDescriptorIndex(u32 index) {
@ -177,9 +177,9 @@ public:
}
void uploadWord(u32 word) {
if (bufferIndex >= 511) Helpers::panic("o no");
if (bufferIndex >= 4095) Helpers::panic("o no, shader upload overflew");
bufferedShader[bufferIndex++] = word;
bufferIndex &= 0x1ff;
bufferIndex &= 0xfff;
}
void uploadDescriptor(u32 word) {

View file

@ -43,6 +43,7 @@ class GPUService {
void processCommandList(u32* cmd);
void memoryFill(u32* cmd);
void triggerDisplayTransfer(u32* cmd);
void flushCacheRegions(u32* cmd);
public:
GPUService(Memory& mem, GPU& gpu, u32& currentPID) : mem(mem), gpu(gpu), currentPID(currentPID) {}

View file

@ -18,7 +18,8 @@ namespace GXCommands {
enum : u32 {
ProcessCommandList = 1,
MemoryFill = 2,
TriggerDisplayTransfer = 3
TriggerDisplayTransfer = 3,
FlushCacheRegions = 5
};
}
@ -214,6 +215,7 @@ void GPUService::processCommandBuffer() {
case GXCommands::ProcessCommandList: processCommandList(cmd); break;
case GXCommands::MemoryFill: memoryFill(cmd); break;
case GXCommands::TriggerDisplayTransfer: triggerDisplayTransfer(cmd); break;
case GXCommands::FlushCacheRegions: flushCacheRegions(cmd); break;
default: Helpers::panic("GSP::GPU::ProcessCommands: Unknown cmd ID %d", cmdID);
}
@ -252,6 +254,10 @@ void GPUService::triggerDisplayTransfer(u32* cmd) {
requestInterrupt(GPUInterrupt::PPF); // Send "Display transfer finished" interrupt
}
void GPUService::flushCacheRegions(u32* cmd) {
log("GSP::GPU::FlushCacheRegions (Stubbed)\n");
}
// Actually send command list (aka display list) to GPU
void GPUService::processCommandList(u32* cmd) {
u32 address = cmd[1] & ~7; // Buffer address