From c9d10de644078a29e2310791ee221f3bc916e923 Mon Sep 17 00:00:00 2001 From: bunnei Date: Sun, 20 Mar 2016 00:37:05 -0400 Subject: shader_jit_x64: Allocate each program independently and persist for emu session. --- src/video_core/shader/shader_jit_x64.h | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src/video_core/shader/shader_jit_x64.h') diff --git a/src/video_core/shader/shader_jit_x64.h b/src/video_core/shader/shader_jit_x64.h index d6f03892d..19f9bdb56 100644 --- a/src/video_core/shader/shader_jit_x64.h +++ b/src/video_core/shader/shader_jit_x64.h @@ -22,10 +22,8 @@ namespace Pica { namespace Shader { -/// Memory needed to be available to compile the next shader (otherwise, clear the cache) -constexpr size_t jit_shader_size = 1024 * 512; -/// Memory allocated for the JIT code space cache -constexpr size_t jit_cache_size = 1024 * 1024 * 8; +/// Memory allocated for each compiled shader (64Kb) +constexpr size_t MAX_SHADER_SIZE = 1024 * 64; using CompiledShader = void(void* registers); @@ -37,9 +35,11 @@ class JitCompiler : public Gen::XCodeBlock { public: JitCompiler(); - CompiledShader* Compile(); + void Run(void* registers) const { + program(registers); + } - void Clear(); + void Compile(); void Compile_ADD(Instruction instr); void Compile_DP3(Instruction instr); @@ -104,12 +104,14 @@ private: /// Offsets in code where a return needs to be inserted std::set return_offsets; - unsigned last_program_counter; ///< Offset of the most recent instruction decoded - unsigned program_counter; ///< Offset of the next instruction to decode - bool looping = false; ///< True if compiling a loop, used to check for nested loops + unsigned last_program_counter = 0; ///< Offset of the most recent instruction decoded + unsigned program_counter = 0; ///< Offset of the next instruction to decode + bool looping = false; ///< True if compiling a loop, used to check for nested loops /// Branches that need to be fixed up once the entire shader program is compiled std::vector> fixup_branches; + + CompiledShader* program = nullptr; }; } // Shader -- cgit v1.2.3