Fixing semaphore waiting logic
This commit is contained in:
1 parent
bcb9a7b148
commit
6a6294c67d
4 files changed
+36
-15
No files matched your search
@@ -29,7 +29,8 @@ Command::Command(PGraphics graphics, PCommandPool pool) : graphics(graphics), po
|
||||
|
||||
Command::~Command() {
|
||||
vkFreeCommandBuffers(graphics->getDevice(), pool->getHandle(), 1, &handle);
|
||||
waitSemaphores.clear();
|
||||
waitHandles.clear();
|
||||
waitFlags.clear();
|
||||
}
|
||||
|
||||
void Command::begin() {
|
||||
@@ -114,8 +115,13 @@ void Command::executeCommands(Array<Gfx::OComputeCommand> commands) {
|
||||
}
|
||||
|
||||
void Command::waitForSemaphore(VkPipelineStageFlags flags, PSemaphore semaphore) {
|
||||
bindResource(semaphore->getCurrentSemaphore());
|
||||
waitSemaphores.add(semaphore);
|
||||
// Capture the concrete VkSemaphore NOW. The wrapper's current handle may
|
||||
// rotate before submit; waiting on a re-resolved handle at submit time can
|
||||
// target a semaphore that is also signalled in this same submit (or one with
|
||||
// no outstanding signal), violating VUID-vkQueueSubmit-pWaitSemaphores-03238.
|
||||
PSemaphoreHandle current = semaphore->getCurrentSemaphore();
|
||||
bindResource(current);
|
||||
waitHandles.add(current->getHandle());
|
||||
waitFlags.add(flags);
|
||||
}
|
||||
|
||||
@@ -137,6 +143,13 @@ void Command::checkFence() {
|
||||
}
|
||||
signalSemaphore->resolveSignal();
|
||||
boundResources.clear();
|
||||
// Clear accumulated wait state so a recycled command buffer does not
|
||||
// re-wait on stale (already-consumed) semaphores from a prior frame.
|
||||
// A binary semaphore's signal->wait pair is single-use; waiting on a
|
||||
// handle whose signal was already consumed violates
|
||||
// VUID-vkQueueSubmit-pWaitSemaphores-03238.
|
||||
waitHandles.clear();
|
||||
waitFlags.clear();
|
||||
graphics->getDestructionManager()->notifyCommandComplete();
|
||||
state = State::Init;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user