mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-20 04:29:13 +12:00
[Shader JIT[ Cache harder
This commit is contained in:
parent
4064abfdeb
commit
6a70edca7e
3 changed files with 19 additions and 1 deletions
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue