From ceb9771a5c10a75198baede1fc0f8a14cff5668d Mon Sep 17 00:00:00 2001 From: Exzap <13877693+Exzap@users.noreply.github.com> Date: Mon, 23 Feb 2026 03:21:24 +0100 Subject: [PATCH] Vulkan: Fixes for object refcounting --- src/Cafe/HW/Latte/Renderer/Vulkan/VKRBase.h | 12 ++---------- .../Latte/Renderer/Vulkan/VulkanPipelineCompiler.cpp | 2 -- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/Cafe/HW/Latte/Renderer/Vulkan/VKRBase.h b/src/Cafe/HW/Latte/Renderer/Vulkan/VKRBase.h index 7dcd3ebc..7d2cb653 100644 --- a/src/Cafe/HW/Latte/Renderer/Vulkan/VKRBase.h +++ b/src/Cafe/HW/Latte/Renderer/Vulkan/VKRBase.h @@ -45,7 +45,7 @@ public: VKRMoveableRefCounter(VKRMoveableRefCounter&& rhs) noexcept { this->refs = std::move(rhs.refs); - this->m_refCount = rhs.m_refCount; + this->m_refCount.store(rhs.m_refCount); rhs.m_refCount = 0; this->selfRef = rhs.selfRef; rhs.selfRef = nullptr; @@ -88,21 +88,13 @@ protected: // does nothing by default } - int m_refCount{}; + std::atomic_int_least32_t m_refCount{}; private: VKRMoveableRefCounterRef* selfRef; std::vector refs; #ifdef CEMU_DEBUG_ASSERT std::vector reverseRefs; #endif - - void moveObj(VKRMoveableRefCounter&& rhs) - { - this->refs = std::move(rhs.refs); - this->m_refCount = rhs.m_refCount; - this->selfRef = rhs.selfRef; - this->selfRef->ref = this; - } }; class VKRDestructibleObject : public VKRMoveableRefCounter diff --git a/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanPipelineCompiler.cpp b/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanPipelineCompiler.cpp index 795d11c3..55b2330e 100644 --- a/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanPipelineCompiler.cpp +++ b/src/Cafe/HW/Latte/Renderer/Vulkan/VulkanPipelineCompiler.cpp @@ -1177,8 +1177,6 @@ void PipelineCompiler::CompileThreadPool_Stop() while (!s_pipelineCompileRequests.empty()) { PipelineCompiler* pipelineCompiler = s_pipelineCompileRequests.pop(); - if (!pipelineCompiler) - break; if (pipelineCompiler) delete pipelineCompiler; }