diff options
author | bunnei <bunneidev@gmail.com> | 2016-03-20 05:37:05 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2016-04-14 05:04:47 +0200 |
commit | c9d10de644078a29e2310791ee221f3bc916e923 (patch) | |
tree | 8383e20e5309d1009a512c0ec6efb80558f1368a /src/video_core/shader/shader_jit_x64.cpp | |
parent | shader_jit_x64: Rewrite flow control to support arbitrary CALL and JMP instructions. (diff) | |
download | yuzu-c9d10de644078a29e2310791ee221f3bc916e923.tar yuzu-c9d10de644078a29e2310791ee221f3bc916e923.tar.gz yuzu-c9d10de644078a29e2310791ee221f3bc916e923.tar.bz2 yuzu-c9d10de644078a29e2310791ee221f3bc916e923.tar.lz yuzu-c9d10de644078a29e2310791ee221f3bc916e923.tar.xz yuzu-c9d10de644078a29e2310791ee221f3bc916e923.tar.zst yuzu-c9d10de644078a29e2310791ee221f3bc916e923.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/shader/shader_jit_x64.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
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<uintptr_t>(GetCodePtr()) - start == SKIP); + ASSERT(reinterpret_cast<ptrdiff_t>(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<uintptr_t>(GetCodePtr()) - reinterpret_cast<uintptr_t>(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 |