File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -101,6 +101,7 @@ void Renderer::retrieveTimestamps() {
101101
102102void Renderer::recreateSwapchain () {
103103 auto oldExtent = swapchain->swapchainExtent ;
104+ spdlog::debug (" Recreating swapchain" );
104105 swapchain->recreate ();
105106 if (swapchain->swapchainExtent == oldExtent) {
106107 return ;
@@ -408,7 +409,13 @@ void Renderer::draw() {
408409 presentInfo.pSwapchains = &swapchain->swapchain .get ();
409410 presentInfo.pImageIndices = ¤tImageIndex;
410411
411- ret = context->queues [VulkanContext::Queue::PRESENT ].queue .presentKHR (presentInfo);
412+ try {
413+ ret = context->queues [VulkanContext::Queue::PRESENT ].queue .presentKHR (presentInfo);
414+ } catch (vk::OutOfDateKHRError& e) {
415+ recreateSwapchain ();
416+ return ;
417+ }
418+
412419 if (ret == vk::Result::eErrorOutOfDateKHR || ret == vk::Result::eSuboptimalKHR) {
413420 recreateSwapchain ();
414421 } else if (ret != vk::Result::eSuccess) {
@@ -527,7 +534,7 @@ bool Renderer::recordRenderCommandBuffer(uint32_t currentFrame) {
527534 }
528535
529536 uint32_t numInstances = totalSumBufferHost->readOne <uint32_t >();
530- spdlog::debug (" Num instances: {}" , numInstances);
537+ // spdlog::debug("Num instances: {}", numInstances);
531538 guiManager.pushTextMetric (" instances" , numInstances);
532539 if (numInstances > scene->getNumVertices () * sortBufferSizeMultiplier) {
533540 auto old = sortBufferSizeMultiplier;
You can’t perform that action at this time.
0 commit comments