mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-18 03:31:31 +12:00
[ShaderJIT] Add const qualifier to JIT callbacks
This commit is contained in:
parent
77cba3110d
commit
46a47912d8
2 changed files with 28 additions and 2 deletions
|
@ -35,9 +35,9 @@ class ShaderEmitter : public Xbyak::CodeGenerator {
|
||||||
void scanForCalls(const PICAShader& shader);
|
void scanForCalls(const PICAShader& shader);
|
||||||
|
|
||||||
public:
|
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
|
// 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;
|
PrologueCallback prologueCb;
|
||||||
|
|
||||||
// Initialize our emitter with "allocSize" bytes of RWX memory
|
// Initialize our emitter with "allocSize" bytes of RWX memory
|
||||||
|
|
|
@ -1,11 +1,17 @@
|
||||||
#if defined(PANDA3DS_DYNAPICA_SUPPORTED) && defined(PANDA3DS_X64_HOST)
|
#if defined(PANDA3DS_DYNAPICA_SUPPORTED) && defined(PANDA3DS_X64_HOST)
|
||||||
#include "PICA/dynapica/shader_rec_emitter_x64.hpp"
|
#include "PICA/dynapica/shader_rec_emitter_x64.hpp"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <cstddef>
|
||||||
|
|
||||||
using namespace Xbyak;
|
using namespace Xbyak;
|
||||||
using namespace Xbyak::util;
|
using namespace Xbyak::util;
|
||||||
|
|
||||||
// Register that points to PICA state
|
// Register that points to PICA state
|
||||||
static constexpr Reg64 statePointer = rbp;
|
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) {
|
void ShaderEmitter::compile(const PICAShader& shaderUnit) {
|
||||||
// Emit prologue first
|
// Emit prologue first
|
||||||
|
@ -65,9 +71,29 @@ void ShaderEmitter::compileInstruction(const PICAShader& shaderUnit) {
|
||||||
const u32 opcode = instruction >> 26;
|
const u32 opcode = instruction >> 26;
|
||||||
|
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
|
case ShaderOpcodes::MOV: recMOV(shaderUnit, instruction); break;
|
||||||
default:
|
default:
|
||||||
Helpers::panic("ShaderJIT: Unimplemented PICA opcode %X", opcode);
|
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
|
#endif
|
Loading…
Add table
Add a link
Reference in a new issue