[ShaderJIT] Add const qualifier to JIT callbacks

This commit is contained in:
wheremyfoodat 2023-06-08 22:44:57 +03:00
parent 77cba3110d
commit 46a47912d8
2 changed files with 28 additions and 2 deletions

View file

@ -35,9 +35,9 @@ class ShaderEmitter : public Xbyak::CodeGenerator {
void scanForCalls(const PICAShader& shader);
public:
using InstructionCallback = void(*)(PICAShader& shaderUnit); // Callback type used for instructions
using InstructionCallback = const void(*)(PICAShader& shaderUnit); // Callback type used for instructions
// Callback type used for the JIT prologue. This is what the caller will call
using PrologueCallback = void(*)(PICAShader& shaderUnit, InstructionCallback cb);
using PrologueCallback = const void(*)(PICAShader& shaderUnit, InstructionCallback cb);
PrologueCallback prologueCb;
// Initialize our emitter with "allocSize" bytes of RWX memory

View file

@ -1,11 +1,17 @@
#if defined(PANDA3DS_DYNAPICA_SUPPORTED) && defined(PANDA3DS_X64_HOST)
#include "PICA/dynapica/shader_rec_emitter_x64.hpp"
#include <algorithm>
#include <cstddef>
using namespace Xbyak;
using namespace Xbyak::util;
// Register that points to PICA state
static constexpr Reg64 statePointer = rbp;
static constexpr Xmm scratch1 = xmm0;
static constexpr Xmm scratch2 = xmm1;
static constexpr Xmm scratch3 = xmm2;
void ShaderEmitter::compile(const PICAShader& shaderUnit) {
// Emit prologue first
@ -65,9 +71,29 @@ void ShaderEmitter::compileInstruction(const PICAShader& shaderUnit) {
const u32 opcode = instruction >> 26;
switch (opcode) {
case ShaderOpcodes::MOV: recMOV(shaderUnit, instruction); break;
default:
Helpers::panic("ShaderJIT: Unimplemented PICA opcode %X", opcode);
}
}
void ShaderEmitter::loadRegister(Xmm dest, const PICAShader& shader, u32 srcReg, u32 index) {
}
void ShaderEmitter::recMOV(const PICAShader& shader, u32 instruction) {
/*
const u32 operandDescriptor = shader.operandDescriptors[instruction & 0x7f];
u32 src = (instruction >> 12) & 0x7f;
const u32 idx = (instruction >> 19) & 3;
const u32 dest = (instruction >> 21) & 0x1f;
src = getIndexedSource(src, idx);
vec4f srcVector = getSourceSwizzled<1>(src, operandDescriptor);
vec4f& destVector = getDest(dest);
u32 componentMask = operandDescriptor & 0xf;
*/
}
#endif