[Shader JIT[ Cache harder
This commit is contained in:
@@ -9,6 +9,17 @@ void ShaderJIT::reset() {
|
||||
void ShaderJIT::prepare(PICAShader& shaderUnit) {
|
||||
// We construct a shader hash from both the code and operand descriptor hashes
|
||||
// This is so that if only one of them changes, we still properly recompile the shader
|
||||
// This code is inspired from how Citra solves this problem
|
||||
Hash hash = shaderUnit.getCodeHash() ^ shaderUnit.getOpdescHash();
|
||||
auto it = cache.find(hash);
|
||||
|
||||
if (it == cache.end()) { // Block has not been compiled yet
|
||||
auto emitter = std::make_unique<ShaderEmitter>();
|
||||
cache.emplace_hint(it, hash, std::move(emitter));
|
||||
} else { // Block has been compiled and found, use it
|
||||
|
||||
}
|
||||
|
||||
shaderUnit.pc = shaderUnit.entrypoint;
|
||||
}
|
||||
#endif // PANDA3DS_SHADER_JIT_SUPPORTED
|
||||
Reference in New Issue
Block a user