[PICA] Fix more shader bugs
This commit is contained in:
@@ -59,6 +59,7 @@ namespace PICAInternalRegs {
|
||||
VertexIntUniform2 = 0x2B3,
|
||||
VertexIntUniform3 = 0x2B4,
|
||||
|
||||
VertexShaderEntrypoint = 0x2BA,
|
||||
VertexShaderTransferEnd = 0x2BF,
|
||||
VertexFloatUniformIndex = 0x2C0,
|
||||
VertexFloatUniformData0 = 0x2C1,
|
||||
|
||||
@@ -150,7 +150,8 @@ class PICAShader {
|
||||
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
|
||||
|
||||
|
||||
u32 entrypoint = 0; // Initial shader PC
|
||||
u32 boolUniform;
|
||||
std::array<OpenGL::Vector<u8, 4>, 4> intUniforms;
|
||||
std::array<vec4f, 96> floatUniforms;
|
||||
|
||||
@@ -113,6 +113,10 @@ void GPU::writeInternalReg(u32 index, u32 value, u32 mask) {
|
||||
shaderUnit.vs.uploadWord(value);
|
||||
break;
|
||||
|
||||
case VertexShaderEntrypoint:
|
||||
shaderUnit.vs.entrypoint = value & 0xffff;
|
||||
break;
|
||||
|
||||
case VertexShaderTransferEnd:
|
||||
if (value != 0) shaderUnit.vs.finalize();
|
||||
break;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include <cmath>
|
||||
|
||||
void PICAShader::run() {
|
||||
pc = 0;
|
||||
pc = entrypoint;
|
||||
loopIndex = 0;
|
||||
ifIndex = 0;
|
||||
callIndex = 0;
|
||||
@@ -63,7 +63,7 @@ void PICAShader::run() {
|
||||
// Handle calls
|
||||
if (callIndex != 0) {
|
||||
auto& info = callInfo[callIndex - 1];
|
||||
if (pc == info.endingPC) { // Check if the IF block ended
|
||||
if (pc == info.endingPC) { // Check if the CALL block ended
|
||||
pc = info.returnPC;
|
||||
callIndex -= 1;
|
||||
}
|
||||
@@ -121,7 +121,7 @@ bool PICAShader::isCondTrue(u32 instruction) {
|
||||
return cmpRegister[0] == refX && cmpRegister[1] == refY;
|
||||
case 2: // At least cmp.x matches
|
||||
return cmpRegister[0] == refX;
|
||||
case 3: // At least cmp.y matches
|
||||
default: // At least cmp.y matches
|
||||
return cmpRegister[1] == refY;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user