aaaaaaaaaaaa

This commit is contained in:
wheremyfoodat 2024-03-07 17:02:38 +00:00 committed by GitHub
parent 869dc20c5c
commit 7fa7559879
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 3 deletions

View file

@ -42,6 +42,12 @@ class ShaderEmitter : private oaknut::CodeBlock, public oaknut::CodeGenerator {
oaknut::Label emitLog2Func();
oaknut::Label emitExp2Func();
template <typename T>
void getLabelPointer(const oaknut::Label& label) {
auto pointer = reinterpret_cast<u8*>(oaknut::CodeBlock::ptr()) + label.offset();
return reinterpret_cast<T>(pointer);
}
// Compile all instructions from [current recompiler PC, end)
void compileUntil(const PICAShader& shaderUnit, u32 endPC);
// Compile instruction "instr"
@ -118,7 +124,7 @@ class ShaderEmitter : private oaknut::CodeBlock, public oaknut::CodeGenerator {
// PC must be a valid entrypoint here. It doesn't have that much overhead in this case, so we use std::array<>::at() to assert it does
InstructionCallback getInstructionCallback(u32 pc) {
return reinterpret_cast<InstructionCallback>(oaknut::CodeBlock::ptr() + instructionLabels.at(pc).offset());
return getLabelPointer<InstructionCallback>(instructionLabels.at(pc));
}
PrologueCallback getPrologueCallback() { return prologueCb; }