From f1eb4992ab81fc4f29e342335c045bf165be4c95 Mon Sep 17 00:00:00 2001 From: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com> Date: Tue, 26 Nov 2024 21:25:09 +0300 Subject: [PATCH] Fix pipelines getting dropped. --- UnleashedRecomp/gpu/video.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/UnleashedRecomp/gpu/video.cpp b/UnleashedRecomp/gpu/video.cpp index 42244d08..23b275ef 100644 --- a/UnleashedRecomp/gpu/video.cpp +++ b/UnleashedRecomp/gpu/video.cpp @@ -4298,22 +4298,17 @@ static void CreateGraphicsPipelineInPipelineThread(const PipelineState& pipeline { XXH64_hash_t hash = XXH3_64bits(&pipelineState, sizeof(pipelineState)); - bool found = false; + bool shouldCompile = false; { std::lock_guard lock(g_asyncPipelineMutex); - found = g_asyncPipelines.contains(hash); + shouldCompile = g_asyncPipelines.emplace(hash).second; } - if (!found) + if (shouldCompile) { auto pipeline = CreateGraphicsPipeline(pipelineState); pipeline->setName(std::format("Async Pipeline {:X}", hash)); - { - std::lock_guard lock(g_asyncPipelineMutex); - g_asyncPipelines.emplace(hash); - } - // Will get dropped in render thread if a different thread already managed to compile this. RenderCommand cmd; cmd.type = RenderCommandType::AddPipeline;