From f43dd4806c61623284a74061a4570b1e209dcebe Mon Sep 17 00:00:00 2001 From: Sergey Kosarevsky Date: Sun, 22 Sep 2024 21:30:19 -0700 Subject: [PATCH] Calling `IContext::wait()` with an empty handle results in `vkDeviceWaitIdle()` --- lvk/LVK.h | 2 +- lvk/vulkan/VulkanClasses.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lvk/LVK.h b/lvk/LVK.h index 8a4873b59d..8d9d465473 100644 --- a/lvk/LVK.h +++ b/lvk/LVK.h @@ -979,7 +979,7 @@ class IContext { virtual ICommandBuffer& acquireCommandBuffer() = 0; virtual SubmitHandle submit(ICommandBuffer& commandBuffer, TextureHandle present = {}) = 0; - virtual void wait(SubmitHandle handle) = 0; + virtual void wait(SubmitHandle handle) = 0; // waiting on an empty handle results in vkDeviceWaitIdle() [[nodiscard]] virtual Holder createBuffer(const BufferDesc& desc, Result* outResult = nullptr) = 0; [[nodiscard]] virtual Holder createSampler(const SamplerStateDesc& desc, Result* outResult = nullptr) = 0; diff --git a/lvk/vulkan/VulkanClasses.cpp b/lvk/vulkan/VulkanClasses.cpp index 0536f4310a..c1ab155506 100644 --- a/lvk/vulkan/VulkanClasses.cpp +++ b/lvk/vulkan/VulkanClasses.cpp @@ -1423,6 +1423,11 @@ const lvk::VulkanImmediateCommands::CommandBufferWrapper& lvk::VulkanImmediateCo void lvk::VulkanImmediateCommands::wait(const SubmitHandle handle) { LVK_PROFILER_FUNCTION_COLOR(LVK_PROFILER_COLOR_WAIT); + if (handle.empty()) { + vkDeviceWaitIdle(device_); + return; + } + if (isReady(handle)) { return; }