diff --git a/Common/GPU/Vulkan/VulkanRenderManager.h b/Common/GPU/Vulkan/VulkanRenderManager.h index 3cad859e8df3..b0ca50d4bfa5 100644 --- a/Common/GPU/Vulkan/VulkanRenderManager.h +++ b/Common/GPU/Vulkan/VulkanRenderManager.h @@ -456,13 +456,13 @@ class VulkanRenderManager { void Invalidate(InvalidationFlags flags); void ResetStats(); + void DrainCompileQueue(); private: void EndCurRenderStep(); void ThreadFunc(); void CompileThreadFunc(); - void DrainCompileQueue(); void Run(VKRRenderThreadTask &task); diff --git a/Core/MIPS/JitCommon/JitBlockCache.cpp b/Core/MIPS/JitCommon/JitBlockCache.cpp index a08f430ed45b..1f0e2e0e291c 100644 --- a/Core/MIPS/JitCommon/JitBlockCache.cpp +++ b/Core/MIPS/JitCommon/JitBlockCache.cpp @@ -76,7 +76,7 @@ static uint64_t HashJitBlock(const JitBlock &b) { } JitBlockCache::JitBlockCache(MIPSState *mipsState, CodeBlockCommon *codeBlock) : - codeBlock_(codeBlock), blocks_(nullptr), num_blocks_(0) { + codeBlock_(codeBlock) { } JitBlockCache::~JitBlockCache() { @@ -90,7 +90,8 @@ bool JitBlock::ContainsAddress(u32 em_address) { } bool JitBlockCache::IsFull() const { - return num_blocks_ >= MAX_NUM_BLOCKS - 1; + // -10 to safely leave space for some proxy blocks, which we don't check before we allocate (not ideal, but should work). + return num_blocks_ >= MAX_NUM_BLOCKS - 10; } void JitBlockCache::Init() { diff --git a/Core/MIPS/JitCommon/JitBlockCache.h b/Core/MIPS/JitCommon/JitBlockCache.h index 6fde09d91573..71b7df966075 100644 --- a/Core/MIPS/JitCommon/JitBlockCache.h +++ b/Core/MIPS/JitCommon/JitBlockCache.h @@ -184,10 +184,10 @@ class JitBlockCache : public JitBlockCacheDebugInterface { MIPSOpcode GetEmuHackOpForBlock(int block_num) const; CodeBlockCommon *codeBlock_; - JitBlock *blocks_; + JitBlock *blocks_ = nullptr; std::unordered_multimap proxyBlockMap_; - int num_blocks_; + int num_blocks_ = 0; std::unordered_multimap links_to_; std::map, u32> block_map_; // (end_addr, start_addr) -> number diff --git a/GPU/Vulkan/GPU_Vulkan.cpp b/GPU/Vulkan/GPU_Vulkan.cpp index 30fec133c4f8..ee68954fd354 100644 --- a/GPU/Vulkan/GPU_Vulkan.cpp +++ b/GPU/Vulkan/GPU_Vulkan.cpp @@ -182,6 +182,9 @@ void GPU_Vulkan::SaveCache(const Path &filename) { } GPU_Vulkan::~GPU_Vulkan() { + VulkanRenderManager *rm = (VulkanRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER); + rm->DrainCompileQueue(); + SaveCache(shaderCachePath_); // Note: We save the cache in DeviceLost DestroyDeviceObjects();