forked from Dynamitos/Seele
Fixing semaphore waiting logic
This commit is contained in:
1 parent
bcb9a7b148
commit
6a6294c67d
4 files changed
+36
-15
No files matched your search
@@ -3,6 +3,7 @@
|
||||
#include "Command.h"
|
||||
#include "Enums.h"
|
||||
#include "Graphics.h"
|
||||
#include "Graphics/Vulkan/Resources.h"
|
||||
#include <mutex>
|
||||
|
||||
using namespace Seele;
|
||||
@@ -25,16 +26,23 @@ void Queue::submitCommandBuffer(PCommand command, const Array<VkSemaphore>& sign
|
||||
VkCommandBuffer cmdHandle = command->handle;
|
||||
|
||||
Array<VkSemaphore> waitSemaphores;
|
||||
// wait semaphores get bound to the cmd when they are added
|
||||
// and unbound when the command completes
|
||||
for (PSemaphore semaphore : command->waitSemaphores) {
|
||||
waitSemaphores.add(semaphore->getHandle());
|
||||
// Use the handles captured at record time (command->waitHandles). Re-resolving
|
||||
// the wrapper's current handle here would let the wait target drift if the
|
||||
// wrapper rotated between record and submit, potentially onto a semaphore that
|
||||
// is also signalled in this same submit.
|
||||
for (VkSemaphore waitHandle : command->waitHandles) {
|
||||
waitSemaphores.add(waitHandle);
|
||||
std::cout << "Semaphore " << waitHandle << " waited on by cmd " << command->getHandle() << std::endl;
|
||||
}
|
||||
|
||||
for (VkSemaphore signalSemaphore : signalSemaphores) {
|
||||
std::cout << "Semaphore " << signalSemaphore << " is signalled by cmd " << command->getHandle() << std::endl;
|
||||
}
|
||||
|
||||
VkSubmitInfo submitInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO,
|
||||
.pNext = nullptr,
|
||||
.waitSemaphoreCount = static_cast<uint32>(command->waitSemaphores.size()),
|
||||
.waitSemaphoreCount = static_cast<uint32>(command->waitHandles.size()),
|
||||
.pWaitSemaphores = waitSemaphores.data(),
|
||||
.pWaitDstStageMask = command->waitFlags.data(),
|
||||
.commandBufferCount = 1,
|
||||
@@ -46,7 +54,7 @@ void Queue::submitCommandBuffer(PCommand command, const Array<VkSemaphore>& sign
|
||||
command->fence->submit();
|
||||
command->state = Command::State::Submit;
|
||||
command->waitFlags.clear();
|
||||
command->waitSemaphores.clear();
|
||||
command->waitHandles.clear();
|
||||
|
||||
if (waitIdleOnSubmit) {
|
||||
command->fence->wait(1000 * 1000ull);
|
||||
|
||||
Reference in new issue
Block a user