|
|
@ -25,8 +25,6 @@ namespace Shader {
|
|
|
|
/// Memory allocated for each compiled shader (64Kb)
|
|
|
|
/// Memory allocated for each compiled shader (64Kb)
|
|
|
|
constexpr size_t MAX_SHADER_SIZE = 1024 * 64;
|
|
|
|
constexpr size_t MAX_SHADER_SIZE = 1024 * 64;
|
|
|
|
|
|
|
|
|
|
|
|
using CompiledShader = void(void* registers);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* This class implements the shader JIT compiler. It recompiles a Pica shader program into x86_64
|
|
|
|
* This class implements the shader JIT compiler. It recompiles a Pica shader program into x86_64
|
|
|
|
* code that can be executed on the host machine directly.
|
|
|
|
* code that can be executed on the host machine directly.
|
|
|
@ -35,8 +33,8 @@ class JitCompiler : public Gen::XCodeBlock {
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
JitCompiler();
|
|
|
|
JitCompiler();
|
|
|
|
|
|
|
|
|
|
|
|
void Run(void* registers) const {
|
|
|
|
void Run(void* registers, unsigned offset) const {
|
|
|
|
program(registers);
|
|
|
|
program(registers, code_ptr[offset]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Compile();
|
|
|
|
void Compile();
|
|
|
@ -111,6 +109,7 @@ private:
|
|
|
|
/// Branches that need to be fixed up once the entire shader program is compiled
|
|
|
|
/// Branches that need to be fixed up once the entire shader program is compiled
|
|
|
|
std::vector<std::pair<Gen::FixupBranch, unsigned>> fixup_branches;
|
|
|
|
std::vector<std::pair<Gen::FixupBranch, unsigned>> fixup_branches;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using CompiledShader = void(void* registers, const u8* start_addr);
|
|
|
|
CompiledShader* program = nullptr;
|
|
|
|
CompiledShader* program = nullptr;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|