From c9240eea7218a044ecff7261ca15e32923e7558c Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Fri, 1 Jan 2021 17:16:54 +1000 Subject: [PATCH] CPU/Recompiler: Use PGXP interpreter for fallback Fixes holes in geometry with PGXP enabled in Threads of Fate. --- src/core/cpu_code_cache.cpp | 6 ++++-- src/core/cpu_code_cache.h | 2 ++ src/core/cpu_core.cpp | 7 ++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/core/cpu_code_cache.cpp b/src/core/cpu_code_cache.cpp index 06c8be631..0b76b6c6e 100644 --- a/src/core/cpu_code_cache.cpp +++ b/src/core/cpu_code_cache.cpp @@ -193,7 +193,7 @@ static void ExecuteImpl() CodeBlock* block = LookupBlock(next_block_key); if (!block) { - InterpretUncachedBlock(); + InterpretUncachedBlock(); continue; } @@ -629,8 +629,10 @@ void FastCompileBlockFunction() CodeBlock* block = LookupBlock(GetNextBlockKey()); if (block) s_single_block_asm_dispatcher(block->host_code); + else if (g_settings.gpu_pgxp_enable) + InterpretUncachedBlock(); else - InterpretUncachedBlock(); + InterpretUncachedBlock(); } #endif diff --git a/src/core/cpu_code_cache.h b/src/core/cpu_code_cache.h index 8e2ea7f98..a984a0224 100644 --- a/src/core/cpu_code_cache.h +++ b/src/core/cpu_code_cache.h @@ -126,6 +126,8 @@ void InvalidateBlocksWithPageIndex(u32 page_index); template void InterpretCachedBlock(const CodeBlock& block); + +template void InterpretUncachedBlock(); /// Invalidates any code pages which overlap the specified range. diff --git a/src/core/cpu_core.cpp b/src/core/cpu_core.cpp index 1cea04320..c12d0f56c 100644 --- a/src/core/cpu_core.cpp +++ b/src/core/cpu_core.cpp @@ -1856,6 +1856,7 @@ template void InterpretCachedBlock(const CodeBlock& block); template void InterpretCachedBlock(const CodeBlock& block); template void InterpretCachedBlock(const CodeBlock& block); +template void InterpretUncachedBlock() { g_state.regs.npc = g_state.regs.pc; @@ -1890,7 +1891,7 @@ void InterpretUncachedBlock() } // execute the instruction we previously fetched - ExecuteInstruction(); + ExecuteInstruction(); // next load delay UpdateLoadDelay(); @@ -1905,6 +1906,10 @@ void InterpretUncachedBlock() } } +template void InterpretUncachedBlock(); +template void InterpretUncachedBlock(); +template void InterpretUncachedBlock(); + } // namespace CodeCache namespace Recompiler::Thunks {