[Shader JIT] Moar

This commit is contained in:
wheremyfoodat 2023-06-08 18:51:03 +03:00
parent 6a70edca7e
commit 415e276ef9
7 changed files with 51 additions and 8 deletions

View file

@ -7,6 +7,7 @@ void ShaderJIT::reset() {
}
void ShaderJIT::prepare(PICAShader& shaderUnit) {
shaderUnit.pc = shaderUnit.entrypoint;
// 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
@ -15,11 +16,10 @@ void ShaderJIT::prepare(PICAShader& shaderUnit) {
if (it == cache.end()) { // Block has not been compiled yet
auto emitter = std::make_unique<ShaderEmitter>();
emitter->compile(shaderUnit);
cache.emplace_hint(it, hash, std::move(emitter));
} else { // Block has been compiled and found, use it
auto emitter = it->second.get();
}
shaderUnit.pc = shaderUnit.entrypoint;
}
#endif // PANDA3DS_SHADER_JIT_SUPPORTED

View file

@ -0,0 +1,11 @@
#if defined(PANDA3DS_DYNAPICA_SUPPORTED) && defined(PANDA3DS_X64_HOST)
#include "PICA/dynapica/shader_rec_emitter_x64.hpp"
using namespace Xbyak;
using namespace Xbyak::util;
void ShaderEmitter::compile(const PICAShader& shaderUnit) {
}
#endif