Skip to content

Commit 88df1f8

Browse files
fix minor Swapchain bugs
1 parent 62d0840 commit 88df1f8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

include/nbl/video/ISwapchain.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ class ISwapchain : public IBackendObject
391391
OUT_OF_DATE,
392392
_ERROR
393393
};
394-
// If `FATAL_ERROR` returned then the `waitSemaphores` are kept alive by the swapchain until the next acquire of the same image index or swapchain destruction (whichever comes first)
394+
// If something else than `FATAL_ERROR` returned then the `waitSemaphores` are kept alive by the swapchain until the next acquire of the same image index or swapchain destruction (whichever comes first)
395395
inline PRESENT_RESULT present(SPresentInfo info)
396396
{
397397
if (!info.queue || info.imgIndex>=m_imageCount)
@@ -407,13 +407,13 @@ class ISwapchain : public IBackendObject
407407
if (threadsafeQ)
408408
threadsafeQ->m.unlock();
409409

410-
// kill a few frame resources
411-
m_frameResources[info.imgIndex]->poll(DeferredFrameSemaphoreDrop::single_poll);
412-
if (retval!=PRESENT_RESULT::FATAL_ERROR)
410+
if (retval!=PRESENT_RESULT::FATAL_ERROR && !info.waitSemaphores.empty())
413411
{
414412
auto& lastWait = info.waitSemaphores.back();
415413
m_frameResources[info.imgIndex]->latch({.semaphore=lastWait.semaphore,.value=lastWait.value},DeferredFrameSemaphoreDrop(info.waitSemaphores));
416414
}
415+
// kill a few frame resources
416+
m_frameResources[info.imgIndex]->poll(DeferredFrameSemaphoreDrop::single_poll);
417417
return retval;
418418
}
419419

0 commit comments

Comments
 (0)