[Shader JIT] Start migrating to new, better ABI

This commit is contained in:
wheremyfoodat 2023-06-28 22:22:09 +03:00
parent 41f29893c2
commit 28e9d87573
3 changed files with 29 additions and 36 deletions

View file

@ -42,9 +42,6 @@ class ShaderEmitter : public Xbyak::CodeGenerator {
// Compile instruction "instr"
void compileInstruction(const PICAShader& shaderUnit);
// Get the offset to be added to the rsp register to get the current return address
size_t getStackOffsetOfReturnPC();
bool isCall(u32 instruction) {
const u32 opcode = instruction >> 26;
return (opcode == ShaderOpcodes::CALL) || (opcode == ShaderOpcodes::CALLC) || (opcode == ShaderOpcodes::CALLU);
@ -68,6 +65,9 @@ class ShaderEmitter : public Xbyak::CodeGenerator {
// Result is returned in the zero flag. If the comparison is true then zero == 0, else zero == 1 (Opposite of checkCmpRegister)
void checkBoolUniform(const PICAShader& shader, u32 instruction);
// Emit a call to a C++ function
void callCppFunc(void* function) { Helpers::panic("[ShaderJIT] Unimplemented: Add support for calling C++ functions in JITted code"); }
// Instruction recompilation functions
void recADD(const PICAShader& shader, u32 instruction);
void recCALL(const PICAShader& shader, u32 instruction);

View file

@ -6,6 +6,7 @@ using namespace Xbyak;
using namespace Xbyak::util;
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
#define PANDA3DS_MS_ABI
constexpr Reg32 arg1 = ecx; // register where first arg is stored
constexpr Reg32 arg2 = edx; // register where second arg is stored
constexpr Reg32 arg3 = r8d; // register where third arg is stored
@ -20,6 +21,7 @@ constexpr Xmm arg4f = xmm3;
constexpr bool isWindows() { return true; }
#else // System V calling convention
#define PANDA3DS_SYSV_ABI
constexpr Reg32 arg1 = edi;
constexpr Reg32 arg2 = esi;
constexpr Reg32 arg3 = edx;