diff --git a/include/PICA/shader.hpp b/include/PICA/shader.hpp index cf43044a..847391f8 100644 --- a/include/PICA/shader.hpp +++ b/include/PICA/shader.hpp @@ -148,8 +148,8 @@ class PICAShader { bool isCondTrue(u32 instruction); public: - std::array loadedShader; // Currently loaded & active shader - std::array bufferedShader; // Shader to be transferred when the SH_CODETRANSFER_END reg gets written to + std::array loadedShader; // Currently loaded & active shader + std::array 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) { diff --git a/include/services/gsp_gpu.hpp b/include/services/gsp_gpu.hpp index 647a235d..bc8ed287 100644 --- a/include/services/gsp_gpu.hpp +++ b/include/services/gsp_gpu.hpp @@ -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) {} diff --git a/src/core/services/gsp_gpu.cpp b/src/core/services/gsp_gpu.cpp index c3b52a87..fed35b3b 100644 --- a/src/core/services/gsp_gpu.cpp +++ b/src/core/services/gsp_gpu.cpp @@ -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