Skip to content

Commit 06175cb

Browse files
Small changes to ISwapchain for resizing after testing:
- need to poll for unpresented acquired frames on old swapchains too - need an OUT_OF_DATE to know to recreate swapchain - r-value recreateion params make no sense
1 parent 4de9e69 commit 06175cb

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

include/nbl/video/ISwapchain.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ class ISwapchain : public IBackendObject
385385
FATAL_ERROR = -1,
386386
SUCCESS = 0,
387387
SUBOPTIMAL,
388+
OUT_OF_DATE,
388389
_ERROR
389390
};
390391
// If `FATAL_ERROR` returned then the `frameResources` are not latched until the next acquire of the same image index or swapchain destruction (whichever comes first)
@@ -422,6 +423,10 @@ class ISwapchain : public IBackendObject
422423

423424
inline bool acquiredImagesAwaitingPresent()
424425
{
426+
// this method is often used to determine whether a swapchain can be thrown away or to spin until all presents are ready, so also need to check ancestors
427+
if (m_oldSwapchain && m_oldSwapchain->acquiredImagesAwaitingPresent())
428+
return true;
429+
425430
for (uint8_t i=0; i<m_imageCount; i++)
426431
{
427432
if (unacquired(i))
@@ -449,7 +454,7 @@ class ISwapchain : public IBackendObject
449454
};
450455

451456
// utility function
452-
inline core::smart_refctd_ptr<ISwapchain> recreate(SSharedCreationParams&& params={})
457+
inline core::smart_refctd_ptr<ISwapchain> recreate(SSharedCreationParams params={})
453458
{
454459
if (!params.deduce(getOriginDevice()->getPhysicalDevice(),m_params.surface.get(),{&m_params.sharedParams.presentMode.value,1},{&m_params.sharedParams.compositeAlpha.value,1},{&m_params.sharedParams.preTransform.value,1}))
455460
return nullptr;

src/nbl/video/CVulkanSwapchain.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,9 +372,9 @@ auto CVulkanSwapchain::present_impl(const SPresentInfo& info) -> PRESENT_RESULT
372372
}
373373
[[fallthrough]];
374374
case VK_ERROR_DEVICE_LOST:
375-
[[fallthrough]];
376-
default:
377375
return PRESENT_RESULT::_ERROR;
376+
default:
377+
return PRESENT_RESULT::OUT_OF_DATE;
378378
}
379379
return PRESENT_RESULT::SUCCESS;
380380
}

0 commit comments

Comments
 (0)