VkQueue: Use a sw::WaitGroup for waitIdle()
Don't (ab)use vk::Fence for its start() finish() events.
sw::WaitGroup shares the same interface, so use that.
Allows vk::Fence to have its destructor deleted again.
Bug: b/133127573
Change-Id: I747ea6965bf85343c720235083b309d8b855a950
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/31684
Tested-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/Vulkan/VkFence.hpp b/src/Vulkan/VkFence.hpp
index b803230..5fe3e85 100644
--- a/src/Vulkan/VkFence.hpp
+++ b/src/Vulkan/VkFence.hpp
@@ -75,6 +75,7 @@
private:
Fence(const Fence&) = delete;
+ ~Fence() = delete;
Fence& operator = (const Fence&) = delete;
sw::WaitGroup wg;
diff --git a/src/Vulkan/VkQueue.cpp b/src/Vulkan/VkQueue.cpp
index 73e3602..262bef6 100644
--- a/src/Vulkan/VkQueue.cpp
+++ b/src/Vulkan/VkQueue.cpp
@@ -183,14 +183,14 @@
VkResult Queue::waitIdle()
{
// Wait for task queue to flush.
- vk::Fence fence;
- fence.start();
+ sw::WaitGroup wg;
+ wg.add();
Task task;
- task.events = &fence;
+ task.events = &wg;
pending.put(task);
- fence.wait();
+ wg.wait();
garbageCollect();