mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-20 12:39:13 +12:00
aaaaaaaaaaaa
This commit is contained in:
parent
869dc20c5c
commit
7fa7559879
2 changed files with 9 additions and 3 deletions
|
@ -42,6 +42,12 @@ class ShaderEmitter : private oaknut::CodeBlock, public oaknut::CodeGenerator {
|
||||||
oaknut::Label emitLog2Func();
|
oaknut::Label emitLog2Func();
|
||||||
oaknut::Label emitExp2Func();
|
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)
|
// Compile all instructions from [current recompiler PC, end)
|
||||||
void compileUntil(const PICAShader& shaderUnit, u32 endPC);
|
void compileUntil(const PICAShader& shaderUnit, u32 endPC);
|
||||||
// Compile instruction "instr"
|
// 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
|
// 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) {
|
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; }
|
PrologueCallback getPrologueCallback() { return prologueCb; }
|
||||||
|
|
|
@ -39,7 +39,7 @@ void ShaderEmitter::compile(const PICAShader& shaderUnit) {
|
||||||
align(16);
|
align(16);
|
||||||
|
|
||||||
l(prologueLabel);
|
l(prologueLabel);
|
||||||
prologueCb = reinterpret_cast<PrologueCallback>(oaknut::CodeBlock::ptr() + prologueLabel.offset());
|
prologueCb = getLabelPointer<PrologueCallback>(prologueLabel);
|
||||||
|
|
||||||
// Set state pointer to the proper pointer
|
// Set state pointer to the proper pointer
|
||||||
// state pointer is volatile, no need to preserve it
|
// state pointer is volatile, no need to preserve it
|
||||||
|
@ -407,7 +407,7 @@ void ShaderEmitter::storeRegister(QReg source, const PICAShader& shader, u32 des
|
||||||
if (writeMask == 0xf) { // No lanes are masked, just use STR
|
if (writeMask == 0xf) { // No lanes are masked, just use STR
|
||||||
STR(source, statePointer, offset);
|
STR(source, statePointer, offset);
|
||||||
} else {
|
} else {
|
||||||
u8* blendMaskPointer = reinterpret_cast<u8*>(oaknut::CodeBlock::ptr() + blendMasks.offset());
|
u8* blendMaskPointer = getLabelPointer<u8*>(blendMasks));
|
||||||
LDR(scratch1, statePointer, offset); // Load current value
|
LDR(scratch1, statePointer, offset); // Load current value
|
||||||
LDR(scratch2, blendMaskPointer + writeMask * 16); // Load write mask for blending
|
LDR(scratch2, blendMaskPointer + writeMask * 16); // Load write mask for blending
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue