mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-12 09:09:47 +12:00
PICA decompiler: Cache VS uniforms
This commit is contained in:
parent
7209740418
commit
0d6bef2d70
4 changed files with 18 additions and 2 deletions
|
@ -133,6 +133,10 @@ class PICAShader {
|
||||||
Hash lastCodeHash = 0; // Last hash computed for the shader code (Used for the JIT caching mechanism)
|
Hash lastCodeHash = 0; // Last hash computed for the shader code (Used for the JIT caching mechanism)
|
||||||
Hash lastOpdescHash = 0; // Last hash computed for the operand descriptors (Also used for the JIT)
|
Hash lastOpdescHash = 0; // Last hash computed for the operand descriptors (Also used for the JIT)
|
||||||
|
|
||||||
|
public:
|
||||||
|
bool uniformsDirty = false;
|
||||||
|
|
||||||
|
protected:
|
||||||
bool codeHashDirty = false;
|
bool codeHashDirty = false;
|
||||||
bool opdescHashDirty = false;
|
bool opdescHashDirty = false;
|
||||||
|
|
||||||
|
@ -283,6 +287,7 @@ class PICAShader {
|
||||||
uniform[2] = f24::fromRaw(((floatUniformBuffer[0] & 0xff) << 16) | (floatUniformBuffer[1] >> 16));
|
uniform[2] = f24::fromRaw(((floatUniformBuffer[0] & 0xff) << 16) | (floatUniformBuffer[1] >> 16));
|
||||||
uniform[3] = f24::fromRaw(floatUniformBuffer[0] >> 8);
|
uniform[3] = f24::fromRaw(floatUniformBuffer[0] >> 8);
|
||||||
}
|
}
|
||||||
|
uniformsDirty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,6 +299,12 @@ class PICAShader {
|
||||||
u[1] = getBits<8, 8>(word);
|
u[1] = getBits<8, 8>(word);
|
||||||
u[2] = getBits<16, 8>(word);
|
u[2] = getBits<16, 8>(word);
|
||||||
u[3] = getBits<24, 8>(word);
|
u[3] = getBits<24, 8>(word);
|
||||||
|
uniformsDirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void uploadBoolUniform(u32 value) {
|
||||||
|
boolUniform = value;
|
||||||
|
uniformsDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void run();
|
void run();
|
||||||
|
|
|
@ -301,7 +301,7 @@ void GPU::writeInternalReg(u32 index, u32 value, u32 mask) {
|
||||||
}
|
}
|
||||||
|
|
||||||
case VertexBoolUniform: {
|
case VertexBoolUniform: {
|
||||||
shaderUnit.vs.boolUniform = value & 0xffff;
|
shaderUnit.vs.uploadBoolUniform(value & 0xffff);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,4 +34,5 @@ void PICAShader::reset() {
|
||||||
|
|
||||||
codeHashDirty = true;
|
codeHashDirty = true;
|
||||||
opdescHashDirty = true;
|
opdescHashDirty = true;
|
||||||
|
uniformsDirty = true;
|
||||||
}
|
}
|
|
@ -987,7 +987,11 @@ bool RendererGL::prepareForDraw(ShaderUnit& shaderUnit, bool isImmediateMode) {
|
||||||
} else {
|
} else {
|
||||||
generatedVertexShader = &(*shader);
|
generatedVertexShader = &(*shader);
|
||||||
gl.bindUBO(hwShaderUniformUBO);
|
gl.bindUBO(hwShaderUniformUBO);
|
||||||
glBufferSubData(GL_UNIFORM_BUFFER, 0, PICAShader::totalUniformSize(), shaderUnit.vs.getUniformPointer());
|
|
||||||
|
if (shaderUnit.vs.uniformsDirty) {
|
||||||
|
shaderUnit.vs.uniformsDirty = false;
|
||||||
|
glBufferSubData(GL_UNIFORM_BUFFER, 0, PICAShader::totalUniformSize(), shaderUnit.vs.getUniformPointer());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue