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.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/video_core/shader/shader_jit_x64.cpp') diff --git a/src/video_core/shader/shader_jit_x64.cpp b/src/video_core/shader/shader_jit_x64.cpp index c798992ec..3da4e51fa 100644 --- a/src/video_core/shader/shader_jit_x64.cpp +++ b/src/video_core/shader/shader_jit_x64.cpp @@ -589,7 +589,7 @@ void JitCompiler::Compile_CALL(Instruction instr) { fixup_branches.push_back({ b, instr.flow_control.dest_offset }); // Make sure that if the above code changes, SKIP gets updated - ASSERT(reinterpret_cast(GetCodePtr()) - start == SKIP); + ASSERT(reinterpret_cast(GetCodePtr()) - start == SKIP); } void JitCompiler::Compile_CALLC(Instruction instr) { @@ -803,8 +803,8 @@ void JitCompiler::FindReturnOffsets() { } } -CompiledShader* JitCompiler::Compile() { - const u8* start = GetCodePtr(); +void JitCompiler::Compile() { + program = (CompiledShader*)GetCodePtr(); // The stack pointer is 8 modulo 16 at the entry of a procedure ABI_PushRegistersAndAdjustStack(ABI_ALL_CALLEE_SAVED, 8); @@ -850,15 +850,14 @@ CompiledShader* JitCompiler::Compile() { SetJumpTarget(branch.first, code_ptr[branch.second]); } - return (CompiledShader*)start; -} + uintptr_t size = reinterpret_cast(GetCodePtr()) - reinterpret_cast(program); + ASSERT_MSG(size <= MAX_SHADER_SIZE, "Compiled a shader that exceeds the allocated size!"); -JitCompiler::JitCompiler() { - AllocCodeSpace(jit_cache_size); + LOG_DEBUG(HW_GPU, "Compiled shader size=%d", size); } -void JitCompiler::Clear() { - ClearCodeSpace(); +JitCompiler::JitCompiler() { + AllocCodeSpace(MAX_SHADER_SIZE); } } // namespace Shader -- cgit v1.2.3