diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2021-04-04 02:41:49 +0200 |
---|---|---|
committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-23 03:51:26 +0200 |
commit | 5ed68e83db39e1f6790a625529f10f4e1d5a8f89 (patch) | |
tree | 4931f4501e9127244eb3faddd5d475cd1c7d176f /src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp | |
parent | shader: Remove unused header in VOTE (diff) | |
download | yuzu-5ed68e83db39e1f6790a625529f10f4e1d5a8f89.tar yuzu-5ed68e83db39e1f6790a625529f10f4e1d5a8f89.tar.gz yuzu-5ed68e83db39e1f6790a625529f10f4e1d5a8f89.tar.bz2 yuzu-5ed68e83db39e1f6790a625529f10f4e1d5a8f89.tar.lz yuzu-5ed68e83db39e1f6790a625529f10f4e1d5a8f89.tar.xz yuzu-5ed68e83db39e1f6790a625529f10f4e1d5a8f89.tar.zst yuzu-5ed68e83db39e1f6790a625529f10f4e1d5a8f89.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp index e8c3a5624..67de3cb79 100644 --- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp @@ -135,8 +135,10 @@ GraphicsPipeline::GraphicsPipeline(Tegra::Engines::Maxwell3D& maxwell3d_, const VkRenderPass render_pass{render_pass_cache.Get(MakeRenderPassKey(state))}; MakePipeline(device, render_pass); - building_flag.test_and_set(); - building_flag.notify_all(); + + std::lock_guard lock{build_mutex}; + is_built = true; + build_condvar.notify_one(); }}; if (worker_thread) { worker_thread->QueueWork(std::move(func)); @@ -196,8 +198,12 @@ void GraphicsPipeline::Configure(bool is_indexed) { texture_cache.UpdateRenderTargets(false); scheduler.RequestRenderpass(texture_cache.GetFramebuffer()); - if (!building_flag.test()) { - scheduler.Record([this](vk::CommandBuffer) { building_flag.wait(false); }); + if (!is_built.load(std::memory_order::relaxed)) { + // Wait for the pipeline to be built + scheduler.Record([this](vk::CommandBuffer) { + std::unique_lock lock{build_mutex}; + build_condvar.wait(lock, [this] { return is_built.load(std::memory_order::relaxed); }); + }); } if (scheduler.UpdateGraphicsPipeline(this)) { scheduler.Record([this](vk::CommandBuffer cmdbuf) { |