[Shader JIT] Add prologue & some more compilation stuffs

This commit is contained in:
wheremyfoodat
2023-06-08 22:22:28 +03:00
parent 415e276ef9
commit 77cba3110d
5 changed files with 116 additions and 7 deletions

View File

@@ -17,9 +17,15 @@ void ShaderJIT::prepare(PICAShader& shaderUnit) {
if (it == cache.end()) { // Block has not been compiled yet
auto emitter = std::make_unique<ShaderEmitter>();
emitter->compile(shaderUnit);
// Get pointer to callbacks
entrypointCallback = emitter->getInstructionCallback(shaderUnit.entrypoint);
prologueCallback = emitter->getPrologueCallback();
cache.emplace_hint(it, hash, std::move(emitter));
} else { // Block has been compiled and found, use it
auto emitter = it->second.get();
entrypointCallback = emitter->getInstructionCallback(shaderUnit.entrypoint);
prologueCallback = emitter->getPrologueCallback();
}
}
#endif // PANDA3DS_SHADER_JIT_SUPPORTED